2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
5 // Try no args. This shouldn't do anything.
8 // This caused security exceptions in the past, make sure it doesn't!
9 var constructor = {}.constructor;
11 importScripts("importScripts_worker_imported1.js");
13 // Try to call a function defined in the imported script.
14 importedScriptFunction();
16 function tryBadScripts() {
19 "importScripts_worker_imported3.js",
20 // Throws an exception
21 "importScripts_worker_imported4.js",
23 "http://example.com/non-existing/importScripts_worker_foo.js",
25 "http://notadomain::notafile aword",
28 for (var i = 0; i < badScripts.length; i++) {
29 var caughtException = false;
30 var url = badScripts[i];
34 caughtException = true;
36 if (!caughtException) {
37 throw "Bad script didn't throw exception: " + url;
42 const url = "data:text/javascript,const startResponse = 'started';";
45 onmessage = function (event) {
48 importScripts("importScripts_worker_imported2.js");
49 importedScriptFunction2();
51 postMessage(startResponse);
55 postMessage("stopped");
58 throw new Error("Bad message: " + event.data);