mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1573844 - Remove external references to js::Class r=mccr8
Depends on D41985 Differential Revision: https://phabricator.services.mozilla.com/D41986 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
41d076b49e
commit
c772fc6cda
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -153,7 +153,7 @@ extern already_AddRefed<nsIScriptTimeoutHandler> 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
|
||||
|
@ -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;
|
||||
|
@ -140,7 +140,7 @@ extern already_AddRefed<nsIScriptTimeoutHandler> NS_CreateJSTimeoutHandler(
|
||||
JSContext* aCx, nsGlobalWindowInner* aWindow, const nsAString& aExpression,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
extern const js::Class OuterWindowProxyClass;
|
||||
extern const JSClass OuterWindowProxyClass;
|
||||
|
||||
//*****************************************************************************
|
||||
// nsGlobalWindowOuter
|
||||
|
@ -677,7 +677,7 @@ bool DefineUnforgeableAttributes(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
// funToString ObjectOps member for interface objects.
|
||||
JSString* InterfaceObjectToString(JSContext* aCx, JS::Handle<JSObject*> 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<JSObject*> global,
|
||||
|
||||
static JSObject* CreateInterfaceObject(
|
||||
JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> constructorProto, const js::Class* constructorClass,
|
||||
JS::Handle<JSObject*> constructorProto, const JSClass* constructorClass,
|
||||
unsigned ctorNargs, const NamedConstructor* namedConstructors,
|
||||
JS::Handle<JSObject*> proto, const NativeProperties* properties,
|
||||
const NativeProperties* chromeOnlyProperties, const char* name,
|
||||
@ -855,7 +855,7 @@ static JSObject* CreateInterfaceObject(
|
||||
|
||||
static JSObject* CreateInterfacePrototypeObject(
|
||||
JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> parentProto, const js::Class* protoClass,
|
||||
JS::Handle<JSObject*> 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<JSObject*> obj,
|
||||
|
||||
void CreateInterfaceObjects(
|
||||
JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> protoProto, const js::Class* protoClass,
|
||||
JS::Handle<JSObject*> protoProto, const JSClass* protoClass,
|
||||
JS::Heap<JSObject*>* protoCache, const char* toStringTag,
|
||||
JS::Handle<JSObject*> constructorProto, const js::Class* constructorClass,
|
||||
JS::Handle<JSObject*> constructorProto, const JSClass* constructorClass,
|
||||
unsigned ctorNargs, const NamedConstructor* namedConstructors,
|
||||
JS::Heap<JSObject*>* constructorCache, const NativeProperties* properties,
|
||||
const NativeProperties* chromeOnlyProperties, const char* name,
|
||||
@ -1107,7 +1107,7 @@ bool TryPreserveWrapper(JS::Handle<JSObject*> 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<uint32_t>(domClass->mInterfaceChain[depth]) == protoID;
|
||||
@ -1326,7 +1326,7 @@ inline const NativePropertyHooks* GetNativePropertyHooksFromConstructorFunction(
|
||||
|
||||
inline const NativePropertyHooks* GetNativePropertyHooks(
|
||||
JSContext* cx, JS::Handle<JSObject*> 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<JSObject*> aNewTarget) {
|
||||
const js::Class* newTargetClass = js::GetObjectClass(aNewTarget);
|
||||
const JSClass* newTargetClass = js::GetObjectClass(aNewTarget);
|
||||
if (IsDOMIfaceAndProtoClass(newTargetClass)) {
|
||||
const DOMIfaceAndProtoJSClass* newTargetIfaceClass =
|
||||
DOMIfaceAndProtoJSClass::FromJSClass(newTargetClass);
|
||||
|
@ -122,7 +122,7 @@ inline T* UnwrapPossiblyNotInitializedDOMObject(JSObject* obj) {
|
||||
return static_cast<T*>(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<JSObject*> global,
|
||||
JS::Handle<JSObject*> protoProto, const js::Class* protoClass,
|
||||
JS::Handle<JSObject*> protoProto, const JSClass* protoClass,
|
||||
JS::Heap<JSObject*>* protoCache, const char* toStringTag,
|
||||
JS::Handle<JSObject*> interfaceProto, const js::Class* constructorClass,
|
||||
JS::Handle<JSObject*> interfaceProto, const JSClass* constructorClass,
|
||||
unsigned ctorNargs, const NamedConstructor* namedConstructors,
|
||||
JS::Heap<JSObject*>* constructorCache,
|
||||
const NativeProperties* regularProperties,
|
||||
@ -1422,7 +1422,7 @@ inline void UpdateWrapper(T* p, void*, JSObject* obj, const JSObject* old) {
|
||||
bool TryPreserveWrapper(JS::Handle<JSObject*> 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<JSObject*> 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<JSObject*> aProto, bool aLazyProto,
|
||||
T* aNative, JS::Handle<JS::Value> aExpandoValue,
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<JSObject*> aTransplantTo, JS::MutableHandle<JSObject*> aProxy,
|
||||
bool& aNewObjectCreated) const {
|
||||
xpc::CompartmentPrivate* priv =
|
||||
|
@ -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<JSObject*> aTransplantTo,
|
||||
JS::MutableHandle<JSObject*> 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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
|
@ -233,7 +233,7 @@ static bool CreateNPObjectMember(NPP npp, JSContext* cx,
|
||||
NPVariant* getPropertyResult,
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
const js::Class sNPObjWrapperProxyClass =
|
||||
const JSClass sNPObjWrapperProxyClass =
|
||||
PROXY_CLASS_DEF(NPRUNTIME_JSCLASS_NAME, JSCLASS_HAS_RESERVED_SLOTS(1));
|
||||
|
||||
typedef struct NPObjectMemberPrivate {
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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<nsID> 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);
|
||||
|
@ -227,7 +227,7 @@ RealmPrivate::RealmPrivate(JS::Realm* realm) : scriptability(realm) {
|
||||
/* static */
|
||||
void RealmPrivate::Init(HandleObject aGlobal, const SiteIdentifier& aSite) {
|
||||
MOZ_ASSERT(aGlobal);
|
||||
DebugOnly<const js::Class*> clasp = js::GetObjectClass(aGlobal);
|
||||
DebugOnly<const JSClass*> 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;
|
||||
|
@ -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),
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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"));
|
||||
|
@ -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()) {
|
||||
|
@ -620,7 +620,7 @@ void CycleCollectedJSRuntime::DescribeGCThing(
|
||||
if (aThing.is<JSObject>()) {
|
||||
JSObject* obj = &aThing.as<JSObject>();
|
||||
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));
|
||||
|
@ -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.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user