diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-03-11 21:57:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-11 21:57:24 +0100 |
commit | 810e4a16bedbc77ef0651f4f24626d98ca566083 (patch) | |
tree | ae82b48442178e0d02292c208d48e4ea8a3d9ca9 /cli/js/runtime_worker.ts | |
parent | b8fa3fd5e7dd906e5616bf2ab8ad6df3f74f244d (diff) |
reorg: Deno global initialization (#4317)
Diffstat (limited to 'cli/js/runtime_worker.ts')
-rw-r--r-- | cli/js/runtime_worker.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cli/js/runtime_worker.ts b/cli/js/runtime_worker.ts index 2b1dba088..3468e8109 100644 --- a/cli/js/runtime_worker.ts +++ b/cli/js/runtime_worker.ts @@ -17,7 +17,8 @@ import { eventTargetProperties } from "./globals.ts"; import * as webWorkerOps from "./ops/web_worker.ts"; -import { log } from "./util.ts"; +import { LocationImpl } from "./web/location.ts"; +import { log, assert, immutableDefine } from "./util.ts"; import { TextEncoder } from "./web/text_encoding.ts"; import * as runtime from "./runtime.ts"; @@ -104,5 +105,13 @@ export function bootstrapWorkerRuntime(name: string): void { Object.defineProperties(globalThis, workerRuntimeGlobalProperties); Object.defineProperties(globalThis, eventTargetProperties); Object.defineProperties(globalThis, { name: readOnly(name) }); - runtime.start(false, name); + const s = runtime.start(name); + + const location = new LocationImpl(s.location); + immutableDefine(globalThis, "location", location); + Object.freeze(globalThis.location); + + // globalThis.Deno is not available in worker scope + delete globalThis.Deno; + assert(globalThis.Deno === undefined); } |