summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/secure-contexts/support/https-subframe-shared.html
blob: 5ae7cde5b0a87ec41c24705b0facf16ac75df9e1 (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
<!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>