mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 658909 - Remove GWNOJO from nsXPConnect. r=mrbkap
This commit is contained in:
parent
92e5a036c5
commit
7b7ed3edeb
@ -1332,15 +1332,18 @@ nsXPConnect::GetNativeOfWrapper(JSContext * aJSContext,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject* obj2 = nullptr;
|
||||
nsIXPConnectWrappedNative* wrapper =
|
||||
XPCWrappedNative::GetWrappedNativeOfJSObject(aJSContext, aJSObj, nullptr,
|
||||
&obj2);
|
||||
if (wrapper)
|
||||
return wrapper->Native();
|
||||
|
||||
if (obj2)
|
||||
return (nsISupports*)xpc_GetJSPrivate(obj2);
|
||||
aJSObj = js::UnwrapObjectChecked(aJSObj, /* stopAtOuter = */ false);
|
||||
if (!aJSObj) {
|
||||
JS_ReportError(aJSContext, "Permission denied to get native of security wrapper");
|
||||
return nullptr;
|
||||
}
|
||||
if (IS_WRAPPER_CLASS(js::GetObjectClass(aJSObj))) {
|
||||
if (IS_SLIM_WRAPPER_OBJECT(aJSObj))
|
||||
return (nsISupports*)xpc_GetJSPrivate(aJSObj);
|
||||
else if (XPCWrappedNative *wn = XPCWrappedNative::Get(aJSObj))
|
||||
return wn->Native();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject* unsafeObj =
|
||||
XPCWrapper::Unwrap(aJSContext, aJSObj, /* stopAtOuter = */ false);
|
||||
|
@ -2765,18 +2765,16 @@ public:
|
||||
static XPCWrappedNative*
|
||||
GetAndMorphWrappedNativeOfJSObject(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JSObject *obj2 = nullptr;
|
||||
XPCWrappedNative* wrapper =
|
||||
GetWrappedNativeOfJSObject(cx, obj, nullptr, &obj2);
|
||||
if (wrapper || !obj2)
|
||||
return wrapper;
|
||||
obj = js::UnwrapObjectChecked(obj, /* stopAtOuter = */ false);
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
if (!IS_WRAPPER_CLASS(js::GetObjectClass(obj)))
|
||||
return nullptr;
|
||||
|
||||
NS_ASSERTION(IS_SLIM_WRAPPER(obj2),
|
||||
"Hmm, someone changed GetWrappedNativeOfJSObject?");
|
||||
SLIM_LOG_WILL_MORPH(cx, obj2);
|
||||
return MorphSlimWrapper(cx, obj2) ?
|
||||
(XPCWrappedNative*)xpc_GetJSPrivate(obj2) :
|
||||
nullptr;
|
||||
if (IS_SLIM_WRAPPER_OBJECT(obj) && !MorphSlimWrapper(cx, obj))
|
||||
return nullptr;
|
||||
MOZ_ASSERT(IS_WN_WRAPPER(obj));
|
||||
return XPCWrappedNative::Get(obj);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
Loading…
Reference in New Issue
Block a user