| 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 var exc; | 8 var exc; |
| 9 | 9 |
| 10 try { | 10 try { |
| 11 new IntersectionObserver(e => {}, {threshold: [1.1]}); | 11 new IntersectionObserver(e => {}, {threshold: [1.1]}); |
| 12 testFailed("IntersectionObserver constructor did not throw due to invalid th
reshold."); | 12 testFailed("IntersectionObserver constructor did not throw due to invalid th
reshold."); |
| 13 } catch(e) { | 13 } catch(e) { |
| 14 exc = e; | 14 exc = e; |
| 15 shouldBeType("exc", "RangeError"); | 15 shouldBeType("exc", "RangeError"); |
| 16 } | 16 } |
| 17 | 17 |
| 18 try { | 18 try { |
| 19 new IntersectionObserver(e => {}, {threshold: ["foo"]}); |
| 20 testFailed("IntersectionObserver constructor did not throw due to invalid th
reshold."); |
| 21 } catch(e) { |
| 22 exc = e; |
| 23 shouldBeType("exc", "RangeError"); |
| 24 } |
| 25 |
| 26 try { |
| 19 new IntersectionObserver(e => {}, {rootMargin: "1"}); | 27 new IntersectionObserver(e => {}, {rootMargin: "1"}); |
| 20 testFailed("IntersectionObserver constructor did not throw due to invalid ro
otMargin."); | 28 testFailed("IntersectionObserver constructor did not throw due to invalid ro
otMargin."); |
| 21 } catch(e) { | 29 } catch(e) { |
| 22 exc = e; | 30 exc = e; |
| 23 shouldBeType("exc", "DOMException"); | 31 shouldBeType("exc", "DOMException"); |
| 24 shouldBe("exc.code", "DOMException.SYNTAX_ERR"); | 32 shouldBe("exc.code", "DOMException.SYNTAX_ERR"); |
| 25 } | 33 } |
| 26 | 34 |
| 27 try { | 35 try { |
| 28 new IntersectionObserver(e => {}, {rootMargin: "2em"}); | 36 new IntersectionObserver(e => {}, {rootMargin: "2em"}); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 110 |
| 103 try { | 111 try { |
| 104 observer.takeRecords(); | 112 observer.takeRecords(); |
| 105 testFailed("IntersectionObserver.takeRecords() with a deleted root did not t
hrow."); | 113 testFailed("IntersectionObserver.takeRecords() with a deleted root did not t
hrow."); |
| 106 } catch(e) { | 114 } catch(e) { |
| 107 exc = e; | 115 exc = e; |
| 108 shouldBeType("exc", "DOMException"); | 116 shouldBeType("exc", "DOMException"); |
| 109 shouldBe("exc.code", "DOMException.INVALID_STATE_ERR"); | 117 shouldBe("exc.code", "DOMException.INVALID_STATE_ERR"); |
| 110 } | 118 } |
| 111 </script> | 119 </script> |
| OLD | NEW |