Components.returnCode not propagated back to do_CreateInstance

RESOLVED DUPLICATE of bug 287107

Status

()

Core
XPConnect
RESOLVED DUPLICATE of bug 287107
13 years ago
13 years ago

People

(Reporter: neil@parkwaycc.co.uk, Assigned: David Bradley)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
I had an obsolete helperAppDlg.xpt in my components directory so when the
nsIHelperAppLauncherDialog IID got revised recently my depend build did not pick
up the change. This meant that the nsHelperAppDlg.js component was unable to
QueryInterface to the new IID. Despite its QueryInterface implementation setting
Components.returnCode to NS_ERROR_NO_INTERFACE js_Invoke returned JS_TRUE thus
returning NS_OK to the do_CreateInstance call although the result was nsnsull.
[nsDocShell subsequently crashed as it relies on NS_ENSURE_SUCCESS(rv, rv);]
So.. first question is whether the JS should be throwing or just setting
returnCode.  I don't know that this is actually documented anywhere, is it?

Comment 2

13 years ago
> So.. first question is whether the JS should be throwing or just setting
> returnCode.  I don't know that this is actually documented anywhere, is it?

I sure couldn't find it. Perhaps throwing should show the JS console warning,
while setting Components.returnCode should just throw a COM exception? What
happens if you set .returnCode to a success code?
(Assignee)

Comment 3

13 years ago
Currently XPConnect ignores the return code if a JS error is not signal. That 
may change in the near future, as there is a bug on that.
(Reporter)

Comment 4

13 years ago
Note that
Components.classes['@mozilla.org/helperapplauncherdialog;1']
          .createInstance(Components.interfaces.nsISupportsString)
asserts in xpcjscid.cpp:810 because instance is null but
Components.classes['@mozilla.org/helperapplauncherdialog;1']
          .createInstance(Components.interfaces.nsISupports)
          .QueryInterface(Components.interfaces.nsISupportsString)
throws NS_NOINTERFACE to JS but that's more xpc fu :-/
docs are at http://www.mozilla.org/scriptable/components_object.html#_returnCode

>Perhaps throwing should show the JS console warning,
>while setting Components.returnCode should just throw a COM exception? 

That certainly was the intent of these throw -> returnCode changes (bug 243621)

Isn't this a dup of bug 287107?

Unfortunately, I had to back out my patch to fix that bug because it exposed
places in Firefox and forumzilla that depend on the bug.

/be
Depends on: 287107

*** This bug has been marked as a duplicate of 287107 ***
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.