Bug 1125901 - Part b: Stop reusing the aProto outparam in GetXPCProto; r=jst

This is pretty poor behaviour in any case, and it blocks the removal of the
outparam in my next patch.
This commit is contained in:
Ms2ger 2015-02-04 09:40:59 +01:00
parent b46f54756b
commit fbe3e5a22d

View File

@ -1776,17 +1776,17 @@ GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin,
}
NS_ENSURE_TRUE(ci, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIXPConnectJSObjectHolder> proto_holder;
nsresult rv =
aXPConnect->GetWrappedNativePrototype(cx, aWin->GetGlobalJSObject(), ci,
aProto);
getter_AddRefs(proto_holder));
NS_ENSURE_SUCCESS(rv, rv);
JS::Rooted<JSObject*> proto_obj(cx, (*aProto)->GetJSObject());
JS::Rooted<JSObject*> proto_obj(cx, proto_holder->GetJSObject());
if (!JS_WrapObject(cx, &proto_obj)) {
return NS_ERROR_FAILURE;
}
NS_IF_RELEASE(*aProto);
return aXPConnect->HoldObject(cx, proto_obj, aProto);
}