OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-in
line'"> | 3 <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-in
line'"> |
4 <script src="/inspector/inspector-test.js"></script> | 4 <script src="/inspector/inspector-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function sendCSPRequest() | 7 function sendCSPRequest() |
8 { | 8 { |
9 var script = document.createElement("script"); | 9 var script = document.createElement("script"); |
10 script.src = "https://www.example.com/csp.js"; | 10 script.src = "https://www.example.com/csp.js"; |
11 document.head.appendChild(script); | 11 document.head.appendChild(script); |
12 } | 12 } |
13 | 13 |
14 function addBlockedScript(url) | 14 function addBlockedScript(url) |
15 { | 15 { |
16 var script = document.createElement("script"); | 16 var script = document.createElement("script"); |
17 script.src = url; | 17 script.src = url; |
18 document.head.appendChild(script); | 18 document.head.appendChild(script); |
19 } | 19 } |
20 | 20 |
21 function test() | 21 function test() |
22 { | 22 { |
23 var requestName; | 23 var requestName; |
24 var nextStep; | 24 var nextStep; |
| 25 Common.moduleSetting('requestBlockingEnabled').set(true); |
25 var blockedSetting = Common.settingForTest("networkBlockedURLs"); | 26 var blockedSetting = Common.settingForTest("networkBlockedURLs"); |
26 | 27 |
27 function onRequest(event) | 28 function onRequest(event) |
28 { | 29 { |
29 var request = event.data; | 30 var request = event.data; |
30 if (request.name() !== requestName) | 31 if (request.name() !== requestName) |
31 return; | 32 return; |
32 requestName = undefined; | 33 requestName = undefined; |
33 InspectorTest.addResult("BlockedReason: " + request.blockedReason()); | 34 InspectorTest.addResult("BlockedReason: " + request.blockedReason()); |
34 nextStep(); | 35 nextStep(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 testBlockedURL([], "resources/silent_script.js", next); | 140 testBlockedURL([], "resources/silent_script.js", next); |
140 } | 141 } |
141 ]); | 142 ]); |
142 } | 143 } |
143 </script> | 144 </script> |
144 </head> | 145 </head> |
145 <body onload="runTest()"> | 146 <body onload="runTest()"> |
146 <p>Tests that blocked reason is recognized correctly.</p> | 147 <p>Tests that blocked reason is recognized correctly.</p> |
147 </body> | 148 </body> |
148 </html> | 149 </html> |
OLD | NEW |