summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/element-timing/cross-origin-iframe-element.sub.html
diff options
context:
space:
mode:
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>