summaryrefslogtreecommitdiff
path: root/cli/tests/workers/test_worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/workers/test_worker.js')
-rw-r--r--cli/tests/workers/test_worker.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/tests/workers/test_worker.js b/cli/tests/workers/test_worker.js
new file mode 100644
index 000000000..4260975a6
--- /dev/null
+++ b/cli/tests/workers/test_worker.js
@@ -0,0 +1,19 @@
+let thrown = false;
+
+if (self.name !== "") {
+ throw Error(`Bad worker name: ${self.name}, expected empty string.`);
+}
+
+onmessage = function (e) {
+ if (thrown === false) {
+ thrown = true;
+ throw new SyntaxError("[test error]");
+ }
+
+ postMessage(e.data);
+ close();
+};
+
+onerror = function () {
+ return false;
+};