Backed out changeset b3f742c00ba1 (bug 1103152)

This commit is contained in:
Wes Kocher 2014-11-24 17:04:30 -08:00
parent b860fe9c8d
commit bd182684f1
88 changed files with 742 additions and 557 deletions

View File

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

View File

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

View File

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

View File

@ -843,10 +843,14 @@ ClearStructuredCloneBuffer(JSAutoStructuredCloneBuffer& aBuffer)
const JSClass IDBObjectStore::sDummyPropJSClass = {
"IDBObjectStore Dummy",
0 /* flags */,
nullptr /* addProperty */,
nullptr /* delProperty */,
JS_PropertyStub /* addProperty */,
JS_DeletePropertyStub /* delProperty */,
JS_PropertyStub /* getProperty */,
JS_StrictPropertyStub /* setProperty */
JS_StrictPropertyStub /* setProperty */,
JS_EnumerateStub /* enumerate */,
JS_ResolveStub /* resolve */,
JS_ConvertStub /* convert */,
JSCLASS_NO_OPTIONAL_MEMBERS
};
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,
nullptr, nullptr,
JS_PropertyStub, JS_StrictPropertyStub, nullptr,
nullptr, NPObjectMember_Convert,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub,
JS_ResolveStub, 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 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 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.
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),
nullptr, nullptr,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub,
XBLEnumerate, nullptr,
nullptr, XBLFinalize,
XBLEnumerate, JS_ResolveStub,
JS_ConvertStub, XBLFinalize,
nullptr, nullptr, nullptr, nullptr
};

View File

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

View File

@ -146,10 +146,18 @@ 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_StrictPropertyStub
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, // finalize
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace
};
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),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
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),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
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),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
dateTimeFormat_finalize
};
@ -2001,10 +2001,13 @@ js::intl_FormatDateTime(JSContext *cx, unsigned argc, Value *vp)
const Class js::IntlClass = {
js_Object_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Intl),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
#if JS_HAS_TOSOURCE

View File

@ -867,13 +867,13 @@ const Class MapIteratorObject::class_ = {
"Map Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(MapIteratorObject::SlotCount),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
MapIteratorObject::finalize
};
@ -1011,13 +1011,13 @@ const Class MapObject::class_ = {
"Map",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Map),
nullptr, // addProperty
nullptr, // delProperty
JS_PropertyStub, // addProperty
JS_DeletePropertyStub, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
nullptr, // enumerate
nullptr, // resolve
nullptr, // convert
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
finalize,
nullptr, // call
nullptr, // hasInstance
@ -1524,13 +1524,13 @@ const Class SetIteratorObject::class_ = {
"Set Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(SetIteratorObject::SlotCount),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
SetIteratorObject::finalize
};
@ -1664,13 +1664,13 @@ const Class SetObject::class_ = {
"Set",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Set),
nullptr, // addProperty
nullptr, // delProperty
JS_PropertyStub, // addProperty
JS_DeletePropertyStub, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
nullptr, // enumerate
nullptr, // resolve
nullptr, // convert
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
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),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
call, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
call, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr
};
@ -352,12 +352,20 @@ SimdTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
// SIMD class
const Class SIMDObject::class_ = {
"SIMD",
JSCLASS_HAS_CACHED_PROTO(JSProto_SIMD),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
"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
};
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),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
JS_EnumerateStub,
JS_ResolveStub,
convert
};

View File

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

View File

@ -36,10 +36,13 @@ const Class js::TypedObjectModuleObject::class_ = {
"TypedObject",
JSCLASS_HAS_RESERVED_SLOTS(SlotCount) |
JSCLASS_HAS_CACHED_PROTO(JSProto_TypedObject),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
static const JSFunctionSpec TypedObjectMethods[] = {
@ -206,10 +209,18 @@ GetPrototype(JSContext *cx, HandleObject obj)
const Class js::TypedProto::class_ = {
"TypedProto",
JSCLASS_HAS_RESERVED_SLOTS(JS_TYPROTO_SLOTS),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr
};
/***************************************************************************
@ -224,15 +235,18 @@ const Class js::TypedProto::class_ = {
const Class js::ScalarTypeDescr::class_ = {
"Scalar",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
ScalarTypeDescr::call
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
ScalarTypeDescr::call,
nullptr,
nullptr,
nullptr
};
const JSFunctionSpec js::ScalarTypeDescr::typeObjectMethods[] = {
@ -317,15 +331,18 @@ ScalarTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
const Class js::ReferenceTypeDescr::class_ = {
"Reference",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
ReferenceTypeDescr::call
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
ReferenceTypeDescr::call,
nullptr,
nullptr,
nullptr
};
const JSFunctionSpec js::ReferenceTypeDescr::typeObjectMethods[] = {
@ -496,14 +513,14 @@ CreatePrototypeObjectForComplexTypeInstance(JSContext *cx,
const Class ArrayTypeDescr::class_ = {
"ArrayType",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr,
nullptr,
TypedObject::construct,
@ -724,13 +741,13 @@ js::IsTypedObjectArray(JSObject &obj)
const Class StructTypeDescr::class_ = {
"StructType",
JSCLASS_HAS_RESERVED_SLOTS(JS_DESCR_SLOTS),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
@ -2403,13 +2420,13 @@ LazyArrayBufferTable::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf)
const Class Name::class_ = { \
# Name, \
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS, \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, \
JS_DeletePropertyStub, \
JS_PropertyStub, \
JS_StrictPropertyStub, \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
@ -3187,3 +3204,4 @@ TypeDescr::traceInstances(JSTracer *trace, uint8_t *mem, size_t length)
mem += size();
}
}

View File

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

View File

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

View File

@ -3364,7 +3364,7 @@ CheckHasNoSuchProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
return false;
// Don't handle proto chains with resolve hooks.
if (curObj->getClass()->resolve)
if (curObj->getClass()->resolve != JS_ResolveStub)
return false;
Shape *shape = curObj->as<NativeObject>().lookup(cx, NameToId(name));
@ -3515,8 +3515,8 @@ IsCacheableSetPropAddSlot(JSContext *cx, HandleObject obj, HandleShape oldShape,
return false;
}
// If object has a resolve hook, don't inline
if (obj->getClass()->resolve)
// If object has a non-default resolve hook, don't inline
if (obj->getClass()->resolve != JS_ResolveStub)
return false;
size_t chainDepth = 0;
@ -3535,7 +3535,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)
if (proto->getClass()->resolve != JS_ResolveStub)
return false;
}

View File

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

View File

@ -2731,12 +2731,13 @@ 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 resolve hook, don't inline
if (obj->getClass()->resolve)
// If object has a non-default resolve hook, don't inline
if (obj->getClass()->resolve != JS_ResolveStub)
return false;
// Likewise for an addProperty hook, since we'll need to invoke it.
if (obj->getClass()->addProperty)
// Likewise for a non-default addProperty hook, since we'll need
// to invoke it.
if (obj->getClass()->addProperty != JS_PropertyStub)
return false;
if (!obj->nonProxyIsExtensible() || !shape->writable())
@ -2758,7 +2759,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)
if (proto->getClass()->resolve != JS_ResolveStub)
return false;
}

View File

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

View File

@ -9,10 +9,13 @@ using namespace JS;
static const JSClass CustomClass = {
"CustomClass",
JSCLASS_HAS_RESERVED_SLOTS(1),
nullptr,
nullptr,
JS_PropertyStub,
JS_StrictPropertyStub
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
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,
nullptr,
nullptr,
JS_PropertyStub,
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
nullptr,
nullptr,
nullptr,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr,
nullptr,
nullptr,

View File

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

View File

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

View File

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

View File

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

View File

@ -7,10 +7,13 @@
static const JSClass ObjectEmulatingUndefinedClass = {
"ObjectEmulatingUndefined",
JSCLASS_EMULATES_UNDEFINED,
nullptr,
nullptr,
JS_PropertyStub,
JS_StrictPropertyStub
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
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,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, my_convert
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, my_convert
};
static bool

View File

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

View File

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

View File

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

View File

@ -17,12 +17,13 @@ BEGIN_TEST(testResolveRecursion)
static const JSClass my_resolve_class = {
"MyResolve",
JSCLASS_HAS_PRIVATE,
nullptr, // add
nullptr, // delete
JS_PropertyStub, // add
JS_DeletePropertyStub, // delete
JS_PropertyStub, // get
JS_StrictPropertyStub, // set
nullptr,
my_resolve
JS_EnumerateStub,
my_resolve,
JS_ConvertStub
};
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);
MOZ_ASSERT(JS_GetClass(global)->resolve == &JS_ResolveStub);
CHECK(JS_DefineProperty(cx, global, "HOTLOOP", 8, 0));
EXEC("var n = 0;\n"

View File

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

View File

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

View File

@ -2144,7 +2144,27 @@ JS_StrictPropertyStub(JSContext *cx, HandleObject obj, HandleId id, bool strict,
}
JS_PUBLIC_API(bool)
JS::OrdinaryToPrimitive(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue vp)
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;
}
JS_PUBLIC_API(bool)
JS_ResolveStub(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp)
{
MOZ_ASSERT(*resolvedp == false);
return true;
}
JS_PUBLIC_API(bool)
JS_ConvertStub(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue vp)
{
MOZ_ASSERT(type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION);
MOZ_ASSERT(obj);
@ -2799,6 +2819,7 @@ 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

@ -1159,17 +1159,6 @@ 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)
@ -2379,6 +2368,20 @@ 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);
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);
template<typename T>
struct JSConstScalarSpec {
const char *name;

View File

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

View File

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

View File

@ -322,10 +322,7 @@ CallJSDeletePropertyOp(JSContext *cx, JSDeletePropertyOp op, HandleObject receiv
JS_CHECK_RECURSION(cx, return false);
assertSameCompartment(cx, receiver, id);
if (op)
return op(cx, receiver, id, succeeded);
*succeeded = true;
return true;
return op(cx, receiver, id, succeeded);
}
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),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
JS_EnumerateStub,
JS_ResolveStub,
date_convert,
nullptr, /* finalize */
nullptr, /* call */

View File

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

View File

@ -277,12 +277,12 @@ namespace js {
JSCLASS_IS_PROXY | \
JSCLASS_IMPLEMENTS_BARRIERS | \
flags, \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
JS_EnumerateStub, \
JS_ResolveStub, \
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),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
fun_enumerate,
js::fun_resolve,
nullptr, /* convert */
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
fun_hasInstance,

View File

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

View File

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

View File

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

View File

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

View File

@ -177,13 +177,13 @@ FinishObjectClassInit(JSContext *cx, JS::HandleObject ctor, JS::HandleObject pro
const Class JSObject::class_ = {
js_Object_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
@ -2724,10 +2724,14 @@ js_InitClass(JSContext *cx, HandleObject obj, JSObject *protoProto_,
{
RootedObject protoProto(cx, protoProto_);
/* Check function pointer members. */
MOZ_ASSERT(clasp->addProperty != JS_PropertyStub); // (use null instead)
/* Assert mandatory function pointer members. */
MOZ_ASSERT(clasp->addProperty);
MOZ_ASSERT(clasp->delProperty);
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)
@ -3283,7 +3287,8 @@ LookupPropertyPureInline(ThreadSafeContext *cx, JSObject *obj, jsid id, NativeOb
// if we know it will never add a property with this name.
do {
const Class *clasp = current->getClass();
if (!clasp->resolve)
MOZ_ASSERT(clasp->resolve);
if (clasp->resolve == JS_ResolveStub)
break;
if (clasp->resolve == fun_resolve && !FunctionHasResolveHook(cx->names(), id))
break;
@ -3653,14 +3658,14 @@ 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 (enumerate) {
if (clasp->flags & JSCLASS_NEW_ENUMERATE)
return ((JSNewEnumerateOp) enumerate)(cx, obj, enum_op, statep, idp);
if (!enumerate(cx, obj))
return false;
if (clasp->flags & JSCLASS_NEW_ENUMERATE) {
MOZ_ASSERT(enumerate != JS_EnumerateStub);
return ((JSNewEnumerateOp) enumerate)(cx, obj, enum_op, statep, idp);
}
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);
statep.setMagic(JS_NATIVE_ENUMERATE);
@ -4240,7 +4245,7 @@ JSObject::hasIdempotentProtoChain() const
return false;
JSResolveOp resolve = obj->getClass()->resolve;
if (resolve && resolve != js::fun_resolve)
if (resolve != JS_ResolveStub && resolve != js::fun_resolve)
return false;
if (obj->getOps()->lookupProperty || obj->getOps()->lookupGeneric || obj->getOps()->lookupElement)

View File

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

View File

@ -38,10 +38,13 @@ using mozilla::RangedPtr;
const Class js::JSONClass = {
js_JSON_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_JSON),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
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,
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

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

View File

@ -585,13 +585,13 @@ const Class WeakMapObject::class_ = {
"WeakMap",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_WeakMap),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
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,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, pm_finalize
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, 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),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
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,
nullptr, nullptr,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub,
sandbox_enumerate, sandbox_resolve,
nullptr, nullptr,
JS_ConvertStub, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};
@ -3962,10 +3962,13 @@ ObjectEmulatingUndefined(JSContext *cx, unsigned argc, jsval *vp)
static const JSClass cls = {
"ObjectEmulatingUndefined",
JSCLASS_EMULATES_UNDEFINED,
nullptr,
nullptr,
JS_PropertyStub,
JS_StrictPropertyStub
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
RootedObject obj(cx, JS_NewObject(cx, &cls, JS::NullPtr(), JS::NullPtr()));
@ -4782,10 +4785,10 @@ global_resolve(JSContext *cx, HandleObject obj, HandleId id, bool *resolvedp)
static const JSClass global_class = {
"global", JSCLASS_GLOBAL_FLAGS,
nullptr, nullptr,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub,
global_enumerate, global_resolve,
nullptr, nullptr,
JS_ConvertStub, nullptr,
nullptr, nullptr, nullptr,
JS_GlobalObjectTraceHook
};
@ -4899,13 +4902,13 @@ static const JSFunctionSpec dom_methods[] = {
static const JSClass dom_class = {
"FakeDOMObject", JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(2),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
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,
nullptr, /* addProperty */
JS_PropertyStub, /* addProperty */
args_delProperty,
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
args_enumerate,
args_resolve,
nullptr, /* convert */
JS_ConvertStub,
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,
nullptr, /* addProperty */
JS_PropertyStub, /* addProperty */
args_delProperty,
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
strictargs_enumerate,
strictargs_resolve,
nullptr, /* convert */
JS_ConvertStub,
ArgumentsObject::finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

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

View File

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

View File

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

View File

@ -203,19 +203,35 @@ LegacyGeneratorObject::close(JSContext *cx, HandleObject obj)
const Class LegacyGeneratorObject::class_ = {
"Generator",
JSCLASS_HAS_RESERVED_SLOTS(GeneratorObject::RESERVED_SLOTS),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr, /* trace */
};
const Class StarGeneratorObject::class_ = {
"Generator",
JSCLASS_HAS_RESERVED_SLOTS(GeneratorObject::RESERVED_SLOTS),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr, /* trace */
};
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,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, GlobalDebuggees_finalize
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, GlobalDebuggees_finalize
};
GlobalObject::DebuggerVector *

View File

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

View File

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

View File

@ -566,7 +566,7 @@ LookupOwnPropertyInline(ExclusiveContext *cx,
}
// id was not found in obj. Try obj's resolve hook, if any.
if (obj->getClass()->resolve) {
if (obj->getClass()->resolve != JS_ResolveStub) {
if (!cx->shouldBeJSContext() || !allowGC)
return false;

View File

@ -1075,9 +1075,7 @@ CallAddPropertyHook(typename ExecutionModeTraits<mode>::ExclusiveContextType cxA
const Class *clasp, HandleNativeObject obj, HandleShape shape,
HandleValue nominal)
{
if (clasp->addProperty) {
MOZ_ASSERT(clasp->addProperty != JS_PropertyStub);
if (clasp->addProperty != JS_PropertyStub) {
if (mode == ParallelExecution)
return false;
@ -1124,9 +1122,7 @@ CallAddPropertyHookDense(typename ExecutionModeTraits<mode>::ExclusiveContextTyp
return true;
}
if (clasp->addProperty) {
MOZ_ASSERT(clasp->addProperty != JS_PropertyStub);
if (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,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr, ForOfPIC_finalize,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, ForOfPIC_finalize,
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */

View File

@ -266,13 +266,13 @@ const Class RegExpObject::class_ = {
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(RegExpObject::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_RegExp),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub, /* enumerate */
JS_ResolveStub,
JS_ConvertStub,
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,
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
resc_finalize,
nullptr, /* call */
nullptr, /* hasInstance */

View File

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

View File

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

View File

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

View File

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

View File

@ -804,13 +804,13 @@ TypedArrayObject::sharedTypedArrayPrototypeClass = {
// until we implement @@toStringTag.
"???",
JSCLASS_HAS_CACHED_PROTO(JSProto_TypedArray),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
@ -1759,13 +1759,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), \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
@ -1804,18 +1804,18 @@ const Class TypedArrayObject::classes[Scalar::TypeMax] = {
*/ \
#typedArray "Prototype", \
JSCLASS_HAS_CACHED_PROTO(JSProto_##typedArray), \
nullptr, /* addProperty */ \
nullptr, /* delProperty */ \
JS_PropertyStub, /* addProperty */ \
JS_DeletePropertyStub, /* delProperty */ \
JS_PropertyStub, /* getProperty */ \
JS_StrictPropertyStub, /* setProperty */ \
nullptr, /* enumerate */ \
nullptr, /* resolve */ \
nullptr, /* convert */ \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
nullptr, /* construct */ \
nullptr, /* trace */ \
JS_EnumerateStub, \
JS_ResolveStub, \
JS_ConvertStub, \
nullptr, /* finalize */ \
nullptr, /* call */ \
nullptr, /* hasInstance */ \
nullptr, /* construct */ \
nullptr, /* trace */ \
{ \
typedArray::createConstructor, \
typedArray::createPrototype, \
@ -1850,10 +1850,13 @@ const Class DataViewObject::protoClass = {
JSCLASS_HAS_PRIVATE |
JSCLASS_HAS_RESERVED_SLOTS(TypedArrayLayout::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_DataView),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub /* setProperty */
JS_StrictPropertyStub, /* setProperty */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
const Class DataViewObject::class_ = {
@ -1862,18 +1865,18 @@ const Class DataViewObject::class_ = {
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(TypedArrayLayout::RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_DataView),
nullptr, /* addProperty */
nullptr, /* delProperty */
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */
JS_PropertyStub, /* getProperty */
JS_StrictPropertyStub, /* setProperty */
nullptr, /* enumerate */
nullptr, /* resolve */
nullptr, /* convert */
nullptr, /* finalize */
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
nullptr, /* finalize */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
ArrayBufferViewObject::trace
ArrayBufferViewObject::trace, /* trace */
};
const JSFunctionSpec DataViewObject::jsfuncs[] = {

View File

@ -57,10 +57,13 @@ static const JSClass kFakeBackstagePassJSClass =
{
"FakeBackstagePass",
0,
nullptr,
nullptr,
JS_PropertyStub,
JS_StrictPropertyStub
JS_DeletePropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
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::OrdinaryToPrimitive(cx, obj, type, vp);
return JS_ConvertStub(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),
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
JS_PropertyStub, JS_DeletePropertyStub, 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, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
sandbox_addProperty, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
sandbox_enumerate, sandbox_resolve, sandbox_convert, sandbox_finalize,
nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook,
JS_NULL_CLASS_SPEC,

View File

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

View File

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

View File

@ -804,8 +804,11 @@ 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 = nullptr;
addProperty = JS_PropertyStub;
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 = nullptr;
delProperty = JS_DeletePropertyStub;
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 = nullptr;
mJSClass.base.enumerate = JS_EnumerateStub;
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;
/* Function pointer members. */
nullptr, // addProperty;
nullptr, // delProperty;
/* Mandatory non-null function pointer members. */
JS_PropertyStub, // addProperty;
JS_DeletePropertyStub, // delProperty;
JS_PropertyStub, // getProperty;
JS_StrictPropertyStub, // setProperty;
XPC_WN_Shared_Proto_Enumerate, // enumerate;
XPC_WN_ModsAllowed_Proto_Resolve, // resolve;
nullptr, // convert;
JS_ConvertStub, // 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;
/* Function pointer members. */
nullptr, // addProperty;
nullptr, // delProperty;
/* Mandatory non-null function pointer members. */
JS_PropertyStub, // addProperty;
JS_DeletePropertyStub, // delProperty;
JS_PropertyStub, // getProperty;
JS_StrictPropertyStub, // setProperty;
XPC_WN_Shared_Proto_Enumerate, // enumerate;
XPC_WN_ModsAllowed_Proto_Resolve, // resolve;
nullptr, // convert;
JS_ConvertStub, // 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;
nullptr, // convert;
JS_ConvertStub, // 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;
nullptr, // convert;
JS_ConvertStub, // convert;
XPC_WN_Shared_Proto_Finalize, // finalize;
/* Optionally non-null members start here. */

View File

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

View File

@ -603,8 +603,8 @@ private:
const JSClass JSRuntimeWrapper::sGlobalClass = {
"PACResolutionThreadGlobal",
JSCLASS_GLOBAL_FLAGS,
nullptr, nullptr, JS_PropertyStub, JS_StrictPropertyStub,
nullptr, nullptr, nullptr,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
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),
nullptr /* addProperty */,
nullptr /* delProperty */,
JS_PropertyStub /* addProperty */,
JS_DeletePropertyStub /* delProperty */,
JS_PropertyStub /* getProperty */,
JS_StrictPropertyStub /* setProperty */,
nullptr /* enumerate */,
nullptr /* resolve */,
nullptr /* convert */,
JS_EnumerateStub /* enumerate */,
JS_ResolveStub /* resolve */,
JS_ConvertStub /* convert */,
Finalize /* finalize */
};

View File

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

View File

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