Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 11 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /resource-timing/tentative/initiator-url/document-initiated.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resource-timing/resources/observe-entry.js"></script>
<script src="../../resources/test-initiator.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<!-- Empty Blocking Script -->
<script src="../../resources/empty.js?blocking"></script>
<!-- Empty Preloaded Script -->
<link rel="preload" href="../../resources/display_paragraph.js" as="script" />
<!-- Loading arbitrary Empty Blocking Async Script -->
<script async src="../../resources/empty.js?async"></script>
<!-- Loading arbitrary Empty Deferred Script -->
<script defer src="../../resources/empty.js?deferred"></script>
<!-- Loading arbitrary Empty Module Script -->
<script type="module" src="../../resources/empty.js?module"></script>
<!-- Empty Stylesheet -->
<link rel="stylesheet" href="../../resources/empty_style.css?link" />
<script src="../../resources/display_paragraph.js"></script>
<!-- Inline Styles -->
<style>
body {
background-image: url("/images/blue.png?inline-style");
font-family: remoteFont, sans-serif;
}
@font-face {
font-family: remoteFont;
/* This query parameter ensures that the Ahem.ttf is not retrieved from the cache. */
src: url("/fonts/Ahem.ttf?initiator-html");
}
</style>
</head>
<body>
<!-- Loading an arbitrary Image using <img> tag -->
<img
src="/images/blue.png?using-Img-tag"
alt="Sample Image for testing initiator Attribute"
/>
<iframe src="../../resources/green.html"></iframe>
<script>
display_paragraph();
// TODO(crbug.com/40919714): The two elements below are not initiated by html.
// They are initiated by script. They should be moved out of this test.
// As of 08/2025 the two below are passing for chromium but because of wrong
// reasons. They are not recognized to be resources initaited by scripts, so they
// are thought to be initiated from main html, for which the url happens to be
// correct for inline scripts.
// Load arbitrary stylesheet with inline script.
const link = document.createElement("link");
link.rel = "stylesheet";
link.href = "../../resources/empty_style.css?inline-script";
document.head.appendChild(link);
// Load arbitrary image with inline script
const img = document.createElement("img");
img.src = "/images/blue.png?inline-script";
document.body.appendChild(img);
const host_info = get_host_info();
const expectedInitiatorUrl = host_info["ORIGIN"] +
"/resource-timing/tentative/initiator-url/document-initiated.html";
const resources = [
"empty.js?blocking",
"display_paragraph.js",
"empty.js?async",
"empty.js?deferred",
"empty.js?module",
"empty_style.css?link",
"blue.png?inline-style",
"Ahem.ttf?initiator-html",
"blue.png?using-Img-tag",
/* "green.html",
TODO(crbug.com/40919714): report initiator for iframe element.
*/
"empty_style.css?inline-script",
"blue.png?inline-script",
];
for (const resource of resources) {
initiator_url_test(resource, expectedInitiatorUrl, resource+
" initiatorUrl from document-initiated", resource+" timeout");
}
</script>
</body>