Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: http3 OR http2
- Manifest: dom/tests/mochitest/general/mochitest.toml
<!--
Any copyright is dedicated to the Public Domain.
-->
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<pre id="test">
<script type="application/javascript">
</script>
</pre>
<a target="_blank"
title="Cross origin resource timing">
Bug #1789128 - Cross-Origin URL Steal is possible using performance.getEntries()
</a>
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
let domains = [
// resource_timing_location_navigate.html navigates via document.location
// resource_timing_meta_refresh.html redirects via meta refresh
// resource_timing_redirect.html redirects via 302 redirect
// embed_navigate.html navigates via document.location
];
let redirectResolves = {};
window.addEventListener("message", (event) => {
console.log("message", event);
redirectResolves[event.origin]();
});
// Wait for all iframes to navigate.
Promise.all(domains.map(domain => {
return new Promise(resolve => {
redirectResolves[domain] = resolve;
})
})).then(() => {
// Check resource timing for iframes.
for (let e of performance.getEntries()) {
ok(!e.name.includes("example.org"), `${e.name} cross origin should not be present in resource timing`)
}
SimpleTest.finish();
});
</script>
<iframe src="resource_timing_location_navigate.html"></iframe>
<iframe src="resource_timing_meta_refresh.html"></iframe>
<iframe src="resource_timing_redirect.html"></iframe>
<embed src="embed_navigate.html">
</body>
</html>