Skip to content

Commit ea1707c

Browse files
[WASM] Fix async/await in config loading (#54652)
* Fixed config issue * Updated Hot Reload test
1 parent 74322d7 commit ea1707c

File tree

10 files changed

+11
-11
lines changed

10 files changed

+11
-11
lines changed

src/mono/sample/mbr/browser/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var Module = {
55
config: null,
66

77
preInit: async function() {
8-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
8+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
99
},
1010

1111
// Called when the runtime is initialized and wasm is ready

src/mono/sample/wasm/browser-bench/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var Module = {
44
config: null,
55

66
preInit: async function() {
7-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
7+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
88
},
99

1010
// Called when the runtime is initialized and wasm is ready

src/mono/sample/wasm/browser-profile/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var Module = {
55
config: null,
66

77
preInit: async function() {
8-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
8+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
99
},
1010

1111
// Called when the runtime is initialized and wasm is ready

src/mono/sample/wasm/browser/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var Module = {
66
config: null,
77

88
preInit: async function() {
9-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
9+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
1010
},
1111

1212
// Called when the runtime is initialized and wasm is ready

src/mono/wasm/debugger/tests/debugger-test/runtime-debugger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var Module = {
55
config: null,
66

77
preInit: async function() {
8-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
8+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
99
},
1010

1111
// Called when the runtime is initialized and wasm is ready

src/mono/wasm/runtime-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ var Module = {
211211
printErr,
212212

213213
preInit: async function() {
214-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
214+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
215215
},
216216

217217
onAbort: function(x) {

src/mono/wasm/runtime/library_mono.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,9 +1451,9 @@ var MonoSupportLib = {
14511451
} else { // shell or worker
14521452
config = JSON.parse(read(configFilePath)); // read is a v8 debugger command
14531453
}
1454-
return config;
1454+
Module.config = config;
14551455
} catch(e) {
1456-
return {message: "failed to load config file", error: e};
1456+
Module.config = {message: "failed to load config file", error: e};
14571457
} finally {
14581458
Module.removeRunDependency(configFilePath);
14591459
}

src/tests/FunctionalTests/WebAssembly/Browser/AOT/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var Module = {
66
config: null,
77

88
preInit: async function() {
9-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
9+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
1010
},
1111

1212
onRuntimeInitialized: function () {

src/tests/FunctionalTests/WebAssembly/Browser/HotReload/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var Module = {
66
config: null,
77

88
preInit: async function() {
9-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
9+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
1010
},
1111

1212
onRuntimeInitialized: function () {

src/tests/FunctionalTests/WebAssembly/Browser/NormalInterp/runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var Module = {
66
config: null,
77

88
preInit: async function() {
9-
Module.config = await MONO.mono_wasm_load_config("./mono-config.json");
9+
await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly
1010
},
1111

1212
onRuntimeInitialized: function () {

0 commit comments

Comments
 (0)