diff options
Diffstat (limited to 'testing/web-platform/tests/workers/modules/resources/nested-static-import-worker.js')
-rw-r--r-- | testing/web-platform/tests/workers/modules/resources/nested-static-import-worker.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/workers/modules/resources/nested-static-import-worker.js b/testing/web-platform/tests/workers/modules/resources/nested-static-import-worker.js new file mode 100644 index 0000000000..c3a9ff0b79 --- /dev/null +++ b/testing/web-platform/tests/workers/modules/resources/nested-static-import-worker.js @@ -0,0 +1,21 @@ +// This script is meant to be imported by a module worker. It receives a +// message from the worker and responds with the list of imported modules. +import * as module from './export-on-static-import-script.js'; +if ('DedicatedWorkerGlobalScope' in self && + self instanceof DedicatedWorkerGlobalScope) { + self.onmessage = e => { + e.target.postMessage(module.importedModules); + }; +} else if ( + 'SharedWorkerGlobalScope' in self && + self instanceof SharedWorkerGlobalScope) { + self.onconnect = e => { + e.ports[0].postMessage(module.importedModules); + }; +} else if ( + 'ServiceWorkerGlobalScope' in self && + self instanceof ServiceWorkerGlobalScope) { + self.onmessage = e => { + e.source.postMessage(module.importedModules); + }; +} |