From 74639e2eccec8cffbfaacc895598dd3caf35b95a Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Thu, 11 Apr 2024 23:05:13 +0200 Subject: [PATCH] minor stuff (#100933) --- .../JavaScript/WebWorkerTest.WebSocket.cs | 1 + src/libraries/tests.proj | 2 ++ src/mono/browser/runtime/assets.ts | 6 ++-- src/mono/browser/runtime/loader/exit.ts | 6 ++-- src/mono/browser/runtime/logging.ts | 30 +++++++++---------- src/mono/browser/runtime/runtime.c | 8 +++++ src/mono/browser/test-main.js | 2 +- 7 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.WebSocket.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.WebSocket.cs index 10153ee995ecc..096259d8a0bce 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.WebSocket.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.WebSocket.cs @@ -39,6 +39,7 @@ await executor.Execute(async () => [Theory, MemberData(nameof(GetTargetThreads2x))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/100931")] public async Task WebSocketClient_ResponseCloseInDifferentThread(Executor executor1, Executor executor2) { using var cts = CreateTestCaseTimeoutSource(); diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 2059501a33952..6406fca7b8cbf 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -398,6 +398,8 @@ + + diff --git a/src/mono/browser/runtime/assets.ts b/src/mono/browser/runtime/assets.ts index 318750ad67258..5c3f7ecce8822 100644 --- a/src/mono/browser/runtime/assets.ts +++ b/src/mono/browser/runtime/assets.ts @@ -44,13 +44,13 @@ export function instantiate_asset (asset: AssetEntry, url: string, bytes: Uint8A // FIXME const lastSlash = virtualName.lastIndexOf("/"); let parentDirectory = (lastSlash > 0) - ? virtualName.substr(0, lastSlash) + ? virtualName.substring(0, lastSlash) : null; let fileName = (lastSlash > 0) - ? virtualName.substr(lastSlash + 1) + ? virtualName.substring(lastSlash + 1) : virtualName; if (fileName.startsWith("/")) - fileName = fileName.substr(1); + fileName = fileName.substring(1); if (parentDirectory) { mono_log_debug(`Creating directory '${parentDirectory}'`); diff --git a/src/mono/browser/runtime/loader/exit.ts b/src/mono/browser/runtime/loader/exit.ts index cdea5d5997265..1fd1c960ae287 100644 --- a/src/mono/browser/runtime/loader/exit.ts +++ b/src/mono/browser/runtime/loader/exit.ts @@ -122,7 +122,7 @@ export function mono_exit (exit_code: number, reason?: any): void { } } } catch (err) { - mono_log_warn("mono_exit failed", err); + mono_log_warn("mono_exit A failed", err); // don't propagate any failures } @@ -132,7 +132,7 @@ export function mono_exit (exit_code: number, reason?: any): void { appendElementOnExit(exit_code); } } catch (err) { - mono_log_warn("mono_exit failed", err); + mono_log_warn("mono_exit B failed", err); // don't propagate any failures } @@ -177,7 +177,7 @@ function set_exit_code_and_quit_now (exit_code: number, reason?: any): void { runtimeHelpers.nativeExit(exit_code); } catch (error: any) { if (runtimeHelpers.ExitStatus && !(error instanceof runtimeHelpers.ExitStatus)) { - mono_log_warn("mono_wasm_exit failed: " + error.toString()); + mono_log_warn("set_exit_code_and_quit_now failed: " + error.toString()); } } } diff --git a/src/mono/browser/runtime/logging.ts b/src/mono/browser/runtime/logging.ts index 3558f24dc6c01..f6928320efba7 100644 --- a/src/mono/browser/runtime/logging.ts +++ b/src/mono/browser/runtime/logging.ts @@ -47,21 +47,6 @@ export const wasm_func_map = new Map(); let wasm_pending_symbol_table: string | undefined; const regexes: any[] = []; -// V8 -// at :wasm-function[1900]:0x83f63 -// at dlfree (:wasm-function[18739]:0x2328ef) -regexes.push(/at (?[^:()]+:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)((?![^)a-fA-F\d])|$)/); - -//# 5: WASM [009712b2], function #111 (''), pc=0x7c16595c973 (+0x53), pos=38740 (+11) -regexes.push(/(?:WASM \[[\da-zA-Z]+\], (?function #(?[\d]+) \(''\)))/); - -//# chrome -//# at http://127.0.0.1:63817/dotnet.wasm:wasm-function[8963]:0x1e23f4 -regexes.push(/(?[a-z]+:\/\/[^ )]*:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)/); - -//# .wasm-function[8962] -regexes.push(/(?<[^ >]+>[.:]wasm-function\[(?[0-9]+)\])/); - export function mono_wasm_symbolicate_string (message: string): string { try { performDeferredSymbolMapParsing(); @@ -186,6 +171,21 @@ function performDeferredSymbolMapParsing () { if (!wasm_pending_symbol_table) return; + // V8 + // at :wasm-function[1900]:0x83f63 + // at dlfree (:wasm-function[18739]:0x2328ef) + regexes.push(/at (?[^:()]+:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)((?![^)a-fA-F\d])|$)/); + + //# 5: WASM [009712b2], function #111 (''), pc=0x7c16595c973 (+0x53), pos=38740 (+11) + regexes.push(/(?:WASM \[[\da-zA-Z]+\], (?function #(?[\d]+) \(''\)))/); + + //# chrome + //# at http://127.0.0.1:63817/dotnet.wasm:wasm-function[8963]:0x1e23f4 + regexes.push(/(?[a-z]+:\/\/[^ )]*:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)/); + + //# .wasm-function[8962] + regexes.push(/(?<[^ >]+>[.:]wasm-function\[(?[0-9]+)\])/); + const text = wasm_pending_symbol_table!; wasm_pending_symbol_table = undefined; try { diff --git a/src/mono/browser/runtime/runtime.c b/src/mono/browser/runtime/runtime.c index 7dbdc02c25999..2132dd9906d59 100644 --- a/src/mono/browser/runtime/runtime.c +++ b/src/mono/browser/runtime/runtime.c @@ -229,6 +229,14 @@ static void *sysglobal_native_handle; static void* wasm_dl_load (const char *name, int flags, char **err, void *user_data) { +#if WASM_SUPPORTS_DLOPEN + if (!name) + return dlopen(NULL, flags); +#else + if (!name) + return NULL; +#endif + void* handle = wasm_dl_lookup_pinvoke_table (name); if (handle) return handle; diff --git a/src/mono/browser/test-main.js b/src/mono/browser/test-main.js index f34be2644aebe..90b332aa5218a 100644 --- a/src/mono/browser/test-main.js +++ b/src/mono/browser/test-main.js @@ -52,7 +52,7 @@ if (!ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WEB && typeof globalThis.crypto === } if (ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER) { - console.log("Running '" + globalThis.navigator.userAgent + "' at: " + globalThis.location.href); + console.log("Running '" + globalThis.navigator.userAgent + "' at: \n" + globalThis.location.href + "\n"); } let v8args;