| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script> | 4 <meta http-equiv="Content-Security-Policy" content="script-src http://localhost:
8000 'nonce-hello'"> |
| 5 </script> | 5 <link id="target" rel="import" href="http://localhost:8000/htmlimports/resources
/child-having-nonce-policy.cgi"> |
| 6 <link id="target" rel="import" href="resources/child-having-nonce-policy.html"> | |
| 7 <script src="/js-test-resources/js-test.js"></script> | |
| 8 </head> | 6 </head> |
| 9 <body> | 7 <body> |
| 10 <script> | 8 <script nonce="hello"> |
| 11 shouldBe("document.inlineScriptHasRun", "undefined"); | 9 function test(actual, expected, message) |
| 12 shouldBe("document.externalScriptHasRun", "undefined"); | 10 { |
| 13 shouldBeTrue("document.externalScriptWithNonceHasRun"); | 11 if (actual === expected) |
| 14 shouldBeTrue("document.inlineScriptWithNonceHasRun"); | 12 console.log("PASS"); |
| 15 shouldBe("document.evalFromInlineHasRun", "undefined"); | 13 else |
| 16 shouldBe("document.evalFromExternalHasRun", "undefined"); | 14 console.log("FAIL:" + message); |
| 17 shouldBe("document.evalFromInlineWithNonceHasRun", "undefined"); | 15 } |
| 18 shouldBe("document.evalFromExternalWithNonceHasRun", "undefined"); | 16 |
| 17 if (window.testRunner) |
| 18 testRunner.dumpAsText(); |
| 19 |
| 20 test(document.inlineScriptHasRun, undefined, "document.inlineScriptHasRun"); |
| 21 test(document.externalScriptHasRun, undefined, "document.externalScriptHasRun"); |
| 22 test(document.externalScriptWithNonceHasRun, true, "document.externalScriptWithN
onceHasRun"); |
| 23 test(document.inlineScriptWithNonceHasRun, true, "document.inlineScriptWithNonce
HasRun"); |
| 24 test(document.evalFromInlineHasRun, undefined, "document.evalFromInlineHasRun"); |
| 25 test(document.evalFromExternalHasRun, undefined, "document.evalFromExternalHasRu
n"); |
| 26 test(document.evalFromInlineWithNonceHasRun, undefined, "document.evalFromInline
WithNonceHasRun"); |
| 27 test(document.evalFromExternalWithNonceHasRun, undefined, "document.evalFromExte
rnalWithNonceHasRun"); |
| 19 </script> | 28 </script> |
| 20 </body> | 29 </body> |
| 21 </html> | 30 </html> |
| OLD | NEW |