From 4ed2ecfcfffc1402c60e0156b6252f2b5a9b7f2f Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Fri, 19 Nov 2021 12:52:56 +0800 Subject: [PATCH] reuse name variable in share scope --- lib/container/ContainerEntryModule.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/container/ContainerEntryModule.js b/lib/container/ContainerEntryModule.js index e592ce480..647118088 100644 --- a/lib/container/ContainerEntryModule.js +++ b/lib/container/ContainerEntryModule.js @@ -217,10 +217,8 @@ class ContainerEntryModule extends Module { ])};`, `var init = ${runtimeTemplate.basicFunction("shareScope, initScope", [ `if (!${RuntimeGlobals.shareScopeMap}) return;`, - `var oldScope = ${RuntimeGlobals.shareScopeMap}[${JSON.stringify( - this._shareScope - )}];`, `var name = ${JSON.stringify(this._shareScope)}`, + `var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`, `if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");`, `${RuntimeGlobals.shareScopeMap}[name] = shareScope;`, `return ${RuntimeGlobals.initializeSharing}(name, initScope);`