https://github.com/web-platform-tests/wpt
Raw File
Tip revision: ae1fe428a0de1b8da6da6e1a2a856738ef2164c3 authored by Luke Bjerring on 03 April 2018, 16:52:33 UTC
Check inherited interfaces exist
Tip revision: ae1fe42
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