blob: 3353e743bb76f4add9ac84fc22c9b7d88afa2084 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/util.js"></script>
</head>
<body onload="runTest()">
<script>
description("Tests that an empty document.referrer is left alone in third-party iframes.");
jsTestIsAsync = true;
function receiveMessage(event) {
if (event.origin === "http://localhost:8000") {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
else
testPassed(event.data.replace("PASS ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
setEnableFeature(false, finishJSTest);
}
window.addEventListener("message", receiveMessage, false);
function runTest() {
if (testRunner) {
setEnableFeature(true, function() {
let iframeElement = document.createElement("iframe");
iframeElement.referrerPolicy = "no-referrer";
iframeElement.src = "http://localhost:8000/resourceLoadStatistics/resources/report-document-referrer.html";
document.body.appendChild(iframeElement);
});
}
}
</script>
</body>
</html>