https://github.com/web-platform-tests/wpt
Raw File
Tip revision: e940b3ad8382b2a2d7f0faeb0385ed53eb15283b authored by Frédéric Wang on 11 September 2018, 08:14:16 UTC
Use document.scrollingElement to access scroll properties of the viewport
Tip revision: e940b3a
report-cross-origin-no-cookies.sub.html
<!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>
back to top