Bug 1103152 - Remove JS_DeletePropertyStub, JS_EnumerateStub, JS_ResolveStub, and JS_ConvertStub. Make five mandatory JSClass hooks optional (nullable). r=bhackett.

--HG--
extra : rebase_source : a349ef612573aff8f87b995a65df94ae56cab13d
extra : amend_source : bbfe549fe0735d8b33ffff66d7eeddcc2ad042d2
This commit is contained in:
Jason Orendorff 2014-12-02 16:56:35 -06:00
parent 8e717f0295
commit 7acf3e4267
89 changed files with 572 additions and 730 deletions

View File

@ -431,8 +431,7 @@ NS_INTERFACE_MAP_END
static const JSClass sDOMConstructorProtoClass = {
"DOM Constructor.prototype", 0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
@ -2053,8 +2052,7 @@ nsWindowSH::NameStructEnabled(JSContext* aCx, nsGlobalWindow *aWin,
#ifdef USE_CONTROLLERS_SHIM
static const JSClass ControllersShimClass = {
"XULControllers", 0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
#endif

View File

@ -425,8 +425,8 @@ class CGDOMJSClass(CGThing):
resolveHook = "mozilla::dom::ResolveGlobal"
enumerateHook = "mozilla::dom::EnumerateGlobal"
else:
resolveHook = "JS_ResolveStub"
enumerateHook = "JS_EnumerateStub"
resolveHook = "nullptr"
enumerateHook = "nullptr"
return fill(
"""
@ -434,12 +434,12 @@ class CGDOMJSClass(CGThing):
{ "${name}",
${flags},
${addProperty}, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
${enumerate}, /* enumerate */
${resolve}, /* resolve */
JS_ConvertStub,
nullptr, /* convert */
${finalize}, /* finalize */
${call}, /* call */
nullptr, /* hasInstance */
@ -457,7 +457,7 @@ class CGDOMJSClass(CGThing):
""",
name=self.descriptor.interface.identifier.name,
flags=classFlags,
addProperty=ADDPROPERTY_HOOK_NAME if wantsAddProperty(self.descriptor) else 'JS_PropertyStub',
addProperty=ADDPROPERTY_HOOK_NAME if wantsAddProperty(self.descriptor) else 'nullptr',
enumerate=enumerateHook,
resolve=resolveHook,
finalize=FINALIZE_HOOK_NAME,
@ -649,13 +649,13 @@ class CGPrototypeJSClass(CGThing):
{
"${name}Prototype",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(${slotCount}),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
@ -745,13 +745,13 @@ class CGInterfaceObjectJSClass(CGThing):
{
"Function",
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(${slotCount}),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
${ctorname}, /* call */
${hasInstance}, /* hasInstance */

View File

@ -14073,13 +14073,13 @@ CreateIndexOp::DoDatabaseWork(TransactionBase* aTransaction)
const JSClass CreateIndexOp::ThreadLocalJSRuntime::kGlobalClass = {
"IndexedDBTransactionThreadGlobal",
JSCLASS_GLOBAL_FLAGS,
/* addProperty*/ JS_PropertyStub,
/* delProperty */ JS_DeletePropertyStub,
/* addProperty */ nullptr,
/* delProperty */ nullptr,
/* getProperty */ JS_PropertyStub,
/* setProperty */ JS_StrictPropertyStub,
/* enumerate */ JS_EnumerateStub,
/* resolve */ JS_ResolveStub,
/* convert */ JS_ConvertStub,
/* enumerate */ nullptr,
/* resolve */ nullptr,
/* convert */ nullptr,
/* finalize */ nullptr,
/* call */ nullptr,
/* hasInstance */ nullptr,

View File

@ -843,14 +843,10 @@ ClearStructuredCloneBuffer(JSAutoStructuredCloneBuffer& aBuffer)
const JSClass IDBObjectStore::sDummyPropJSClass = {
"IDBObjectStore Dummy",
0 /* flags */,
JS_PropertyStub /* addProperty */,
JS_DeletePropertyStub /* delProperty */,
nullptr /* addProperty */,
nullptr /* delProperty */,
JS_PropertyStub /* getProperty */,
JS_StrictPropertyStub /* setProperty */,
JS_EnumerateStub /* enumerate */,
JS_ResolveStub /* resolve */,
JS_ConvertStub /* convert */,
JSCLASS_NO_OPTIONAL_MEMBERS
JS_StrictPropertyStub /* setProperty */
};
IDBObjectStore::IDBObjectStore(IDBTransaction* aTransaction,

View File

@ -229,9 +229,9 @@ NPObjectMember_Trace(JSTracer *trc, JSObject *obj);
static const JSClass sNPObjectMemberClass =
{
"NPObject Ambiguous Member class", JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub,
JS_ResolveStub, NPObjectMember_Convert,
nullptr, nullptr,
JS_PropertyStub, JS_StrictPropertyStub, nullptr,
nullptr, NPObjectMember_Convert,
NPObjectMember_Finalize, NPObjectMember_Call,
nullptr, nullptr, NPObjectMember_Trace
};
@ -1713,16 +1713,16 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::
{
MOZ_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
// Plugins do not simply use JS_ConvertStub, and the default [[DefaultValue]]
// behavior, because that behavior involves calling toString or valueOf on
// objects which weren't designed to accommodate this. Usually this wouldn't
// be a problem, because the absence of either property, or the presence of
// either property with a value that isn't callable, will cause that property
// to simply be ignored. But there is a problem in one specific case: Java,
// specifically java.lang.Integer. The Integer class has static valueOf
// methods, none of which are nullary, so the JS-reflected method will behave
// poorly when called with no arguments. We work around this problem by
// giving plugins a [[DefaultValue]] which uses only toString and not valueOf.
// Plugins do not simply use the default [[DefaultValue]] behavior, because
// that behavior involves calling toString or valueOf on objects which
// weren't designed to accommodate this. Usually this wouldn't be a problem,
// because the absence of either property, or the presence of either property
// with a value that isn't callable, will cause that property to simply be
// ignored. But there is a problem in one specific case: Java, specifically
// java.lang.Integer. The Integer class has static valueOf methods, none of
// which are nullary, so the JS-reflected method will behave poorly when
// called with no arguments. We work around this problem by giving plugins a
// [[DefaultValue]] which uses only toString and not valueOf.
JS::Rooted<JS::Value> v(cx, JSVAL_VOID);
if (!JS_GetProperty(cx, obj, "toString", &v))

View File

@ -92,10 +92,10 @@ static const JSClass gPrototypeJSClass = {
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS |
// Our one reserved slot holds the relevant nsXBLPrototypeBinding
JSCLASS_HAS_RESERVED_SLOTS(1),
JS_PropertyStub, JS_DeletePropertyStub,
nullptr, nullptr,
JS_PropertyStub, JS_StrictPropertyStub,
XBLEnumerate, JS_ResolveStub,
JS_ConvertStub, XBLFinalize,
XBLEnumerate, nullptr,
nullptr, XBLFinalize,
nullptr, nullptr, nullptr, nullptr
};

View File

@ -924,13 +924,13 @@ const Class AsmJSModuleObject::class_ = {
"AsmJSModuleObject",
JSCLASS_IS_ANONYMOUS | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(AsmJSModuleObject::RESERVED_SLOTS),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
nullptr, /* convert */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
AsmJSModuleObject_finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -146,18 +146,10 @@ MSC_FETCHBITOP(uint32_t, long, _InterlockedAnd, _InterlockedOr, _InterlockedXor)
const Class AtomicsObject::class_ = {
"Atomics",
JSCLASS_HAS_CACHED_PROTO(JSProto_Atomics),
nullptr, // addProperty
nullptr, // delProperty
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, // finalize
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace
JS_StrictPropertyStub
};
static bool

View File

@ -559,13 +559,13 @@ static const uint32_t COLLATOR_SLOTS_COUNT = 1;
static const Class CollatorClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(COLLATOR_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
collator_finalize
};
@ -1048,13 +1048,13 @@ static const uint32_t NUMBER_FORMAT_SLOTS_COUNT = 1;
static const Class NumberFormatClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(NUMBER_FORMAT_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
numberFormat_finalize
};
@ -1505,13 +1505,13 @@ static const uint32_t DATE_TIME_FORMAT_SLOTS_COUNT = 1;
static const Class DateTimeFormatClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(DATE_TIME_FORMAT_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
dateTimeFormat_finalize
};
@ -2001,13 +2001,10 @@ js::intl_FormatDateTime(JSContext *cx, unsigned argc, Value *vp)
const Class js::IntlClass = {
js_Object_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Intl),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
#if JS_HAS_TOSOURCE

View File

@ -868,13 +868,13 @@ const Class MapIteratorObject::class_ = {
"Map Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(MapIteratorObject::SlotCount),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
MapIteratorObject::finalize
};
@ -1012,13 +1012,13 @@ const Class MapObject::class_ = {
"Map",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Map),
JS_PropertyStub, // addProperty
JS_DeletePropertyStub, // delProperty
nullptr, // addProperty
nullptr, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, // enumerate
nullptr, // resolve
nullptr, // convert
finalize,
nullptr, // call
nullptr, // hasInstance
@ -1544,13 +1544,13 @@ const Class SetIteratorObject::class_ = {
"Set Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(SetIteratorObject::SlotCount),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
SetIteratorObject::finalize
};
@ -1684,13 +1684,13 @@ const Class SetObject::class_ = {
"Set",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Set),
JS_PropertyStub, // addProperty
JS_DeletePropertyStub, // delProperty
nullptr, // addProperty
nullptr, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, // enumerate
nullptr, // resolve
nullptr, // convert
finalize,
nullptr, // call
nullptr, // hasInstance

View File

@ -1307,9 +1307,8 @@ FinishObjectClassInit(JSContext *cx, JS::HandleObject ctor, JS::HandleObject pro
self->setIntrinsicsHolder(intrinsicsHolder);
/* Define a property 'global' with the current global as its value. */
RootedValue global(cx, ObjectValue(*self));
if (!JSObject::defineProperty(cx, intrinsicsHolder, cx->names().global,
global, JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_PERMANENT | JSPROP_READONLY))
if (!JSObject::defineProperty(cx, intrinsicsHolder, cx->names().global, global,
nullptr, nullptr, JSPROP_PERMANENT | JSPROP_READONLY))
{
return false;
}
@ -1340,13 +1339,13 @@ FinishObjectClassInit(JSContext *cx, JS::HandleObject ctor, JS::HandleObject pro
const Class PlainObject::class_ = {
js_Object_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -168,17 +168,17 @@ static bool type##SignMask(JSContext *cx, unsigned argc, Value *vp) { \
const Class SimdTypeDescr::class_ = {
"SIMD",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS) | JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
TypeDescr::finalize,
call, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
call,
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr
};
@ -353,20 +353,12 @@ SimdTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
// SIMD class
const Class SIMDObject::class_ = {
"SIMD",
JSCLASS_HAS_CACHED_PROTO(JSProto_SIMD),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr
"SIMD",
JSCLASS_HAS_CACHED_PROTO(JSProto_SIMD),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
};
JSObject *

View File

@ -19,12 +19,12 @@ using namespace js;
const Class SymbolObject::class_ = {
"Symbol",
JSCLASS_HAS_RESERVED_SLOTS(RESERVED_SLOTS) | JSCLASS_HAS_CACHED_PROTO(JSProto_Symbol),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
nullptr, /* enumerate */
nullptr, /* resolve */
convert
};

View File

@ -942,13 +942,10 @@ OOMAfterAllocations(JSContext *cx, unsigned argc, jsval *vp)
static const js::Class FakePromiseClass = {
"Promise", JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
static bool
@ -994,13 +991,13 @@ finalize_counter_finalize(JSFreeOp *fop, JSObject *obj)
static const JSClass FinalizeCounterClass = {
"FinalizeCounter", JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
finalize_counter_finalize
};
@ -1536,13 +1533,13 @@ class CloneBufferObject : public NativeObject {
const Class CloneBufferObject::class_ = {
"CloneBuffer", JSCLASS_HAS_RESERVED_SLOTS(CloneBufferObject::NUM_SLOTS),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
Finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -37,13 +37,10 @@ const Class js::TypedObjectModuleObject::class_ = {
"TypedObject",
JSCLASS_HAS_RESERVED_SLOTS(SlotCount) |
JSCLASS_HAS_CACHED_PROTO(JSProto_TypedObject),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
static const JSFunctionSpec TypedObjectMethods[] = {
@ -210,18 +207,10 @@ GetPrototype(JSContext *cx, HandleObject obj)
const Class js::TypedProto::class_ = {
"TypedProto",
JSCLASS_HAS_RESERVED_SLOTS(JS_TYPROTO_SLOTS),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr
JS_StrictPropertyStub /* setProperty */
};
/***************************************************************************
@ -236,18 +225,15 @@ const Class js::TypedProto::class_ = {
const Class js::ScalarTypeDescr::class_ = {
"Scalar",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS) | JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
TypeDescr::finalize,
ScalarTypeDescr::call,
nullptr,
nullptr,
nullptr
ScalarTypeDescr::call
};
const JSFunctionSpec js::ScalarTypeDescr::typeObjectMethods[] = {
@ -336,18 +322,15 @@ ScalarTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
const Class js::ReferenceTypeDescr::class_ = {
"Reference",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS) | JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
TypeDescr::finalize,
ReferenceTypeDescr::call,
nullptr,
nullptr,
nullptr
ReferenceTypeDescr::call
};
const JSFunctionSpec js::ReferenceTypeDescr::typeObjectMethods[] = {
@ -518,13 +501,13 @@ CreatePrototypeObjectForComplexTypeInstance(JSContext *cx,
const Class ArrayTypeDescr::class_ = {
"ArrayType",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS) | JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub,
JS_DeletePropertyStub,
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
TypeDescr::finalize,
nullptr,
nullptr,
@ -752,13 +735,13 @@ js::IsTypedObjectArray(JSObject &obj)
const Class StructTypeDescr::class_ = {
"StructType",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS) | JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub,
JS_DeletePropertyStub,
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
TypeDescr::finalize,
nullptr, /* call */
nullptr, /* hasInstance */
@ -2438,13 +2421,13 @@ LazyArrayBufferTable::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf)
const Class Name::class_ = { \
# Name, \
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS, \
JS_PropertyStub, \
JS_DeletePropertyStub, \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, \
JS_StrictPropertyStub, \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \

View File

@ -25,13 +25,10 @@ const Class WeakSetObject::class_ = {
"WeakSet",
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_CACHED_PROTO(JSProto_WeakSet) |
JSCLASS_HAS_RESERVED_SLOTS(WeakSetObject::RESERVED_SLOTS),
JS_PropertyStub, // addProperty
JS_DeletePropertyStub, // delProperty
nullptr, // addProperty
nullptr, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub // setProperty
};
const JSPropertySpec WeakSetObject::properties[] = {

View File

@ -514,15 +514,13 @@ namespace UInt64 {
static const JSClass sCTypesGlobalClass = {
"ctypes",
JSCLASS_HAS_RESERVED_SLOTS(CTYPESGLOBAL_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
static const JSClass sCABIClass = {
"CABI",
JSCLASS_HAS_RESERVED_SLOTS(CABI_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
// Class representing ctypes.{C,Pointer,Array,Struct,Function}Type.prototype.
@ -531,8 +529,8 @@ static const JSClass sCABIClass = {
static const JSClass sCTypeProtoClass = {
"CType",
JSCLASS_HAS_RESERVED_SLOTS(CTYPEPROTO_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
ConstructAbstract, nullptr, ConstructAbstract
};
@ -541,15 +539,14 @@ static const JSClass sCTypeProtoClass = {
static const JSClass sCDataProtoClass = {
"CData",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
static const JSClass sCTypeClass = {
"CType",
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CTYPE_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::Finalize,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, CType::Finalize,
CType::ConstructData, CType::HasInstance, CType::ConstructData,
CType::Trace
};
@ -557,16 +554,16 @@ static const JSClass sCTypeClass = {
static const JSClass sCDataClass = {
"CData",
JSCLASS_HAS_RESERVED_SLOTS(CDATA_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, ArrayType::Getter, ArrayType::Setter,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CData::Finalize,
nullptr, nullptr, ArrayType::Getter, ArrayType::Setter,
nullptr, nullptr, nullptr, CData::Finalize,
FunctionType::Call, nullptr, FunctionType::Call
};
static const JSClass sCClosureClass = {
"CClosure",
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CCLOSURE_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CClosure::Finalize,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, CClosure::Finalize,
nullptr, nullptr, nullptr, CClosure::Trace
};
@ -576,8 +573,7 @@ static const JSClass sCClosureClass = {
static const JSClass sCDataFinalizerProtoClass = {
"CDataFinalizer",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
/*
@ -589,8 +585,8 @@ static const JSClass sCDataFinalizerProtoClass = {
static const JSClass sCDataFinalizerClass = {
"CDataFinalizer",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(CDATAFINALIZER_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CDataFinalizer::Finalize,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, CDataFinalizer::Finalize,
};
@ -765,29 +761,27 @@ static const JSFunctionSpec sFunctionInstanceFunctions[] = {
static const JSClass sInt64ProtoClass = {
"Int64",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
static const JSClass sUInt64ProtoClass = {
"UInt64",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
static const JSClass sInt64Class = {
"Int64",
JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, Int64Base::Finalize
};
static const JSClass sUInt64Class = {
"UInt64",
JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, Int64Base::Finalize
};
static const JSFunctionSpec sInt64StaticFunctions[] = {

View File

@ -34,8 +34,8 @@ typedef Rooted<JSFlatString*> RootedFlatString;
static const JSClass sLibraryClass = {
"Library",
JSCLASS_HAS_RESERVED_SLOTS(LIBRARY_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub,JS_ResolveStub, JS_ConvertStub, Library::Finalize
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, Library::Finalize
};
#define CTYPESFN_FLAGS \

View File

@ -15,9 +15,9 @@ using namespace JS;
/* The class of the global object. */
const JSClass global_class = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};

View File

@ -3390,7 +3390,7 @@ CheckHasNoSuchProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
return false;
// Don't handle proto chains with resolve hooks.
if (curObj->getClass()->resolve != JS_ResolveStub)
if (curObj->getClass()->resolve)
return false;
Shape *shape = curObj->as<NativeObject>().lookup(cx, NameToId(name));
@ -3539,8 +3539,8 @@ IsCacheableSetPropAddSlot(JSContext *cx, HandleObject obj, HandleShape oldShape,
return false;
}
// If object has a non-default resolve hook, don't inline
if (obj->getClass()->resolve != JS_ResolveStub)
// If object has a resolve hook, don't inline
if (obj->getClass()->resolve)
return false;
size_t chainDepth = 0;
@ -3559,7 +3559,7 @@ IsCacheableSetPropAddSlot(JSContext *cx, HandleObject obj, HandleShape oldShape,
// Otherise, if there's no such property, watch out for a resolve hook that would need
// to be invoked and thus prevent inlining of property addition.
if (proto->getClass()->resolve != JS_ResolveStub)
if (proto->getClass()->resolve)
return false;
}

View File

@ -6605,7 +6605,7 @@ ClassHasResolveHook(CompileCompartment *comp, const Class *clasp, PropertyName *
if (clasp == &ArrayObject::class_)
return name == comp->runtime()->names().length;
if (clasp->resolve == JS_ResolveStub)
if (!clasp->resolve)
return false;
if (clasp->resolve == str_resolve) {

View File

@ -2731,13 +2731,12 @@ IsPropertyAddInlineable(NativeObject *obj, HandleId id, ConstantOrRegister val,
// the shape must be the one we just added.
MOZ_ASSERT(shape == obj->lastProperty());
// If object has a non-default resolve hook, don't inline
if (obj->getClass()->resolve != JS_ResolveStub)
// If object has a resolve hook, don't inline
if (obj->getClass()->resolve)
return false;
// Likewise for a non-default addProperty hook, since we'll need
// to invoke it.
if (obj->getClass()->addProperty != JS_PropertyStub)
// Likewise for an addProperty hook, since we'll need to invoke it.
if (obj->getClass()->addProperty)
return false;
if (!obj->nonProxyIsExtensible() || !shape->writable())
@ -2759,7 +2758,7 @@ IsPropertyAddInlineable(NativeObject *obj, HandleId id, ConstantOrRegister val,
// Otherwise, if there's no such property, watch out for a resolve
// hook that would need to be invoked and thus prevent inlining of
// property addition.
if (proto->getClass()->resolve != JS_ResolveStub)
if (proto->getClass()->resolve)
return false;
}

View File

@ -20,12 +20,9 @@ static const JSClass AddPropertyClass = {
"AddPropertyTester",
0,
AddProperty,
JS_DeletePropertyStub, /* delProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
BEGIN_TEST(testAddPropertyHook)

View File

@ -9,13 +9,10 @@ using namespace JS;
static const JSClass CustomClass = {
"CustomClass",
JSCLASS_HAS_RESERVED_SLOTS(1),
nullptr,
nullptr,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub
};
static const uint32_t CUSTOM_SLOT = 0;

View File

@ -11,13 +11,13 @@ static TestJSPrincipals system_principals(1);
static const JSClass global_class = {
"global",
JSCLASS_IS_GLOBAL | JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub,
JS_DeletePropertyStub,
nullptr,
nullptr,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,

View File

@ -25,13 +25,10 @@ static const JSClass ptestClass = {
"PTest",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, // add
JS_DeletePropertyStub, // delete
nullptr, // add
nullptr, // delete
test_prop_get, // get
JS_StrictPropertyStub, // set
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub // set
};
static bool

View File

@ -23,8 +23,8 @@ BEGIN_TEST(testRedefineGlobalEval)
{
static const JSClass cls = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
GlobalEnumerate, GlobalResolve, JS_ConvertStub,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
GlobalEnumerate, GlobalResolve, nullptr,
nullptr, nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};

View File

@ -40,13 +40,10 @@ END_TEST(testLookup_bug522590)
static const JSClass DocumentAllClass = {
"DocumentAll",
JSCLASS_EMULATES_UNDEFINED,
nullptr,
nullptr,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub
};
bool
@ -83,8 +80,8 @@ document_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *res
static const JSClass document_class = {
"document", 0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, document_resolve, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, document_resolve, nullptr
};
BEGIN_TEST(testLookup_bug570195)

View File

@ -96,8 +96,8 @@ BEGIN_TEST(testNewObject_1)
static const JSClass cls = {
"testNewObject_1",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, constructHook
};
JS::RootedObject ctor(cx, JS_NewObject(cx, &cls, JS::NullPtr(), JS::NullPtr()));

View File

@ -7,13 +7,10 @@
static const JSClass ObjectEmulatingUndefinedClass = {
"ObjectEmulatingUndefined",
JSCLASS_EMULATES_UNDEFINED,
nullptr,
nullptr,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub
};
static bool

View File

@ -22,8 +22,8 @@ my_convert(JSContext* context, JS::HandleObject obj, JSType type, JS::MutableHan
static const JSClass myClass = {
"MyClass",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, my_convert
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, my_convert
};
static bool

View File

@ -22,13 +22,13 @@ int BarkWhenTracedClass::traceCount;
const JSClass BarkWhenTracedClass::class_ = {
"BarkWhenTracedClass", 0,
JS_PropertyStub,
JS_DeletePropertyStub,
nullptr,
nullptr,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr,
nullptr,
finalize,
nullptr,
nullptr,

View File

@ -26,8 +26,7 @@ reset(JSContext *cx)
}
static const JSClass ptestClass = {
"Prof", 0, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub,
JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
"Prof", 0, nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
static bool

View File

@ -19,8 +19,7 @@ CounterAdd(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHand
static const JSClass CounterClass = {
"Counter", /* name */
0, /* flags */
CounterAdd, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
CounterAdd, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
BEGIN_TEST(testPropCache_bug505798)

View File

@ -17,13 +17,12 @@ BEGIN_TEST(testResolveRecursion)
static const JSClass my_resolve_class = {
"MyResolve",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, // add
JS_DeletePropertyStub, // delete
nullptr, // add
nullptr, // delete
JS_PropertyStub, // get
JS_StrictPropertyStub, // set
JS_EnumerateStub,
my_resolve,
JS_ConvertStub
nullptr,
my_resolve
};
obj1 = obj2 = nullptr;

View File

@ -68,7 +68,7 @@ BEGIN_TEST(testSetProperty_InheritedGlobalSetter)
// This is a JSAPI test because jsapi-test globals do not have a resolve
// hook and therefore can use the property cache in some cases where the
// shell can't.
MOZ_ASSERT(JS_GetClass(global)->resolve == &JS_ResolveStub);
MOZ_ASSERT(!JS_GetClass(global)->resolve);
CHECK(JS_DefineProperty(cx, global, "HOTLOOP", 8, 0));
EXEC("var n = 0;\n"

View File

@ -142,14 +142,14 @@ JSObject *newKey()
static const js::Class keyClass = {
"keyWithDelgate",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr,
nullptr,
nullptr,
@ -202,14 +202,14 @@ JSObject *newDelegate()
static const js::Class delegateClass = {
"delegate",
JSCLASS_GLOBAL_FLAGS | JSCLASS_HAS_RESERVED_SLOTS(1),
JS_PropertyStub,
JS_DeletePropertyStub,
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr,
nullptr,
nullptr,

View File

@ -228,8 +228,8 @@ class JSAPITest
static const JSClass * basicGlobalClass() {
static const JSClass c = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};

View File

@ -2143,28 +2143,18 @@ JS_StrictPropertyStub(JSContext *cx, HandleObject obj, HandleId id, bool strict,
return true;
}
JS_PUBLIC_API(bool)
JS_DeletePropertyStub(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
{
*succeeded = true;
return true;
}
JS_PUBLIC_API(bool)
JS_EnumerateStub(JSContext *cx, HandleObject obj)
{
return true;
}
#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 4
/* See comment in jsapi.h. */
JS_PUBLIC_API(bool)
JS_ResolveStub(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp)
{
MOZ_ASSERT(*resolvedp == false);
return true;
}
#endif /* GCC 4.4 */
JS_PUBLIC_API(bool)
JS_ConvertStub(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue vp)
JS::OrdinaryToPrimitive(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue vp)
{
MOZ_ASSERT(type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION);
MOZ_ASSERT(obj);
@ -2819,7 +2809,6 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
MOZ_ASSERT_IF(setter == JS_StrictPropertyStub,
getter == JS_PropertyStub || (attrs & JSPROP_PROPOP_ACCESSORS));
// If !(attrs & JSPROP_PROPOP_ACCESSORS), then either getter/setter are both
// possibly-null JSNatives (or possibly-null JSFunction* if JSPROP_GETTER or
// JSPROP_SETTER is appropriately set), or both are the well-known property

View File

@ -1158,6 +1158,17 @@ ToString(JSContext *cx, HandleValue v)
return js::ToStringSlow(cx, v);
}
/*
* Implements ES6 draft rev 28 (2014 Oct 14) 7.1.1, second algorithm.
*
* Most users should not call this -- use JS::ToNumber, ToBoolean, or ToString
* instead. This should only be called from custom convert hooks. It implements
* the default conversion behavior shared by most objects in JS, so it's useful
* as a fallback.
*/
extern JS_PUBLIC_API(bool)
OrdinaryToPrimitive(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue vp);
} /* namespace JS */
extern JS_PUBLIC_API(bool)
@ -2367,19 +2378,16 @@ extern JS_PUBLIC_API(bool)
JS_StrictPropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool strict,
JS::MutableHandleValue vp);
extern JS_PUBLIC_API(bool)
JS_DeletePropertyStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
bool *succeeded);
extern JS_PUBLIC_API(bool)
JS_EnumerateStub(JSContext *cx, JS::HandleObject obj);
#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 4
/*
* This is here because GCC 4.4 for Android ICS can't compile the JS engine
* without it. The function is unused, but if you delete it, we'll trigger a
* compiler bug. When we no longer support ICS, this can be deleted.
* See bug 1103152.
*/
extern JS_PUBLIC_API(bool)
JS_ResolveStub(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool *resolvedp);
extern JS_PUBLIC_API(bool)
JS_ConvertStub(JSContext *cx, JS::HandleObject obj, JSType type,
JS::MutableHandleValue vp);
#endif /* GCC 4.4 */
template<typename T>
struct JSConstScalarSpec {

View File

@ -2785,12 +2785,8 @@ GetIndexedPropertiesInRange(JSContext *cx, HandleObject obj, uint32_t begin, uin
// properties.
JSObject *pobj = obj;
do {
if (!pobj->isNative() ||
pobj->getClass()->resolve != JS_ResolveStub ||
pobj->getOps()->lookupGeneric)
{
if (!pobj->isNative() || pobj->getClass()->resolve || pobj->getOps()->lookupGeneric)
return true;
}
} while ((pobj = pobj->getProto()));
// Collect indexed property names.
@ -3364,17 +3360,17 @@ const Class ArrayObject::class_ = {
"Array",
JSCLASS_HAS_CACHED_PROTO(JSProto_Array),
array_addProperty,
JS_DeletePropertyStub, /* delProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr, /* trace */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr, /* trace */
{
GenericCreateConstructor<js_Array, 1, JSFunction::FinalizeKind>,
CreateArrayPrototype,

View File

@ -28,13 +28,10 @@ using namespace js::types;
const Class BooleanObject::class_ = {
"Boolean",
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Boolean),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
MOZ_ALWAYS_INLINE bool

View File

@ -322,7 +322,10 @@ CallJSDeletePropertyOp(JSContext *cx, JSDeletePropertyOp op, HandleObject receiv
JS_CHECK_RECURSION(cx, return false);
assertSameCompartment(cx, receiver, id);
return op(cx, receiver, id, succeeded);
if (op)
return op(cx, receiver, id, succeeded);
*succeeded = true;
return true;
}
inline bool

View File

@ -3020,12 +3020,12 @@ const Class DateObject::class_ = {
js_Date_str,
JSCLASS_HAS_RESERVED_SLOTS(RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_Date),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
nullptr, /* enumerate */
nullptr, /* resolve */
date_convert,
nullptr, /* finalize */
nullptr, /* call */

View File

@ -65,13 +65,13 @@ static const JSFunctionSpec exception_methods[] = {
JSCLASS_IMPLEMENTS_BARRIERS | \
JSCLASS_HAS_CACHED_PROTO(JSProto_##name) | \
JSCLASS_HAS_RESERVED_SLOTS(ErrorObject::RESERVED_SLOTS), \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
exn_finalize, \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
@ -95,13 +95,13 @@ ErrorObject::classes[JSEXN_LIMIT] = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Error) |
JSCLASS_HAS_RESERVED_SLOTS(ErrorObject::RESERVED_SLOTS),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
exn_finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -278,12 +278,12 @@ namespace js {
JSCLASS_IS_PROXY | \
JSCLASS_IMPLEMENTS_BARRIERS | \
flags, \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
JS_EnumerateStub, \
JS_ResolveStub, \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
js::proxy_Convert, \
js::proxy_Finalize, /* finalize */ \
nullptr, /* call */ \

View File

@ -894,13 +894,13 @@ const Class JSFunction::class_ = {
js_Function_str,
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Function),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
fun_enumerate,
js::fun_resolve,
JS_ConvertStub,
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
fun_hasInstance,

View File

@ -2363,8 +2363,7 @@ types::UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, const Class *c
static inline bool
ClassCanHaveExtraProperties(const Class *clasp)
{
MOZ_ASSERT(clasp->resolve);
return clasp->resolve != JS_ResolveStub
return clasp->resolve
|| clasp->ops.lookupGeneric
|| clasp->ops.getGeneric
|| IsAnyTypedArrayClass(clasp);

View File

@ -286,8 +286,10 @@ Snapshot(JSContext *cx, HandleObject pobj_, unsigned flags, AutoIdVector *props)
!pobj->getOps()->enumerate &&
!(clasp->flags & JSCLASS_NEW_ENUMERATE))
{
if (!clasp->enumerate(cx, pobj.as<NativeObject>()))
return false;
if (JSEnumerateOp enumerate = clasp->enumerate) {
if (!enumerate(cx, pobj.as<NativeObject>()))
return false;
}
if (!EnumerateNativeProperties(cx, pobj.as<NativeObject>(), flags, ht, props))
return false;
} else {
@ -719,7 +721,7 @@ js::GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleOb
IsAnyTypedArray(pobj) ||
pobj->hasUncacheableProto() ||
pobj->getOps()->enumerate ||
pobj->getClass()->enumerate != JS_EnumerateStub ||
pobj->getClass()->enumerate ||
pobj->as<NativeObject>().containsPure(cx->names().iteratorIntrinsic))
{
shapes.clear();
@ -917,13 +919,13 @@ const Class PropertyIteratorObject::class_ = {
JSCLASS_HAS_CACHED_PROTO(JSProto_Iterator) |
JSCLASS_HAS_PRIVATE |
JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
finalize,
nullptr, /* call */
nullptr, /* hasInstance */
@ -942,14 +944,10 @@ const Class ArrayIteratorObject::class_ = {
"Array Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(ArrayIteratorSlotCount),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr /* finalize */
JS_StrictPropertyStub /* setProperty */
};
static const JSFunctionSpec array_iterator_methods[] = {
@ -961,14 +959,10 @@ static const JSFunctionSpec array_iterator_methods[] = {
static const Class StringIteratorPrototypeClass = {
"String Iterator",
JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr /* finalize */
JS_StrictPropertyStub /* setProperty */
};
enum {
@ -981,14 +975,10 @@ const Class StringIteratorObject::class_ = {
"String Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(StringIteratorSlotCount),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr /* finalize */
JS_StrictPropertyStub /* setProperty */
};
static const JSFunctionSpec string_iterator_methods[] = {
@ -1315,13 +1305,13 @@ stopiter_hasInstance(JSContext *cx, HandleObject obj, MutableHandleValue v, bool
const Class StopIterationObject::class_ = {
"StopIteration",
JSCLASS_HAS_CACHED_PROTO(JSProto_StopIteration),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
stopiter_hasInstance,

View File

@ -79,13 +79,10 @@ MathCache::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf)
const Class js::MathClass = {
js_Math_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Math),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
bool

View File

@ -464,13 +464,10 @@ static const JSFunctionSpec number_functions[] = {
const Class NumberObject::class_ = {
js_Number_str,
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Number),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
static bool

View File

@ -2591,14 +2591,10 @@ js_InitClass(JSContext *cx, HandleObject obj, JSObject *protoProto_,
{
RootedObject protoProto(cx, protoProto_);
/* Assert mandatory function pointer members. */
MOZ_ASSERT(clasp->addProperty);
MOZ_ASSERT(clasp->delProperty);
/* Check function pointer members. */
MOZ_ASSERT(clasp->addProperty != JS_PropertyStub); // (use null instead)
MOZ_ASSERT(clasp->getProperty);
MOZ_ASSERT(clasp->setProperty);
MOZ_ASSERT(clasp->enumerate);
MOZ_ASSERT(clasp->resolve);
MOZ_ASSERT(clasp->convert);
RootedAtom atom(cx, Atomize(cx, clasp->name, strlen(clasp->name)));
if (!atom)
@ -3153,8 +3149,7 @@ LookupPropertyPureInline(ThreadSafeContext *cx, JSObject *obj, jsid id, NativeOb
// with a non-integer property.
do {
const Class *clasp = current->getClass();
MOZ_ASSERT(clasp->resolve);
if (clasp->resolve == JS_ResolveStub)
if (!clasp->resolve)
break;
if (clasp->resolve == fun_resolve && !FunctionHasResolveHook(cx->names(), id))
break;
@ -3526,13 +3521,13 @@ JS_EnumerateState(JSContext *cx, HandleObject obj, JSIterateOp enum_op,
/* If the class has a custom JSCLASS_NEW_ENUMERATE hook, call it. */
const Class *clasp = obj->getClass();
JSEnumerateOp enumerate = clasp->enumerate;
if (clasp->flags & JSCLASS_NEW_ENUMERATE) {
MOZ_ASSERT(enumerate != JS_EnumerateStub);
return ((JSNewEnumerateOp) enumerate)(cx, obj, enum_op, statep, idp);
}
if (enumerate) {
if (clasp->flags & JSCLASS_NEW_ENUMERATE)
return ((JSNewEnumerateOp) enumerate)(cx, obj, enum_op, statep, idp);
if (!enumerate(cx, obj))
return false;
if (!enumerate(cx, obj))
return false;
}
/* Tell InitNativeIterator to treat us like a native object. */
MOZ_ASSERT(enum_op == JSENUMERATE_INIT || enum_op == JSENUMERATE_INIT_ALL);
@ -4113,7 +4108,7 @@ JSObject::hasIdempotentProtoChain() const
return false;
JSResolveOp resolve = obj->getClass()->resolve;
if (resolve != JS_ResolveStub && resolve != js::fun_resolve && resolve != js::str_resolve)
if (resolve && resolve != js::fun_resolve && resolve != js::str_resolve)
return false;
if (obj->getOps()->lookupProperty || obj->getOps()->lookupGeneric || obj->getOps()->lookupElement)

View File

@ -686,7 +686,7 @@ class JSObject : public js::gc::Cell
{
JSConvertOp op = obj->getClass()->convert;
bool ok;
if (op == JS_ConvertStub)
if (!op)
ok = js::DefaultValue(cx, obj, hint, vp);
else
ok = op(cx, obj, hint, vp);

View File

@ -38,13 +38,10 @@ using mozilla::RangedPtr;
const Class js::JSONClass = {
js_JSON_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_JSON),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
static inline bool

View File

@ -1348,13 +1348,13 @@ const Class ScriptSourceObject::class_ = {
"ScriptSource",
JSCLASS_HAS_RESERVED_SLOTS(RESERVED_SLOTS) |
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -426,13 +426,12 @@ const Class StringObject::class_ = {
js_String_str,
JSCLASS_HAS_RESERVED_SLOTS(StringObject::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_String),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
str_enumerate,
str_resolve,
JS_ConvertStub
str_resolve
};
/*

View File

@ -612,13 +612,13 @@ const Class WeakMapObject::class_ = {
"WeakMap",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_WeakMap),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
WeakMap_finalize,
nullptr, /* call */
nullptr, /* construct */

View File

@ -161,8 +161,8 @@ static void pm_finalize(JSFreeOp* fop, JSObject* obj);
static const JSClass pm_class = {
"PerfMeasurement", JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, pm_finalize
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, pm_finalize
};
// Constructor and destructor

View File

@ -1020,13 +1020,13 @@ static const uint32_t CacheEntry_BYTECODE = 1;
static const JSClass CacheEntry_class = {
"CacheEntryObject", JSCLASS_HAS_RESERVED_SLOTS(2),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
@ -2569,10 +2569,10 @@ sandbox_resolve(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp)
static const JSClass sandbox_class = {
"sandbox",
JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub,
nullptr, nullptr,
JS_PropertyStub, JS_StrictPropertyStub,
sandbox_enumerate, sandbox_resolve,
JS_ConvertStub, nullptr,
nullptr, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};
@ -3962,13 +3962,10 @@ ObjectEmulatingUndefined(JSContext *cx, unsigned argc, jsval *vp)
static const JSClass cls = {
"ObjectEmulatingUndefined",
JSCLASS_EMULATES_UNDEFINED,
nullptr,
nullptr,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub
};
RootedObject obj(cx, JS_NewObject(cx, &cls, JS::NullPtr(), JS::NullPtr()));
@ -4785,10 +4782,10 @@ global_resolve(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp)
static const JSClass global_class = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub,
nullptr, nullptr,
JS_PropertyStub, JS_StrictPropertyStub,
global_enumerate, global_resolve,
JS_ConvertStub, nullptr,
nullptr, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};
@ -4902,13 +4899,13 @@ static const JSFunctionSpec dom_methods[] = {
static const JSClass dom_class = {
"FakeDOMObject", JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(2),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -570,13 +570,13 @@ const Class NormalArgumentsObject::class_ = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(NormalArgumentsObject::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_Object) | JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub, /* addProperty */
nullptr, /* addProperty */
args_delProperty,
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
args_enumerate,
args_resolve,
JS_ConvertStub,
nullptr, /* convert */
ArgumentsObject::finalize,
nullptr, /* call */
nullptr, /* hasInstance */
@ -594,13 +594,13 @@ const Class StrictArgumentsObject::class_ = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(StrictArgumentsObject::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_Object) | JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub, /* addProperty */
nullptr, /* addProperty */
args_delProperty,
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
strictargs_enumerate,
strictargs_resolve,
JS_ConvertStub,
nullptr, /* convert */
ArgumentsObject::finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -95,13 +95,10 @@ js::ToClampedIndex(JSContext *cx, HandleValue v, uint32_t length, uint32_t *out)
const Class ArrayBufferObject::protoClass = {
"ArrayBufferPrototype",
JSCLASS_HAS_CACHED_PROTO(JSProto_ArrayBuffer),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
const Class ArrayBufferObject::class_ = {
@ -110,13 +107,13 @@ const Class ArrayBufferObject::class_ = {
JSCLASS_HAS_RESERVED_SLOTS(RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_ArrayBuffer) |
JSCLASS_BACKGROUND_FINALIZE,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
ArrayBufferObject::finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -2341,8 +2341,8 @@ const Class Debugger::jsclass = {
"Debugger",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUG_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Debugger::finalize,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, Debugger::finalize,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
@ -3821,8 +3821,8 @@ const Class DebuggerScript_class = {
"Script",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGSCRIPT_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
@ -4775,8 +4775,8 @@ const Class DebuggerSource_class = {
"Source",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGSOURCE_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
@ -5121,8 +5121,8 @@ DebuggerFrame_finalize(FreeOp *fop, JSObject *obj)
const Class DebuggerFrame_class = {
"Frame", JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGFRAME_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, DebuggerFrame_finalize
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, DebuggerFrame_finalize
};
static NativeObject *
@ -5340,8 +5340,7 @@ DebuggerFrame_getOlder(JSContext *cx, unsigned argc, Value *vp)
const Class DebuggerArguments_class = {
"Arguments", JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGARGUMENTS_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
/* The getter used for each element of frame.arguments. See DebuggerFrame_getArguments. */
@ -5854,8 +5853,8 @@ const Class DebuggerObject_class = {
"Object",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGOBJECT_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
@ -6762,8 +6761,8 @@ const Class DebuggerEnv_class = {
"Environment",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGENV_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */

View File

@ -72,13 +72,10 @@ DebuggerMemory::construct(JSContext *cx, unsigned argc, Value *vp)
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_COUNT),
JS_PropertyStub, // addProperty
JS_DeletePropertyStub, // delProperty
nullptr, // addProperty
nullptr, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub, // enumerate
JS_ResolveStub, // resolve
JS_ConvertStub, // convert
JS_StrictPropertyStub // setProperty
};
/* static */ DebuggerMemory *

View File

@ -203,35 +203,19 @@ LegacyGeneratorObject::close(JSContext *cx, HandleObject obj)
const Class LegacyGeneratorObject::class_ = {
"Generator",
JSCLASS_HAS_RESERVED_SLOTS(GeneratorObject::RESERVED_SLOTS),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr, /* trace */
JS_StrictPropertyStub /* setProperty */
};
const Class StarGeneratorObject::class_ = {
"Generator",
JSCLASS_HAS_RESERVED_SLOTS(GeneratorObject::RESERVED_SLOTS),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr, /* trace */
JS_StrictPropertyStub /* setProperty */
};
static const JSFunctionSpec star_generator_methods[] = {

View File

@ -462,8 +462,8 @@ GlobalDebuggees_finalize(FreeOp *fop, JSObject *obj)
static const Class
GlobalDebuggees_class = {
"GlobalDebuggee", JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, GlobalDebuggees_finalize
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, GlobalDebuggees_finalize
};
GlobalObject::DebuggerVector *

View File

@ -176,10 +176,9 @@ js::CancelOffThreadIonCompile(JSCompartment *compartment, JSScript *script)
static const JSClass parseTaskGlobalClass = {
"internal-parse-task-global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub,
nullptr, nullptr,
JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub,
JS_ConvertStub, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};

View File

@ -142,8 +142,7 @@ static const uint32_t JSSLOT_SAVED_ID = 1;
static const Class js_NoSuchMethodClass = {
"NoSuchMethod",
JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
/*

View File

@ -536,7 +536,13 @@ LookupOwnPropertyInline(ExclusiveContext *cx,
}
// id was not found in obj. Try obj's resolve hook, if any.
if (obj->getClass()->resolve != JS_ResolveStub) {
if (obj->getClass()->resolve
#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 4
// Workaround. See the comment on JS_ResolveStub in jsapi.h.
&& obj->getClass()->resolve != JS_ResolveStub
#endif
)
{
if (!cx->shouldBeJSContext() || !allowGC)
return false;

View File

@ -1065,7 +1065,9 @@ CallAddPropertyHook(typename ExecutionModeTraits<mode>::ExclusiveContextType cxA
const Class *clasp, HandleNativeObject obj, HandleShape shape,
HandleValue nominal)
{
if (clasp->addProperty != JS_PropertyStub) {
if (clasp->addProperty) {
MOZ_ASSERT(clasp->addProperty != JS_PropertyStub);
if (mode == ParallelExecution)
return false;
@ -1112,7 +1114,9 @@ CallAddPropertyHookDense(typename ExecutionModeTraits<mode>::ExclusiveContextTyp
return true;
}
if (clasp->addProperty != JS_PropertyStub) {
if (clasp->addProperty) {
MOZ_ASSERT(clasp->addProperty != JS_PropertyStub);
if (mode == ParallelExecution)
return false;

View File

@ -302,8 +302,8 @@ ForOfPIC_traceObject(JSTracer *trc, JSObject *obj)
const Class ForOfPIC::jsclass = {
"ForOfPIC", JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, ForOfPIC_finalize,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, ForOfPIC_finalize,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */

View File

@ -264,13 +264,13 @@ const Class RegExpObject::class_ = {
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(RegExpObject::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_RegExp),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub, /* enumerate */
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -38,13 +38,13 @@ resc_trace(JSTracer *trc, JSObject *obj)
const Class RegExpStaticsObject::class_ = {
"RegExpStatics",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
resc_finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -141,14 +141,13 @@ SavedFrame::HashPolicy::rekey(Key &key, const Key &newKey)
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(SavedFrame::JSSLOT_COUNT),
JS_PropertyStub, // addProperty
JS_DeletePropertyStub, // delProperty
nullptr, // addProperty
nullptr, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub, // enumerate
JS_ResolveStub, // resolve
JS_ConvertStub, // convert
nullptr, // enumerate
nullptr, // resolve
nullptr, // convert
SavedFrame::finalize // finalize
};

View File

@ -292,26 +292,20 @@ CallObject::createForStrictEval(JSContext *cx, AbstractFramePtr frame)
const Class CallObject::class_ = {
"Call",
JSCLASS_IS_ANONYMOUS | JSCLASS_HAS_RESERVED_SLOTS(CallObject::RESERVED_SLOTS),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
nullptr /* convert: Leave it nullptr so we notice if calls ever escape */
JS_StrictPropertyStub /* setProperty */
};
const Class DeclEnvObject::class_ = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(DeclEnvObject::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
/*
@ -588,26 +582,23 @@ const Class StaticWithObject::class_ = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(StaticWithObject::RESERVED_SLOTS) |
JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
const Class DynamicWithObject::class_ = {
"With",
JSCLASS_HAS_RESERVED_SLOTS(DynamicWithObject::RESERVED_SLOTS) |
JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
@ -745,13 +736,10 @@ const Class BlockObject::class_ = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(BlockObject::RESERVED_SLOTS) |
JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
template<XDRMode mode>
@ -1041,13 +1029,13 @@ const Class UninitializedLexicalObject::class_ = {
"UninitializedLexical",
JSCLASS_HAS_RESERVED_SLOTS(UninitializedLexicalObject::RESERVED_SLOTS) |
JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -51,10 +51,9 @@ selfHosting_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep
static const JSClass self_hosting_global_class = {
"self-hosting-global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub,
nullptr, nullptr,
JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub,
JS_ConvertStub, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};

View File

@ -300,13 +300,10 @@ SharedArrayBufferObject::addSizeOfExcludingThis(JSObject *obj, mozilla::MallocSi
const Class SharedArrayBufferObject::protoClass = {
"SharedArrayBufferPrototype",
JSCLASS_HAS_CACHED_PROTO(JSProto_SharedArrayBuffer),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
const Class SharedArrayBufferObject::class_ = {
@ -314,13 +311,13 @@ const Class SharedArrayBufferObject::class_ = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(SharedArrayBufferObject::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_SharedArrayBuffer),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
SharedArrayBufferObject::Finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -704,13 +704,13 @@ IMPL_SHARED_TYPED_ARRAY_COMBINED_UNWRAPPERS(Float64, double, double)
JSCLASS_HAS_RESERVED_SLOTS(SharedTypedArrayObject::RESERVED_SLOTS) | \
JSCLASS_HAS_PRIVATE | \
JSCLASS_HAS_CACHED_PROTO(JSProto_Shared##_typedArray), \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
@ -725,13 +725,13 @@ IMPL_SHARED_TYPED_ARRAY_COMBINED_UNWRAPPERS(Float64, double, double)
JSCLASS_HAS_RESERVED_SLOTS(SharedTypedArrayObject::RESERVED_SLOTS) | \
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | \
JSCLASS_HAS_CACHED_PROTO(JSProto_Shared##_typedArray), \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \

View File

@ -806,13 +806,13 @@ TypedArrayObject::sharedTypedArrayPrototypeClass = {
// until we implement @@toStringTag.
"???",
JSCLASS_HAS_CACHED_PROTO(JSProto_TypedArray),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
@ -1765,13 +1765,13 @@ IMPL_TYPED_ARRAY_COMBINED_UNWRAPPERS(Float64, double, double)
JSCLASS_HAS_RESERVED_SLOTS(TypedArrayLayout::RESERVED_SLOTS) | \
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | \
JSCLASS_HAS_CACHED_PROTO(JSProto_##_typedArray), \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
@ -1810,18 +1810,18 @@ const Class TypedArrayObject::classes[Scalar::MaxTypedArrayViewType] = {
*/ \
#typedArray "Prototype", \
JSCLASS_HAS_CACHED_PROTO(JSProto_##typedArray), \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
nullptr, /* construct */ \
nullptr, /* trace */ \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
nullptr, /* construct */ \
nullptr, /* trace */ \
{ \
typedArray::createConstructor, \
typedArray::createPrototype, \
@ -1856,13 +1856,10 @@ const Class DataViewObject::protoClass = {
JSCLASS_HAS_PRIVATE |
JSCLASS_HAS_RESERVED_SLOTS(TypedArrayLayout::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_DataView),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub /* setProperty */
};
const Class DataViewObject::class_ = {
@ -1871,18 +1868,18 @@ const Class DataViewObject::class_ = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(TypedArrayLayout::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_DataView),
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
ArrayBufferViewObject::trace, /* trace */
ArrayBufferViewObject::trace
};
const JSFunctionSpec DataViewObject::jsfuncs[] = {

View File

@ -57,13 +57,10 @@ static const JSClass kFakeBackstagePassJSClass =
{
"FakeBackstagePass",
0,
nullptr,
nullptr,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
JS_StrictPropertyStub
};
static const char kXPConnectServiceContractID[] = "@mozilla.org/js/xpc/XPConnect;1";

View File

@ -343,7 +343,7 @@ sandbox_convert(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue
return true;
}
return JS_ConvertStub(cx, obj, type, vp);
return JS::OrdinaryToPrimitive(cx, obj, type, vp);
}
static bool
@ -459,7 +459,7 @@ sandbox_addProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleV
static const js::Class SandboxClass = {
"Sandbox",
XPCONNECT_GLOBAL_FLAGS_WITH_EXTRA_SLOTS(1),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
sandbox_enumerate, sandbox_resolve, sandbox_convert, sandbox_finalize,
nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook,
JS_NULL_CLASS_SPEC,
@ -478,7 +478,7 @@ static const js::Class SandboxClass = {
static const js::Class SandboxWriteToProtoClass = {
"Sandbox",
XPCONNECT_GLOBAL_FLAGS_WITH_EXTRA_SLOTS(1),
sandbox_addProperty, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
sandbox_addProperty, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
sandbox_enumerate, sandbox_resolve, sandbox_convert, sandbox_finalize,
nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook,
JS_NULL_CLASS_SPEC,

View File

@ -772,10 +772,9 @@ env_resolve(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp)
static const JSClass env_class = {
"environment", JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, env_setProperty,
env_enumerate, env_resolve,
JS_ConvertStub, nullptr
nullptr, nullptr,
JS_PropertyStub, env_setProperty,
env_enumerate, env_resolve
};
/***************************************************************************/

View File

@ -1444,13 +1444,13 @@ FinalizeStub(JSFreeOp *fop, JSObject *obj)
static const JSClass XPCOutParamClass = {
"XPCOutParam",
0,
JS_PropertyStub,
JS_DeletePropertyStub,
nullptr,
nullptr,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
FinalizeStub,
nullptr, /* call */
nullptr, /* hasInstance */

View File

@ -804,11 +804,8 @@ XPCWrappedNative::Init(HandleObject parent,
MOZ_ASSERT(jsclazz &&
jsclazz->name &&
jsclazz->flags &&
jsclazz->addProperty &&
jsclazz->delProperty &&
jsclazz->getProperty &&
jsclazz->setProperty &&
jsclazz->enumerate &&
jsclazz->resolve &&
jsclazz->convert &&
jsclazz->finalize, "bad class");

View File

@ -1101,7 +1101,7 @@ XPCNativeScriptableShared::PopulateJSClass()
if (mFlags.WantAddProperty())
addProperty = XPC_WN_Helper_AddProperty;
else if (mFlags.UseJSStubForAddProperty())
addProperty = JS_PropertyStub;
addProperty = nullptr;
else if (mFlags.AllowPropModsDuringResolve())
addProperty = XPC_WN_MaybeResolvingPropertyStub;
else
@ -1112,7 +1112,7 @@ XPCNativeScriptableShared::PopulateJSClass()
if (mFlags.WantDelProperty())
delProperty = XPC_WN_Helper_DelProperty;
else if (mFlags.UseJSStubForDelProperty())
delProperty = JS_DeletePropertyStub;
delProperty = nullptr;
else if (mFlags.AllowPropModsDuringResolve())
delProperty = XPC_WN_MaybeResolvingDeletePropertyStub;
else
@ -1139,7 +1139,7 @@ XPCNativeScriptableShared::PopulateJSClass()
if (mFlags.WantNewEnumerate() || mFlags.WantEnumerate() ||
mFlags.DontEnumStaticProps())
mJSClass.base.enumerate = JS_EnumerateStub;
mJSClass.base.enumerate = nullptr;
else
mJSClass.base.enumerate = XPC_WN_Shared_Enumerate;
@ -1392,20 +1392,20 @@ const js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass = {
"XPC_WN_ModsAllowed_WithCall_Proto_JSClass", // name;
WRAPPER_SLOTS, // flags;
/* Mandatory non-null function pointer members. */
JS_PropertyStub, // addProperty;
JS_DeletePropertyStub, // delProperty;
/* Function pointer members. */
nullptr, // addProperty;
nullptr, // delProperty;
JS_PropertyStub, // getProperty;
JS_StrictPropertyStub, // setProperty;
XPC_WN_Shared_Proto_Enumerate, // enumerate;
XPC_WN_ModsAllowed_Proto_Resolve, // resolve;
JS_ConvertStub, // convert;
nullptr, // convert;
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */
nullptr, // call;
nullptr, // construct;
nullptr, // hasInstance;
nullptr, // call;
nullptr, // construct;
nullptr, // hasInstance;
XPC_WN_Shared_Proto_Trace, // trace;
JS_NULL_CLASS_SPEC,
@ -1417,14 +1417,14 @@ const js::Class XPC_WN_ModsAllowed_NoCall_Proto_JSClass = {
"XPC_WN_ModsAllowed_NoCall_Proto_JSClass", // name;
WRAPPER_SLOTS, // flags;
/* Mandatory non-null function pointer members. */
JS_PropertyStub, // addProperty;
JS_DeletePropertyStub, // delProperty;
/* Function pointer members. */
nullptr, // addProperty;
nullptr, // delProperty;
JS_PropertyStub, // getProperty;
JS_StrictPropertyStub, // setProperty;
XPC_WN_Shared_Proto_Enumerate, // enumerate;
XPC_WN_ModsAllowed_Proto_Resolve, // resolve;
JS_ConvertStub, // convert;
nullptr, // convert;
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */
@ -1511,7 +1511,7 @@ const js::Class XPC_WN_NoMods_WithCall_Proto_JSClass = {
XPC_WN_OnlyIWrite_Proto_SetPropertyStub, // setProperty;
XPC_WN_Shared_Proto_Enumerate, // enumerate;
XPC_WN_NoMods_Proto_Resolve, // resolve;
JS_ConvertStub, // convert;
nullptr, // convert;
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */
@ -1536,7 +1536,7 @@ const js::Class XPC_WN_NoMods_NoCall_Proto_JSClass = {
XPC_WN_OnlyIWrite_Proto_SetPropertyStub, // setProperty;
XPC_WN_Shared_Proto_Enumerate, // enumerate;
XPC_WN_NoMods_Proto_Resolve, // resolve;
JS_ConvertStub, // convert;
nullptr, // convert;
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */

View File

@ -145,17 +145,13 @@ XPCWrappedNativeXrayTraits::getWN(JSObject *wrapper)
const JSClass XPCWrappedNativeXrayTraits::HolderClass = {
"NativePropertyHolder", JSCLASS_HAS_RESERVED_SLOTS(2),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub,
JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub,
JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
const JSClass JSXrayTraits::HolderClass = {
"JSXrayHolder", JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
bool
@ -851,8 +847,8 @@ ExpandoObjectFinalize(JSFreeOp *fop, JSObject *obj)
const JSClass ExpandoObjectClass = {
"XrayExpandoObject",
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_EXPANDO_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, ExpandoObjectFinalize
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, ExpandoObjectFinalize
};
bool

View File

@ -603,8 +603,8 @@ private:
const JSClass JSRuntimeWrapper::sGlobalClass = {
"PACResolutionThreadGlobal",
JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};

View File

@ -115,13 +115,13 @@ void Finalize(JSFreeOp *fop, JSObject *objSelf)
static const JSClass sWitnessClass = {
"FinalizationWitness",
JSCLASS_HAS_RESERVED_SLOTS(WITNESS_INSTANCES_SLOTS),
JS_PropertyStub /* addProperty */,
JS_DeletePropertyStub /* delProperty */,
nullptr /* addProperty */,
nullptr /* delProperty */,
JS_PropertyStub /* getProperty */,
JS_StrictPropertyStub /* setProperty */,
JS_EnumerateStub /* enumerate */,
JS_ResolveStub /* resolve */,
JS_ConvertStub /* convert */,
nullptr /* enumerate */,
nullptr /* resolve */,
nullptr /* convert */,
Finalize /* finalize */
};

View File

@ -1268,8 +1268,7 @@ WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::MutableHandle<JS::Value>
static const JSClass JSHistogram_class = {
"JSHistogram", /* name */
JSCLASS_HAS_PRIVATE, /* flags */
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, &JSHistogram_class, JS::NullPtr(), JS::NullPtr()));
@ -1446,8 +1445,7 @@ WrapAndReturnKeyedHistogram(KeyedHistogram *h, JSContext *cx, JS::MutableHandle<
static const JSClass JSHistogram_class = {
"JSKeyedHistogram", /* name */
JSCLASS_HAS_PRIVATE, /* flags */
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub
};
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, &JSHistogram_class, JS::NullPtr(), JS::NullPtr()));

View File

@ -86,9 +86,9 @@ CreateGlobalAndRunTest(JSRuntime* rt, JSContext* cx)
{
static const JSClass GlobalClass = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};