blob: b83d09e651c3a20d45b38363a1b565e16a83f585 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
</script>
</head>
<body>
<p>This tests that in an isolated world the Content Security Policy of the Web Worker bypassed and the worker is allowed to import a script from a different origin, not listed in its script-src, through a redirect.</p>
<pre id="result"></pre>
<script>
window.onmessage = function (event)
{
document.getElementById("result").textContent = event.data;
if (window.testRunner)
testRunner.notifyDone();
}
function runTest()
{
var worker;
try {
worker = new Worker("http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker-importScript-redirect-cross-origin-allowed.php?csp=" + encodeURIComponent("script-src http://127.0.0.1:8000/security/contentSecurityPolicy/resources/redir.php"));
worker.onmessage = function (event) { window.postMessage(event.data, "*"); }
} catch (exception) {
window.postMessage("FAIL should not have thrown an exception when creating worker. Threw exception " + exception + ".", "*");
}
}
if (window.testRunner)
testRunner.evaluateScriptInIsolatedWorld(0, runTest.toString() + ";runTest();");
</script>
</body>
</html>