diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props index 9b479dcbe19c17..2841f25c3f3bdc 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props @@ -221,6 +221,8 @@ + + diff --git a/src/libraries/Common/src/Interop/Browser/Interop.Runtime.cs b/src/libraries/Common/src/Interop/Browser/Interop.Runtime.cs index 051b412b1199d5..ac3f3d04affd15 100644 --- a/src/libraries/Common/src/Interop/Browser/Interop.Runtime.cs +++ b/src/libraries/Common/src/Interop/Browser/Interop.Runtime.cs @@ -98,7 +98,7 @@ public static void StopProfile() { } - // Called by the AOT profiler to save profile data into INTERNAL.aot_profile_data + // Called by the AOT profiler to save profile data into Module.INTERNAL.aot_profile_data [MethodImplAttribute(MethodImplOptions.NoInlining)] public static unsafe void DumpAotProfileData(ref byte buf, int len, string extraArg) { diff --git a/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/MarshalTests.cs b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/MarshalTests.cs index 101ce90eaa272e..8f39ece22e515d 100644 --- a/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/MarshalTests.cs +++ b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/MarshalTests.cs @@ -283,7 +283,7 @@ public static void BindStaticMethod() { HelperMarshal._intValue = 0; Runtime.InvokeJS(@$" - var invoke_int = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); + var invoke_int = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); invoke_int (200); "); @@ -295,7 +295,7 @@ public static void BindIntPtrStaticMethod() { HelperMarshal._intPtrValue = IntPtr.Zero; Runtime.InvokeJS(@$" - var invoke_int_ptr = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeIntPtr""); + var invoke_int_ptr = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeIntPtr""); invoke_int_ptr (42); "); Assert.Equal(42, (int)HelperMarshal._intPtrValue); @@ -306,7 +306,7 @@ public static void MarshalIntPtrToJS() { HelperMarshal._marshaledIntPtrValue = IntPtr.Zero; Runtime.InvokeJS(@$" - var invokeMarshalIntPtr = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeMarshalIntPtr""); + var invokeMarshalIntPtr = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeMarshalIntPtr""); var r = invokeMarshalIntPtr (); if (r != 42) throw `Invalid int_ptr value`; @@ -319,7 +319,7 @@ public static void InvokeStaticMethod() { HelperMarshal._intValue = 0; Runtime.InvokeJS(@$" - INTERNAL.call_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt"", [ 300 ]); + Module.INTERNAL.call_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt"", [ 300 ]); "); Assert.Equal(300, HelperMarshal._intValue); @@ -330,7 +330,7 @@ public static void ResolveMethod() { HelperMarshal._intValue = 0; Runtime.InvokeJS(@$" - var invoke_int = INTERNAL.mono_method_resolve (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); + var invoke_int = Module.INTERNAL.mono_method_resolve (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); App.call_test_method (""InvokeInt"", [ invoke_int ]); "); @@ -629,7 +629,7 @@ public static void BoundStaticMethodMissingArgs() HelperMarshal._intValue = 1; Runtime.InvokeJS(@$" - var invoke_int = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); + var invoke_int = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); invoke_int (); "); Assert.Equal(0, HelperMarshal._intValue); @@ -640,7 +640,7 @@ public static void BoundStaticMethodExtraArgs() { HelperMarshal._intValue = 0; Runtime.InvokeJS(@$" - var invoke_int = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); + var invoke_int = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); invoke_int (200, 400); "); Assert.Equal(200, HelperMarshal._intValue); @@ -654,13 +654,13 @@ public static void BoundStaticMethodArgumentTypeCoercion() HelperMarshal._intValue = 0; Runtime.InvokeJS(@$" - var invoke_int = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); + var invoke_int = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); invoke_int (""200""); "); Assert.Equal(200, HelperMarshal._intValue); Runtime.InvokeJS(@$" - var invoke_int = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); + var invoke_int = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); invoke_int (400.5); "); Assert.Equal(400, HelperMarshal._intValue); @@ -671,14 +671,14 @@ public static void BoundStaticMethodUnpleasantArgumentTypeCoercion() { HelperMarshal._intValue = 100; Runtime.InvokeJS(@$" - var invoke_int = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); + var invoke_int = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); invoke_int (""hello""); "); Assert.Equal(0, HelperMarshal._intValue); // In this case at the very least, the leading "7" is not turned into the number 7 Runtime.InvokeJS(@$" - var invoke_int = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); + var invoke_int = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeInt""); invoke_int (""7apples""); "); Assert.Equal(0, HelperMarshal._intValue); @@ -689,7 +689,7 @@ public static void PassUintArgument() { HelperMarshal._uintValue = 0; Runtime.InvokeJS(@$" - var invoke_uint = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeUInt""); + var invoke_uint = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeUInt""); invoke_uint (0xFFFFFFFE); "); @@ -702,9 +702,9 @@ public static void ReturnUintEnum () HelperMarshal._uintValue = 0; HelperMarshal._enumValue = TestEnum.BigValue; Runtime.InvokeJS(@$" - var get_value = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}GetEnumValue""); + var get_value = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}GetEnumValue""); var e = get_value (); - var invoke_uint = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeUInt""); + var invoke_uint = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}InvokeUInt""); invoke_uint (e); "); Assert.Equal((uint)TestEnum.BigValue, HelperMarshal._uintValue); @@ -715,7 +715,7 @@ public static void PassUintEnumByValue () { HelperMarshal._enumValue = TestEnum.Zero; Runtime.InvokeJS(@$" - var set_enum = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}SetEnumValue"", ""j""); + var set_enum = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}SetEnumValue"", ""j""); set_enum (0xFFFFFFFE); "); Assert.Equal(TestEnum.BigValue, HelperMarshal._enumValue); @@ -728,7 +728,7 @@ public static void PassUintEnumByValueMasqueradingAsInt () // HACK: We're explicitly telling the bindings layer to pass an int here, not an enum // Because we know the enum is : uint, this is compatible, so it works. Runtime.InvokeJS(@$" - var set_enum = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}SetEnumValue"", ""i""); + var set_enum = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}SetEnumValue"", ""i""); set_enum (0xFFFFFFFE); "); Assert.Equal(TestEnum.BigValue, HelperMarshal._enumValue); @@ -740,7 +740,7 @@ public static void PassUintEnumByNameIsNotImplemented () HelperMarshal._enumValue = TestEnum.Zero; var exc = Assert.Throws( () => Runtime.InvokeJS(@$" - var set_enum = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}SetEnumValue"", ""j""); + var set_enum = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}SetEnumValue"", ""j""); set_enum (""BigValue""); ") ); @@ -752,7 +752,7 @@ public static void CannotUnboxUint64 () { var exc = Assert.Throws( () => Runtime.InvokeJS(@$" - var get_u64 = INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}GetUInt64"", """"); + var get_u64 = Module.INTERNAL.mono_bind_static_method (""{HelperMarshal.INTEROP_CLASS}GetUInt64"", """"); var u64 = get_u64(); ") ); @@ -806,7 +806,7 @@ public static void ManuallyInternString() { HelperMarshal._stringResource = HelperMarshal._stringResource2 = null; Runtime.InvokeJS(@" - var sym = INTERNAL.mono_intern_string(""interned string 3""); + var sym = Module.INTERNAL.mono_intern_string(""interned string 3""); App.call_test_method (""InvokeString"", [ sym ], ""s""); App.call_test_method (""InvokeString2"", [ sym ], ""s""); "); @@ -823,7 +823,7 @@ public static void LargeStringsAreNotAutomaticallyLocatedInInternTable() var s = ""long interned string""; for (var i = 0; i < 1024; i++) s += String(i % 10); - var sym = INTERNAL.mono_intern_string(s); + var sym = Module.INTERNAL.mono_intern_string(s); App.call_test_method (""InvokeString"", [ sym ], ""S""); App.call_test_method (""InvokeString2"", [ sym ], ""s""); "); @@ -837,7 +837,7 @@ public static void CanInternVeryManyStrings() HelperMarshal._stringResource = null; Runtime.InvokeJS(@" for (var i = 0; i < 10240; i++) - INTERNAL.mono_intern_string('s' + i); + Module.INTERNAL.mono_intern_string('s' + i); App.call_test_method (""InvokeString"", [ 's5000' ], ""S""); "); Assert.Equal("s5000", HelperMarshal._stringResource); @@ -864,8 +864,8 @@ public static void InternedStringReturnValuesWork() HelperMarshal._stringResource = HelperMarshal._stringResource2 = null; var fqn = "[System.Private.Runtime.InteropServices.JavaScript.Tests]System.Runtime.InteropServices.JavaScript.Tests.HelperMarshal:StoreArgumentAndReturnLiteral"; Runtime.InvokeJS( - $"var a = INTERNAL.mono_bind_static_method('{fqn}')('test');\r\n" + - $"var b = INTERNAL.mono_bind_static_method('{fqn}')(a);\r\n" + + $"var a = Module.INTERNAL.mono_bind_static_method('{fqn}')('test');\r\n" + + $"var b = Module.INTERNAL.mono_bind_static_method('{fqn}')(a);\r\n" + "App.call_test_method ('InvokeString2', [ b ]);" ); Assert.Equal("s: 1 length: 1", HelperMarshal._stringResource); diff --git a/src/mono/sample/mbr/browser/index.html b/src/mono/sample/mbr/browser/index.html index 6122370dd9d650..c461acc317c37f 100644 --- a/src/mono/sample/mbr/browser/index.html +++ b/src/mono/sample/mbr/browser/index.html @@ -2,37 +2,40 @@ - - TESTS - - - - - - Result from Sample.Test.TestMeaning: -
- Click here (upto 2 times): -
- - - + + TESTS + + + + + + Result from Sample.Test.TestMeaning: +
+ Click here (upto 2 times): +
+ + - - + + + + + + \ No newline at end of file diff --git a/src/mono/sample/mbr/browser/runtime.js b/src/mono/sample/mbr/browser/runtime.js index 0252041eff5acf..42e3077b034b16 100644 --- a/src/mono/sample/mbr/browser/runtime.js +++ b/src/mono/sample/mbr/browser/runtime.js @@ -3,29 +3,30 @@ "use strict"; var Module = { + no_global_exports: true, config: null, preInit: async function () { - await MONO.mono_wasm_load_config("./mono-config.json"); // sets MONO.config implicitly + await Module.MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.MONO.config implicitly }, // Called when the runtime is initialized and wasm is ready onRuntimeInitialized: function () { - if (!MONO.config || MONO.config.error) { + if (!Module.MONO.config || Module.MONO.config.error) { console.log("An error occured while loading the config file"); return; } - MONO.config.loaded_cb = function () { + Module.MONO.config.loaded_cb = function () { App.init(); }; - MONO.config.environment_variables = { + Module.MONO.config.environment_variables = { "DOTNET_MODIFIABLE_ASSEMBLIES": "debug" }; - MONO.config.fetch_file_cb = function (asset) { + Module.MONO.config.fetch_file_cb = function (asset) { return fetch(asset, { credentials: 'same-origin' }); } - MONO.mono_load_runtime_and_bcl_args(MONO.config); + Module.MONO.mono_load_runtime_and_bcl_args(Module.MONO.config); }, }; diff --git a/src/mono/sample/wasm/browser-bench/index.html b/src/mono/sample/wasm/browser-bench/index.html index 136e400e70c2ae..2c16b33dd2d279 100644 --- a/src/mono/sample/wasm/browser-bench/index.html +++ b/src/mono/sample/wasm/browser-bench/index.html @@ -2,64 +2,66 @@ - - TESTS - - - - - - Output:

- - + }); + } + + var App = { + init: function () { + if (tasks != '') + Module.INTERNAL.call_static_method("[Wasm.Browser.Bench.Sample] Sample.Test:SetTasks", tasks); + yieldBench(); + } + }; + + + + - + - - + \ No newline at end of file diff --git a/src/mono/sample/wasm/browser-bench/runtime.js b/src/mono/sample/wasm/browser-bench/runtime.js index 2d934c659ea135..0fb7223f3001aa 100644 --- a/src/mono/sample/wasm/browser-bench/runtime.js +++ b/src/mono/sample/wasm/browser-bench/runtime.js @@ -3,20 +3,21 @@ "use strict"; var Module = { + no_global_exports: true, config: null, preInit: async function () { - await MONO.mono_wasm_load_config("./mono-config.json"); // sets MONO.config implicitly + await Module.MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.MONO.config implicitly }, // Called when the runtime is initialized and wasm is ready onRuntimeInitialized: function () { - if (!MONO.config || MONO.config.error) { + if (!Module.MONO.config || Module.MONO.config.error) { console.log("An error occured while loading the config file"); return; } - MONO.config.loaded_cb = function () { + Module.MONO.config.loaded_cb = function () { try { App.init(); } catch (error) { @@ -24,19 +25,19 @@ var Module = { throw (error); } }; - MONO.config.fetch_file_cb = function (asset) { + Module.MONO.config.fetch_file_cb = function (asset) { return fetch(asset, { credentials: 'same-origin' }); } - if (MONO.config.enable_profiler) { - MONO.config.aot_profiler_options = { + if (Module.MONO.config.enable_profiler) { + Module.MONO.config.aot_profiler_options = { write_at: "Sample.Test::StopProfile", send_to: "System.Runtime.InteropServices.JavaScript.Runtime::DumpAotProfileData" } } try { - MONO.mono_load_runtime_and_bcl_args(MONO.config); + Module.MONO.mono_load_runtime_and_bcl_args(Module.MONO.config); } catch (error) { test_exit(1); throw (error); diff --git a/src/mono/sample/wasm/browser-profile/runtime.js b/src/mono/sample/wasm/browser-profile/runtime.js index 69b84d002bb8d4..93074e3b3b169c 100644 --- a/src/mono/sample/wasm/browser-profile/runtime.js +++ b/src/mono/sample/wasm/browser-profile/runtime.js @@ -3,21 +3,22 @@ "use strict"; var Module = { + no_global_exports: true, is_testing: false, config: null, preInit: async function () { - await MONO.mono_wasm_load_config("./mono-config.json"); // sets MONO.config implicitly + await Module.MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.MONO.config implicitly }, // Called when the runtime is initialized and wasm is ready onRuntimeInitialized: function () { - if (!MONO.config || MONO.config.error) { + if (!Module.MONO.config || Module.MONO.config.error) { console.log("An error occured while loading the config file"); return; } - MONO.config.loaded_cb = function () { + Module.MONO.config.loaded_cb = function () { try { Module.init(); } catch (error) { @@ -25,19 +26,19 @@ var Module = { throw (error); } }; - MONO.config.fetch_file_cb = function (asset) { + Module.MONO.config.fetch_file_cb = function (asset) { return fetch(asset, { credentials: 'same-origin' }); } - if (MONO.config.enable_profiler) { - MONO.config.aot_profiler_options = { + if (Module.MONO.config.enable_profiler) { + Module.MONO.config.aot_profiler_options = { write_at: "Sample.Test::StopProfile", send_to: "System.Runtime.InteropServices.JavaScript.Runtime::DumpAotProfileData" } } try { - MONO.mono_load_runtime_and_bcl_args(MONO.config); + Module.MONO.mono_load_runtime_and_bcl_args(Module.MONO.config); } catch (error) { Module.test_exit(1); throw (error); @@ -46,7 +47,7 @@ var Module = { init: function () { console.log("not ready yet") - const ret = INTERNAL.call_static_method("[Wasm.BrowserProfile.Sample] Sample.Test:TestMeaning", []); + const ret = Module.INTERNAL.call_static_method("[Wasm.BrowserProfile.Sample] Sample.Test:TestMeaning", []); document.getElementById("out").innerHTML = ret; console.log("ready"); @@ -56,8 +57,8 @@ var Module = { Module.test_exit(exit_code); } - if (MONO.config.enable_profiler) { - INTERNAL.call_static_method("[Wasm.BrowserProfile.Sample] Sample.Test:StopProfile", []); + if (Module.MONO.config.enable_profiler) { + Module.INTERNAL.call_static_method("[Wasm.BrowserProfile.Sample] Sample.Test:StopProfile", []); Module.saveProfile(); } }, @@ -85,7 +86,7 @@ var Module = { saveProfile: function () { const a = document.createElement('a'); - const blob = new Blob([INTERNAL.aot_profile_data]); + const blob = new Blob([Module.INTERNAL.aot_profile_data]); a.href = URL.createObjectURL(blob); a.download = "data.aotprofile"; // Append anchor to body. diff --git a/src/mono/sample/wasm/browser/index.html b/src/mono/sample/wasm/browser/index.html index cedcae5715afb0..1a516b29d4c35b 100644 --- a/src/mono/sample/wasm/browser/index.html +++ b/src/mono/sample/wasm/browser/index.html @@ -36,7 +36,7 @@ var App = { init: function () { - var ret = INTERNAL.call_static_method("[Wasm.Browser.Sample] Sample.Test:TestMeaning", []); + var ret = Module.INTERNAL.call_static_method("[Wasm.Browser.Sample] Sample.Test:TestMeaning", []); document.getElementById("out").innerHTML = ret; if (is_testing) diff --git a/src/mono/sample/wasm/browser/runtime.js b/src/mono/sample/wasm/browser/runtime.js index 8b14c3637e6b4f..6c00b21e11aa3a 100644 --- a/src/mono/sample/wasm/browser/runtime.js +++ b/src/mono/sample/wasm/browser/runtime.js @@ -3,21 +3,21 @@ "use strict"; var Module = { - + no_global_exports: true, config: null, preInit: async function () { - await MONO.mono_wasm_load_config("./mono-config.json"); // sets MONO.config implicitly + await Module.MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.MONO.config implicitly }, // Called when the runtime is initialized and wasm is ready onRuntimeInitialized: function () { - if (!MONO.config || MONO.config.error) { + if (!Module.MONO.config || Module.MONO.config.error) { console.log("No config found"); return; } - MONO.config.loaded_cb = function () { + Module.MONO.config.loaded_cb = function () { try { App.init(); } catch (error) { @@ -25,12 +25,12 @@ var Module = { throw (error); } }; - MONO.config.fetch_file_cb = function (asset) { + Module.MONO.config.fetch_file_cb = function (asset) { return fetch(asset, { credentials: 'same-origin' }); } try { - MONO.mono_load_runtime_and_bcl_args(MONO.config); + Module.MONO.mono_load_runtime_and_bcl_args(Module.MONO.config); } catch (error) { test_exit(1); throw (error); diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 69facc5d7204a3..10709c8151c296 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -221,8 +221,10 @@ <_WasmRuntimePackSrcFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" /> - <_DotnetJSSrcFile Include="$(_WasmRuntimePackSrcDir)\*.js" Exclude="$(_WasmRuntimePackSrcDir)\*.iffe.js"/> + <_DotnetJSSrcFile Include="$(_WasmRuntimePackSrcDir)\*.js" Exclude="$(_WasmRuntimePackSrcDir)\*.iffe.js;$(_WasmRuntimePackSrcDir)\*.pre.js;$(_WasmRuntimePackSrcDir)\*.post.js"/> + <_WasmExtraJSFile Include="$(_WasmRuntimePackSrcDir)\*.pre.js" Kind="pre-js" /> <_WasmExtraJSFile Include="$(_WasmRuntimePackSrcDir)\*.iffe.js" Kind="pre-js" /> + <_WasmExtraJSFile Include="$(_WasmRuntimePackSrcDir)\*.post.js" Kind="post-js" /> <_WasmNativeFileForLinking Include="@(NativeFileReference)" /> diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs b/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs index 97acfe9517d4ee..2d5102b9f6edeb 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs @@ -172,31 +172,31 @@ internal class MonoCommands public MonoCommands(string expression) => this.expression = expression; - public static MonoCommands GetDebuggerAgentBufferReceived() => new MonoCommands("INTERNAL.mono_wasm_get_dbg_command_info()"); + public static MonoCommands GetDebuggerAgentBufferReceived() => new MonoCommands("Module.INTERNAL.mono_wasm_get_dbg_command_info()"); - public static MonoCommands IsRuntimeReady() => new MonoCommands("INTERNAL.mono_wasm_runtime_is_ready"); + public static MonoCommands IsRuntimeReady() => new MonoCommands("Module.INTERNAL.mono_wasm_runtime_is_ready"); - public static MonoCommands GetLoadedFiles() => new MonoCommands("INTERNAL.mono_wasm_get_loaded_files()"); + public static MonoCommands GetLoadedFiles() => new MonoCommands("Module.INTERNAL.mono_wasm_get_loaded_files()"); public static MonoCommands SendDebuggerAgentCommand(int id, int command_set, int command, string command_parameters) { - return new MonoCommands($"INTERNAL.mono_wasm_send_dbg_command ({id}, {command_set}, {command},'{command_parameters}')"); + return new MonoCommands($"Module.INTERNAL.mono_wasm_send_dbg_command ({id}, {command_set}, {command},'{command_parameters}')"); } public static MonoCommands SendDebuggerAgentCommandWithParms(int id, int command_set, int command, string command_parameters, int len, int type, string parm) { - return new MonoCommands($"INTERNAL.mono_wasm_send_dbg_command_with_parms ({id}, {command_set}, {command},'{command_parameters}', {len}, {type}, '{parm}')"); + return new MonoCommands($"Module.INTERNAL.mono_wasm_send_dbg_command_with_parms ({id}, {command_set}, {command},'{command_parameters}', {len}, {type}, '{parm}')"); } - public static MonoCommands CallFunctionOn(JToken args) => new MonoCommands($"INTERNAL.mono_wasm_call_function_on ({args})"); + public static MonoCommands CallFunctionOn(JToken args) => new MonoCommands($"Module.INTERNAL.mono_wasm_call_function_on ({args})"); - public static MonoCommands GetDetails(int objectId, JToken args = null) => new MonoCommands($"INTERNAL.mono_wasm_get_details ({objectId}, {(args ?? "{ }")})"); + public static MonoCommands GetDetails(int objectId, JToken args = null) => new MonoCommands($"Module.INTERNAL.mono_wasm_get_details ({objectId}, {(args ?? "{ }")})"); - public static MonoCommands Resume() => new MonoCommands($"INTERNAL.mono_wasm_debugger_resume ()"); + public static MonoCommands Resume() => new MonoCommands($"Module.INTERNAL.mono_wasm_debugger_resume ()"); - public static MonoCommands DetachDebugger() => new MonoCommands($"INTERNAL.mono_wasm_detach_debugger()"); + public static MonoCommands DetachDebugger() => new MonoCommands($"Module.INTERNAL.mono_wasm_detach_debugger()"); - public static MonoCommands ReleaseObject(DotnetObjectId objectId) => new MonoCommands($"INTERNAL.mono_wasm_release_object('{objectId}')"); + public static MonoCommands ReleaseObject(DotnetObjectId objectId) => new MonoCommands($"Module.INTERNAL.mono_wasm_release_object('{objectId}')"); } internal enum MonoErrorCodes diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs index dd807d0bfaf54e..8b21e64c630192 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs @@ -36,7 +36,7 @@ public async Task CreateJSBreakpoint() { // Test that js breakpoints get set correctly // 13 24 - // 13 33 + // 13 40 var bp1_res = await SetBreakpoint("/debugger-driver.html", 13, 24); Assert.EndsWith("debugger-driver.html", bp1_res.Value["breakpointId"].ToString()); @@ -48,7 +48,7 @@ public async Task CreateJSBreakpoint() Assert.Equal(13, loc["lineNumber"]); Assert.Equal(24, loc["columnNumber"]); - var bp2_res = await SetBreakpoint("/debugger-driver.html", 13, 33); + var bp2_res = await SetBreakpoint("/debugger-driver.html", 13, 40); Assert.EndsWith("debugger-driver.html", bp2_res.Value["breakpointId"].ToString()); Assert.Equal(1, bp2_res.Value["locations"]?.Value()?.Count); @@ -57,14 +57,14 @@ public async Task CreateJSBreakpoint() Assert.NotNull(loc2["scriptId"]); Assert.Equal(13, loc2["lineNumber"]); - Assert.Equal(33, loc2["columnNumber"]); + Assert.Equal(40, loc2["columnNumber"]); } [Fact] public async Task CreateJS0Breakpoint() { // 13 24 - // 13 33 + // 13 40 var bp1_res = await SetBreakpoint("/debugger-driver.html", 13, 0); Assert.EndsWith("debugger-driver.html", bp1_res.Value["breakpointId"].ToString()); @@ -76,7 +76,7 @@ public async Task CreateJS0Breakpoint() Assert.Equal(13, loc["lineNumber"]); Assert.Equal(24, loc["columnNumber"]); - var bp2_res = await SetBreakpoint("/debugger-driver.html", 13, 33); + var bp2_res = await SetBreakpoint("/debugger-driver.html", 13, 40); Assert.EndsWith("debugger-driver.html", bp2_res.Value["breakpointId"].ToString()); Assert.Equal(1, bp2_res.Value["locations"]?.Value()?.Count); @@ -85,7 +85,7 @@ public async Task CreateJS0Breakpoint() Assert.NotNull(loc2["scriptId"]); Assert.Equal(13, loc2["lineNumber"]); - Assert.Equal(33, loc2["columnNumber"]); + Assert.Equal(40, loc2["columnNumber"]); } [Theory] diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/MonoJsTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/MonoJsTests.cs index 38742d8d363304..7d9a2fe7f35a4d 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/MonoJsTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/MonoJsTests.cs @@ -18,12 +18,12 @@ public async Task BadRaiseDebugEventsTest() { var bad_expressions = new[] { - "INTERNAL.mono_wasm_raise_debug_event('')", - "INTERNAL.mono_wasm_raise_debug_event(undefined)", - "INTERNAL.mono_wasm_raise_debug_event({})", + "Module.INTERNAL.mono_wasm_raise_debug_event('')", + "Module.INTERNAL.mono_wasm_raise_debug_event(undefined)", + "Module.INTERNAL.mono_wasm_raise_debug_event({})", - "INTERNAL.mono_wasm_raise_debug_event({eventName:'foo'}, '')", - "INTERNAL.mono_wasm_raise_debug_event({eventName:'foo'}, 12)" + "Module.INTERNAL.mono_wasm_raise_debug_event({eventName:'foo'}, '')", + "Module.INTERNAL.mono_wasm_raise_debug_event({eventName:'foo'}, 12)" }; foreach (var expression in bad_expressions) @@ -58,7 +58,7 @@ public async Task RaiseDebugEventTraceTest(bool? trace) }); var trace_str = trace.HasValue ? $"trace: {trace.ToString().ToLower()}" : String.Empty; - var expression = $"INTERNAL.mono_wasm_raise_debug_event({{ eventName:'qwe' }}, {{ {trace_str} }})"; + var expression = $"Module.INTERNAL.mono_wasm_raise_debug_event({{ eventName:'qwe' }}, {{ {trace_str} }})"; var res = await cli.SendCommand($"Runtime.evaluate", JObject.FromObject(new { expression }), token); Assert.True(res.IsOk, $"Expected to pass for {expression}"); @@ -139,7 +139,7 @@ async Task AssemblyLoadedEventTest(string asm_name, string asm_path, string pdb_ pdb_base64 = Convert.ToBase64String(bytes); } - var expression = $@"INTERNAL.mono_wasm_raise_debug_event({{ + var expression = $@"Module.INTERNAL.mono_wasm_raise_debug_event({{ eventName: 'AssemblyLoaded', assembly_name: '{asm_name}', assembly_b64: '{asm_base64}', diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-driver.html b/src/mono/wasm/debugger/tests/debugger-test/debugger-driver.html index 07b06b95fe9e85..6adf90e2790cd3 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-driver.html +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-driver.html @@ -6,14 +6,14 @@