summaryrefslogtreecommitdiff
path: root/js/src/tests/js1_8_5/extensions/worker-error.js
blob: 67dcc1970dd4ac3564bc1c7ee506680c292b5837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/licenses/publicdomain/
 * Contributor: Jason Orendorff <jorendorff@mozilla.com>
 */

if (typeof Worker != 'undefined') {
    JSTest.waitForExplicitFinish();

    // The script throws new Error("fail") on first message.
    var w = Worker(workerDir + "worker-error-child.js");
    var a = [];
    w.onerror = function (event) {
        reportCompare("fail", event.message, "worker-error");
        JSTest.testFinished();
    };
    w.postMessage("hello");
} else {
    reportCompare(0, 0, "Test skipped. Shell workers required.");
}