From fbad758bd665abc3689c8aa7bbb8a44e229a879e Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 4 Feb 2015 09:40:59 +0100 Subject: [PATCH] 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. --- dom/base/nsDOMClassInfo.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index ab917796b90..514de67ecc6 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1776,17 +1776,17 @@ GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin, } NS_ENSURE_TRUE(ci, NS_ERROR_UNEXPECTED); + nsCOMPtr proto_holder; nsresult rv = aXPConnect->GetWrappedNativePrototype(cx, aWin->GetGlobalJSObject(), ci, - aProto); + getter_AddRefs(proto_holder)); NS_ENSURE_SUCCESS(rv, rv); - JS::Rooted proto_obj(cx, (*aProto)->GetJSObject()); + JS::Rooted 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); }