From c22541b762a18c36f7e37eb08f3361ad760268a2 Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Wed, 23 Jun 2010 17:09:00 -0500 Subject: [PATCH] Fix bug 572130. r=jst --- js/src/xpconnect/src/xpcvariant.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/js/src/xpconnect/src/xpcvariant.cpp b/js/src/xpconnect/src/xpcvariant.cpp index c8f42aa596a8..9fefc33de39b 100644 --- a/js/src/xpconnect/src/xpcvariant.cpp +++ b/js/src/xpconnect/src/xpcvariant.cpp @@ -41,6 +41,7 @@ /* nsIVariant implementation for xpconnect. */ #include "xpcprivate.h" +#include "XPCWrapper.h" NS_IMPL_CYCLE_COLLECTION_CLASS(XPCVariant) @@ -431,15 +432,17 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx, NS_ASSERTION(type == nsIDataType::VTYPE_INTERFACE || type == nsIDataType::VTYPE_INTERFACE_IS, "Weird variant"); - *pJSVal = realVal; - return JS_TRUE; - // else, it's an object and we really need to double wrap it if we've - // already decided that its 'natural' type is as some sort of interface. - - // We just fall through to the code below and let it do what it does. + return XPCWrapper::RewrapObject(lccx.GetJSContext(), scope, + JSVAL_TO_OBJECT(realVal), + XPCWrapper::UNKNOWN, pJSVal); } + // else, it's an object and we really need to double wrap it if we've + // already decided that its 'natural' type is as some sort of interface. + + // We just fall through to the code below and let it do what it does. + // The nsIVariant is not a XPCVariant (or we act like it isn't). // So we extract the data and do the Right Thing.