| OLD | NEW |
| 1 <body> | 1 <body> |
| 2 You should see six OKs below (and not hang): <br> | 2 You should see 7 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 try { | |
| 9 selection.collapse(body, -1); | |
| 10 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI
L")+"<br>"); } | |
| 11 | 8 |
| 12 try { | 9 function shouldThrowIndexSizeErrorException(script) |
| 13 selection.setBaseAndExtent(body, -1, body, 0); | 10 { |
| 14 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI
L")+"<br>"); } | 11 try { |
| 12 eval(script); |
| 13 } catch (e) { |
| 14 document.write(((e.code == DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")
+ "<br>"); |
| 15 } |
| 16 } |
| 15 | 17 |
| 16 try { | 18 shouldThrowIndexSizeErrorException("selection.collapse(body, -1);"); |
| 17 selection.setBaseAndExtent(body, 0, body, -1); | 19 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, -1, body, 0
);"); |
| 18 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI
L")+"<br>"); } | 20 shouldThrowIndexSizeErrorException("selection.setBaseAndExtent(body, 0, body, -1
);"); |
| 19 | 21 shouldThrowIndexSizeErrorException("selection.collapse(body, -1);"); |
| 20 try { | 22 shouldThrowIndexSizeErrorException("selection.getRangeAt(-1);"); |
| 21 selection.collapse(body, -1); | 23 shouldThrowIndexSizeErrorException("selection.getRangeAt(10000);"); |
| 22 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI
L")+"<br>"); } | 24 shouldThrowIndexSizeErrorException("selection.collapse(body, 10000);"); |
| 23 | |
| 24 try { | |
| 25 selection.getRangeAt(-1); | |
| 26 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI
L")+"<br>"); } | |
| 27 | |
| 28 try { | |
| 29 selection.getRangeAt(10000); | |
| 30 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI
L")+"<br>"); } | |
| 31 | 25 |
| 32 // these should throw as well but don't at the moment. Just checking they don't
crash. | 26 // these should throw as well but don't at the moment. Just checking they don't
crash. |
| 33 selection.collapse(body, 10000); | |
| 34 selection.setBaseAndExtent(body, 1000, body, 0); | 27 selection.setBaseAndExtent(body, 1000, body, 0); |
| 35 selection.setBaseAndExtent(body, 0, body, 10000); | 28 selection.setBaseAndExtent(body, 0, body, 10000); |
| 36 selection.collapse(body, 10000); | |
| 37 </script> | 29 </script> |
| OLD | NEW |