<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
pre, #log {
position: absolute;
top: 0;
left: 200px;
}
iframe {
width: 150px;
height: 200px;
}
</style>
<iframe src="http://localhost:8080/intersection-observer/resources/root-bounds-iframe.html"></iframe>
<script>
async_test(t => {
let records = [];
// This window will receive a message from the iframe for each IntersectionObserver
// notification.
window.addEventListener("message", event => {
if (event.data == "done") {
t.step(() => {
assert_equals(records.length, 3);
assert_not_equals(records[0].rootBounds, "null", "First notification reports root bounds");
assert_equals(records[1].rootBounds, "null", "Second notification does not report root bounds");
assert_equals(records[2].rootBounds, "null", "Third notification does not report root bounds");
});
t.done();
}
records.push(event.data);
});
}, "IntersectionObserver target moved from a top-level document to a cross-origin iframe does not report root bounds.");
</script>