[WASM] Fix async/await in config loading (#54652)
authorDaniel Genkin <genkind@gmail.com>
Thu, 24 Jun 2021 15:39:04 +0000 (11:39 -0400)
committerGitHub <noreply@github.com>
Thu, 24 Jun 2021 15:39:04 +0000 (10:39 -0500)
* Fixed config issue

* Updated Hot Reload test

src/mono/sample/mbr/browser/runtime.js
src/mono/sample/wasm/browser-bench/runtime.js
src/mono/sample/wasm/browser-profile/runtime.js
src/mono/sample/wasm/browser/runtime.js
src/mono/wasm/debugger/tests/debugger-test/runtime-debugger.js
src/mono/wasm/runtime-test.js
src/mono/wasm/runtime/library_mono.js
src/tests/FunctionalTests/WebAssembly/Browser/AOT/runtime.js
src/tests/FunctionalTests/WebAssembly/Browser/HotReload/runtime.js
src/tests/FunctionalTests/WebAssembly/Browser/NormalInterp/runtime.js

index 32918aa..7478117 100644 (file)
@@ -5,7 +5,7 @@ var Module = {
     config: null,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
     // Called when the runtime is initialized and wasm is ready
index 60c383d..f9bdf8b 100644 (file)
@@ -4,7 +4,7 @@ var Module = {
     config: null,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
     // Called when the runtime is initialized and wasm is ready
index 2c83ff5..f063698 100644 (file)
@@ -5,7 +5,7 @@ var Module = {
     config: null,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
     // Called when the runtime is initialized and wasm is ready
index e97feef..816136a 100644 (file)
@@ -6,7 +6,7 @@ var Module = {
     config: null,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
     // Called when the runtime is initialized and wasm is ready
index 360aa9b..8fb1e86 100644 (file)
@@ -5,7 +5,7 @@ var Module = {
     config: null,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
     // Called when the runtime is initialized and wasm is ready
index 8b3395f..89b9c5d 100644 (file)
@@ -211,7 +211,7 @@ var Module = {
        printErr,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
        onAbort: function(x) {
index 84fb568..8f8d4cb 100644 (file)
@@ -1451,9 +1451,9 @@ var MonoSupportLib = {
                                } else { // shell or worker
                                        config = JSON.parse(read(configFilePath)); // read is a v8 debugger command
                                }
-                               return config;
+                               Module.config = config;
                        } catch(e) {
-                               return {message: "failed to load config file", error: e};
+                               Module.config = {message: "failed to load config file", error: e};
                        } finally {
                                Module.removeRunDependency(configFilePath);
                        }
index 65cba13..11f8d64 100644 (file)
@@ -6,7 +6,7 @@ var Module = {
     config: null,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
     onRuntimeInitialized: function () {
index 4859991..94f1a36 100644 (file)
@@ -6,7 +6,7 @@ var Module = {
     config: null,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
     onRuntimeInitialized: function () {
index 1a8abf5..b522747 100644 (file)
@@ -6,7 +6,7 @@ var Module = {
     config: null,
 
     preInit: async function() {
-        Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
+        await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
     },
 
     onRuntimeInitialized: function () {