diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp index 726a820a3476..63dc0e191fb4 100644 --- a/js/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -229,6 +229,15 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, JSObject *scope, JSObject *obj // Ok, must be case (1). Fall through and create a new wrapper. } + + // Nasty hack for late-breaking bug 781476. This will confuse identity checks, + // but it's probably better than any of our alternatives. + if (!AccessCheck::isChrome(js::GetObjectCompartment(scope)) && + AccessCheck::subsumes(js::GetObjectCompartment(scope), + js::GetObjectCompartment(obj))) + { + return DoubleWrap(cx, obj, flags); + } } }