| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <div id="root"></div> | 2 <div id="root"></div> |
| 3 <div id="target"></div> | 3 <div id="target"></div> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="../resources/gc.js"></script> | 5 <script src="../resources/gc.js"></script> |
| 6 <script> | 6 <script> |
| 7 description("Test for observer exceptions."); | 7 description("Test for observer exceptions."); |
| 8 let rootDiv = document.getElementById("root"); | 8 let rootDiv = document.getElementById("root"); |
| 9 var exc; | 9 var exc; |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 try { | 37 try { |
| 38 new IntersectionObserver(e => {}, {rootMargin: "auto"}); | 38 new IntersectionObserver(e => {}, {rootMargin: "auto"}); |
| 39 testFailed("IntersectionObserver constructor did not throw due to invalid ro
otMargin."); | 39 testFailed("IntersectionObserver constructor did not throw due to invalid ro
otMargin."); |
| 40 } catch(e) { | 40 } catch(e) { |
| 41 exc = e; | 41 exc = e; |
| 42 shouldBeType("exc", "DOMException"); | 42 shouldBeType("exc", "DOMException"); |
| 43 shouldBe("exc.code", "DOMException.SYNTAX_ERR"); | 43 shouldBe("exc.code", "DOMException.SYNTAX_ERR"); |
| 44 } | 44 } |
| 45 | 45 |
| 46 try { |
| 47 new IntersectionObserver(e => {}, {rootMargin: "1px 1px 1px 1px 1px"}); |
| 48 testFailed("IntersectionObserver constructor did not throw due to too many r
ootMargin value."); |
| 49 } catch(e) { |
| 50 exc = e; |
| 51 shouldBeType("exc", "DOMException"); |
| 52 shouldBe("exc.code", "DOMException.SYNTAX_ERR"); |
| 53 } |
| 54 |
| 46 let observer = new IntersectionObserver(c => {}, {}); | 55 let observer = new IntersectionObserver(c => {}, {}); |
| 47 try { | 56 try { |
| 48 observer.observe("foo"); | 57 observer.observe("foo"); |
| 49 testFailed("IntersectionObserver.observe with a bad target argument did not
throw."); | 58 testFailed("IntersectionObserver.observe with a bad target argument did not
throw."); |
| 50 } catch(e) { | 59 } catch(e) { |
| 51 exc = e; | 60 exc = e; |
| 52 shouldBeType("exc", "TypeError"); | 61 shouldBeType("exc", "TypeError"); |
| 53 } | 62 } |
| 54 | 63 |
| 55 observer = new IntersectionObserver(c => {}, {root: rootDiv}); | 64 observer = new IntersectionObserver(c => {}, {root: rootDiv}); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 86 | 95 |
| 87 try { | 96 try { |
| 88 observer.takeRecords(); | 97 observer.takeRecords(); |
| 89 testFailed("IntersectionObserver.takeRecords() with a deleted root did not t
hrow."); | 98 testFailed("IntersectionObserver.takeRecords() with a deleted root did not t
hrow."); |
| 90 } catch(e) { | 99 } catch(e) { |
| 91 exc = e; | 100 exc = e; |
| 92 shouldBeType("exc", "DOMException"); | 101 shouldBeType("exc", "DOMException"); |
| 93 shouldBe("exc.code", "DOMException.INVALID_STATE_ERR"); | 102 shouldBe("exc.code", "DOMException.INVALID_STATE_ERR"); |
| 94 } | 103 } |
| 95 </script> | 104 </script> |
| OLD | NEW |