blob: 2c4de274603d4d39af47de65c5186799c8b54b11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var seenScopeError;
onerror = function (message, filename, lineno) {
if (!seenScopeError) {
seenScopeError = true;
postMessage({
type: "scope",
data: { message, filename, lineno },
});
return true;
}
};
onmessage = function (event) {
var workerId = parseInt(event.data);
if (workerId > 1) {
var worker = new Worker("errorPropagation_worker.js");
worker.onmessage = function (msg) {
postMessage(msg.data);
};
var seenWorkerError;
worker.onerror = function (error) {
if (!seenWorkerError) {
seenWorkerError = true;
postMessage({
type: "worker",
data: {
message: error.message,
filename: error.filename,
lineno: error.lineno,
},
});
error.preventDefault();
}
};
worker.postMessage(workerId - 1);
return;
}
var interval = setInterval(function () {
throw new Error("expectedError");
}, 100);
};
|