Skip to content

Commit

Permalink
only trigger compatibility mode when usage and configuration are glob…
Browse files Browse the repository at this point in the history
…al (dotnet#62488)
  • Loading branch information
pavelsavara committed Dec 7, 2021
1 parent 6cf785d commit 8369363
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/mono/wasm/runtime/cjs/dotnet.cjs.extpost.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

if (typeof globalThis.Module === "object") {
// if loaded into global namespace and configured with global Module, we will self start in compatibility mode
let ENVIRONMENT_IS_GLOBAL = typeof globalThis.Module === "object" && globalThis.__dotnet_runtime === __dotnet_runtime;
if (ENVIRONMENT_IS_GLOBAL) {
createDotnetRuntime(() => { return globalThis.Module; }).then((exports) => exports);
}
1 change: 0 additions & 1 deletion src/mono/wasm/runtime/cjs/dotnet.cjs.pre.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const MONO = {}, BINDING = {}, INTERNAL = {};
let ENVIRONMENT_IS_GLOBAL = typeof globalThis.Module === "object";
if (ENVIRONMENT_IS_GLOBAL) {
if (globalThis.Module.ready) {
throw new Error("MONO_WASM: Module.ready couldn't be redefined.")
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/runtime/es6/dotnet.es6.lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const DotnetSupportLib = {
$DOTNET__postset: `
let __dotnet_replacements = {scriptDirectory, readAsync, fetch: globalThis.fetch};
let __dotnet_exportedAPI = __dotnet_runtime.__initializeImportsAndExports(
{ isGlobal:ENVIRONMENT_IS_GLOBAL, isNode:ENVIRONMENT_IS_NODE, isShell:ENVIRONMENT_IS_SHELL, isWeb:ENVIRONMENT_IS_WEB, locateFile },
{ isGlobal:false, isNode:ENVIRONMENT_IS_NODE, isShell:ENVIRONMENT_IS_SHELL, isWeb:ENVIRONMENT_IS_WEB, locateFile },
{ mono:MONO, binding:BINDING, internal:INTERNAL, module:Module },
__dotnet_replacements);
Expand Down

0 comments on commit 8369363

Please sign in to comment.