diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-09-04 21:52:19 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 07:52:19 -0400 |
commit | 9e50b3ee61b88b8767ecd1165f2aee62a81842de (patch) | |
tree | 6064237d5d7edf6339816b3620c33c8e18ca8a50 /cli/rt/99_main.js | |
parent | 15649b61bd7ac5d868f2df2825e242a39582a622 (diff) |
fix: don't expose globalThis.__bootstrap (#7344)
Diffstat (limited to 'cli/rt/99_main.js')
-rw-r--r-- | cli/rt/99_main.js | 14 |
1 files changed, 6 insertions, 8 deletions
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); |