summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/element-timing/cross-origin-iframe-element.sub.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/element-timing/cross-origin-iframe-element.sub.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/element-timing/cross-origin-iframe-element.sub.html')
-rw-r--r--testing/web-platform/tests/element-timing/cross-origin-iframe-element.sub.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/web-platform/tests/element-timing/cross-origin-iframe-element.sub.html b/testing/web-platform/tests/element-timing/cross-origin-iframe-element.sub.html
new file mode 100644
index 0000000000..2f49933ab9
--- /dev/null
+++ b/testing/web-platform/tests/element-timing/cross-origin-iframe-element.sub.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<meta charset=utf-8>
+<title>Element Timing: do NOT observe elements from cross-origin iframes</title>
+<body>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/element-timing-helpers.js"></script>
+<script>
+ async_test((t) => {
+ assert_implements(window.PerformanceElementTiming, "PerformanceElementTiming is not implemented");
+ const observer = new PerformanceObserver(
+ t.step_func_done((entryList) => {
+ assert_unreached("We should not observe a cross origin element.");
+ })
+ );
+ observer.observe({entryTypes: ['element']});
+ // We add the iframe during onload to be sure that the observer is registered
+ // in time for it to observe the element timing.
+ // TODO(npm): change observer to use buffered flag.
+ window.onload = t.step_func(() => {
+ // Add a cross origin iframe with an image.
+ const iframe = document.createElement('iframe');
+ iframe.src = 'http://{{domains[www]}}:{{ports[http][1]}}'
+ + '/element-timing/resources/iframe-with-square.html';
+ document.body.appendChild(iframe);
+ iframe.onload = t.step_func(() => {
+ t.step_timeout( () => {
+ // After some wait, assume observer did not receive the entry, so the test passes.
+ t.done();
+ }, 100);
+ });
+ });
+ }, 'Element from cross origin iframe is NOT observable.');
+</script>
+
+</body>