Use IDL for nsJSCID::{CreateInstance,GetService}

RESOLVED FIXED in mozilla11

Status

()

Core
XPConnect
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Ms2ger, Assigned: Ms2ger)

Tracking

Trunk
mozilla11
Points:
---
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
Created attachment 576965 [details] [diff] [review]
Patch v1
Attachment #576965 - Flags: review?(bobbyholley+bmo)
Comment on attachment 576965 [details] [diff] [review]
Patch v1

I'm really sorry for totally failing on my promise of speedy reviews. :-( Thanks for doing this stuff!

>-    nsISupports createInstance();
>-    nsISupports getService();
>+    [implicit_jscontext,optional_argc] jsval createInstance([optional] in jsval iid);
>+    [implicit_jscontext,optional_argc] jsval getService([optional] in jsval iid);

It's good that you're using jsvals here, because I just wrote a patch that makes XPConnect throw on null IIDs: bug 705875. ;-)

>-    rv = xpc->WrapNativeToJSVal(cx, obj, inst, nsnull, iid, true, vp, nsnull);
>-    if (NS_FAILED(rv) || JSVAL_IS_PRIMITIVE(*vp))
>+    rv = nsXPConnect::GetXPConnect()->WrapNativeToJSVal(aCx, obj, inst, nsnull, iid, true, aRetval, nsnull);
>+    if (NS_FAILED(rv) || JSVAL_IS_PRIMITIVE(*aRetval))

Can nsXPConnect::GetXPConnect() ever return null? We check for it before, and with this patch we don't. We should either keep checking or be very sure that it's safe. Same thing in getInterface().

r=bholley once that's figured out.
Attachment #576965 - Flags: review?(bobbyholley+bmo) → review+
So, I realized that as much as I like the aFoo naming convention, it isn't consistent with js-style, and XPConnect is supposed to be js-style. So r+ contingent on changing that as well. :-(
(Assignee)

Comment 3

6 years ago
nsXPConnect::GetXPConnect() certainly can't be null at that point; we would already have returned when the helper failed. (I doubt it can be null otherwise; maybe on shutdown?)

https://hg.mozilla.org/mozilla-central/rev/f7c8894bbdae
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
You need to log in before you can comment on or make changes to this bug.