Closed Bug 1044109 Opened 10 years ago Closed 8 years ago

Regression: Error thrown by function in JS XPCOM component is shown in error console even if call is wrapped in a try/catch.

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: nhnt11, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: regression)

In a scenario with two JS components, one tries to call a function the other. The function throws NS_ERROR_NOT_IMPLEMENTED, and even though the call is wrapped in a try/catch, the error is shown in the error console as an uncaught exception.
For more context, please see [1].

This bug was noticed by Instantbird users some time in June.

[1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1019132#c2
Blocks: 1019132
Version: unspecified → Trunk
I might take a patch, but in general this stuff is broken enough that we need to fix bug 1044109 before we make any meaningful progress on it.
Depends on: 981187
(In reply to Bobby Holley (:bholley) from comment #1)
> I might take a patch, but in general this stuff is broken enough that we
> need to fix bug 1044109 before we make any meaningful progress on it.

Er, bug 981187.
Note that this was a purposeful change.  We used to guess-suppress the exception sometimes, but then that led to exceptions that never ever got reported...
Just to be clear, the catch {} block is executed, but there is a spurious uncaught error. If I report the error from the catch block, I see /two/ errors in the console: one |uncaught exception: 2147500033| and one (from the catch block) |[Exception... "Method not implemented'Method not implemented' when calling method: [prplIAccount::requestRoomInfo]"  nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)"|
Yes, exactly.  The point is the callee has to decide whether to report or not before it knows whether the caller will actually even see the exception, so it has no way to tell whether the exception might get caught in the future.  We were having cases of uncaught exceptions not getting reported as a result, because the callee thought the caller would handle it but the caller wasn't actually JS.

Like Bobby says, bug 981187 will make things here saner, hopefully.
Blocks: 1178729
OK, things are saner, but at this point this bug seems like it should be wontfix.  We really just don't know whether we have a JS caller or not at the point when we need to report the exception, so the options are to swallow exceptions when we should not or report even if caught further upstream.  Given that choice, we will do the latter.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.