Bug 839027 - Kill object typeof hook. r=jorendorff

This commit is contained in:
Tom Schuster 2013-02-11 21:05:13 +01:00
parent fe76bd2104
commit b5f30783df
12 changed files with 3 additions and 96 deletions

View File

@ -974,7 +974,6 @@ Class ParallelArrayObject::class_ = {
deleteElement,
deleteSpecial,
NULL, // enumerate
NULL, // typeof
NULL, // thisObject
}
};

View File

@ -1013,12 +1013,6 @@ typedef JSBool
typedef JSBool
(* JSConvertOp)(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp);
/*
* Delegate typeof to an object so it can cloak a primitive or another object.
*/
typedef JSType
(* JSTypeOfOp)(JSContext *cx, JSHandleObject obj);
typedef struct JSFreeOp JSFreeOp;
struct JSFreeOp {

View File

@ -187,8 +187,7 @@ typedef JSBool
(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict);
typedef JSBool
(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict);
typedef JSType
(* TypeOfOp)(JSContext *cx, HandleObject obj);
typedef JSObject *
(* ObjectOp)(JSContext *cx, HandleObject obj);
@ -287,14 +286,13 @@ struct ObjectOps
DeleteSpecialOp deleteSpecial;
JSNewEnumerateOp enumerate;
TypeOfOp typeOf;
ObjectOp thisObject;
};
#define JS_NULL_OBJECT_OPS \
{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \
NULL,NULL,NULL,NULL}
NULL,NULL,NULL}
struct Class
{

View File

@ -720,7 +720,7 @@ js::TypeOfValue(JSContext *cx, const Value &vref)
return JSTYPE_VOID;
if (v.isObject()) {
RootedObject obj(cx, &v.toObject());
return JSObject::typeOf(cx, obj);
return baseops::TypeOf(cx, obj);
}
JS_ASSERT(v.isBoolean());
return JSTYPE_BOOLEAN;

View File

@ -925,7 +925,6 @@ class JSObject : public js::ObjectImpl
JS::MutableHandleValue statep, JS::MutableHandleId idp);
static inline bool defaultValue(JSContext *cx, js::HandleObject obj,
JSType hint, js::MutableHandleValue vp);
static inline JSType typeOf(JSContext *cx, js::HandleObject obj);
static inline JSObject *thisObject(JSContext *cx, js::HandleObject obj);
static bool thisObject(JSContext *cx, const js::Value &v, js::Value *vp);

View File

@ -73,13 +73,6 @@ JSObject::defaultValue(JSContext *cx, js::HandleObject obj, JSType hint, js::Mut
return ok;
}
/* static */ inline JSType
JSObject::typeOf(JSContext *cx, js::HandleObject obj)
{
js::TypeOfOp op = obj->getOps()->typeOf;
return (op ? op : js::baseops::TypeOf)(cx, obj);
}
/* static */ inline JSObject *
JSObject::thisObject(JSContext *cx, js::HandleObject obj)
{

View File

@ -347,12 +347,6 @@ BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleVa
return false;
}
JSType
BaseProxyHandler::typeOf(JSContext *cx, JSObject *proxy)
{
return IsFunctionProxy(proxy) ? JSTYPE_FUNCTION : JSTYPE_OBJECT;
}
bool
BaseProxyHandler::objectClassIs(JSObject *proxy, ESClassValue classValue, JSContext *cx)
{
@ -477,11 +471,6 @@ DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandle
return true;
}
JSType
DirectProxyHandler::typeOf(JSContext *cx, JSObject *proxy)
{
return TypeOfValue(cx, ObjectValue(*GetProxyTargetObject(proxy)));
}
bool
DirectProxyHandler::objectClassIs(JSObject *proxy, ESClassValue classValue,
@ -748,7 +737,6 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler {
/* Spidermonkey extensions. */
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
CallArgs args) MOZ_OVERRIDE;
virtual JSType typeOf(JSContext *cx, JSObject *proxy);
virtual bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Value *vp) MOZ_OVERRIDE;
static ScriptedIndirectProxyHandler singleton;
@ -967,18 +955,6 @@ ScriptedIndirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, N
return BaseProxyHandler::nativeCall(cx, test, impl, args);
}
JSType
ScriptedIndirectProxyHandler::typeOf(JSContext *cx, JSObject *proxy)
{
/*
* This function is only here to prevent a regression in
* js1_8_5/extensions/scripted-proxies.js. It will be removed when the
* direct proxy refactor is complete.
*/
return BaseProxyHandler::typeOf(cx, proxy);
}
bool
ScriptedIndirectProxyHandler::defaultValue(JSContext *cx, JSObject *proxy, JSType hint, Value *vp)
{
@ -2480,15 +2456,6 @@ Proxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool
return GetProxyHandler(proxy)->hasInstance(cx, proxy, v, bp);
}
JSType
Proxy::typeOf(JSContext *cx, JSObject *proxy_)
{
// FIXME: API doesn't allow us to report error (bug 618906).
JS_CHECK_RECURSION(cx, return JSTYPE_OBJECT);
RootedObject proxy(cx, proxy_);
return GetProxyHandler(proxy)->typeOf(cx, proxy);
}
bool
Proxy::objectClassIs(JSObject *proxy_, ESClassValue classValue, JSContext *cx)
{
@ -2877,13 +2844,6 @@ proxy_HasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, JSBoo
return true;
}
static JSType
proxy_TypeOf(JSContext *cx, HandleObject proxy)
{
JS_ASSERT(proxy->isProxy());
return Proxy::typeOf(cx, proxy);
}
#define PROXY_CLASS_EXT \
{ \
NULL, /* equality */ \
@ -2942,7 +2902,6 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
proxy_DeleteElement,
proxy_DeleteSpecial,
NULL, /* enumerate */
proxy_TypeOf,
NULL, /* thisObject */
}
};
@ -3002,7 +2961,6 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = {
proxy_DeleteElement,
proxy_DeleteSpecial,
NULL, /* enumerate */
NULL, /* typeof */
NULL, /* thisObject */
}
};
@ -3070,7 +3028,6 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
proxy_DeleteElement,
proxy_DeleteSpecial,
NULL, /* enumerate */
proxy_TypeOf,
NULL, /* thisObject */
}
};

View File

@ -100,7 +100,6 @@ class JS_FRIEND_API(BaseProxyHandler) {
virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval);
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args);
virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp);
virtual JSType typeOf(JSContext *cx, JSObject *proxy);
virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx);
virtual JSString *obj_toString(JSContext *cx, JSObject *proxy);
virtual JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent);
@ -159,7 +158,6 @@ public:
CallArgs args) MOZ_OVERRIDE;
virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v,
bool *bp) MOZ_OVERRIDE;
virtual JSType typeOf(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE;
virtual bool objectClassIs(JSObject *obj, ESClassValue classValue,
JSContext *cx) MOZ_OVERRIDE;
virtual JSString *obj_toString(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE;
@ -206,7 +204,6 @@ class Proxy {
static bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval);
static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args);
static bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp);
static JSType typeOf(JSContext *cx, JSObject *proxy);
static bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx);
static JSString *obj_toString(JSContext *cx, JSObject *proxy);
static JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent);

View File

@ -3184,7 +3184,6 @@ Class js::ArrayBufferClass = {
ArrayBufferObject::obj_deleteElement,
ArrayBufferObject::obj_deleteSpecial,
ArrayBufferObject::obj_enumerate,
NULL, /* typeOf */
NULL, /* thisObject */
}
};
@ -3356,7 +3355,6 @@ IMPL_TYPED_ARRAY_COMBINED_UNWRAPPERS(Float64, double, double)
_typedArray::obj_deleteElement, \
_typedArray::obj_deleteSpecial, \
_typedArray::obj_enumerate, \
NULL, /* typeOf */ \
NULL, /* thisObject */ \
} \
}

View File

@ -545,12 +545,6 @@ with_Enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op,
return JSObject::enumerate(cx, actual, enum_op, statep, idp);
}
static JSType
with_TypeOf(JSContext *cx, HandleObject obj)
{
return JSTYPE_OBJECT;
}
static JSObject *
with_ThisObject(JSContext *cx, HandleObject obj)
{
@ -605,7 +599,6 @@ Class js::WithClass = {
with_DeleteElement,
with_DeleteSpecial,
with_Enumerate,
with_TypeOf,
with_ThisObject,
}
};

View File

@ -811,7 +811,6 @@ XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
nullptr, // deleteElement
nullptr, // deleteSpecial
XPC_WN_JSOp_Enumerate,
XPC_WN_JSOp_TypeOf_Object,
XPC_WN_JSOp_ThisObject,
}
},
@ -1198,18 +1197,6 @@ XPC_WN_JSOp_Enumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op,
return JS_EnumerateState(cx, obj, enum_op, statep, idp);
}
JSType
XPC_WN_JSOp_TypeOf_Object(JSContext *cx, JSHandleObject obj)
{
return JSTYPE_OBJECT;
}
JSType
XPC_WN_JSOp_TypeOf_Function(JSContext *cx, JSHandleObject obj)
{
return JSTYPE_FUNCTION;
}
namespace {
NS_STACK_CLASS class AutoPopJSContext

View File

@ -1481,12 +1481,6 @@ extern JSBool
XPC_WN_JSOp_Enumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op,
JSMutableHandleValue statep, JSMutableHandleId idp);
extern JSType
XPC_WN_JSOp_TypeOf_Object(JSContext *cx, JSHandleObject obj);
extern JSType
XPC_WN_JSOp_TypeOf_Function(JSContext *cx, JSHandleObject obj);
extern JSObject*
XPC_WN_JSOp_ThisObject(JSContext *cx, JSHandleObject obj);
@ -1522,7 +1516,6 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JSHandleObject obj);
nullptr, /* deleteElement */ \
nullptr, /* deleteSpecial */ \
XPC_WN_JSOp_Enumerate, \
XPC_WN_JSOp_TypeOf_Function, \
XPC_WN_JSOp_ThisObject, \
}
@ -1557,7 +1550,6 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JSHandleObject obj);
nullptr, /* deleteElement */ \
nullptr, /* deleteSpecial */ \
XPC_WN_JSOp_Enumerate, \
XPC_WN_JSOp_TypeOf_Object, \
XPC_WN_JSOp_ThisObject, \
}