зеркало из https://github.com/mozilla/gecko-dev.git
Bug 812669 - Remove XPConnect equality hooks. r=mrbkap
This commit is contained in:
Родитель
a77855ef90
Коммит
65c0eb0358
|
@ -508,13 +508,11 @@ static const char kDOMStringBundleURL[] =
|
|||
nsIXPCScriptable::WANT_FINALIZE | \
|
||||
nsIXPCScriptable::WANT_ENUMERATE | \
|
||||
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE | \
|
||||
nsIXPCScriptable::USE_STUB_EQUALITY_HOOK | \
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT | \
|
||||
nsIXPCScriptable::WANT_OUTER_OBJECT)
|
||||
|
||||
#define NODE_SCRIPTABLE_FLAGS \
|
||||
((DOM_DEFAULT_SCRIPTABLE_FLAGS | \
|
||||
nsIXPCScriptable::USE_STUB_EQUALITY_HOOK | \
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY) & \
|
||||
~nsIXPCScriptable::USE_JSSTUB_FOR_ADDPROPERTY)
|
||||
|
||||
|
@ -4177,15 +4175,6 @@ nsDOMClassInfo::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMClassInfo::Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
|
||||
JSObject * obj, const jsval &val, bool *bp)
|
||||
{
|
||||
NS_WARNING("nsDOMClassInfo::Equality Don't call me!");
|
||||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMClassInfo::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
|
||||
JSObject * obj, JSObject * *_retval)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* boolean to PR_TRUE before making the call. Implementations may skip writing
|
||||
* to *_retval unless they want to return PR_FALSE.
|
||||
*/
|
||||
[uuid(c4788e02-3239-490a-8aeb-60fad08303fd)]
|
||||
[uuid(1236e34a-21e0-423c-a8c8-9b3f1e6d7060)]
|
||||
interface nsIXPCScriptable : nsISupports
|
||||
{
|
||||
/* bitflags used for 'flags' (only 32 bits available!) */
|
||||
|
@ -52,9 +52,8 @@ interface nsIXPCScriptable : nsISupports
|
|||
const uint32_t ALLOW_PROP_MODS_TO_PROTOTYPE = 1 << 25;
|
||||
const uint32_t IS_GLOBAL_OBJECT = 1 << 26;
|
||||
const uint32_t DONT_REFLECT_INTERFACE_NAMES = 1 << 27;
|
||||
const uint32_t WANT_EQUALITY = 1 << 28;
|
||||
// Unused bit here!
|
||||
const uint32_t WANT_OUTER_OBJECT = 1 << 29;
|
||||
const uint32_t USE_STUB_EQUALITY_HOOK = 1 << 30;
|
||||
|
||||
// The high order bit is RESERVED for consumers of these flags.
|
||||
// No implementor of this interface should ever return flags
|
||||
|
@ -134,9 +133,6 @@ interface nsIXPCScriptable : nsISupports
|
|||
in JSContextPtr cx, in JSObjectPtr obj,
|
||||
in jsval val, out boolean bp);
|
||||
|
||||
boolean equality(in nsIXPConnectWrappedNative wrapper,
|
||||
in JSContextPtr cx, in JSObjectPtr obj, in jsval val);
|
||||
|
||||
JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper,
|
||||
in JSContextPtr cx, in JSObjectPtr obj);
|
||||
|
||||
|
|
|
@ -77,9 +77,6 @@ XPC_MAP_CLASSNAME::GetScriptableFlags()
|
|||
#ifdef XPC_MAP_WANT_HASINSTANCE
|
||||
nsIXPCScriptable::WANT_HASINSTANCE |
|
||||
#endif
|
||||
#ifdef XPC_MAP_WANT_EQUALITY
|
||||
nsIXPCScriptable::WANT_EQUALITY |
|
||||
#endif
|
||||
#ifdef XPC_MAP_WANT_OUTER_OBJECT
|
||||
nsIXPCScriptable::WANT_OUTER_OBJECT |
|
||||
#endif
|
||||
|
@ -175,11 +172,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
#endif
|
||||
|
||||
#ifndef XPC_MAP_WANT_EQUALITY
|
||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, const jsval &val, bool *bp)
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
#endif
|
||||
|
||||
#ifndef XPC_MAP_WANT_OUTER_OBJECT
|
||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, JSObject * *_retval)
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
|
@ -259,10 +251,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext *cx, JSObject *pr
|
|||
#undef XPC_MAP_WANT_HASINSTANCE
|
||||
#endif
|
||||
|
||||
#ifdef XPC_MAP_WANT_EQUALITY
|
||||
#undef XPC_MAP_WANT_EQUALITY
|
||||
#endif
|
||||
|
||||
#ifdef XPC_MAP_WANT_OUTER_OBJECT
|
||||
#undef XPC_MAP_WANT_OUTER_OBJECT
|
||||
#endif
|
||||
|
|
|
@ -709,49 +709,6 @@ XPC_WN_NoHelper_Resolve(JSContext *cx, JSHandleObject obj, JSHandleId id)
|
|||
JSPROP_PERMANENT, nullptr);
|
||||
}
|
||||
|
||||
nsISupports *
|
||||
XPC_GetIdentityObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
XPCWrappedNative *wrapper =
|
||||
XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj);
|
||||
|
||||
return wrapper ? wrapper->GetIdentityObject() : nullptr;
|
||||
}
|
||||
|
||||
JSBool
|
||||
XPC_WN_Equality(JSContext *cx, JSHandleObject obj, JSHandleValue v, JSBool *bp)
|
||||
{
|
||||
*bp = false;
|
||||
|
||||
JSObject *obj2;
|
||||
XPCWrappedNative *wrapper =
|
||||
XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj, nullptr, &obj2);
|
||||
if (obj2) {
|
||||
*bp = !JSVAL_IS_PRIMITIVE(v) && (JSVAL_TO_OBJECT(v) == obj2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
|
||||
|
||||
XPCNativeScriptableInfo* si = wrapper->GetScriptableInfo();
|
||||
if (si && si->GetFlags().WantEquality()) {
|
||||
bool res;
|
||||
nsresult rv = si->GetCallback()->Equality(wrapper, cx, obj, v, &res);
|
||||
if (NS_FAILED(rv))
|
||||
return Throw(rv, cx);
|
||||
*bp = res;
|
||||
} else if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
JSObject *other = JSVAL_TO_OBJECT(v);
|
||||
|
||||
*bp = (obj == other ||
|
||||
XPC_GetIdentityObject(cx, obj) ==
|
||||
XPC_GetIdentityObject(cx, other));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
XPC_WN_OuterObject(JSContext *cx, JSHandleObject obj_)
|
||||
{
|
||||
|
@ -815,7 +772,7 @@ XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
|
|||
|
||||
// ClassExtension
|
||||
{
|
||||
XPC_WN_Equality,
|
||||
nullptr, // equality
|
||||
nullptr, // outerObject
|
||||
nullptr, // innerObject
|
||||
nullptr, // iteratorObject
|
||||
|
@ -1427,14 +1384,7 @@ XPCNativeScriptableShared::PopulateJSClass()
|
|||
ops->typeOf = XPC_WN_JSOp_TypeOf_Object;
|
||||
}
|
||||
|
||||
if (mFlags.UseStubEqualityHook()) {
|
||||
NS_ASSERTION(!mFlags.WantEquality(),
|
||||
"If you want an Equality callback, you can't use a stub "
|
||||
"equality hook");
|
||||
mJSClass.base.ext.equality = nullptr;
|
||||
} else {
|
||||
mJSClass.base.ext.equality = XPC_WN_Equality;
|
||||
}
|
||||
mJSClass.base.ext.equality = nullptr;
|
||||
|
||||
if (mFlags.WantHasInstance())
|
||||
mJSClass.base.hasInstance = XPC_WN_Helper_HasInstance;
|
||||
|
|
|
@ -1466,9 +1466,6 @@ extern js::Class XPC_WN_ModsAllowed_NoCall_Proto_JSClass;
|
|||
extern js::Class XPC_WN_Tearoff_JSClass;
|
||||
extern js::Class XPC_WN_NoHelper_Proto_JSClass;
|
||||
|
||||
extern JSBool
|
||||
XPC_WN_Equality(JSContext *cx, JSHandleObject obj, const jsval *v, JSBool *bp);
|
||||
|
||||
extern JSBool
|
||||
XPC_WN_CallMethod(JSContext *cx, unsigned argc, jsval *vp);
|
||||
|
||||
|
@ -2144,7 +2141,6 @@ public:
|
|||
JSBool WantCall() GET_IT(WANT_CALL)
|
||||
JSBool WantConstruct() GET_IT(WANT_CONSTRUCT)
|
||||
JSBool WantHasInstance() GET_IT(WANT_HASINSTANCE)
|
||||
JSBool WantEquality() GET_IT(WANT_EQUALITY)
|
||||
JSBool WantOuterObject() GET_IT(WANT_OUTER_OBJECT)
|
||||
JSBool UseJSStubForAddProperty() GET_IT(USE_JSSTUB_FOR_ADDPROPERTY)
|
||||
JSBool UseJSStubForDelProperty() GET_IT(USE_JSSTUB_FOR_DELPROPERTY)
|
||||
|
@ -2157,7 +2153,6 @@ public:
|
|||
JSBool AllowPropModsToPrototype() GET_IT(ALLOW_PROP_MODS_TO_PROTOTYPE)
|
||||
JSBool IsGlobalObject() GET_IT(IS_GLOBAL_OBJECT)
|
||||
JSBool DontReflectInterfaceNames() GET_IT(DONT_REFLECT_INTERFACE_NAMES)
|
||||
JSBool UseStubEqualityHook() GET_IT(USE_STUB_EQUALITY_HOOK)
|
||||
|
||||
#undef GET_IT
|
||||
};
|
||||
|
@ -4260,9 +4255,6 @@ xpc_ForcePropertyResolve(JSContext* cx, JSObject* obj, jsid id);
|
|||
inline jsid
|
||||
GetRTIdByIndex(JSContext *cx, unsigned index);
|
||||
|
||||
nsISupports *
|
||||
XPC_GetIdentityObject(JSContext *cx, JSObject *obj);
|
||||
|
||||
namespace xpc {
|
||||
|
||||
class CompartmentPrivate
|
||||
|
|
Загрузка…
Ссылка в новой задаче