OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta http-equiv="Content-Security-Policy" content="default-src https:; script-s
rc 'unsafe-inline'"> | 4 <meta http-equiv="Content-Security-Policy" content="default-src https:; script-s
rc 'unsafe-inline'"> |
5 <script> | 5 <script> |
6 if (window.testRunner) { | 6 if (window.testRunner) { |
7 testRunner.waitUntilDone(); | 7 testRunner.waitUntilDone(); |
8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
9 } | 9 } |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 img.src = '../resources/abe.png'; | 27 img.src = '../resources/abe.png'; |
28 })); | 28 })); |
29 } | 29 } |
30 | 30 |
31 function expectStyleLoad(shouldLoad) { | 31 function expectStyleLoad(shouldLoad) { |
32 // onerror doesn't seem to work on <link>. | 32 // onerror doesn't seem to work on <link>. |
33 // Fortunately, srcdoc iframes are bound by containing CSP. | 33 // Fortunately, srcdoc iframes are bound by containing CSP. |
34 return produceOutput(new Promise(function(resolve, reject) { | 34 return produceOutput(new Promise(function(resolve, reject) { |
35 var iframe = document.createElement('iframe'); | 35 var iframe = document.createElement('iframe'); |
36 iframe.onload = function() { | 36 iframe.onload = function() { |
37 var didLoad = iframe.contentDocument.styleSheets.length > 0; | 37 var didLoad = iframe.contentDocument.styleSheets.length > 0 && i
frame.contentDocument.styleSheets[0].rules.length > 0; |
38 (shouldLoad == didLoad) ? resolve() : reject(new Error()); | 38 (shouldLoad == didLoad) ? resolve() : reject(new Error()); |
39 setTimeout(function() { iframe.remove(); }, 0); | 39 setTimeout(function() { iframe.remove(); }, 0); |
40 }; | 40 }; |
41 iframe.srcdoc = '<link rel="stylesheet" href="../resources/cssStyle.
css">'; | 41 iframe.srcdoc = '<link rel="stylesheet" href="../resources/cssStyle.
css">'; |
42 document.body.appendChild(iframe); | 42 document.body.appendChild(iframe); |
43 })); | 43 })); |
44 } | 44 } |
45 | 45 |
46 window.onload = function() { | 46 window.onload = function() { |
47 Promise.resolve() | 47 Promise.resolve() |
(...skipping 27 matching lines...) Expand all Loading... |
75 }; | 75 }; |
76 </script> | 76 </script> |
77 </head> | 77 </head> |
78 <body> | 78 <body> |
79 <p> | 79 <p> |
80 This test ensures that registering a scheme as bypassing CSP actually by
passes CSP. | 80 This test ensures that registering a scheme as bypassing CSP actually by
passes CSP. |
81 This test passes if only PASSes are generated. | 81 This test passes if only PASSes are generated. |
82 </p> | 82 </p> |
83 </body> | 83 </body> |
84 </html> | 84 </html> |
OLD | NEW |