From c985879ed02c31268c19b0bcbcad3d7a7147c047 Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Fri, 8 Apr 2011 14:28:24 -0700 Subject: [PATCH] Bug 641342 - Treat chrome DOM objects like DOM objects. r=gal/jst --HG-- extra : rebase_source : 6df8538f4f06a6cbe2b56943937a0f9430ee80ec --- js/src/xpconnect/wrappers/WrapperFactory.cpp | 21 +++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/js/src/xpconnect/wrappers/WrapperFactory.cpp b/js/src/xpconnect/wrappers/WrapperFactory.cpp index 29c50bf234f..04bf1427b21 100644 --- a/js/src/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/src/xpconnect/wrappers/WrapperFactory.cpp @@ -279,8 +279,23 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO return nsnull; } } - wrapper = &FilteringWrapper::singleton; + + JSObject *inner = obj; + OBJ_TO_INNER_OBJECT(cx, inner); + XPCWrappedNative *wn; + if (IS_WN_WRAPPER(inner) && + (wn = static_cast(inner->getPrivate()))->HasProto() && + wn->GetProto()->ClassIsDOMObject()) { + typedef XrayWrapper Xray; + wrapper = &FilteringWrapper::singleton; + xrayHolder = Xray::createHolder(cx, obj, parent); + if (!xrayHolder) + return nsnull; + } else { + wrapper = &FilteringWrapper::singleton; + } } else if (AccessCheck::isSameOrigin(origin, target)) { // Same origin we use a transparent wrapper, unless the compartment asks // for an Xray or the wrapper needs a SOW. @@ -317,7 +332,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO wrapper = &FilteringWrapper::singleton; } else { - wrapper= &FilteringWrapper::singleton; }