Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-reportonly.https.php

Issue 2002003002: Generate CSP violation reports for 'block-all-mixed-content' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PHP Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <?php
2 header("Content-Security-Policy-Report-Only: block-all-mixed-content");
3 ?>
4 <!doctype html>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <body>
8 <script>
9 async_test(t => {
10 var i = document.createElement('img');
11 i.onerror = t.assert_unreached;
12 i.onload = t.step_func_done(_ => {
13 assert_equals(128, i.naturalWidth);
14 assert_equals(128, i.naturalHeight);
15 });
16 i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=1";
17 }, "Mixed images are allowed in the presence of 'block-all-mixed-content' in report-only mode.");
18
19 async_test(t => {
20 var i = document.createElement('img');
21 document.addEventListener('securitypolicyviolation', t.step_func_done(e => {
22 var expectations = {
23 'documentURI': document.location.toString(),
24 'referrer': document.referrer,
25 'blockedURI': 'http://127.0.0.1:8080',
26 'violatedDirective': 'block-all-mixed-content',
27 'effectiveDirective': 'block-all-mixed-content',
28 'originalPolicy': 'block-all-mixed-content',
29 'sourceFile': '',
30 'lineNumber': 0,
31 'columnNumber': 0,
32 'statusCode': 0
33 };
34 for (key in expectations)
35 assert_equals(expectations[key], e[key], key);
36 }));
37 i.src = "http://127.0.0.1:8080/security/resources/compass.jpg?t=2";
38 }, "Mixed images generate CSP violation reports in the presence of 'block-al l-mixed-content'.");
39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698