diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index 962d2a705ab5..0cbf84c0fdfb 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -752,7 +752,7 @@ static const RemoteLocationProxy sSingleton; // so JSObject::swap can swap it with CrossCompartmentWrappers without requiring // malloc. template <> -const js::Class RemoteLocationProxy::Base::sClass = +const JSClass RemoteLocationProxy::Base::sClass = PROXY_CLASS_DEF("Proxy", JSCLASS_HAS_RESERVED_SLOTS(2)); void BrowsingContext::Location(JSContext* aCx, diff --git a/dom/base/RemoteOuterWindowProxy.cpp b/dom/base/RemoteOuterWindowProxy.cpp index e2fd05d18083..e2a3c7083471 100644 --- a/dom/base/RemoteOuterWindowProxy.cpp +++ b/dom/base/RemoteOuterWindowProxy.cpp @@ -58,7 +58,7 @@ static const RemoteOuterWindowProxy sSingleton; // so JSObject::swap can swap it with CrossCompartmentWrappers without requiring // malloc. template <> -const js::Class RemoteOuterWindowProxy::Base::sClass = +const JSClass RemoteOuterWindowProxy::Base::sClass = PROXY_CLASS_DEF("Proxy", JSCLASS_HAS_RESERVED_SLOTS(2)); bool GetRemoteOuterWindowProxy(JSContext* aCx, BrowsingContext* aContext, diff --git a/dom/base/nsGlobalWindowInner.h b/dom/base/nsGlobalWindowInner.h index a664c7c76cc8..32029b6f3597 100644 --- a/dom/base/nsGlobalWindowInner.h +++ b/dom/base/nsGlobalWindowInner.h @@ -153,7 +153,7 @@ extern already_AddRefed NS_CreateJSTimeoutHandler( JSContext* aCx, nsGlobalWindowInner* aWindow, const nsAString& aExpression, mozilla::ErrorResult& aError); -extern const js::Class OuterWindowProxyClass; +extern const JSClass OuterWindowProxyClass; //***************************************************************************** // nsGlobalWindowInner: Global Object for Scripting diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index 32fd9df2a555..d60227f20a70 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -347,7 +347,7 @@ nsPIDOMWindowOuter* nsPIDOMWindowOuter::GetFromCurrentInner( // We store the nsGlobalWindowOuter* in our first slot. // // We store our holder weakmap in the second slot. -const js::Class OuterWindowProxyClass = PROXY_CLASS_DEF( +const JSClass OuterWindowProxyClass = PROXY_CLASS_DEF( "Proxy", JSCLASS_HAS_RESERVED_SLOTS(2)); /* additional class flags */ static const size_t OUTER_WINDOW_SLOT = 0; diff --git a/dom/base/nsGlobalWindowOuter.h b/dom/base/nsGlobalWindowOuter.h index 7f90211149d3..5b99626c8704 100644 --- a/dom/base/nsGlobalWindowOuter.h +++ b/dom/base/nsGlobalWindowOuter.h @@ -140,7 +140,7 @@ extern already_AddRefed NS_CreateJSTimeoutHandler( JSContext* aCx, nsGlobalWindowInner* aWindow, const nsAString& aExpression, mozilla::ErrorResult& aError); -extern const js::Class OuterWindowProxyClass; +extern const JSClass OuterWindowProxyClass; //***************************************************************************** // nsGlobalWindowOuter diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 0b08279e2c57..1974b1785daa 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -677,7 +677,7 @@ bool DefineUnforgeableAttributes(JSContext* cx, JS::Handle obj, // funToString ObjectOps member for interface objects. JSString* InterfaceObjectToString(JSContext* aCx, JS::Handle aObject, bool /* isToSource */) { - const js::Class* clasp = js::GetObjectClass(aObject); + const JSClass* clasp = js::GetObjectClass(aObject); MOZ_ASSERT(IsDOMIfaceAndProtoClass(clasp)); const DOMIfaceAndProtoJSClass* ifaceAndProtoJSClass = @@ -726,7 +726,7 @@ static bool DefineConstructor(JSContext* cx, JS::Handle global, static JSObject* CreateInterfaceObject( JSContext* cx, JS::Handle global, - JS::Handle constructorProto, const js::Class* constructorClass, + JS::Handle constructorProto, const JSClass* constructorClass, unsigned ctorNargs, const NamedConstructor* namedConstructors, JS::Handle proto, const NativeProperties* properties, const NativeProperties* chromeOnlyProperties, const char* name, @@ -855,7 +855,7 @@ static JSObject* CreateInterfaceObject( static JSObject* CreateInterfacePrototypeObject( JSContext* cx, JS::Handle global, - JS::Handle parentProto, const js::Class* protoClass, + JS::Handle parentProto, const JSClass* protoClass, const NativeProperties* properties, const NativeProperties* chromeOnlyProperties, const char* const* unscopableNames, const char* toStringTag, @@ -953,9 +953,9 @@ bool DefineProperties(JSContext* cx, JS::Handle obj, void CreateInterfaceObjects( JSContext* cx, JS::Handle global, - JS::Handle protoProto, const js::Class* protoClass, + JS::Handle protoProto, const JSClass* protoClass, JS::Heap* protoCache, const char* toStringTag, - JS::Handle constructorProto, const js::Class* constructorClass, + JS::Handle constructorProto, const JSClass* constructorClass, unsigned ctorNargs, const NamedConstructor* namedConstructors, JS::Heap* constructorCache, const NativeProperties* properties, const NativeProperties* chromeOnlyProperties, const char* name, @@ -1107,7 +1107,7 @@ bool TryPreserveWrapper(JS::Handle obj) { } // Can only be called with a DOM JSClass. -bool InstanceClassHasProtoAtDepth(const js::Class* clasp, uint32_t protoID, +bool InstanceClassHasProtoAtDepth(const JSClass* clasp, uint32_t protoID, uint32_t depth) { const DOMJSClass* domClass = DOMJSClass::FromJSClass(clasp); return static_cast(domClass->mInterfaceChain[depth]) == protoID; @@ -1326,7 +1326,7 @@ inline const NativePropertyHooks* GetNativePropertyHooksFromConstructorFunction( inline const NativePropertyHooks* GetNativePropertyHooks( JSContext* cx, JS::Handle obj, DOMObjectType& type) { - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); const DOMJSClass* domClass = GetDOMClass(clasp); if (domClass) { @@ -1742,7 +1742,7 @@ static void DEBUG_CheckXBLLookup(JSContext* cx, JS::PropertyDescriptor* desc) { } if (id.get() == GetJSIDByIndex(cx, XPCJSContext::IDX_ISINSTANCE)) { - const js::Class* objClass = js::GetObjectClass(obj); + const JSClass* objClass = js::GetObjectClass(obj); if (IsDOMIfaceAndProtoClass(objClass) && DOMIfaceAndProtoJSClass::FromJSClass(objClass) ->wantsInterfaceHasInstance) { @@ -1766,7 +1766,7 @@ static void DEBUG_CheckXBLLookup(JSContext* cx, JS::PropertyDescriptor* desc) { if (id.get() == SYMBOL_TO_JSID(JS::GetWellKnownSymbol( cx, JS::SymbolCode::hasInstance))) { - const js::Class* objClass = js::GetObjectClass(obj); + const JSClass* objClass = js::GetObjectClass(obj); if (IsDOMIfaceAndProtoClass(objClass) && DOMIfaceAndProtoJSClass::FromJSClass(objClass) ->wantsInterfaceHasInstance) { @@ -2425,7 +2425,7 @@ bool InterfaceHasInstance(JSContext* cx, unsigned argc, JS::Value* vp) { return CallOrdinaryHasInstance(cx, args); } - const js::Class* thisClass = js::GetObjectClass(thisObj); + const JSClass* thisClass = js::GetObjectClass(thisObj); if (!IsDOMIfaceAndProtoClass(thisClass)) { return CallOrdinaryHasInstance(cx, args); @@ -2501,7 +2501,7 @@ bool InterfaceIsInstance(JSContext* cx, unsigned argc, JS::Value* vp) { return true; } - const js::Class* thisClass = js::GetObjectClass(thisObj); + const JSClass* thisClass = js::GetObjectClass(thisObj); if (!IsDOMIfaceAndProtoClass(thisClass)) { args.rval().setBoolean(false); return true; @@ -3429,7 +3429,7 @@ bool ForEachHandler(JSContext* aCx, unsigned aArgc, JS::Value* aVp) { static inline prototypes::ID GetProtoIdForNewtarget( JS::Handle aNewTarget) { - const js::Class* newTargetClass = js::GetObjectClass(aNewTarget); + const JSClass* newTargetClass = js::GetObjectClass(aNewTarget); if (IsDOMIfaceAndProtoClass(newTargetClass)) { const DOMIfaceAndProtoJSClass* newTargetIfaceClass = DOMIfaceAndProtoJSClass::FromJSClass(newTargetClass); diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 97508ae70c38..c6c4b3980524 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -122,7 +122,7 @@ inline T* UnwrapPossiblyNotInitializedDOMObject(JSObject* obj) { return static_cast(val.toPrivate()); } -inline const DOMJSClass* GetDOMClass(const js::Class* clasp) { +inline const DOMJSClass* GetDOMClass(const JSClass* clasp) { return IsDOMClass(clasp) ? DOMJSClass::FromJSClass(clasp) : nullptr; } @@ -722,9 +722,9 @@ struct NamedConstructor { // clang-format on void CreateInterfaceObjects( JSContext* cx, JS::Handle global, - JS::Handle protoProto, const js::Class* protoClass, + JS::Handle protoProto, const JSClass* protoClass, JS::Heap* protoCache, const char* toStringTag, - JS::Handle interfaceProto, const js::Class* constructorClass, + JS::Handle interfaceProto, const JSClass* constructorClass, unsigned ctorNargs, const NamedConstructor* namedConstructors, JS::Heap* constructorCache, const NativeProperties* regularProperties, @@ -1422,7 +1422,7 @@ inline void UpdateWrapper(T* p, void*, JSObject* obj, const JSObject* old) { bool TryPreserveWrapper(JS::Handle obj); // Can only be called with a DOM JSClass. -bool InstanceClassHasProtoAtDepth(const js::Class* clasp, uint32_t protoID, +bool InstanceClassHasProtoAtDepth(const JSClass* clasp, uint32_t protoID, uint32_t depth); // Only set allowNativeWrapper to false if you really know you need it; if in @@ -2273,7 +2273,7 @@ inline bool XrayGetNativeProto(JSContext* cx, JS::Handle obj, MOZ_ASSERT(JS_IsNativeFunction(obj, Constructor)); protop.set(JS::GetRealmFunctionPrototype(cx)); } else { - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); MOZ_ASSERT(IsDOMIfaceAndProtoClass(clasp)); ProtoGetter protoGetter = DOMIfaceAndProtoJSClass::FromJSClass(clasp)->mGetParentProto; @@ -2337,7 +2337,7 @@ extern const JSClassOps sBoringInterfaceObjectClassClassOps; extern const js::ObjectOps sInterfaceObjectClassObjectOps; inline bool UseDOMXray(JSObject* obj) { - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); return IsDOMClass(clasp) || JS_IsNativeFunction(obj, Constructor) || IsDOMIfaceAndProtoClass(clasp); } @@ -2348,7 +2348,7 @@ inline bool IsDOMConstructor(JSObject* obj) { return true; } - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); // Check for a DOM interface object. return dom::IsDOMIfaceAndProtoClass(clasp) && dom::DOMIfaceAndProtoJSClass::FromJSClass(clasp)->mType == @@ -2588,7 +2588,7 @@ class MOZ_STACK_CLASS BindingJSObjectCreator { } } - void CreateProxyObject(JSContext* aCx, const js::Class* aClass, + void CreateProxyObject(JSContext* aCx, const JSClass* aClass, const DOMProxyHandler* aHandler, JS::Handle aProto, bool aLazyProto, T* aNative, JS::Handle aExpandoValue, diff --git a/dom/bindings/DOMJSClass.h b/dom/bindings/DOMJSClass.h index f07c1faa4e3b..a0afe2e6f36e 100644 --- a/dom/bindings/DOMJSClass.h +++ b/dom/bindings/DOMJSClass.h @@ -418,7 +418,7 @@ struct DOMJSClass { // It would be nice to just inherit from JSClass, but that precludes pure // compile-time initialization of the form |DOMJSClass = {...};|, since C++ // only allows brace initialization for aggregate/POD types. - const js::Class mBase; + const JSClass mBase; // A list of interfaces that this object implements, in order of decreasing // derivedness. @@ -457,11 +457,11 @@ struct DOMJSClass { // Special JSClass for DOM interface and interface prototype objects. struct DOMIfaceAndProtoJSClass { - // It would be nice to just inherit from js::Class, but that precludes pure + // It would be nice to just inherit from JSClass, but that precludes pure // compile-time initialization of the form // |DOMJSInterfaceAndPrototypeClass = {...};|, since C++ only allows brace // initialization for aggregate/POD types. - const js::Class mBase; + const JSClass mBase; // Either eInterface, eInterfacePrototype, eGlobalInterfacePrototype or // eNamedPropertiesObject. diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index b7f924274189..db2957af5d1f 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -153,7 +153,7 @@ class ShadowingDOMProxyHandler : public DOMProxyHandler { }; inline bool IsDOMProxy(JSObject* obj) { - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); return clasp->isProxy() && js::GetProxyHandler(obj)->family() == &DOMProxyHandler::family; } diff --git a/dom/bindings/RemoteObjectProxy.cpp b/dom/bindings/RemoteObjectProxy.cpp index 9229fadfe9da..81948820894e 100644 --- a/dom/bindings/RemoteObjectProxy.cpp +++ b/dom/bindings/RemoteObjectProxy.cpp @@ -171,7 +171,7 @@ const char* RemoteObjectProxyBase::className( } void RemoteObjectProxyBase::GetOrCreateProxyObject( - JSContext* aCx, void* aNative, const js::Class* aClasp, + JSContext* aCx, void* aNative, const JSClass* aClasp, JS::Handle aTransplantTo, JS::MutableHandle aProxy, bool& aNewObjectCreated) const { xpc::CompartmentPrivate* priv = diff --git a/dom/bindings/RemoteObjectProxy.h b/dom/bindings/RemoteObjectProxy.h index 1256a3abbd8c..03fce31fcd8e 100644 --- a/dom/bindings/RemoteObjectProxy.h +++ b/dom/bindings/RemoteObjectProxy.h @@ -116,7 +116,7 @@ class RemoteObjectProxyBase : public js::BaseProxyHandler, * failed after creating the object. */ void GetOrCreateProxyObject(JSContext* aCx, void* aNative, - const js::Class* aClasp, + const JSClass* aClasp, JS::Handle aTransplantTo, JS::MutableHandle aProxy, bool& aNewObjectCreated) const; @@ -170,7 +170,7 @@ class RemoteObjectProxy : public RemoteObjectProxyBase { aCx, aProxy, /* slot = */ 0, P, F, aHolder); } - static const js::Class sClass; + static const JSClass sClass; }; /** diff --git a/dom/bindings/SimpleGlobalObject.cpp b/dom/bindings/SimpleGlobalObject.cpp index 1fe555cb595e..2550ba074f58 100644 --- a/dom/bindings/SimpleGlobalObject.cpp +++ b/dom/bindings/SimpleGlobalObject.cpp @@ -76,14 +76,14 @@ static const JSClassOps SimpleGlobalClassOps = { static const js::ClassExtension SimpleGlobalClassExtension = { SimpleGlobal_moved}; -const js::Class SimpleGlobalClass = { - "", - JSCLASS_GLOBAL_FLAGS | JSCLASS_HAS_PRIVATE | - JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_FOREGROUND_FINALIZE, - &SimpleGlobalClassOps, - JS_NULL_CLASS_SPEC, - &SimpleGlobalClassExtension, - JS_NULL_OBJECT_OPS}; +const JSClass SimpleGlobalClass = {"", + JSCLASS_GLOBAL_FLAGS | JSCLASS_HAS_PRIVATE | + JSCLASS_PRIVATE_IS_NSISUPPORTS | + JSCLASS_FOREGROUND_FINALIZE, + &SimpleGlobalClassOps, + JS_NULL_CLASS_SPEC, + &SimpleGlobalClassExtension, + JS_NULL_OBJECT_OPS}; // static JSObject* SimpleGlobalObject::Create(GlobalType globalType, diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index f48d703b3f0b..f39d08f623c7 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -233,7 +233,7 @@ static bool CreateNPObjectMember(NPP npp, JSContext* cx, NPVariant* getPropertyResult, JS::MutableHandle vp); -const js::Class sNPObjWrapperProxyClass = +const JSClass sNPObjWrapperProxyClass = PROXY_CLASS_DEF(NPRUNTIME_JSCLASS_NAME, JSCLASS_HAS_RESERVED_SLOTS(1)); typedef struct NPObjectMemberPrivate { diff --git a/js/xpconnect/idl/nsIXPCScriptable.idl b/js/xpconnect/idl/nsIXPCScriptable.idl index 51c901006dde..55cda4896b6e 100644 --- a/js/xpconnect/idl/nsIXPCScriptable.idl +++ b/js/xpconnect/idl/nsIXPCScriptable.idl @@ -23,7 +23,6 @@ interface nsIXPConnectWrappedNative; [ptr] native JSValPtr(JS::Value); [ptr] native JSFreeOpPtr(JSFreeOp); [ref] native JSCallArgsRef(const JS::CallArgs); -[ptr] native jsClassPtr(const js::Class); [ptr] native JSClassPtr(const JSClass); native JSMutableHandleIdVector(JS::MutableHandleIdVector); @@ -64,7 +63,6 @@ interface nsIXPCScriptable : nsISupports { readonly attribute AUTF8String className; [notxpcom,nostdcall] uint32_t getScriptableFlags(); - [notxpcom,nostdcall] jsClassPtr getClass(); [notxpcom,nostdcall] JSClassPtr getJSClass(); void preCreate(in nsISupports nativeObj, in JSContextPtr cx, diff --git a/js/xpconnect/public/xpc_make_class.h b/js/xpconnect/public/xpc_make_class.h index a53209fa8b92..45d297ce5b88 100644 --- a/js/xpconnect/public/xpc_make_class.h +++ b/js/xpconnect/public/xpc_make_class.h @@ -7,7 +7,7 @@ #ifndef xpc_make_class_h #define xpc_make_class_h -// This file should be used to create js::Class instances for nsIXPCScriptable +// This file should be used to create JSClass instances for nsIXPCScriptable // instances. This includes any file that uses xpc_map_end.h. #include "xpcpublic.h" diff --git a/js/xpconnect/public/xpc_map_end.h b/js/xpconnect/public/xpc_map_end.h index 3d880fd0cac3..bc6b3ec766c2 100644 --- a/js/xpconnect/public/xpc_map_end.h +++ b/js/xpconnect/public/xpc_map_end.h @@ -34,16 +34,13 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::GetClassName(nsACString& aClassName) { uint32_t XPC_MAP_CLASSNAME::GetScriptableFlags() { return (XPC_MAP_FLAGS); } // virtual -const js::Class* XPC_MAP_CLASSNAME::GetClass() { +const JSClass* XPC_MAP_CLASSNAME::GetJSClass() { static const JSClassOps classOps = XPC_MAKE_CLASS_OPS(GetScriptableFlags()); - static const js::Class klass = + static const JSClass klass = XPC_MAKE_CLASS(XPC_MAP_QUOTED_CLASSNAME, GetScriptableFlags(), &classOps); return &klass; } -// virtual -const JSClass* XPC_MAP_CLASSNAME::GetJSClass() { return GetClass(); } - /**************************************************************/ #if !((XPC_MAP_FLAGS)&XPC_SCRIPTABLE_WANT_PRECREATE) diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 4812a992c041..760a30caee00 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -458,7 +458,7 @@ static const js::ClassExtension SandboxClassExtension = { sandbox_moved /* objectMovedOp */ }; -static const js::Class SandboxClass = { +static const JSClass SandboxClass = { "Sandbox", XPCONNECT_GLOBAL_FLAGS_WITH_EXTRA_SLOTS(1) | JSCLASS_FOREGROUND_FINALIZE, &SandboxClassOps, @@ -471,7 +471,7 @@ static const JSFunctionSpec SandboxFunctions[] = { JS_FN("importFunction", SandboxImport, 1, 0), JS_FS_END}; bool xpc::IsSandbox(JSObject* obj) { - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); return clasp == &SandboxClass; } @@ -1069,7 +1069,7 @@ nsresult xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, realmOptions.behaviors().setDiscardSource(options.discardSource); - const js::Class* clasp = &SandboxClass; + const JSClass* clasp = &SandboxClass; RootedObject sandbox( cx, xpc::CreateGlobalObject(cx, clasp, principal, realmOptions)); @@ -1151,7 +1151,7 @@ nsresult xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, JS_ReportErrorASCII(cx, "Sandbox must subsume sandboxPrototype"); return NS_ERROR_INVALID_ARG; } - const js::Class* unwrappedClass = js::GetObjectClass(unwrappedProto); + const JSClass* unwrappedClass = js::GetObjectClass(unwrappedProto); useSandboxProxy = IS_WN_CLASS(unwrappedClass) || mozilla::dom::IsDOMClass(unwrappedClass); } diff --git a/js/xpconnect/src/XPCCallContext.cpp b/js/xpconnect/src/XPCCallContext.cpp index 58738ad65a0d..de907b683278 100644 --- a/js/xpconnect/src/XPCCallContext.cpp +++ b/js/xpconnect/src/XPCCallContext.cpp @@ -15,7 +15,7 @@ using namespace mozilla; using namespace xpc; using namespace JS; -static inline bool IsTearoffClass(const js::Class* clazz) { +static inline bool IsTearoffClass(const JSClass* clazz) { return clazz == &XPC_WN_Tearoff_JSClass; } @@ -69,7 +69,7 @@ XPCCallContext::XPCCallContext( mState = INIT_FAILED; return; } - const js::Class* clasp = js::GetObjectClass(unwrapped); + const JSClass* clasp = js::GetObjectClass(unwrapped); if (IS_WN_CLASS(clasp)) { mWrapper = XPCWrappedNative::Get(unwrapped); } else if (IsTearoffClass(clasp)) { diff --git a/js/xpconnect/src/XPCJSID.cpp b/js/xpconnect/src/XPCJSID.cpp index 1118d0c48dad..991ebda6f5b6 100644 --- a/js/xpconnect/src/XPCJSID.cpp +++ b/js/xpconnect/src/XPCJSID.cpp @@ -35,7 +35,7 @@ static bool ID_GetNumber(JSContext* aCx, unsigned aArgc, Value* aVp); // 1/4 of the representation of the nsID value. This allows us to avoid an extra // allocation for the nsID object, and eliminates the need for a finalizer. enum { kID_Slot0, kID_Slot1, kID_Slot2, kID_Slot3, kID_SlotCount }; -static const js::Class sID_Class = { +static const JSClass sID_Class = { "nsJSID", JSCLASS_HAS_RESERVED_SLOTS(kID_SlotCount), JS_NULL_CLASS_OPS}; /****************************************************************************** @@ -51,7 +51,7 @@ static bool IID_GetName(JSContext* aCx, unsigned aArgc, Value* aVp); // Interface ID objects use a single reserved slot containing a pointer to the // nsXPTInterfaceInfo object for the interface in question. enum { kIID_InfoSlot, kIID_SlotCount }; -static const js::Class sIID_Class = { +static const JSClass sIID_Class = { "nsJSIID", JSCLASS_HAS_RESERVED_SLOTS(kIID_SlotCount), JS_NULL_CLASS_OPS}; /****************************************************************************** @@ -68,14 +68,14 @@ static bool CID_GetName(JSContext* aCx, unsigned aArgc, Value* aVp); // ContractID objects use a single reserved slot, containing the ContractID. The // nsCID value for this object is looked up when the object is being unwrapped. enum { kCID_ContractSlot, kCID_SlotCount }; -static const js::Class sCID_Class = { +static const JSClass sCID_Class = { "nsJSCID", JSCLASS_HAS_RESERVED_SLOTS(kCID_SlotCount), JS_NULL_CLASS_OPS}; /** * Ensure that the nsID prototype objects have been created for the current * global, and extract the prototype values. */ -static JSObject* GetIDPrototype(JSContext* aCx, const js::Class* aClass) { +static JSObject* GetIDPrototype(JSContext* aCx, const JSClass* aClass) { XPCWrappedNativeScope* scope = ObjectScope(CurrentGlobalOrNull(aCx)); if (NS_WARN_IF(!scope)) { return nullptr; @@ -145,7 +145,7 @@ static JSObject* GetIDPrototype(JSContext* aCx, const js::Class* aClass) { } // Unwrap the given value to an object with the correct class, or nullptr. -static JSObject* GetIDObject(HandleValue aVal, const Class* aClass) { +static JSObject* GetIDObject(HandleValue aVal, const JSClass* aClass) { if (aVal.isObject()) { // We care only about IID/CID objects here, so CheckedUnwrapStatic is fine. JSObject* obj = js::CheckedUnwrapStatic(&aVal.toObject()); @@ -220,7 +220,7 @@ Maybe JSValue2ID(JSContext* aCx, HandleValue aVal) { /** * Public ID Object Constructor Methods */ -static JSObject* NewIDObjectHelper(JSContext* aCx, const js::Class* aClass) { +static JSObject* NewIDObjectHelper(JSContext* aCx, const JSClass* aClass) { RootedObject proto(aCx, GetIDPrototype(aCx, aClass)); if (proto) { return JS_NewObjectWithGivenProto(aCx, aClass, proto); diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 8a267ddc15f5..b66baa69512d 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -227,7 +227,7 @@ RealmPrivate::RealmPrivate(JS::Realm* realm) : scriptability(realm) { /* static */ void RealmPrivate::Init(HandleObject aGlobal, const SiteIdentifier& aSite) { MOZ_ASSERT(aGlobal); - DebugOnly clasp = js::GetObjectClass(aGlobal); + DebugOnly clasp = js::GetObjectClass(aGlobal); MOZ_ASSERT(clasp->flags & (JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_HAS_PRIVATE) || dom::IsDOMClass(clasp)); @@ -3152,7 +3152,7 @@ bool XPCJSRuntime::InitializeStrings(JSContext* cx) { return true; } -bool XPCJSRuntime::DescribeCustomObjects(JSObject* obj, const js::Class* clasp, +bool XPCJSRuntime::DescribeCustomObjects(JSObject* obj, const JSClass* clasp, char (&name)[72]) const { if (clasp != &XPC_WN_Proto_JSClass) { return false; @@ -3171,7 +3171,7 @@ bool XPCJSRuntime::DescribeCustomObjects(JSObject* obj, const js::Class* clasp, } bool XPCJSRuntime::NoteCustomGCThingXPCOMChildren( - const js::Class* clasp, JSObject* obj, + const JSClass* clasp, JSObject* obj, nsCycleCollectionTraversalCallback& cb) const { if (clasp != &XPC_WN_Tearoff_JSClass) { return false; diff --git a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp index 9c6211b7131f..d4a9d64bd8b7 100644 --- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -565,7 +565,7 @@ enum WNHelperType { WN_NOHELPER, WN_HELPER }; static void WrappedNativeFinalize(JSFreeOp* fop, JSObject* obj, WNHelperType helperType) { - const js::Class* clazz = js::GetObjectClass(obj); + const JSClass* clazz = js::GetObjectClass(obj); if (clazz->flags & JSCLASS_DOM_GLOBAL) { mozilla::dom::DestroyProtoAndIfaceCache(obj); } @@ -606,7 +606,7 @@ void XPC_WN_NoHelper_Finalize(JSFreeOp* fop, JSObject* obj) { /* static */ void XPCWrappedNative::Trace(JSTracer* trc, JSObject* obj) { - const js::Class* clazz = js::GetObjectClass(obj); + const JSClass* clazz = js::GetObjectClass(obj); if (clazz->flags & JSCLASS_DOM_GLOBAL) { mozilla::dom::TraceProtoAndIfaceCache(trc, obj); } @@ -660,7 +660,7 @@ static const JSClassOps XPC_WN_NoHelper_JSClassOps = { const js::ClassExtension XPC_WN_JSClassExtension = {WrappedNativeObjectMoved}; -const js::Class XPC_WN_NoHelper_JSClass = { +const JSClass XPC_WN_NoHelper_JSClass = { "XPCWrappedNative_NoHelper", XPC_WRAPPER_FLAGS | JSCLASS_IS_WRAPPED_NATIVE | JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_FOREGROUND_FINALIZE, @@ -906,7 +906,7 @@ MOZ_ALWAYS_INLINE JSObject* FixUpThisIfBroken(JSObject* obj, JSObject* funobj) { JSObject* parentObj = &js::GetFunctionNativeReserved(funobj, XPC_FUNCTION_PARENT_OBJECT_SLOT) .toObject(); - const js::Class* parentClass = js::GetObjectClass(parentObj); + const JSClass* parentClass = js::GetObjectClass(parentObj); if (MOZ_UNLIKELY( (IS_NOHELPER_CLASS(parentClass) || IS_CU_CLASS(parentClass)) && (js::GetObjectClass(obj) != parentClass))) { @@ -1103,7 +1103,7 @@ static const JSClassOps XPC_WN_Proto_JSClassOps = { static const js::ClassExtension XPC_WN_Proto_ClassExtension = { XPC_WN_Proto_ObjectMoved}; -const js::Class XPC_WN_Proto_JSClass = { +const JSClass XPC_WN_Proto_JSClass = { "XPC_WN_Proto_JSClass", XPC_WRAPPER_FLAGS, &XPC_WN_Proto_JSClassOps, JS_NULL_CLASS_SPEC, &XPC_WN_Proto_ClassExtension, JS_NULL_OBJECT_OPS}; @@ -1192,7 +1192,7 @@ static const JSClassOps XPC_WN_Tearoff_JSClassOps = { static const js::ClassExtension XPC_WN_Tearoff_JSClassExtension = { XPC_WN_TearOff_ObjectMoved}; -const js::Class XPC_WN_Tearoff_JSClass = { +const JSClass XPC_WN_Tearoff_JSClass = { "WrappedNative_TearOff", XPC_WRAPPER_FLAGS | JSCLASS_HAS_RESERVED_SLOTS(XPC_WN_TEAROFF_RESERVED_SLOTS), diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index 2eec7e719432..edf65f118027 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -459,7 +459,7 @@ JSObject* CreateGlobalObject(JSContext* cx, const JSClass* clasp, // thing. Also note that we only check this for JSCLASS_DOM_GLOBAL // classes because xpc::TraceXPCGlobal won't call // TraceProtoAndIfaceCache unless that flag is set. - if (!((const js::Class*)clasp)->isWrappedNative()) { + if (!((const JSClass*)clasp)->isWrappedNative()) { VerifyTraceProtoAndIfaceCacheCalledTracer trc(cx); TraceChildren(&trc, GCCellPtr(global.get())); MOZ_ASSERT(trc.ok, diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 1789ff3323e3..691e80e56af0 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -196,7 +196,7 @@ extern const char XPC_XPCONNECT_CONTRACTID[]; // If IS_WN_CLASS for the JSClass of an object is true, the object is a // wrappednative wrapper, holding the XPCWrappedNative in its private slot. -static inline bool IS_WN_CLASS(const js::Class* clazz) { +static inline bool IS_WN_CLASS(const JSClass* clazz) { return clazz->isWrappedNative(); } @@ -507,10 +507,10 @@ class XPCJSRuntime final : public mozilla::CycleCollectedJSRuntime { bool InitializeStrings(JSContext* cx); - virtual bool DescribeCustomObjects(JSObject* aObject, const js::Class* aClasp, + virtual bool DescribeCustomObjects(JSObject* aObject, const JSClass* aClasp, char (&aName)[72]) const override; virtual bool NoteCustomGCThingXPCOMChildren( - const js::Class* aClasp, JSObject* aObj, + const JSClass* aClasp, JSObject* aObj, nsCycleCollectionTraversalCallback& aCb) const override; /** @@ -793,12 +793,12 @@ class MOZ_STACK_CLASS XPCCallContext final { // These are the various JSClasses and callbacks whose use that required // visibility from more than one .cpp file. -extern const js::Class XPC_WN_NoHelper_JSClass; -extern const js::Class XPC_WN_Proto_JSClass; -extern const js::Class XPC_WN_Tearoff_JSClass; +extern const JSClass XPC_WN_NoHelper_JSClass; +extern const JSClass XPC_WN_Proto_JSClass; +extern const JSClass XPC_WN_Tearoff_JSClass; #define XPC_WN_TEAROFF_RESERVED_SLOTS 1 #define XPC_WN_TEAROFF_FLAT_OBJECT_SLOT 0 -extern const js::Class XPC_WN_NoHelper_Proto_JSClass; +extern const JSClass XPC_WN_NoHelper_Proto_JSClass; extern bool XPC_WN_CallMethod(JSContext* cx, unsigned argc, JS::Value* vp); diff --git a/js/xpconnect/wrappers/AccessCheck.cpp b/js/xpconnect/wrappers/AccessCheck.cpp index de5e78dab61a..25eb5d46875c 100644 --- a/js/xpconnect/wrappers/AccessCheck.cpp +++ b/js/xpconnect/wrappers/AccessCheck.cpp @@ -81,7 +81,7 @@ bool AccessCheck::isChrome(JSObject* obj) { bool IsCrossOriginAccessibleObject(JSObject* obj) { obj = js::UncheckedUnwrap(obj, /* stopAtWindowProxy = */ false); - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); return (clasp->name[0] == 'L' && !strcmp(clasp->name, "Location")) || (clasp->name[0] == 'W' && !strcmp(clasp->name, "Window")); diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 3f3e7395ee7c..73f8e9c5690e 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -617,7 +617,7 @@ bool JSXrayTraits::resolveOwnProperty(JSContext* cx, HandleObject wrapper, } if (ShouldResolveStaticProperties(standardConstructor)) { - const js::Class* clasp = js::ProtoKeyToClass(standardConstructor); + const JSClass* clasp = js::ProtoKeyToClass(standardConstructor); MOZ_ASSERT(clasp->specDefined()); if (!TryResolvePropertyFromSpecs( @@ -700,7 +700,7 @@ bool JSXrayTraits::resolveOwnProperty(JSContext* cx, HandleObject wrapper, } // Grab the JSClass. We require all Xrayable classes to have a ClassSpec. - const js::Class* clasp = js::GetObjectClass(target); + const JSClass* clasp = js::GetObjectClass(target); MOZ_ASSERT(clasp->specDefined()); // Indexed array properties are handled above, so we can just work with the @@ -949,7 +949,7 @@ bool JSXrayTraits::enumerateNames(JSContext* cx, HandleObject wrapper, } if (ShouldResolveStaticProperties(standardConstructor)) { - const js::Class* clasp = js::ProtoKeyToClass(standardConstructor); + const JSClass* clasp = js::ProtoKeyToClass(standardConstructor); MOZ_ASSERT(clasp->specDefined()); if (!AppendNamesFromFunctionAndPropertySpecs( @@ -983,7 +983,7 @@ bool JSXrayTraits::enumerateNames(JSContext* cx, HandleObject wrapper, } // Grab the JSClass. We require all Xrayable classes to have a ClassSpec. - const js::Class* clasp = js::GetObjectClass(target); + const JSClass* clasp = js::GetObjectClass(target); MOZ_ASSERT(clasp->specDefined()); return AppendNamesFromFunctionAndPropertySpecs( @@ -1006,7 +1006,7 @@ bool JSXrayTraits::construct(JSContext* cx, HandleObject wrapper, return baseInstance.construct(cx, wrapper, args); } - const js::Class* clasp = js::ProtoKeyToClass(standardConstructor); + const JSClass* clasp = js::ProtoKeyToClass(standardConstructor); MOZ_ASSERT(clasp); if (!(clasp->flags & JSCLASS_HAS_XRAYED_CONSTRUCTOR)) { return baseInstance.construct(cx, wrapper, args); @@ -1744,7 +1744,7 @@ bool DOMXrayTraits::call(JSContext* cx, HandleObject wrapper, const JS::CallArgs& args, const js::Wrapper& baseInstance) { RootedObject obj(cx, getTargetObject(wrapper)); - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); // What we have is either a WebIDL interface object, a WebIDL prototype // object, or a WebIDL instance object. WebIDL prototype objects never have // a clasp->call. WebIDL interface objects we want to invoke on the xray @@ -1767,7 +1767,7 @@ bool DOMXrayTraits::construct(JSContext* cx, HandleObject wrapper, const js::Wrapper& baseInstance) { RootedObject obj(cx, getTargetObject(wrapper)); MOZ_ASSERT(mozilla::dom::HasConstructor(obj)); - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); // See comments in DOMXrayTraits::call() explaining what's going on here. if (clasp->flags & JSCLASS_IS_DOMIFACEANDPROTOJSCLASS) { if (JSNative construct = clasp->getConstruct()) { diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index e2da8d0c5503..367392f3046c 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -620,7 +620,7 @@ void CycleCollectedJSRuntime::DescribeGCThing( if (aThing.is()) { JSObject* obj = &aThing.as(); compartmentAddress = (uint64_t)js::GetObjectCompartment(obj); - const js::Class* clasp = js::GetObjectClass(obj); + const JSClass* clasp = js::GetObjectClass(obj); // Give the subclass a chance to do something if (DescribeCustomObjects(obj, clasp, name)) { @@ -655,7 +655,7 @@ void CycleCollectedJSRuntime::NoteGCThingJSChildren( } void CycleCollectedJSRuntime::NoteGCThingXPCOMChildren( - const js::Class* aClasp, JSObject* aObj, + const JSClass* aClasp, JSObject* aObj, nsCycleCollectionTraversalCallback& aCb) const { MOZ_ASSERT(aClasp); MOZ_ASSERT(aClasp == js::GetObjectClass(aObj)); diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h index 40eae7ff427a..c371fd0dc22b 100644 --- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -118,7 +118,7 @@ class CycleCollectedJSRuntime { void DescribeGCThing(bool aIsMarked, JS::GCCellPtr aThing, nsCycleCollectionTraversalCallback& aCb) const; - virtual bool DescribeCustomObjects(JSObject* aObject, const js::Class* aClasp, + virtual bool DescribeCustomObjects(JSObject* aObject, const JSClass* aClasp, char (&aName)[72]) const { return false; // We did nothing. } @@ -126,11 +126,11 @@ class CycleCollectedJSRuntime { void NoteGCThingJSChildren(JS::GCCellPtr aThing, nsCycleCollectionTraversalCallback& aCb) const; - void NoteGCThingXPCOMChildren(const js::Class* aClasp, JSObject* aObj, + void NoteGCThingXPCOMChildren(const JSClass* aClasp, JSObject* aObj, nsCycleCollectionTraversalCallback& aCb) const; virtual bool NoteCustomGCThingXPCOMChildren( - const js::Class* aClasp, JSObject* aObj, + const JSClass* aClasp, JSObject* aObj, nsCycleCollectionTraversalCallback& aCb) const { return false; // We did nothing. }