Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /element-timing/cross-origin-iframe-element.sub.html - WPT Dashboard Interop Dashboard
<!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');
+ '/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>