summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/sharedWorker_thirdparty_frame.html
blob: ebd78412a607a7617b4d75c8c211fffa263a97ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE HTML>
<script>
  let params = new URLSearchParams(document.location.search.substring(1));
  let name = params.get('name');
  try {
    let worker = new SharedWorker('sharedWorker_sharedWorker.js',
                                  { name });
    worker.port.addEventListener('message', evt => {
      parent.postMessage( { name, result: 'allowed' }, '*');
    }, { once: true });
    worker.port.start();
    worker.port.postMessage('ping');
  } catch(e) {
    parent.postMessage({ name, result: 'blocked' }, '*');
  }
</script>