xref: /aosp_15_r20/external/cronet/net/data/websocket/websocket_shared_worker.html (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1<html>
2<body>
3<div id=result></div>
4<script>
5function log(message)
6{
7  document.getElementById("result").innerHTML += message + "<br>";
8}
9var worker = new SharedWorker("websocket_worker_simple.js");
10var protocol = location.protocol.replace('http', 'ws');
11var url = protocol + '//' + location.host + '/echo-with-no-extension';
12worker.port.onmessage = function (evt) {
13  log(evt.data);
14  if (evt.data == "DONE") {
15    document.title = "OK";
16  } else {
17    document.title = "FAIL";
18  }
19};
20worker.port.postMessage(url);
21
22</script>
23</body>
24</html>
25