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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/blink-contrib/frame-src-blocked.sub.html

Issue 2704543002: Import wpt@3bd204d7e86fd81e98e63f4ce59b95d98bad1c54 (Closed)
Patch Set: Created 3 years, 10 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 <!DOCTYPE html>
2 <html>
3
4 <head>
5 <!-- Programmatically converted from a WebKit Reftest, please forgive result ing idiosyncracies.-->
6 <title>frame-src-blocked</title>
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9 <script src='../support/logTest.sub.js?logs=["PASS IFrame %231 generated a l oad event."]'></script>
10 <script>
11 window.addEventListener("message", function(event) {
12 alert_assert(event.data);
13 }, false);
14
15 function alert_assert(msg) {
16 t_alert.step(function() {
17 if (msg.match(/^FAIL/i)) {
18 assert_unreached(msg);
19 t_alert.done();
20 }
21 for (var i = 0; i < expected_alerts.length; i++) {
22 if (expected_alerts[i] == msg) {
23 assert_true(expected_alerts[i] == msg);
24 expected_alerts.splice(i, 1);
25 if (expected_alerts.length == 0) {
26 t_alert.done();
27 }
28 return;
29 }
30 }
31 assert_unreached('unexpected alert: ' + msg);
32 t_log.done();
33 });
34 }
35
36 </script>
37 <!-- enforcing policy:
38 frame-src 'none'; script-src 'self' 'unsafe-inline'; connect-src 'self';
39 -->
40 <p>
41 IFrames blocked by CSP should generate a 'load', not 'error' event, rega rdless of blocked state. This means they appear to be normal cross-origin loads, thereby not leaking URL information directly to JS.
42 </p>
43 <script>
44 window.wasPostTestScriptParsed = true;
45 var loads = 0;
46
47 function loadEvent() {
48 loads++;
49 log("PASS " + "IFrame #" + loads + " generated a load event.");
50 }
51
52 </script>
53 </head>
54
55 <body>
56 <iframe src="/content-security-policy/blink-contrib/resources/postmessage-fa il.html" onload="loadEvent()" onerror="log('FAIL')"></iframe>
57 <div id="log"></div>
58 <script async defer src="../support/checkReport.sub.js?reportExists=true&amp ;reportField=violated-directive&amp;reportValue=frame-src%20&apos;none&apos;"></ script>
59 </body>
60
61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698