2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
5 onmessage = function (event) {
6 let chromeURL = event.data.replace(
7 "test_chromeWorkerJSM.xhtml",
8 "WorkerTest_badworker.js"
11 let mochitestURL = event.data
12 .replace("test_chromeWorkerJSM.xhtml", "WorkerTest_badworker.js")
14 "chrome://mochitests/content/chrome",
15 "http://mochi.test:8888/tests"
18 // We should be able to XHR to anything we want, including a chrome URL.
19 let xhr = new XMLHttpRequest();
20 xhr.open("GET", mochitestURL, false);
23 if (!xhr.responseText) {
24 throw "Can't load script file via XHR!";
27 // We shouldn't be able to make a ChromeWorker to a non-chrome URL.
29 new ChromeWorker(mochitestURL);
31 if (e.name === "SecurityError") {
36 throw "creating a chrome worker with a bad URL should throw a SecurityError";