summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-04-26 19:57:38 +0200
committerGitHub <noreply@github.com>2023-04-26 19:57:38 +0200
commit14aaa73c0200d7fac4aa224d623e28b5955daab9 (patch)
treeb5a0c41f831fefb2d506f323a55570493a216787 /runtime/js
parent2df6db36c85c27d424d54e9c168ef4ea09c5c08c (diff)
refactor: don't expose Deno[Deno.internal].core namespace (#18816)
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/99_main.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index fa16cc1f4..914940f5c 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -391,12 +391,6 @@ function promiseRejectMacrotaskCallback() {
let hasBootstrapped = false;
// Set up global properties shared by main and worker runtime.
ObjectDefineProperties(globalThis, windowOrWorkerGlobalScope);
-// FIXME(bartlomieju): temporarily add whole `Deno.core` to
-// `Deno[Deno.internal]` namespace. It should be removed and only necessary
-// methods should be left there.
-ObjectAssign(internals, {
- core,
-});
const internalSymbol = Symbol("Deno.internal");
const finalDenoNs = {
internal: internalSymbol,
@@ -428,7 +422,7 @@ function bootstrapMainRuntime(runtimeOptions) {
13: v8Version,
14: userAgent,
15: inspectFlag,
- // 16: enableTestingFeaturesFlag
+ 16: enableTestingFeaturesFlag,
} = runtimeOptions;
performance.setTimeOrigin(DateNow());
@@ -503,6 +497,12 @@ function bootstrapMainRuntime(runtimeOptions) {
ObjectAssign(finalDenoNs, denoNsUnstable);
}
+ // Add `Deno[Deno.internal].core` namespace if
+ // `--enable-testing-features-do-not-use` flag is set.
+ if (enableTestingFeaturesFlag) {
+ ObjectAssign(internals, { core });
+ }
+
// Setup `Deno` global - we're actually overriding already existing global
// `Deno` with `Deno` namespace from "./deno.ts".
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
@@ -612,6 +612,11 @@ function bootstrapWorkerRuntime(
noColor: util.readOnly(noColor),
args: util.readOnly(ObjectFreeze(args)),
});
+ // Add `Deno[Deno.internal].core` namespace if
+ // `--enable-testing-features-do-not-use` flag is set.
+ if (enableTestingFeaturesFlag) {
+ ObjectAssign(internals, { core });
+ }
// Setup `Deno` global - we're actually overriding already
// existing global `Deno` with `Deno` namespace from "./deno.ts".
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));