|
1 /** |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
4 */ |
|
5 const importSubURL = "relativeLoad_sub_import.js"; |
|
6 |
|
7 onmessage = function(event) { |
|
8 var xhr = new XMLHttpRequest(); |
|
9 xhr.open("GET", "testXHR.txt", false); |
|
10 xhr.send(null); |
|
11 if (xhr.status != 404) { |
|
12 throw "Loaded an xhr from the wrong location!"; |
|
13 } |
|
14 |
|
15 importScripts(importSubURL); |
|
16 var worker = new Worker("relativeLoad_sub_worker2.js"); |
|
17 worker.onerror = function(event) { |
|
18 throw event.data; |
|
19 }; |
|
20 worker.onmessage = function(event) { |
|
21 if (event.data != workerSubURL) { |
|
22 throw "Bad data!"; |
|
23 } |
|
24 postMessage(workerSubURL); |
|
25 }; |
|
26 }; |