Skip to content

Commit fdaffaf

Browse files
committed
fix(runtime): Correctly retrieve discarded exceptions flag
The value is wrongly read as `false` when the current thread doesn't have a `TNSRuntime` object associated with it. Instead of calling `[TNSRuntime current]` use `[TNSRuntime runtimeForVM:]` which will correctly find the object that matches the current execution state.
1 parent d0040e0 commit fdaffaf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/NativeScript/JSErrors.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void reportErrorIfAny(JSC::ExecState* execState, JSC::CatchScope& scope) {
9696
|| globalObject->isUIApplicationMainAtTopOfCallstack();
9797

9898
if (treatExceptionsAsUncaught) {
99-
id discardExceptionsValue = [[TNSRuntime current] appPackageJson][@"discardUncaughtJsExceptions"];
99+
id discardExceptionsValue = [[TNSRuntime runtimeForVM:&execState->vm()] appPackageJson][@"discardUncaughtJsExceptions"];
100100
bool discardExceptions = [discardExceptionsValue boolValue];
101101
scope.clearException();
102102
if (discardExceptions) {
@@ -181,8 +181,8 @@ void reportFatalErrorBeforeShutdown(ExecState* execState, Exception* exception,
181181
CFRunLoopRunInMode((CFStringRef)TNSInspectorRunLoopMode, 0.1, false);
182182
}
183183
}
184-
185-
id discardExceptionsValue = [[TNSRuntime current] appPackageJson][@"discardUncaughtJsExceptions"];
184+
185+
id discardExceptionsValue = [[TNSRuntime runtimeForVM:&execState->vm()] appPackageJson][@"discardUncaughtJsExceptions"];
186186
bool discardExceptions = [discardExceptionsValue boolValue];
187187
if (!discardExceptions) {
188188
String message = exception->value().toString(globalObject->globalExec())->value(globalObject->globalExec());

0 commit comments

Comments
 (0)