Imported Upstream version 1.0.0
[platform/upstream/js.git] / js / src / tests / js1_8_5 / extensions / worker-init.js
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * Any copyright is dedicated to the Public Domain.
4  * http://creativecommons.org/licenses/publicdomain/
5  * Contributor: Jason Orendorff <jorendorff@mozilla.com>
6  */
7
8 if (typeof Worker != 'undefined') {
9     JSTest.waitForExplicitFinish();
10     // Messages sent during initialization are a corner case, but in any case
11     // they should be delivered (no waiting until initialization is complete).
12     var w = new Worker(workerDir + "worker-init-child.js"); // posts a message, then loops forever
13     w.onmessage = function (event) {
14         reportCompare(0, 0, "worker-init");
15         JSTest.testFinished();
16     };
17 } else {
18     reportCompare(0, 0, "Test skipped. Shell workers required.");
19 }