Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / selection-invalid-offset.html
blobd0f8bc64f92eaf9a7355937aea5ada00ac2559ed
1 <body>
2 You should see 7 OKs below (and not hang): <br>
3 <script>
4 if (window.testRunner)
5 testRunner.dumpAsText();
6 var body = document.body;
7 var selection = window.getSelection();
9 function shouldThrowIndexSizeErrorException(script)
11 try {
12 eval(script);
13 } catch (e) {
14 document.write(((e.code == DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL") + "<br>");
18 shouldThrowIndexSizeErrorException("selection.collapse(body, -1);");
19 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, -1, body, 0);");
20 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, 0, body, -1);");
21 shouldThrowIndexSizeErrorException("selection.collapse(body, -1);");
22 shouldThrowIndexSizeErrorException("selection.getRangeAt(-1);");
23 shouldThrowIndexSizeErrorException("selection.getRangeAt(10000);");
24 shouldThrowIndexSizeErrorException("selection.collapse(body, 10000);");
26 // these should throw as well but don't at the moment. Just checking they don't crash.
27 selection.setBaseAndExtent(body, 1000, body, 0);
28 selection.setBaseAndExtent(body, 0, body, 10000);
29 </script>