1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/workers/test/subdir/relativeLoad_sub_worker.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +/** 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.7 + */ 1.8 +const importSubURL = "relativeLoad_sub_import.js"; 1.9 + 1.10 +onmessage = function(event) { 1.11 + var xhr = new XMLHttpRequest(); 1.12 + xhr.open("GET", "testXHR.txt", false); 1.13 + xhr.send(null); 1.14 + if (xhr.status != 404) { 1.15 + throw "Loaded an xhr from the wrong location!"; 1.16 + } 1.17 + 1.18 + importScripts(importSubURL); 1.19 + var worker = new Worker("relativeLoad_sub_worker2.js"); 1.20 + worker.onerror = function(event) { 1.21 + throw event.data; 1.22 + }; 1.23 + worker.onmessage = function(event) { 1.24 + if (event.data != workerSubURL) { 1.25 + throw "Bad data!"; 1.26 + } 1.27 + postMessage(workerSubURL); 1.28 + }; 1.29 +};