blob: b6a1e585b3c9b34bc4b6ea98b4d71873a163d8bf [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
</script>
</head>
<body>
<p>This tests a Web Worker with Content Security Policy &quot;script-src 'self'&quot; blocks the import of a script from a different origin through a redirect.</p>
<pre id="result"></pre>
<script>
function reportResultAndNotifyDone(message)
{
document.getElementById("result").textContent = message;
if (window.testRunner)
testRunner.notifyDone();
}
var worker;
try {
worker = new Worker("resources/worker-importScript-redirect-cross-origin-blocked.php?csp=" + encodeURIComponent("script-src 'self'"));
worker.onmessage = function (event) { reportResultAndNotifyDone(event.data); };
} catch (exception) {
reportResultAndNotifyDone("FAIL should not have thrown an exception when creating worker. Threw exception " + exception + ".");
}
</script>
</body>
</html>