Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser] unhandled exceptions #100855

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mono/browser/runtime/invoke-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export function mono_wasm_invoke_jsimport_MT (signature: JSFunctionSignature, ar
}
}
return;
} catch (ex2: any) {
runtimeHelpers.nativeAbort(ex2);
} catch (ex: any) {
loaderHelpers.mono_exit(1, ex);
return;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/mono/browser/runtime/pthreads/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ export function exec_synchronization_context_pump (): void {
return;
}
forceThreadMemoryViewRefresh();
tcwraps.mono_wasm_synchronization_context_pump();
try {
tcwraps.mono_wasm_synchronization_context_pump();
} catch (ex) {
loaderHelpers.mono_exit(1, ex);
}
}

export function mono_wasm_schedule_synchronization_context (): void {
Expand Down
31 changes: 22 additions & 9 deletions src/mono/browser/runtime/scheduling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,28 @@ function prevent_timer_throttling_tick () {
if (!loaderHelpers.is_runtime_running()) {
return;
}
cwraps.mono_wasm_execute_timer();
pump_count++;
try {
cwraps.mono_wasm_execute_timer();
pump_count++;
} catch (ex) {
loaderHelpers.mono_exit(1, ex);
}
mono_background_exec_until_done();
}

function mono_background_exec_until_done () {
if (WasmEnableThreads) return;
Module.maybeExit();
if (!loaderHelpers.is_runtime_running()) {
return;
}
while (pump_count > 0) {
--pump_count;
cwraps.mono_background_exec();
try {
while (pump_count > 0) {
--pump_count;
if (!loaderHelpers.is_runtime_running()) {
return;
}
cwraps.mono_background_exec();
}
} catch (ex) {
loaderHelpers.mono_exit(1, ex);
}
}

Expand Down Expand Up @@ -78,5 +86,10 @@ function mono_wasm_schedule_timer_tick () {
return;
}
lastScheduledTimeoutId = undefined;
cwraps.mono_wasm_execute_timer();
try {
cwraps.mono_wasm_execute_timer();
pump_count++;
} catch (ex) {
loaderHelpers.mono_exit(1, ex);
}
}
Loading