From 9e50b3ee61b88b8767ecd1165f2aee62a81842de Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Fri, 4 Sep 2020 21:52:19 +1000 Subject: fix: don't expose globalThis.__bootstrap (#7344) --- cli/rt/06_util.js | 1 - cli/rt/99_main.js | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'cli/rt') diff --git a/cli/rt/06_util.js b/cli/rt/06_util.js index b0ed5696f..011fa6de5 100644 --- a/cli/rt/06_util.js +++ b/cli/rt/06_util.js @@ -53,7 +53,6 @@ function immutableDefine( o, p, - // eslint-disable-next-line @typescript-eslint/no-explicit-any value, ) { Object.defineProperty(o, p, { diff --git a/cli/rt/99_main.js b/cli/rt/99_main.js index 846216ec4..c6d6d1395 100644 --- a/cli/rt/99_main.js +++ b/cli/rt/99_main.js @@ -1,7 +1,6 @@ // Removes the `__proto__` for security reasons. This intentionally makes // Deno non compliant with ECMA-262 Annex B.2.2.1 // -// eslint-disable-next-line @typescript-eslint/no-explicit-any delete Object.prototype.__proto__; ((window) => { @@ -292,9 +291,9 @@ delete Object.prototype.__proto__; if (hasBootstrapped) { throw new Error("Worker runtime already bootstrapped"); } - // Remove bootstrapping methods from global scope - globalThis.__bootstrap = undefined; - globalThis.bootstrap = undefined; + // Remove bootstrapping data from the global scope + delete globalThis.__bootstrap; + delete globalThis.bootstrap; util.log("bootstrapMainRuntime"); hasBootstrapped = true; Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods); @@ -360,9 +359,9 @@ delete Object.prototype.__proto__; if (hasBootstrapped) { throw new Error("Worker runtime already bootstrapped"); } - // Remove bootstrapping methods from global scope - globalThis.__bootstrap = undefined; - globalThis.bootstrap = undefined; + // Remove bootstrapping data from the global scope + delete globalThis.__bootstrap; + delete globalThis.bootstrap; util.log("bootstrapWorkerRuntime"); hasBootstrapped = true; Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods); @@ -412,7 +411,6 @@ delete Object.prototype.__proto__; workerRuntime: bootstrapWorkerRuntime, }, configurable: true, - writable: true, }, }); })(this); -- cgit v1.2.3