blob: 2922894832dc7b4ab85754c486eb1bf4cab8d355 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<title>Cookies are not sent on cross origin violation reports</title>
<!-- CSP headers
Content-Security-Policy: script-src 'unsafe-inline' 'self'; img-src 'none'; report-uri http://{{domains[www1]}}:{{ports[http][0]}}/content-security-policy/support/report.py?op=put&reportID=$id
-->
</head>
<body>
<script>
var test = async_test("Image should not load");
fetch(
"/cookies/resources/set-cookie.py?name=cspViolationReportCookie1&path=" + encodeURIComponent("{{domains[www1]}}:{{ports[http][0]}}/"),
{mode: 'no-cors', credentials: 'include'})
.then(() => {
// This image will generate a CSP violation report.
const img = new Image();
img.onerror = test.step_func_done();
img.onload = test.unreached_func("Should not have loaded the image");
img.src = "../support/fail.png";
document.body.appendChild(img);
});
</script>
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=img-src%20%27none%27&noCookies=true'></script>
</body>
</html>