From 9165af61d7211a0b1dee256f6a79f36b072889d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Jul 2024 15:12:05 +0200 Subject: [PATCH 1/3] Remove check for browser agent --- src/mono/browser/runtime/lazyLoading.ts | 2 +- src/mono/browser/runtime/loader/assets.ts | 2 +- src/mono/browser/runtime/loader/config.ts | 9 --------- src/mono/browser/runtime/loader/globals.ts | 3 +-- src/mono/browser/runtime/startup.ts | 4 ++-- src/mono/browser/runtime/types/internal.ts | 1 - 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/mono/browser/runtime/lazyLoading.ts b/src/mono/browser/runtime/lazyLoading.ts index 9787c18ac33ec3..f8c1a968dbf481 100644 --- a/src/mono/browser/runtime/lazyLoading.ts +++ b/src/mono/browser/runtime/lazyLoading.ts @@ -53,7 +53,7 @@ export async function loadLazyAssembly (assemblyNameToLoad: string): Promise { const defaultConfigSrc = loaderHelpers.locateFile(module.configSrc!); diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts index 91e0a89f2c0f9e..12a731aee780db 100644 --- a/src/mono/browser/runtime/loader/globals.ts +++ b/src/mono/browser/runtime/loader/globals.ts @@ -15,7 +15,7 @@ import { assertIsControllablePromise, createPromiseController, getPromiseControl import { mono_download_assets, resolve_single_asset_path, retrieve_asset_download } from "./assets"; import { mono_log_error, set_thread_prefix, setup_proxy_console } from "./logging"; import { invokeLibraryInitializers } from "./libraryInitializers"; -import { deep_merge_config, isDebuggingSupported } from "./config"; +import { deep_merge_config } from "./config"; import { logDownloadStatsToConsole, purgeUnusedCacheEntriesAsync } from "./assetsCache"; // if we are the first script loaded in the web worker, we are expected to become the sidecar @@ -128,7 +128,6 @@ export function setLoaderGlobals ( retrieve_asset_download, invokeLibraryInitializers, - isDebuggingSupported, // from wasm-feature-detect npm package exceptions, diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 4d07e712358b08..249720a6b6a405 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -328,7 +328,7 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: () => void) runtimeList.registerRuntime(exportedRuntimeAPI); - if (!runtimeHelpers.mono_wasm_runtime_is_ready) mono_wasm_runtime_ready(); + if (loaderHelpers.config.debugLevel !== 0 && !runtimeHelpers.mono_wasm_runtime_is_ready) mono_wasm_runtime_ready(); if (loaderHelpers.config.debugLevel !== 0 && loaderHelpers.config.cacheBootResources) { loaderHelpers.logDownloadStatsToConsole(); @@ -600,7 +600,7 @@ export function mono_wasm_load_runtime (): void { debugLevel = 0 + debugLevel; } } - if (!loaderHelpers.isDebuggingSupported() || !runtimeHelpers.config.resources!.pdb) { + if (!runtimeHelpers.config.resources!.pdb) { debugLevel = 0; } cwraps.mono_wasm_load_runtime(debugLevel); diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts index 0627543d1fb12f..4ec8ced41c32ae 100644 --- a/src/mono/browser/runtime/types/internal.ts +++ b/src/mono/browser/runtime/types/internal.ts @@ -172,7 +172,6 @@ export type LoaderHelpers = { invokeLibraryInitializers: (functionName: string, args: any[]) => Promise, libraryInitializers?: { scriptName: string, exports: any }[]; - isDebuggingSupported(): boolean, isChromium: boolean, isFirefox: boolean From c51be7725925839b9b65c9c0e7c5508050561896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Mon, 29 Jul 2024 13:58:54 +0200 Subject: [PATCH 2/3] Feedback --- src/mono/browser/runtime/startup.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 249720a6b6a405..b29bbbecf2a8d6 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -328,7 +328,9 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: () => void) runtimeList.registerRuntime(exportedRuntimeAPI); - if (loaderHelpers.config.debugLevel !== 0 && !runtimeHelpers.mono_wasm_runtime_is_ready) mono_wasm_runtime_ready(); + if (loaderHelpers.config.debugLevel !== 0 && !runtimeHelpers.mono_wasm_runtime_is_ready) { + mono_wasm_runtime_ready(); + } if (loaderHelpers.config.debugLevel !== 0 && loaderHelpers.config.cacheBootResources) { loaderHelpers.logDownloadStatsToConsole(); @@ -600,9 +602,6 @@ export function mono_wasm_load_runtime (): void { debugLevel = 0 + debugLevel; } } - if (!runtimeHelpers.config.resources!.pdb) { - debugLevel = 0; - } cwraps.mono_wasm_load_runtime(debugLevel); endMeasure(mark, MeasuredBlock.loadRuntime); From c3a2a3bf33c3d36d0957849ab600181bd3d2c447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Mon, 5 Aug 2024 14:48:40 +0200 Subject: [PATCH 3/3] Fix test --- .../System/Runtime/InteropServices/JavaScript/JSImportTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs index f2d45a51123336..987bc6a2e7abba 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportTest.cs @@ -238,7 +238,7 @@ public unsafe void CreateFunctionString() [Fact] public unsafe void CreateFunctionInternal() { - Func internals = Utils.CreateFunctionBool("return INTERNAL.mono_wasm_runtime_is_ready"); + Func internals = Utils.CreateFunctionBool("return true"); Assert.True(internals()); }