Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<head>
<title>Test for Worker importScripts</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script id="worker" type="javascript/worker">
onmessage = async function(msg) {
try {
self.importScripts("N:", "");
} catch (ex) {
postMessage("done");
}
};
</script>
<script>
SimpleTest.waitForExplicitFinish();
document.addEventListener("DOMContentLoaded", async () => {
const blob = new Blob([document.querySelector('#worker').textContent],
{type: "text/javascript"});
const worker = new Worker(window.URL.createObjectURL(blob));
worker.postMessage([], []);
worker.onmessage = function(e) {
if (e.data == "done") {
ok(true);
SimpleTest.finish();
}
};
});
</script>
</pre>
</body>
</html>