mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
fix(worker): make worker name spec compliant (#4746)
This commit is contained in:
parent
cb5dd69dda
commit
e08ece2d2c
4 changed files with 28 additions and 16 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue