mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 996785 - Move global CPOW functions to top level (r=mrbkap)
This commit is contained in:
parent
64f0d70e37
commit
380ef2b5f4
@ -1907,9 +1907,9 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> unwrapped(cx, js::CheckedUnwrap(instance, true));
|
||||
if (unwrapped && jsipc::JavaScriptParent::IsCPOW(unwrapped)) {
|
||||
if (unwrapped && jsipc::IsCPOW(unwrapped)) {
|
||||
bool boolp = false;
|
||||
if (!jsipc::JavaScriptParent::DOMInstanceOf(cx, unwrapped, clasp->mPrototypeID,
|
||||
if (!jsipc::DOMInstanceOf(cx, unwrapped, clasp->mPrototypeID,
|
||||
clasp->mDepth, &boolp)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -30,14 +30,14 @@ JavaScriptParent::JavaScriptParent()
|
||||
static inline JavaScriptParent *
|
||||
ParentOf(JSObject *obj)
|
||||
{
|
||||
MOZ_ASSERT(JavaScriptParent::IsCPOW(obj));
|
||||
MOZ_ASSERT(IsCPOW(obj));
|
||||
return reinterpret_cast<JavaScriptParent *>(GetProxyExtra(obj, 0).toPrivate());
|
||||
}
|
||||
|
||||
ObjectId
|
||||
JavaScriptParent::idOf(JSObject *obj)
|
||||
{
|
||||
MOZ_ASSERT(JavaScriptParent::IsCPOW(obj));
|
||||
MOZ_ASSERT(IsCPOW(obj));
|
||||
|
||||
Value v = GetProxyExtra(obj, 1);
|
||||
MOZ_ASSERT(v.isDouble());
|
||||
@ -647,14 +647,17 @@ JavaScriptParent::ActorDestroy(ActorDestroyReason why)
|
||||
inactive_ = true;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
JavaScriptParent::IsCPOW(JSObject *obj)
|
||||
namespace mozilla {
|
||||
namespace jsipc {
|
||||
|
||||
bool
|
||||
IsCPOW(JSObject *obj)
|
||||
{
|
||||
return IsProxy(obj) && GetProxyHandler(obj) == &CPOWProxyHandler::singleton;
|
||||
}
|
||||
|
||||
/* static */ nsresult
|
||||
JavaScriptParent::InstanceOf(JSObject *proxy, const nsID *id, bool *bp)
|
||||
nsresult
|
||||
InstanceOf(JSObject *proxy, const nsID *id, bool *bp)
|
||||
{
|
||||
JavaScriptParent *parent = ParentOf(proxy);
|
||||
if (!parent->active())
|
||||
@ -662,6 +665,15 @@ JavaScriptParent::InstanceOf(JSObject *proxy, const nsID *id, bool *bp)
|
||||
return parent->instanceOf(proxy, id, bp);
|
||||
}
|
||||
|
||||
bool
|
||||
DOMInstanceOf(JSContext *cx, JSObject *proxy, int prototypeID, int depth, bool *bp)
|
||||
{
|
||||
FORWARD(domInstanceOf, (cx, proxy, prototypeID, depth, bp));
|
||||
}
|
||||
|
||||
} /* namespace jsipc */
|
||||
} /* namespace mozilla */
|
||||
|
||||
nsresult
|
||||
JavaScriptParent::instanceOf(JSObject *obj, const nsID *id, bool *bp)
|
||||
{
|
||||
@ -680,12 +692,6 @@ JavaScriptParent::instanceOf(JSObject *obj, const nsID *id, bool *bp)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
JavaScriptParent::DOMInstanceOf(JSContext *cx, JSObject *proxy, int prototypeID, int depth, bool *bp)
|
||||
{
|
||||
FORWARD(domInstanceOf, (cx, proxy, prototypeID, depth, bp));
|
||||
}
|
||||
|
||||
bool
|
||||
JavaScriptParent::domInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp)
|
||||
{
|
||||
|
@ -68,16 +68,12 @@ class JavaScriptParent
|
||||
|
||||
void drop(JSObject *obj);
|
||||
|
||||
static bool IsCPOW(JSObject *obj);
|
||||
|
||||
static nsresult InstanceOf(JSObject *obj, const nsID *id, bool *bp);
|
||||
nsresult instanceOf(JSObject *obj, const nsID *id, bool *bp);
|
||||
|
||||
/*
|
||||
* Check that |obj| is a DOM wrapper whose prototype chain contains
|
||||
* |prototypeID| at depth |depth|.
|
||||
*/
|
||||
static bool DOMInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp);
|
||||
bool domInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp);
|
||||
|
||||
mozilla::ipc::IProtocol*
|
||||
@ -103,6 +99,15 @@ class JavaScriptParent
|
||||
bool inactive_;
|
||||
};
|
||||
|
||||
bool
|
||||
IsCPOW(JSObject *obj);
|
||||
|
||||
nsresult
|
||||
InstanceOf(JSObject *obj, const nsID *id, bool *bp);
|
||||
|
||||
bool
|
||||
DOMInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp);
|
||||
|
||||
} // jsipc
|
||||
} // mozilla
|
||||
|
||||
|
@ -66,7 +66,7 @@ UnwrapNativeCPOW(nsISupports* wrapper)
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> underware = do_QueryInterface(wrapper);
|
||||
if (underware) {
|
||||
JSObject* mainObj = underware->GetJSObject();
|
||||
if (mainObj && mozilla::jsipc::JavaScriptParent::IsCPOW(mainObj))
|
||||
if (mainObj && mozilla::jsipc::IsCPOW(mainObj))
|
||||
return mainObj;
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -465,7 +465,7 @@ FindObjectForHasInstance(JSContext *cx, HandleObject objArg)
|
||||
RootedObject obj(cx, objArg), proto(cx);
|
||||
|
||||
while (obj && !IS_WN_REFLECTOR(obj) &&
|
||||
!IsDOMObject(obj) && !mozilla::jsipc::JavaScriptParent::IsCPOW(obj))
|
||||
!IsDOMObject(obj) && !mozilla::jsipc::IsCPOW(obj))
|
||||
{
|
||||
if (js::IsWrapper(obj)) {
|
||||
obj = js::CheckedUnwrap(obj, /* stopAtOuter = */ false);
|
||||
@ -487,8 +487,8 @@ xpc::HasInstance(JSContext *cx, HandleObject objArg, const nsID *iid, bool *bp)
|
||||
if (!obj)
|
||||
return NS_OK;
|
||||
|
||||
if (mozilla::jsipc::JavaScriptParent::IsCPOW(obj))
|
||||
return mozilla::jsipc::JavaScriptParent::InstanceOf(obj, iid, bp);
|
||||
if (mozilla::jsipc::IsCPOW(obj))
|
||||
return mozilla::jsipc::InstanceOf(obj, iid, bp);
|
||||
|
||||
nsISupports *identity = UnwrapReflectorToISupports(obj);
|
||||
if (!identity)
|
||||
|
Loading…
Reference in New Issue
Block a user