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; }