summaryrefslogtreecommitdiffstats
path: root/dom/websocket/tests/iframe_webworker_wss.html
blob: a4fb966b7dc917db686a8c5d453da018d62a2e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<html><body>
Creating WebSocket
<script type="application/javascript">
onmessage = function(e) {
  parent.postMessage(e.data, '*');
}

try{
  let worker = new Worker("data:text/javascript,new WebSocket('ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello')");
  worker.onerror = (e) => {
    parent.postMessage(e.message, '*');
    close();
  };
  worker.onmessage = (e) => {
    parent.postMessage(e.message, '*');
    close();
  };
  // catch the security error thrown so it doesn't surface as a duplicate test failure
} catch(e) {}

</script>
</body></html>