Bug 788914 - Generate vanilla cross-compartment wrappers when UniversalXPConnect is enabled. r=mrbkap

This commit is contained in:
Bobby Holley 2012-09-11 01:05:10 -07:00
Родитель abb56bcab8
Коммит 5fbf125729
2 изменённых файлов: 11 добавлений и 4 удалений

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

@ -4380,11 +4380,8 @@ GetCompartmentPrivate(JSObject *object)
return GetCompartmentPrivate(compartment);
}
inline bool IsUniversalXPConnectEnabled(JSContext *cx)
inline bool IsUniversalXPConnectEnabled(JSCompartment *compartment)
{
JSCompartment *compartment = js::GetContextCompartment(cx);
if (!compartment)
return false;
CompartmentPrivate *priv =
static_cast<CompartmentPrivate*>(JS_GetCompartmentPrivate(compartment));
if (!priv)
@ -4392,6 +4389,14 @@ inline bool IsUniversalXPConnectEnabled(JSContext *cx)
return priv->universalXPConnectEnabled;
}
inline bool IsUniversalXPConnectEnabled(JSContext *cx)
{
JSCompartment *compartment = js::GetContextCompartment(cx);
if (!compartment)
return false;
return IsUniversalXPConnectEnabled(compartment);
}
inline void EnableUniversalXPConnect(JSContext *cx)
{
JSCompartment *compartment = js::GetContextCompartment(cx);

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

@ -349,6 +349,8 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO
}
}
}
} else if (xpc::IsUniversalXPConnectEnabled(target)) {
wrapper = &CrossCompartmentWrapper::singleton;
} else if (AccessCheck::isChrome(origin)) {
JSFunction *fun = JS_GetObjectFunction(obj);
if (fun) {