Jetpack child process doesn't report errors outside of registerReceiver() callbacks

NEW
Unassigned

Status

()

Core
DOM: Content Processes
7 years ago
3 years ago

People

(Reporter: atul, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
If the main body of a script executed via nsIJetpack.evalScript() throws an exception that isn't caught, it isn't reported as an error via a "core:exception" message.

Looking at the source code, it seems like this is a result of the JSOPTION_DONT_REPORT_UNCAUGHT option being set on the context running JS in the Jetpack child process and the fact that JetpackChild::RecvEvalScript() isn't checking the return value of JS_EvaluateUCScript() and calling JS_ReportPendingException() if it's failed. I could be wrong, though.
This bug also has a workaround, in that the whole script that's executed can just be surrounded by a try ... catch.
Comparing JetpackChild::RecvEvalScript with  JetpackActorCommon::RecvMessage (which *does* throw an exception) it seems as if it is enough to just check the return value of JS_EvaluateUCScript and call JS_ReportPendingException, as Atul suggested.

I have tried this out and it looks as if this does indeed solve the problem.
Component: IPC → DOM: Content Processes
You need to log in before you can comment on or make changes to this bug.