From e08ece2d2cc2c39b067dc271f52516bdee7c06ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 14 Apr 2020 17:41:06 +0200 Subject: fix(worker): make worker name spec compliant (#4746) --- cli/js/runtime_worker.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cli/js/runtime_worker.ts') diff --git a/cli/js/runtime_worker.ts b/cli/js/runtime_worker.ts index 8881b438b..1e7a9a67d 100644 --- a/cli/js/runtime_worker.ts +++ b/cli/js/runtime_worker.ts @@ -107,7 +107,10 @@ export const workerRuntimeGlobalProperties = { workerMessageRecvCallback: nonEnumerable(workerMessageRecvCallback), }; -export function bootstrapWorkerRuntime(name: string): void { +export function bootstrapWorkerRuntime( + name: string, + internalName?: string +): void { if (hasBootstrapped) { throw new Error("Worker runtime already bootstrapped"); } @@ -119,7 +122,7 @@ export function bootstrapWorkerRuntime(name: string): void { Object.defineProperties(globalThis, eventTargetProperties); Object.defineProperties(globalThis, { name: readOnly(name) }); setEventTargetData(globalThis); - const s = runtime.start(name); + const s = runtime.start(internalName ?? name); const location = new LocationImpl(s.location); immutableDefine(globalThis, "location", location); -- cgit v1.2.3