Closed Bug 589308 Opened 14 years ago Closed 3 years ago

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

Categories

(Core :: DOM: Content Processes, defect, P5)

x86
macOS
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: avarma, Unassigned)

Details

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
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5

(In reply to Eddy Bruel [:ejpbruel] from comment #1)

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.

So the problem is solved (and IIUC jetpack has gone entirely).

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.