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
|
<!DOCTYPE html>
<script>
try {
var w = new SharedWorker("shared-worker-script.js");
w.port.onmessage = function(e) {
parent.postMessage({ type: "shared", error: false, exception: false,
isSecureContext: e.data }, "*");
};
w.onerror = function(e) {
parent.postMessage({ type: "shared", error: true, exception: false },
"*");
}
w.port.start();
} catch (e) {
parent.postMessage({ type: "shared", exception: true }, "*");
}
try {
var w = new SharedWorker("parent-shared-worker-script.js");
w.port.onmessage = function(e) {
parent.postMessage({ type: "nested", error: false, exception: false,
isSecureContext: e.data }, "*");
};
w.onerror = function(e) {
parent.postMessage({ type: "nested", error: true, exception: false },
"*");
}
w.port.start();
} catch (e) {
parent.postMessage({ type: "nested", exception: true }, "*");
}
</script>
|