https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 0322f4a8924395e866e774d68200e5844e72f793 authored by Lennart Grahl on 19 May 2018, 00:04:14 UTC
Add a test based on discussion in https://github.com/w3c/webrtc-pc/pull/1851 with @jan-ivar
Tip revision: 0322f4a
wasm_service_worker_test.https.html
<!DOCTYPE html>
<title>Service Worker: postMessage with wasm</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script>
  promise_test(async test => {
    var registration = await service_worker_unregister_and_register(
      test, 'resources/service-worker.js', 'resources/blank.html');
      add_completion_callback(() => registration.unregister());
      var worker = registration.installing;
      var data = await new Promise((resolve, reject) => {
        var messageChannel = new MessageChannel();
        worker.postMessage({port: messageChannel.port2}, [messageChannel.port2]);
        worker.postMessage({compile: true});
        messageChannel.port1.onmessage = event => resolve(event.data);
      });
      assert_equals(data, null);
  }, 'postMessaging wasm from a service worker should fail');
</script>
back to top