Bug 829252 part 3. When wrapping things with an nsISupports in XPCWrappedJS for WebIDL callback interfaces, use the aggregated version. r=peterv

This commit is contained in:
Boris Zbarsky 2013-01-29 08:44:01 -05:00
parent 27b4736d69
commit fe29b143cd

View File

@ -1923,10 +1923,18 @@ if (!ccx.IsValid()) {
${codeOnFailure}
}
nsISupports* supp = nullptr;
if (XPCConvert::GetISupportsFromJSObject(${source}, &supp)) {
nsCOMPtr<nsIXPConnectWrappedNative> xpcwn = do_QueryInterface(supp);
if (xpcwn) {
supp = xpcwn->Native();
}
}
const nsIID& iid = NS_GET_IID(${nativeType});
nsRefPtr<nsXPCWrappedJS> wrappedJS;
rv = nsXPCWrappedJS::GetNewOrUsed(ccx, ${source}, iid,
NULL, getter_AddRefs(wrappedJS));
supp, getter_AddRefs(wrappedJS));
if (NS_FAILED(rv) || !wrappedJS) {
${codeOnFailure}
}