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:
- /resource-timing/tentative/initiator-url/xml-http-request.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="../../resources/test-initiator.js"></script>
<script src="../../resources/loading-resource-lib.js"></script>
</head>
<body>
<h1>Description</h1>
<p> This test verifies that, for a resource fetched with a XMLHttpRequest,
the initiator_url points to the script where xmlhttprequest.send()
happens.
</p>
</body>
<script>
var img = document.createElement("img");
document.body.appendChild(img);
const label = "initiator_url_xmlhttprequest";
const resource = "/images/blue.png?"+label;
const hostInfo = get_host_info();
const expectedInitiatorUrl = hostInfo["ORIGIN"] +
"/resource-timing/tentative/initiator-url/xml-http-request.html";
const request = new XMLHttpRequest();
request.onload = function() {load_image(label, img)};
request.open("GET", "/resources/blank.html");
request.send();
initiator_url_test(resource, expectedInitiatorUrl, resource +
" initiatorUrl from XMLHttpRequest()", resource + " timeout");
</script>