blob: 63c4a84c123942a9ac1570d1b357fb67cd396201 [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 strict-origin-when-cross-origin referrer policy when cross origin from HTTPS to HTTP.");
jsTestIsAsync = true;
if (window.internals) {
internals.settings.setAllowDisplayOfInsecureContent(true);
internals.setResourceLoadStatisticsEnabled(false);
}
function loadImage() {
// Should be the empty string because we are cross-origin and going from HTTPS to HTTP.
let expected = "";
let img = new Image();
img.referrerPolicy = "strict-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>