| Index: third_party/WebKit/LayoutTests/intersection-observer/deleted-root.html
|
| diff --git a/third_party/WebKit/LayoutTests/intersection-observer/deleted-root.html b/third_party/WebKit/LayoutTests/intersection-observer/deleted-root.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..995b5a753d40116c003ab0e0d3da314d06543a17
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/intersection-observer/deleted-root.html
|
| @@ -0,0 +1,53 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="../resources/gc.js"></script>
|
| +
|
| +<div id="root"></div>
|
| +<div id="target"></div>
|
| +
|
| +<script>
|
| +// Initialize observer and remove root in an inner function to avoid
|
| +// references to rootDiv remaining live on this function's stack frame
|
| +// (http://crbug.com/595672/).
|
| +function initializeObserverThenRemoveRootDiv() {
|
| + let rootDiv = document.getElementById("root");
|
| + let observer = new IntersectionObserver(c => {}, {root: rootDiv});
|
| + rootDiv.parentNode.removeChild(rootDiv);
|
| + return observer;
|
| +}
|
| +
|
| +var target = document.getElementById("target");
|
| +var observer = initializeObserverThenRemoveRootDiv();
|
| +gc();
|
| +
|
| +test(function() {
|
| + assert_throws("INVALID_STATE_ERR", function() {
|
| + observer.observe(target);
|
| + })
|
| +}, "IntersectionObserver.observe() with a deleted root did not throw.");
|
| +
|
| +test(function() {
|
| + assert_throws("INVALID_STATE_ERR", function() {
|
| + observer.observe(target);
|
| + })
|
| +}, "IntersectionObserver.observe() with a deleted root did not throw.");
|
| +
|
| +test(function() {
|
| + assert_throws("INVALID_STATE_ERR", function() {
|
| + observer.unobserve(target);
|
| + })
|
| +}, "IntersectionObserver.unobserve() with a deleted root did not throw.");
|
| +
|
| +test(function() {
|
| + assert_throws("INVALID_STATE_ERR", function() {
|
| + observer.disconnect();
|
| + })
|
| +}, "IntersectionObserver.disconnect() with a deleted root did not throw.");
|
| +
|
| +test(function() {
|
| + assert_throws("INVALID_STATE_ERR", function() {
|
| + observer.takeRecords();
|
| + })
|
| +}, "IntersectionObserver.takeRecords() with a deleted root did not throw.");
|
| +</script>
|
|
|