mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 876604 - Outparamdel UnwrapDOMObjectToISupports; r=bz
This commit is contained in:
parent
04c8cd41cd
commit
1602264ebc
@ -2102,8 +2102,8 @@ nsScriptSecurityManager::old_doGetObjectPrincipal(JS::Handle<JSObject*> aObj,
|
||||
if (!(~jsClass->flags & (JSCLASS_HAS_PRIVATE |
|
||||
JSCLASS_PRIVATE_IS_NSISUPPORTS))) {
|
||||
priv = (nsISupports *) js::GetObjectPrivate(obj);
|
||||
} else if (!UnwrapDOMObjectToISupports(obj, priv)) {
|
||||
priv = nullptr;
|
||||
} else {
|
||||
priv = UnwrapDOMObjectToISupports(obj);
|
||||
}
|
||||
|
||||
if (aAllowShortCircuit) {
|
||||
|
@ -600,8 +600,7 @@ NativeInterface2JSObjectAndThrowIfFailed(JSContext* aCx,
|
||||
bool
|
||||
TryPreserveWrapper(JSObject* obj)
|
||||
{
|
||||
nsISupports* native;
|
||||
if (UnwrapDOMObjectToISupports(obj, native)) {
|
||||
if (nsISupports* native = UnwrapDOMObjectToISupports(obj)) {
|
||||
nsWrapperCache* cache = nullptr;
|
||||
CallQueryInterface(native, &cache);
|
||||
if (cache) {
|
||||
@ -683,8 +682,8 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp)
|
||||
return false;
|
||||
}
|
||||
|
||||
nsISupports* native;
|
||||
if (!UnwrapDOMObjectToISupports(obj, native)) {
|
||||
nsISupports* native = UnwrapDOMObjectToISupports(obj);
|
||||
if (!native) {
|
||||
return Throw<true>(cx, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
@ -1469,8 +1468,8 @@ ReparentWrapper(JSContext* aCx, JS::HandleObject aObjArg)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsISupports* native;
|
||||
if (!UnwrapDOMObjectToISupports(aObj, native)) {
|
||||
nsISupports* native = UnwrapDOMObjectToISupports(aObj);
|
||||
if (!native) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -153,16 +153,15 @@ GetDOMClass(JSObject* obj)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline bool
|
||||
UnwrapDOMObjectToISupports(JSObject* obj, nsISupports*& result)
|
||||
inline nsISupports*
|
||||
UnwrapDOMObjectToISupports(JSObject* aObject)
|
||||
{
|
||||
const DOMClass* clasp = GetDOMClass(obj);
|
||||
const DOMClass* clasp = GetDOMClass(aObject);
|
||||
if (!clasp || !clasp->mDOMObjectIsISupports) {
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
result = UnwrapDOMObject<nsISupports>(obj);
|
||||
return true;
|
||||
return UnwrapDOMObject<nsISupports>(aObject);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
@ -76,7 +76,8 @@ XPCConvert::GetISupportsFromJSObject(JSObject* obj, nsISupports** iface)
|
||||
*iface = (nsISupports*) xpc_GetJSPrivate(obj);
|
||||
return true;
|
||||
}
|
||||
return UnwrapDOMObjectToISupports(obj, *iface);
|
||||
*iface = UnwrapDOMObjectToISupports(obj);
|
||||
return !!*iface;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -531,8 +531,9 @@ nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
||||
} else if (IsDOMObject(obj)) {
|
||||
// Not all DOM objects implement nsISupports. But if they don't,
|
||||
// there's nothing to do in this HasInstance hook.
|
||||
if (!UnwrapDOMObjectToISupports(obj, identity))
|
||||
return NS_OK;;
|
||||
identity = UnwrapDOMObjectToISupports(obj);
|
||||
if (!identity)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsISupports> supp;
|
||||
identity->QueryInterface(*iid, getter_AddRefs(supp));
|
||||
*bp = supp;
|
||||
|
@ -633,7 +633,7 @@ castNative(JSContext *cx,
|
||||
} else if (cur) {
|
||||
nsISupports *native;
|
||||
QITableEntry *entries;
|
||||
if (mozilla::dom::UnwrapDOMObjectToISupports(cur, native)) {
|
||||
if ((native = mozilla::dom::UnwrapDOMObjectToISupports(cur))) {
|
||||
entries = nullptr;
|
||||
} else if (IS_SLIM_WRAPPER(cur)) {
|
||||
native = static_cast<nsISupports*>(xpc_GetJSPrivate(cur));
|
||||
|
@ -1328,9 +1328,8 @@ nsXPConnect::GetNativeOfWrapper(JSContext * aJSContext,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsISupports* supports = nullptr;
|
||||
mozilla::dom::UnwrapDOMObjectToISupports(aJSObj, supports);
|
||||
nsCOMPtr<nsISupports> canonical = do_QueryInterface(supports);
|
||||
nsCOMPtr<nsISupports> canonical =
|
||||
do_QueryInterface(mozilla::dom::UnwrapDOMObjectToISupports(aJSObj));
|
||||
return canonical;
|
||||
}
|
||||
|
||||
|
@ -1278,8 +1278,8 @@ DOMXrayTraits::construct(JSContext *cx, HandleObject wrapper,
|
||||
void
|
||||
DOMXrayTraits::preserveWrapper(JSObject *target)
|
||||
{
|
||||
nsISupports *identity;
|
||||
if (!mozilla::dom::UnwrapDOMObjectToISupports(target, identity))
|
||||
nsISupports *identity = mozilla::dom::UnwrapDOMObjectToISupports(target);
|
||||
if (!identity)
|
||||
return;
|
||||
nsWrapperCache* cache = nullptr;
|
||||
CallQueryInterface(identity, &cache);
|
||||
@ -1941,9 +1941,7 @@ do_QueryInterfaceNative(JSContext* cx, HandleObject wrapper)
|
||||
if (IsWrapper(wrapper) && WrapperFactory::IsXrayWrapper(wrapper)) {
|
||||
RootedObject target(cx, XrayTraits::getTargetObject(wrapper));
|
||||
if (GetXrayType(target) == XrayForDOMObject) {
|
||||
if (!UnwrapDOMObjectToISupports(target, nativeSupports)) {
|
||||
nativeSupports = nullptr;
|
||||
}
|
||||
nativeSupports = UnwrapDOMObjectToISupports(target);
|
||||
} else {
|
||||
XPCWrappedNative *wn = GetWrappedNative(target);
|
||||
nativeSupports = wn->Native();
|
||||
|
Loading…
Reference in New Issue
Block a user