diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/intersection-observer/cross-origin-iframe.sub.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/intersection-observer/cross-origin-iframe.sub.html')
-rw-r--r-- | testing/web-platform/tests/intersection-observer/cross-origin-iframe.sub.html | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/testing/web-platform/tests/intersection-observer/cross-origin-iframe.sub.html b/testing/web-platform/tests/intersection-observer/cross-origin-iframe.sub.html new file mode 100644 index 0000000000..d444237f6b --- /dev/null +++ b/testing/web-platform/tests/intersection-observer/cross-origin-iframe.sub.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="./resources/intersection-observer-test-utils.js"></script> + +<style> +pre, #log { + position: absolute; + top: 0; + left: 200px; +} +iframe { + width: 160px; + height: 100px; + overflow-y: scroll; +} +.spacer { + height: calc(100vh + 100px); +} +</style> + +<div class="spacer"></div> +<iframe src="http://{{hosts[alt][]}}:{{ports[http][0]}}/intersection-observer/resources/cross-origin-subframe.html" sandbox="allow-scripts"></iframe> +<div class="spacer"></div> + +<script> +async_test(function(t) { + var iframe = document.querySelector("iframe"); + + function handleMessage(event) { + if (event.data.hasOwnProperty('scrollTo')) { + document.scrollingElement.scrollTop = event.data.scrollTo; + waitForNotification(t, function() { iframe.contentWindow.postMessage("", "*"); }, + "document.scrollingElement.scrollTop = " + event.data.scrollTo); + } else if (event.data.hasOwnProperty('actual')) { + checkJsonEntries(event.data.actual, event.data.expected, event.data.description); + } else if (event.data.hasOwnProperty('DONE')) { + document.scrollingElement.scrollTop = 0; + t.done(); + } else { + var description = event.data.description; + waitForNotification(t, function() { iframe.contentWindow.postMessage("", "*"); }, description); + } + } + + window.addEventListener("message", t.step_func(handleMessage)); + + iframe.onload = t.step_func(function() { + waitForNotification(t, function() { iframe.contentWindow.postMessage("", "*") }, "setup"); + }); +}, "Intersection observer test with no explicit root and target in a cross-origin iframe."); +</script> |