Revision 3bacf4115fd29c0cf9962d264f3cf1f9b0a04708 authored by Sriram on 23 January 2018, 13:38:05 UTC, committed by Chromium WPT Sync on 23 January 2018, 13:38:05 UTC
Bug: 782555
Change-Id: I5c09a86b8290aee9288596055388976af3aa5818
1 parent 9c8964b
Raw File
data-url-shared-window.html
<!DOCTYPE html>
<head>
<title>data URL shared worker</title>
</head>
<body>
<script>
onmessage = event => {
  const port = event.ports[0];
  // This shared worker counts the total number of connected documents and
  // notifies the connector of it.
  const kScript =
      "onconnect = e => {" +
      "  if (self.count === undefined)" +
      "    self.count = 0;" +
      "  self.count++;" +
      "  e.ports[0].postMessage(self.count);" +
      "};";
  const worker = new SharedWorker('data:application/javascript,' + kScript);
  worker.port.onmessage = e => port.postMessage(e.data);
};

window.opener.postMessage('LOADED', '*');
</script>
</body>
</html>
back to top