OLD | NEW |
1 <body> | 1 <body> |
2 You should see 7 OKs below (and not hang): <br> | 2 You should see 9 OKs below (and not hang): <br> |
3 <script> | 3 <script> |
4 if (window.testRunner) | 4 if (window.testRunner) |
5 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
6 var body = document.body; | 6 var body = document.body; |
7 var selection = window.getSelection(); | 7 var selection = window.getSelection(); |
8 | 8 |
9 function shouldThrowIndexSizeErrorException(script) | 9 function shouldThrowIndexSizeErrorException(script) |
10 { | 10 { |
11 try { | 11 try { |
12 eval(script); | 12 eval(script); |
13 } catch (e) { | 13 } catch (e) { |
14 document.write(((e.code == DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")
+ "<br>"); | 14 document.write(((e.code == DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")
+ "<br>"); |
15 } | 15 } |
16 } | 16 } |
17 | 17 |
18 shouldThrowIndexSizeErrorException("selection.collapse(body, -1);"); | 18 shouldThrowIndexSizeErrorException("selection.collapse(body, -1);"); |
19 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, -1, body, 0
);"); | 19 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, -1, body, 0
);"); |
20 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, 0, body, -1
);"); | 20 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, 0, body, -1
);"); |
21 shouldThrowIndexSizeErrorException("selection.collapse(body, -1);"); | 21 shouldThrowIndexSizeErrorException("selection.collapse(body, -1);"); |
22 shouldThrowIndexSizeErrorException("selection.getRangeAt(-1);"); | 22 shouldThrowIndexSizeErrorException("selection.getRangeAt(-1);"); |
23 shouldThrowIndexSizeErrorException("selection.getRangeAt(10000);"); | 23 shouldThrowIndexSizeErrorException("selection.getRangeAt(10000);"); |
24 shouldThrowIndexSizeErrorException("selection.collapse(body, 10000);"); | 24 shouldThrowIndexSizeErrorException("selection.collapse(body, 10000);"); |
25 | 25 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, 1000, body,
0)"); |
26 // these should throw as well but don't at the moment. Just checking they don't
crash. | 26 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, 0, body, 10
000)"); |
27 selection.setBaseAndExtent(body, 1000, body, 0); | |
28 selection.setBaseAndExtent(body, 0, body, 10000); | |
29 </script> | 27 </script> |
OLD | NEW |