Closed Bug 755769 Opened 12 years ago Closed 6 years ago

Errors in mozApps onsuccess/onerror functions do not show up in Error Console

Categories

(Core Graveyard :: DOM: Apps, defect)

14 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: ianbicking, Unassigned)

Details

When running code like this, one would expect the error to show up in the Error or Web Console, but it does not:

navigator.mozApps.getSelf().onsuccess = function () {
  console.log('In onsuccess');
  throw 'Broken';
};

This is demonstrated in http://app1.ianbicking.org/example-error.html if you click on the text "tryError4", or run tryError4() from the Web Console.

In another Bug 755553 I was told:

> I know we do not show in some cases exceptions that happen in synthesized DOM events. They don't even show in the error console.
>
> Does this error show in the Error Console for you? If it does, then it's most-likely an issue with the nsIScriptError that is sent - it might lack the inner/outer window IDs.
>
> For errors to display in the Web Console they need to have the originating inner and outer window IDs.
Blocks: 746465
Is this just a case of XPConnect eating the exception because there is script on the stack when the event handler throws?  We've certainly had bug reports about that before.

How exactly is the onsuccess handler being invoked on the browser side?
In dom/base/Webapps.js it invokes Services.DOMRequest.fireSuccess(req, aResult).  The req object is what getSelf() returns, and is created with Services.DOMRequest.createRequest(window)
Hmm.  That calls DispatchEvent from C++.  Olli, does it need to do some sort of extra context-pushing or JS stack-setting-aside before it does that?

Note that bug 503244 is the bug I was thinking of in comment 1.
Dispatching events does cx pushing.
Not sure about JS stack handling. I'll test this - and if I don't, please remind me :)
(I'm worried about the performance of JS-stack-setting-aside)
Though, perhaps if the stack handling is pushed up to nsEventDispatcher, it isn't too bad.
https://bugzilla.mozilla.org/show_bug.cgi?id=503244#c45 could still be valid.
No longer blocks: 746465
Component: DOM: Mozilla Extensions → DOM: Apps
Product: Core → Core Graveyard
Core Graveyard / DOM: Apps is inactive. Closing all bugs in this component.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.