| <body> |
| You should see six OKs below (and not hang): <br> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| var body = document.body; |
| var selection = window.getSelection(); |
| try { |
| selection.collapse(body, -1); |
| } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")+"<br>"); } |
| |
| try { |
| selection.setBaseAndExtent(body, -1, body, 0); |
| } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")+"<br>"); } |
| |
| try { |
| selection.setBaseAndExtent(body, 0, body, -1); |
| } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")+"<br>"); } |
| |
| try { |
| selection.setPosition(body, -1); |
| } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")+"<br>"); } |
| |
| try { |
| selection.getRangeAt(-1); |
| } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")+"<br>"); } |
| |
| try { |
| selection.getRangeAt(10000); |
| } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAIL")+"<br>"); } |
| |
| // these should throw as well but don't at the moment. Just checking they don't crash. |
| selection.collapse(body, 10000); |
| selection.setBaseAndExtent(body, 1000, body, 0); |
| selection.setBaseAndExtent(body, 0, body, 10000); |
| selection.setPosition(body, 10000); |
| </script> |