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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/cascade-helper.js

Issue 2472333003: CSP: "local schemes" should inherit policy when embedded. (Closed)
Patch Set: dcheng@ Created 4 years 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 function assert_allowed_image_in_document(test, doc, url) {
2 doc.addEventListener('securitypolicyviolation', test.step_func(e => {
3 if (e.blockedURI == url)
4 assert_unreached("No violation expected for " + url);
5 }));
6
7 var i = doc.createElement('img');
8 i.onerror = test.unreached_func("onerror fired for " + url);
9 i.onload = test.step_func_done();
10 i.src = url;
11 }
12
13
14 function assert_blocked_image_in_document(test, doc, url) {
15 var cspEvent = false;
16 var errorEvent = false;
17 doc.addEventListener('securitypolicyviolation', test.step_func(e => {
18 if (e.blockedURI != url)
19 return;
20
21 cspEvent = true;
22 if (errorEvent)
23 test.done();
24 }));
25
26 var i = doc.createElement('img');
27 i.onload = test.unreached_func("onload fired for " + url);
28 i.onerror = test.step_func(e => {
29 errorEvent = true;
30 if (cspEvent)
31 test.done();
32 });
33 i.src = url;
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698