diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 3b3aee9534c8..5cbd077b4384 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -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 diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 3dc6832a50a2..e1b407879f43 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -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 */ diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index bd6caae6e809..302d14899ab1 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -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, diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 34fdfd3ecf94..7ac06dbebf4d 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -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, diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index cea5cbc61931..2a5748c18516 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -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 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 v(cx, JSVAL_VOID); if (!JS_GetProperty(cx, obj, "toString", &v)) diff --git a/dom/xbl/nsXBLBinding.cpp b/dom/xbl/nsXBLBinding.cpp index 63ef958a3212..851ff7e78d96 100644 --- a/dom/xbl/nsXBLBinding.cpp +++ b/dom/xbl/nsXBLBinding.cpp @@ -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 }; diff --git a/js/src/asmjs/AsmJSModule.cpp b/js/src/asmjs/AsmJSModule.cpp index dcff4d1f28e3..6f1174aa2e86 100644 --- a/js/src/asmjs/AsmJSModule.cpp +++ b/js/src/asmjs/AsmJSModule.cpp @@ -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 */ diff --git a/js/src/builtin/AtomicsObject.cpp b/js/src/builtin/AtomicsObject.cpp index ac7e10494a7b..c4106b6eee19 100644 --- a/js/src/builtin/AtomicsObject.cpp +++ b/js/src/builtin/AtomicsObject.cpp @@ -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 diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 24684c086d1b..f9af590046fd 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -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 diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index 366855970702..006febb6e81f 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -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 diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 89160d29eb32..7b17685e4a5b 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -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 */ diff --git a/js/src/builtin/SIMD.cpp b/js/src/builtin/SIMD.cpp index 46d4eeca532d..4f193c85605d 100644 --- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -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 * diff --git a/js/src/builtin/SymbolObject.cpp b/js/src/builtin/SymbolObject.cpp index cd2527017510..a8bb7112fb51 100644 --- a/js/src/builtin/SymbolObject.cpp +++ b/js/src/builtin/SymbolObject.cpp @@ -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 }; diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index eddb928549b8..4db13f12fb58 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -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 */ diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp index e2a96015c1e2..858560612712 100644 --- a/js/src/builtin/TypedObject.cpp +++ b/js/src/builtin/TypedObject.cpp @@ -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 */ \ diff --git a/js/src/builtin/WeakSetObject.cpp b/js/src/builtin/WeakSetObject.cpp index 31da25bb2d12..0a23e5b70ddd 100644 --- a/js/src/builtin/WeakSetObject.cpp +++ b/js/src/builtin/WeakSetObject.cpp @@ -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[] = { diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index ead6dc9d111c..ce118de9d550 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -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[] = { diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index 8ea8d766cf44..ec8759e6b393 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -34,8 +34,8 @@ typedef Rooted 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 \ diff --git a/js/src/gdb/gdb-tests.cpp b/js/src/gdb/gdb-tests.cpp index 9357e3f08acc..adef008e536b 100644 --- a/js/src/gdb/gdb-tests.cpp +++ b/js/src/gdb/gdb-tests.cpp @@ -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 }; diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 63cbfe4f4436..c952c59e7414 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -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().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; } diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 69a7bf557ea3..2d0762d956c3 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -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) { diff --git a/js/src/jit/IonCaches.cpp b/js/src/jit/IonCaches.cpp index e7c012153e74..ca8be9146e56 100644 --- a/js/src/jit/IonCaches.cpp +++ b/js/src/jit/IonCaches.cpp @@ -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; } diff --git a/js/src/jsapi-tests/testAddPropertyPropcache.cpp b/js/src/jsapi-tests/testAddPropertyPropcache.cpp index 1047ad2245a1..1c24ccf4dac1 100644 --- a/js/src/jsapi-tests/testAddPropertyPropcache.cpp +++ b/js/src/jsapi-tests/testAddPropertyPropcache.cpp @@ -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) diff --git a/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp b/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp index d1b1cede1217..f7f46bfb8531 100644 --- a/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp +++ b/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp @@ -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; diff --git a/js/src/jsapi-tests/testChromeBuffer.cpp b/js/src/jsapi-tests/testChromeBuffer.cpp index a370b746136c..5fb1311dc731 100644 --- a/js/src/jsapi-tests/testChromeBuffer.cpp +++ b/js/src/jsapi-tests/testChromeBuffer.cpp @@ -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, diff --git a/js/src/jsapi-tests/testClassGetter.cpp b/js/src/jsapi-tests/testClassGetter.cpp index c7be62d8911d..be6f5583373e 100644 --- a/js/src/jsapi-tests/testClassGetter.cpp +++ b/js/src/jsapi-tests/testClassGetter.cpp @@ -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 diff --git a/js/src/jsapi-tests/testFreshGlobalEvalRedefinition.cpp b/js/src/jsapi-tests/testFreshGlobalEvalRedefinition.cpp index db8d98b06d33..916ad1cf5cdc 100644 --- a/js/src/jsapi-tests/testFreshGlobalEvalRedefinition.cpp +++ b/js/src/jsapi-tests/testFreshGlobalEvalRedefinition.cpp @@ -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 }; diff --git a/js/src/jsapi-tests/testLookup.cpp b/js/src/jsapi-tests/testLookup.cpp index 9bec16648122..449db4b701b0 100644 --- a/js/src/jsapi-tests/testLookup.cpp +++ b/js/src/jsapi-tests/testLookup.cpp @@ -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) diff --git a/js/src/jsapi-tests/testNewObject.cpp b/js/src/jsapi-tests/testNewObject.cpp index b00f7822d843..826118e6467a 100644 --- a/js/src/jsapi-tests/testNewObject.cpp +++ b/js/src/jsapi-tests/testNewObject.cpp @@ -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())); diff --git a/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp b/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp index 5b3372553df8..a35337a00c27 100644 --- a/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp +++ b/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp @@ -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 diff --git a/js/src/jsapi-tests/testOps.cpp b/js/src/jsapi-tests/testOps.cpp index 6448261d490c..33ae036d5215 100644 --- a/js/src/jsapi-tests/testOps.cpp +++ b/js/src/jsapi-tests/testOps.cpp @@ -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 diff --git a/js/src/jsapi-tests/testPersistentRooted.cpp b/js/src/jsapi-tests/testPersistentRooted.cpp index e2e3281a857f..d713b148fb87 100644 --- a/js/src/jsapi-tests/testPersistentRooted.cpp +++ b/js/src/jsapi-tests/testPersistentRooted.cpp @@ -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, diff --git a/js/src/jsapi-tests/testProfileStrings.cpp b/js/src/jsapi-tests/testProfileStrings.cpp index e00c1703b2a9..51a1d2713eaa 100644 --- a/js/src/jsapi-tests/testProfileStrings.cpp +++ b/js/src/jsapi-tests/testProfileStrings.cpp @@ -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 diff --git a/js/src/jsapi-tests/testPropCache.cpp b/js/src/jsapi-tests/testPropCache.cpp index 4d86cecf4162..662c04947ff2 100644 --- a/js/src/jsapi-tests/testPropCache.cpp +++ b/js/src/jsapi-tests/testPropCache.cpp @@ -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) diff --git a/js/src/jsapi-tests/testResolveRecursion.cpp b/js/src/jsapi-tests/testResolveRecursion.cpp index 9a878a96e04e..e86ef2158071 100644 --- a/js/src/jsapi-tests/testResolveRecursion.cpp +++ b/js/src/jsapi-tests/testResolveRecursion.cpp @@ -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; diff --git a/js/src/jsapi-tests/testSetProperty.cpp b/js/src/jsapi-tests/testSetProperty.cpp index 27a09bbbe5a3..41c19ba1e4bf 100644 --- a/js/src/jsapi-tests/testSetProperty.cpp +++ b/js/src/jsapi-tests/testSetProperty.cpp @@ -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" diff --git a/js/src/jsapi-tests/testWeakMap.cpp b/js/src/jsapi-tests/testWeakMap.cpp index 00b50c99ac40..7312c81444d9 100644 --- a/js/src/jsapi-tests/testWeakMap.cpp +++ b/js/src/jsapi-tests/testWeakMap.cpp @@ -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, diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 85717b5d5fe2..709489cbbd49 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -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 }; diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 47af11a8a8b7..becd85116ea5 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -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 diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 10580fd30be3..772b2a1c1521 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -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 struct JSConstScalarSpec { diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 1d527ceeec4f..8ddb45838603 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -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, CreateArrayPrototype, diff --git a/js/src/jsbool.cpp b/js/src/jsbool.cpp index cc504bb12ade..186bf60fbb8b 100644 --- a/js/src/jsbool.cpp +++ b/js/src/jsbool.cpp @@ -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 diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index 72a5ad150b7d..fdfce943371f 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -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 diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 6398625439a4..d24d03096ecb 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -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 */ diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 7bb75548c911..7443af4e534d 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -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 */ diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 419b9bcecf5b..45f828df2bf7 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -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 */ \ diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index be560bffd60a..f376aa6308ae 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -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, diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index b7d61753522a..111b492f6263 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -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); diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index 77d31e2ec299..148495ced51c 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -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())) - return false; + if (JSEnumerateOp enumerate = clasp->enumerate) { + if (!enumerate(cx, pobj.as())) + return false; + } if (!EnumerateNativeProperties(cx, pobj.as(), 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().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, diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index 7ed41ee67600..a776b8ee0828 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -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 diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 2ce162fc0100..4a14d34339cb 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -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 diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 6b76bde51d89..aad4c717ae42 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -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) diff --git a/js/src/jsobj.h b/js/src/jsobj.h index eb32de6caf2c..113e792b6715 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -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); diff --git a/js/src/json.cpp b/js/src/json.cpp index 41141989efaf..f34882cab1af 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -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 diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 3231fec1c42d..43fd66c40208 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -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 */ diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 796c9089f29b..c7a828cb451e 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -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 }; /* diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 2d4db9e47d79..90a73a9f4bc3 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -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 */ diff --git a/js/src/perf/jsperf.cpp b/js/src/perf/jsperf.cpp index e9a12345525e..85f6d8815df2 100644 --- a/js/src/perf/jsperf.cpp +++ b/js/src/perf/jsperf.cpp @@ -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 diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 372032a465de..e766813af0b4 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -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 */ diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp index 4b2e18ba1676..e95c64d26aa1 100644 --- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -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 */ diff --git a/js/src/vm/ArrayBufferObject.cpp b/js/src/vm/ArrayBufferObject.cpp index 0e1971a020be..360dd25fbf5f 100644 --- a/js/src/vm/ArrayBufferObject.cpp +++ b/js/src/vm/ArrayBufferObject.cpp @@ -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 */ diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index d5d471684a50..2200379bea1f 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -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 */ diff --git a/js/src/vm/DebuggerMemory.cpp b/js/src/vm/DebuggerMemory.cpp index d15533a10a50..33a48972a24a 100644 --- a/js/src/vm/DebuggerMemory.cpp +++ b/js/src/vm/DebuggerMemory.cpp @@ -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 * diff --git a/js/src/vm/GeneratorObject.cpp b/js/src/vm/GeneratorObject.cpp index 4a834d2d829e..680d9f8ddb70 100644 --- a/js/src/vm/GeneratorObject.cpp +++ b/js/src/vm/GeneratorObject.cpp @@ -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[] = { diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index 18c5c1d8cbce..dd82dec79010 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -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 * diff --git a/js/src/vm/HelperThreads.cpp b/js/src/vm/HelperThreads.cpp index 2e4833119c47..ff34a7c56832 100644 --- a/js/src/vm/HelperThreads.cpp +++ b/js/src/vm/HelperThreads.cpp @@ -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 }; diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index b0df65396d27..ea13b0e2c098 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -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 }; /* diff --git a/js/src/vm/NativeObject-inl.h b/js/src/vm/NativeObject-inl.h index a9a20669ea0f..f8df90330c7a 100644 --- a/js/src/vm/NativeObject-inl.h +++ b/js/src/vm/NativeObject-inl.h @@ -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; diff --git a/js/src/vm/NativeObject.cpp b/js/src/vm/NativeObject.cpp index 59549d1c4499..edbefe93f4ea 100644 --- a/js/src/vm/NativeObject.cpp +++ b/js/src/vm/NativeObject.cpp @@ -1065,7 +1065,9 @@ CallAddPropertyHook(typename ExecutionModeTraits::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::ExclusiveContextTyp return true; } - if (clasp->addProperty != JS_PropertyStub) { + if (clasp->addProperty) { + MOZ_ASSERT(clasp->addProperty != JS_PropertyStub); + if (mode == ParallelExecution) return false; diff --git a/js/src/vm/PIC.cpp b/js/src/vm/PIC.cpp index 9205b882ceed..c8d669dc0232 100644 --- a/js/src/vm/PIC.cpp +++ b/js/src/vm/PIC.cpp @@ -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 */ diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index 8e9cf4481b99..473856ee1356 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -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 */ diff --git a/js/src/vm/RegExpStatics.cpp b/js/src/vm/RegExpStatics.cpp index f8150c627173..41552c98ae7b 100644 --- a/js/src/vm/RegExpStatics.cpp +++ b/js/src/vm/RegExpStatics.cpp @@ -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 */ diff --git a/js/src/vm/SavedStacks.cpp b/js/src/vm/SavedStacks.cpp index 84e1b0258bb0..13dc51769ebd 100644 --- a/js/src/vm/SavedStacks.cpp +++ b/js/src/vm/SavedStacks.cpp @@ -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 }; diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 0a0ce83337bb..a62de2a008cb 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -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 @@ -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 */ diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 38794d6eb15a..6cac3ae64925 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -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 }; diff --git a/js/src/vm/SharedArrayObject.cpp b/js/src/vm/SharedArrayObject.cpp index 1bf8fb10c042..d0405c365d4e 100644 --- a/js/src/vm/SharedArrayObject.cpp +++ b/js/src/vm/SharedArrayObject.cpp @@ -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 */ diff --git a/js/src/vm/SharedTypedArrayObject.cpp b/js/src/vm/SharedTypedArrayObject.cpp index 0b47dc7ab1fd..437c20da5f13 100644 --- a/js/src/vm/SharedTypedArrayObject.cpp +++ b/js/src/vm/SharedTypedArrayObject.cpp @@ -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 */ \ diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp index 339cd9fc5b51..5d5ca737f97a 100644 --- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -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[] = { diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index 0281754917ee..006597c42119 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -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"; diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index f95a86539c6e..a7d79bb78b76 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -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, diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index 9990b9e50b4e..73f315cc4ee4 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -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 }; /***************************************************************************/ diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 5383cc3a6840..faf7a8d42a4e 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -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 */ diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 686e2c5f6446..f259f6679852 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -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"); diff --git a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp index 471c27d86dd6..7b005f230c6b 100644 --- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -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. */ diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 10f59ae9a98e..b59d8890d97e 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -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 diff --git a/netwerk/base/src/ProxyAutoConfig.cpp b/netwerk/base/src/ProxyAutoConfig.cpp index c7c4fb3b0bf1..cd4831841dc9 100644 --- a/netwerk/base/src/ProxyAutoConfig.cpp +++ b/netwerk/base/src/ProxyAutoConfig.cpp @@ -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 }; diff --git a/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp b/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp index 2c234b142b9e..42639e6b015d 100644 --- a/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp +++ b/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp @@ -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 */ }; diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index daebb1559d16..3241094da488 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -1268,8 +1268,7 @@ WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::MutableHandle 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 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 obj(cx, JS_NewObject(cx, &JSHistogram_class, JS::NullPtr(), JS::NullPtr())); diff --git a/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp b/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp index b025d3663107..5dabcfb1aae7 100644 --- a/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp +++ b/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp @@ -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 };