blob: a3c22f6b710f0aa502b36be1c273f6c820085ddf [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'nonce-noncynonce' 'nonce-noncy+/=nonce'">
</head>
<body>
<script nonce="noncynonce">
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var modules = new Set([
'allow1',
'allow2',
'allow3',
]);
var array = [];
var count = 0;
function ok(num)
{
// load should be done for module tags before calling the result of import.
if (modules.has(`allow${num}`))
error(num);
array.push(num);
if (array.length === 6) {
alert(array.sort().toString());
done("PASS");
}
}
document.body.addEventListener('load', function (ev) {
let id = ev.target.id;
if (modules.has(id))
modules.delete(id);
else if (id)
error(id);
}, /* capture */ true);
document.body.addEventListener('error', function (ev) {
error(ev.target.id);
}, /* capture */ true);
function error(num)
{
alert(`FAIL (${num})`);
}
function done(msg) {
document.querySelector("pre").innerHTML = msg;
if (window.testRunner)
testRunner.notifyDone();
}
</script>
<script type="module" nonce="noncynonce" id="allow1">
import("./resources/import-scriptnonce-allowed1.js");
</script>
<script type="module" nonce="noncynonce noncynonce" id="block1">
import("./resources/import-scriptnonce-blocked1.js");
</script>
<script type="module" nonce="noncynonce" id="allow2">
import("./resources/import-scriptnonce-allowed2.js");
</script>
<script type="module" id="block2">
import("./resources/import-scriptnonce-blocked2.js");
</script>
<script type="module" nonce="noncy+/=nonce" id="allow3">
import("./resources/import-scriptnonce-allowed3.js");
</script>
<script type="module" nonce="noncynonceno?" id="block3">
import("./resources/import-scriptnonce-blocked3.js");
</script>
<script nonce="noncynonce" id="allow4">
import("./resources/import-scriptnonce-allowed4.js");
</script>
<script nonce="noncynonce noncynonce" id="block4">
import("./resources/import-scriptnonce-blocked4.js");
</script>
<script nonce="noncynonce" id="allow5">
import("./resources/import-scriptnonce-allowed5.js");
</script>
<script id="block5">
import("./resources/import-scriptnonce-blocked5.js");
</script>
<script nonce="noncy+/=nonce" id="allow6">
import("./resources/import-scriptnonce-allowed6.js");
</script>
<script nonce="noncynonceno?" id="block6">
import("./resources/import-scriptnonce-blocked6.js");
</script>
<p>
This tests the effect of a script-nonce value.
</p>
<pre></pre>
</body>
</html>