From: Daniel Genkin Date: Thu, 24 Jun 2021 15:39:04 +0000 (-0400) Subject: [WASM] Fix async/await in config loading (#54652) X-Git-Tag: submit/tizen/20210909.063632~604 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea1707cf3a4a513de37a41d89591cca88460e9fa;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [WASM] Fix async/await in config loading (#54652) * Fixed config issue * Updated Hot Reload test --- diff --git a/src/mono/sample/mbr/browser/runtime.js b/src/mono/sample/mbr/browser/runtime.js index 32918aa..7478117 100644 --- a/src/mono/sample/mbr/browser/runtime.js +++ b/src/mono/sample/mbr/browser/runtime.js @@ -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 diff --git a/src/mono/sample/wasm/browser-bench/runtime.js b/src/mono/sample/wasm/browser-bench/runtime.js index 60c383d..f9bdf8b 100644 --- a/src/mono/sample/wasm/browser-bench/runtime.js +++ b/src/mono/sample/wasm/browser-bench/runtime.js @@ -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 diff --git a/src/mono/sample/wasm/browser-profile/runtime.js b/src/mono/sample/wasm/browser-profile/runtime.js index 2c83ff5..f063698 100644 --- a/src/mono/sample/wasm/browser-profile/runtime.js +++ b/src/mono/sample/wasm/browser-profile/runtime.js @@ -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 diff --git a/src/mono/sample/wasm/browser/runtime.js b/src/mono/sample/wasm/browser/runtime.js index e97feef..816136a 100644 --- a/src/mono/sample/wasm/browser/runtime.js +++ b/src/mono/sample/wasm/browser/runtime.js @@ -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 diff --git a/src/mono/wasm/debugger/tests/debugger-test/runtime-debugger.js b/src/mono/wasm/debugger/tests/debugger-test/runtime-debugger.js index 360aa9b..8fb1e86 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/runtime-debugger.js +++ b/src/mono/wasm/debugger/tests/debugger-test/runtime-debugger.js @@ -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 diff --git a/src/mono/wasm/runtime-test.js b/src/mono/wasm/runtime-test.js index 8b3395f..89b9c5d 100644 --- a/src/mono/wasm/runtime-test.js +++ b/src/mono/wasm/runtime-test.js @@ -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) { diff --git a/src/mono/wasm/runtime/library_mono.js b/src/mono/wasm/runtime/library_mono.js index 84fb568..8f8d4cb 100644 --- a/src/mono/wasm/runtime/library_mono.js +++ b/src/mono/wasm/runtime/library_mono.js @@ -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); } diff --git a/src/tests/FunctionalTests/WebAssembly/Browser/AOT/runtime.js b/src/tests/FunctionalTests/WebAssembly/Browser/AOT/runtime.js index 65cba13..11f8d64 100644 --- a/src/tests/FunctionalTests/WebAssembly/Browser/AOT/runtime.js +++ b/src/tests/FunctionalTests/WebAssembly/Browser/AOT/runtime.js @@ -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 () { diff --git a/src/tests/FunctionalTests/WebAssembly/Browser/HotReload/runtime.js b/src/tests/FunctionalTests/WebAssembly/Browser/HotReload/runtime.js index 4859991..94f1a36 100644 --- a/src/tests/FunctionalTests/WebAssembly/Browser/HotReload/runtime.js +++ b/src/tests/FunctionalTests/WebAssembly/Browser/HotReload/runtime.js @@ -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 () { diff --git a/src/tests/FunctionalTests/WebAssembly/Browser/NormalInterp/runtime.js b/src/tests/FunctionalTests/WebAssembly/Browser/NormalInterp/runtime.js index 1a8abf5..b522747 100644 --- a/src/tests/FunctionalTests/WebAssembly/Browser/NormalInterp/runtime.js +++ b/src/tests/FunctionalTests/WebAssembly/Browser/NormalInterp/runtime.js @@ -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 () {