| <!DOCTYPE html> |
| <title>Service Worker: Dynamic import() on ServiceWorkerGlobalScope</title> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../resources/test-helpers.js"></script> |
| <script> |
| |
| // This test should not be upstreamed to WPT because this tests Chrome-specific |
| // behavior. |
| |
| promise_test(t => { |
| const kScope = 'resources/dynamic-import.html'; |
| const kScriptURL = 'resources/dynamic-import-worker.js'; |
| return service_worker_unregister_and_register(t, kScriptURL, kScope) |
| .then(registration => { |
| const promise = new Promise(resolve => { |
| navigator.serviceWorker.onmessage = resolve; |
| }); |
| registration.installing.postMessage(''); |
| return promise; |
| }) |
| .then(msg_event => { |
| assert_equals(msg_event.data.name, 'TypeError'); |
| assert_equals( |
| msg_event.data.message, |
| 'Module scripts are not supported on WorkerGlobalScope yet ' + |
| '(see https://crbug.com/680046).'); |
| }); |
| }, 'Dynamic import() on ServiceWorkerGlobalScope should reject the promise.'); |
| |
| </script> |