summaryrefslogtreecommitdiff
path: root/runtime/js/99_main.js
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2024-02-06 22:28:32 +0100
committerGitHub <noreply@github.com>2024-02-06 22:28:32 +0100
commitc8b2af8ed1b27822b0e6193b7a82903f54e56d95 (patch)
tree0ea57f0d038552971914d08b95e0dec5d93ef102 /runtime/js/99_main.js
parentc6def993e052626be3933de4299bf4b2eb76e48a (diff)
refactor: use web utils and lazy load utils from core (#22289)
Diffstat (limited to 'runtime/js/99_main.js')
-rw-r--r--runtime/js/99_main.js35
1 files changed, 17 insertions, 18 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 112cea122..afd3be03b 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -51,7 +51,6 @@ const {
const {
isNativeError,
} = core;
-import * as util from "ext:runtime/06_util.js";
import * as event from "ext:deno_web/02_event.js";
import * as location from "ext:deno_web/12_location.js";
import * as version from "ext:runtime/01_version.ts";
@@ -729,9 +728,9 @@ function bootstrapMainRuntime(runtimeOptions) {
// TODO(bartlomieju): in the future we might want to change the
// behavior of setting `name` to actually update the process name.
// Empty string matches what browsers do.
- name: util.writable(""),
- close: util.writable(windowClose),
- closed: util.getterOnly(() => windowIsClosing),
+ name: core.propWritable(""),
+ close: core.propWritable(windowClose),
+ closed: core.propGetterOnly(() => windowIsClosing),
});
ObjectSetPrototypeOf(globalThis, Window.prototype);
@@ -757,11 +756,11 @@ function bootstrapMainRuntime(runtimeOptions) {
);
ObjectDefineProperties(finalDenoNs, {
- pid: util.getterOnly(opPid),
- ppid: util.getterOnly(opPpid),
- noColor: util.getterOnly(() => op_bootstrap_no_color()),
- args: util.getterOnly(opArgs),
- mainModule: util.getterOnly(() => op_main_module()),
+ pid: core.propGetterOnly(opPid),
+ ppid: core.propGetterOnly(opPpid),
+ noColor: core.propGetterOnly(() => op_bootstrap_no_color()),
+ args: core.propGetterOnly(opArgs),
+ mainModule: core.propGetterOnly(() => op_main_module()),
// TODO(kt3k): Remove this export at v2
// See https://github.com/denoland/deno/issues/9294
customInspect: {
@@ -811,7 +810,7 @@ function bootstrapMainRuntime(runtimeOptions) {
// Setup `Deno` global - we're actually overriding already existing global
// `Deno` with `Deno` namespace from "./deno.ts".
- ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
+ ObjectDefineProperty(globalThis, "Deno", core.propReadOnly(finalDenoNs));
if (nodeBootstrap) {
nodeBootstrap(hasNodeModulesDir, maybeBinaryNpmCommandName);
@@ -859,16 +858,16 @@ function bootstrapWorkerRuntime(
});
ObjectDefineProperties(globalThis, workerRuntimeGlobalProperties);
ObjectDefineProperties(globalThis, {
- name: util.writable(name),
+ name: core.propWritable(name),
// TODO(bartlomieju): should be readonly?
- close: util.nonEnumerable(workerClose),
- postMessage: util.writable(postMessage),
+ close: core.propNonEnumerable(workerClose),
+ postMessage: core.propWritable(postMessage),
});
if (enableTestingFeaturesFlag) {
ObjectDefineProperty(
globalThis,
"importScripts",
- util.writable(importScripts),
+ core.propWritable(importScripts),
);
}
ObjectSetPrototypeOf(globalThis, DedicatedWorkerGlobalScope.prototype);
@@ -918,9 +917,9 @@ function bootstrapWorkerRuntime(
}
ObjectDefineProperties(finalDenoNs, {
- pid: util.getterOnly(opPid),
- noColor: util.getterOnly(() => op_bootstrap_no_color()),
- args: util.getterOnly(opArgs),
+ pid: core.propGetterOnly(opPid),
+ noColor: core.propGetterOnly(() => op_bootstrap_no_color()),
+ args: core.propGetterOnly(opArgs),
// TODO(kt3k): Remove this export at v2
// See https://github.com/denoland/deno/issues/9294
customInspect: {
@@ -936,7 +935,7 @@ function bootstrapWorkerRuntime(
});
// Setup `Deno` global - we're actually overriding already
// existing global `Deno` with `Deno` namespace from "./deno.ts".
- ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
+ ObjectDefineProperty(globalThis, "Deno", core.propReadOnly(finalDenoNs));
if (nodeBootstrap) {
nodeBootstrap(hasNodeModulesDir, maybeBinaryNpmCommandName);