blob: 92dd101e5ca56b9c296d03ecec79c8127627eff0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body onload="loadImage()">
<script>
description("Tests the behavior of origin-when-cross-origin referrer policy when cross origin.");
jsTestIsAsync = true;
if (window.internals)
internals.setResourceLoadStatisticsEnabled(false);
function loadImage() {
// Should be the origin, not the full URL, because we are cross-origin.
let expected = "http://127.0.0.1:8000/";
let img = new Image();
img.referrerPolicy = "origin-when-cross-origin";
img.onload = function() { testPassed('referrer is "' + expected + '"'); finishJSTest(); }
img.onerror = function() { testFailed("referrer is not as expected"); finishJSTest(); }
img.src = "http://localhost:8000/referrer-policy/resources/image.py?expected=" + expected;
if (window.internals)
internals.setResourceLoadStatisticsEnabled(true);
}
</script>
</body>
</html>