Closed Bug 288698 Opened 21 years ago Closed 21 years ago

Components.returnCode not propagated back to do_CreateInstance

Categories

(Core :: XPConnect, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 287107

People

(Reporter: neil, Assigned: dbradley)

References

Details

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?
> 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?
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.
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
Closed: 21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.