summaryrefslogtreecommitdiff
path: root/js/src/tests/js1_8_5/extensions/worker-error-propagation-child.js
blob: e4160b8ee5e6a60cdcdea4651ee20ea1b2cf4fdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* -*- 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>
 */

function onmessage(event) {
    var n = +event.data;
    if (n == 0)
        throw new Error("boom");
    var w = new Worker(workerDir + "worker-error-propagation-child.js");
    w.onmessage = function (event) { postMessage(event.data); };
    // No w.onerror here. We are testing error propagation when it is absent.
    w.postMessage(n - 1 + "");
}