bug 580128 - Don't create multiple wrappers for global objects (like BackstagePass). r=mrbkap

This commit is contained in:
Peter Van der Beken 2010-10-10 15:47:16 -07:00
Родитель 61df9ba9bc
Коммит dd733e0342
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -84,8 +84,9 @@ WrapperFactory::PrepareForWrapping(JSContext *cx, JSObject *scope, JSObject *obj
// Now, our object is ready to be wrapped, but several objects (notably
// nsJSIIDs) have a wrapper per scope. If we are about to wrap one of
// those objects in a security wrapper, then we need to hand back the
// wrapper for the new scope instead. So...
if (!IS_WN_WRAPPER(obj))
// wrapper for the new scope instead. Also, global objects don't move
// between scopes so for those we also want to return the wrapper. So...
if (!IS_WN_WRAPPER(obj) || !obj->getParent())
return obj;
XPCWrappedNative *wn = static_cast<XPCWrappedNative *>(xpc_GetJSPrivate(obj));