summaryrefslogtreecommitdiff
path: root/cli/js/runtime_worker.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/runtime_worker.ts')
-rw-r--r--cli/js/runtime_worker.ts13
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);
}