Skip to content

Commit

Permalink
[browser] Remove check for user agent when attaching debugger (#105559)
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Aug 9, 2024
1 parent e4bef7c commit 7fa25e8
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public unsafe void CreateFunctionString()
[Fact]
public unsafe void CreateFunctionInternal()
{
Func<bool> internals = Utils.CreateFunctionBool("return INTERNAL.mono_wasm_runtime_is_ready");
Func<bool> internals = Utils.CreateFunctionBool("return true");
Assert.True(internals());
}

Expand Down
2 changes: 1 addition & 1 deletion src/mono/browser/runtime/lazyLoading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function loadLazyAssembly (assemblyNameToLoad: string): Promise<boo

let pdbNameToLoad = assemblyNameWithoutExtension + ".pdb";
let shouldLoadPdb = false;
if (loaderHelpers.config.debugLevel != 0 && loaderHelpers.isDebuggingSupported()) {
if (loaderHelpers.config.debugLevel != 0) {
shouldLoadPdb = Object.prototype.hasOwnProperty.call(lazyAssemblies, pdbNameToLoad);
if (loaderHelpers.config.resources!.fingerprinting) {
const map = loaderHelpers.config.resources!.fingerprinting;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/browser/runtime/loader/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export function prepareAssets () {
}


if (config.debugLevel != 0 && loaderHelpers.isDebuggingSupported()) {
if (config.debugLevel != 0) {
if (resources.corePdb) {
for (const name in resources.corePdb) {
addAsset({
Expand Down
9 changes: 0 additions & 9 deletions src/mono/browser/runtime/loader/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,6 @@ export async function mono_wasm_load_config (module: DotnetModuleInternal): Prom
}
}

export function isDebuggingSupported (): boolean {
// Copied from blazor MonoDebugger.ts/attachDebuggerHotkey
if (!globalThis.navigator) {
return false;
}

return loaderHelpers.isChromium || loaderHelpers.isFirefox;
}

async function loadBootConfig (module: DotnetModuleInternal): Promise<void> {
const defaultConfigSrc = loaderHelpers.locateFile(module.configSrc!);

Expand Down
3 changes: 1 addition & 2 deletions src/mono/browser/runtime/loader/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -128,7 +128,6 @@ export function setLoaderGlobals (

retrieve_asset_download,
invokeLibraryInitializers,
isDebuggingSupported,

// from wasm-feature-detect npm package
exceptions,
Expand Down
7 changes: 3 additions & 4 deletions src/mono/browser/runtime/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ 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();
Expand Down Expand Up @@ -600,9 +602,6 @@ export function mono_wasm_load_runtime (): void {
debugLevel = 0 + debugLevel;
}
}
if (!loaderHelpers.isDebuggingSupported() || !runtimeHelpers.config.resources!.pdb) {
debugLevel = 0;
}
cwraps.mono_wasm_load_runtime(debugLevel);
endMeasure(mark, MeasuredBlock.loadRuntime);

Expand Down
1 change: 0 additions & 1 deletion src/mono/browser/runtime/types/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ export type LoaderHelpers = {
invokeLibraryInitializers: (functionName: string, args: any[]) => Promise<void>,
libraryInitializers?: { scriptName: string, exports: any }[];

isDebuggingSupported(): boolean,
isChromium: boolean,
isFirefox: boolean

Expand Down

0 comments on commit 7fa25e8

Please sign in to comment.