blob: d516aed8f59945e9da6afc98c576f6ba9e57c46e [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 same-origin referrer policy when same origin.");
jsTestIsAsync = true;
if (window.internals)
internals.setResourceLoadStatisticsEnabled(false);
function loadImage() {
// Should be the full URL because we are same-origin.
let expected = "http://127.0.0.1:8000/referrer-policy-img/same-origin/same-origin.html";
let img = new Image();
img.referrerPolicy = "same-origin";
img.onload = function() { testPassed('referrer is "' + expected + '"'); finishJSTest(); }
img.onerror = function() { testFailed("referrer is not as expected"); finishJSTest(); }
img.src = "http://127.0.0.1:8000/referrer-policy/resources/image.py?expected=" + expected;
if (window.internals)
internals.setResourceLoadStatisticsEnabled(true);
}
</script>
</body>
</html>