From 17db9a067b3585ba5edd9a0da98d68f15f41ffb5 Mon Sep 17 00:00:00 2001 From: Igor Bukanov Date: Sat, 4 Feb 2012 01:54:57 +0100 Subject: [PATCH] bug 723517 - Drop cx argumrent from JS_GetClass(cx, obj). r=luke --- caps/src/nsSecurityManagerFactory.cpp | 2 +- content/xbl/src/nsXBLBinding.cpp | 6 +- content/xbl/src/nsXBLDocumentInfo.cpp | 4 +- dom/base/nsDOMClassInfo.cpp | 18 +- dom/base/nsDOMWindowUtils.cpp | 2 +- dom/base/nsJSEnvironment.cpp | 2 +- dom/base/nsJSUtils.cpp | 2 +- dom/indexedDB/IDBObjectStore.cpp | 2 +- dom/plugins/base/nsJSNPRuntime.cpp | 12 +- dom/workers/EventTarget.cpp | 2 +- dom/workers/Events.cpp | 18 +- dom/workers/Exceptions.cpp | 10 +- dom/workers/File.cpp | 12 +- dom/workers/FileReaderSync.cpp | 8 +- dom/workers/Location.cpp | 6 +- dom/workers/Navigator.cpp | 4 +- dom/workers/Worker.cpp | 14 +- dom/workers/WorkerScope.cpp | 10 +- dom/workers/XMLHttpRequest.cpp | 18 +- js/jsd/jsd_val.c | 3 +- js/src/ctypes/CTypes.cpp | 252 +++++++++++------------ js/src/ctypes/CTypes.h | 14 +- js/src/ctypes/Library.cpp | 14 +- js/src/ctypes/Library.h | 2 +- js/src/jsapi-tests/testNewObject.cpp | 2 +- js/src/jsapi-tests/testSetProperty.cpp | 2 +- js/src/jsapi.cpp | 8 - js/src/jsapi.h | 11 +- js/src/perf/jsperf.cpp | 2 +- js/src/shell/js.cpp | 14 +- js/src/shell/jsworkers.cpp | 6 +- js/xpconnect/shell/xpcshell.cpp | 2 +- js/xpconnect/wrappers/WrapperFactory.cpp | 2 +- 33 files changed, 233 insertions(+), 253 deletions(-) diff --git a/caps/src/nsSecurityManagerFactory.cpp b/caps/src/nsSecurityManagerFactory.cpp index 961d478e0281..4dfe4920b6eb 100644 --- a/caps/src/nsSecurityManagerFactory.cpp +++ b/caps/src/nsSecurityManagerFactory.cpp @@ -339,7 +339,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext) JSAutoRequest ar(cx); while ((proto = JS_GetPrototype(cx, obj)) != nsnull) obj = proto; - JSClass *objectClass = JS_GET_CLASS(cx, obj); + JSClass *objectClass = JS_GetClass(obj); jsval v; if (!JS_GetProperty(cx, global, "netscape", &v)) diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index 3d86f4ab90fe..f8edb9a6e779 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -111,7 +111,7 @@ XBLFinalize(JSContext *cx, JSObject *obj) static_cast(::JS_GetPrivate(cx, obj)); NS_RELEASE(docInfo); - nsXBLJSClass* c = static_cast(::JS_GET_CLASS(cx, obj)); + nsXBLJSClass* c = static_cast(::JS_GetClass(obj)); c->Drop(); } @@ -149,7 +149,7 @@ XBLResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags, } // We have this field. Time to install it. Get our node. - JSClass* nodeClass = ::JS_GET_CLASS(cx, origObj); + JSClass* nodeClass = ::JS_GetClass(origObj); if (!nodeClass) { return JS_FALSE; } @@ -1093,7 +1093,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen break; } - JSClass* clazz = ::JS_GET_CLASS(cx, proto); + JSClass* clazz = ::JS_GetClass(proto); if (!clazz || (~clazz->flags & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) || diff --git a/content/xbl/src/nsXBLDocumentInfo.cpp b/content/xbl/src/nsXBLDocumentInfo.cpp index 7fc05f637a05..28558541a765 100644 --- a/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/content/xbl/src/nsXBLDocumentInfo.cpp @@ -121,7 +121,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JSObject *obj, jsid id, PRUin // Make sure to actually operate on our object, and not some object further // down on the proto chain. - while (JS_GET_CLASS(cx, obj) != &nsXBLDocGlobalObject::gSharedGlobalClass) { + while (JS_GetClass(obj) != &nsXBLDocGlobalObject::gSharedGlobalClass) { obj = ::JS_GetPrototype(cx, obj); if (!obj) { ::JS_ReportError(cx, "Invalid access to a global object property."); @@ -129,7 +129,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JSObject *obj, jsid id, PRUin } } - nsresult rv = ssm->CheckPropertyAccess(cx, obj, JS_GET_CLASS(cx, obj)->name, + nsresult rv = ssm->CheckPropertyAccess(cx, obj, JS_GetClass(obj)->name, id, accessType); return NS_SUCCEEDED(rv); } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 8011c23dafbc..4651087df700 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -4898,7 +4898,7 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * proto) } NS_ASSERTION(::JS_GetPrototype(cx, proto) && - JS_GET_CLASS(cx, ::JS_GetPrototype(cx, proto)) == sObjectClass, + JS_GetClass(::JS_GetPrototype(cx, proto)) == sObjectClass, "Hmm, somebody did something evil?"); #ifdef DEBUG @@ -5288,7 +5288,7 @@ nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj) JSAutoRequest ar(cx); while ((proto = ::JS_GetPrototype(cx, obj))) { - if (JS_GET_CLASS(cx, proto) == &sGlobalScopePolluterClass) { + if (JS_GetClass(proto) == &sGlobalScopePolluterClass) { nsIHTMLDocument *doc = (nsIHTMLDocument *)::JS_GetPrivate(cx, proto); NS_IF_RELEASE(doc); @@ -5330,7 +5330,7 @@ nsWindowSH::InstallGlobalScopePolluter(JSContext *cx, JSObject *obj, // scope polluter (right before Object.prototype). while ((proto = ::JS_GetPrototype(cx, o))) { - if (JS_GET_CLASS(cx, proto) == sObjectClass) { + if (JS_GetClass(proto) == sObjectClass) { // Set the global scope polluters prototype to Object.prototype ::JS_SplicePrototype(cx, gsp, proto); @@ -5447,7 +5447,7 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, // only do that if the JSClass name is one that is likely to be a // window object. - const char *name = JS_GET_CLASS(cx, JSVAL_TO_OBJECT(*vp))->name; + const char *name = JS_GetClass(JSVAL_TO_OBJECT(*vp))->name; // The list of Window class names here need to be kept in sync // with the actual class names! The class name @@ -5906,7 +5906,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper, dom_obj = wrapped_obj; } - JSClass *dom_class = JS_GET_CLASS(cx, dom_obj); + JSClass *dom_class = JS_GetClass(dom_obj); if (!dom_class) { NS_ERROR("nsDOMConstructor::HasInstance can't get class."); return NS_ERROR_UNEXPECTED; @@ -6305,7 +6305,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx, if (proto && (!xpc_proto_proto || - JS_GET_CLASS(cx, xpc_proto_proto) == sObjectClass)) { + JS_GetClass(xpc_proto_proto) == sObjectClass)) { if (!JS_WrapObject(cx, &proto) || !JS_SetPrototype(cx, dot_prototype, proto)) { return NS_ERROR_UNEXPECTED; @@ -8977,7 +8977,7 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, uintN argc, jsval *vp) // another method, use the document.all callee object as self. JSObject *self; if (JSVAL_IS_OBJECT(JS_CALLEE(cx, vp)) && - ::JS_GetClass(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))) == &sHTMLDocumentAllClass) { + ::JS_GetClass(JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))) == &sHTMLDocumentAllClass) { self = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); } else { self = JS_THIS_OBJECT(cx, vp); @@ -8998,7 +8998,7 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, uintN argc, jsval *vp) static inline JSObject * GetDocumentAllHelper(JSContext *cx, JSObject *obj) { - while (obj && JS_GET_CLASS(cx, obj) != &sHTMLDocumentAllHelperClass) { + while (obj && JS_GetClass(obj) != &sHTMLDocumentAllHelperClass) { obj = ::JS_GetPrototype(cx, obj); } @@ -9697,7 +9697,7 @@ nsHTMLPluginObjElementSH::SetupProtoChain(nsIXPConnectWrappedNative *wrapper, return NS_ERROR_UNEXPECTED; } - if (pi_proto && JS_GET_CLASS(cx, pi_proto) != sObjectClass) { + if (pi_proto && JS_GetClass(pi_proto) != sObjectClass) { // The plugin wrapper has a proto that's not Object.prototype, set // 'pi.__proto__.__proto__' to the original 'this.__proto__' if (pi_proto != my_proto && !::JS_SetPrototype(cx, pi_proto, my_proto)) { diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 19b950fdc338..ab17db9e9ab3 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1526,7 +1526,7 @@ nsDOMWindowUtils::GetClassName(const JS::Value& aObject, JSContext* aCx, char** return NS_ERROR_XPC_BAD_CONVERT_JS; } - *aName = NS_strdup(JS_GET_CLASS(aCx, JSVAL_TO_OBJECT(aObject))->name); + *aName = NS_strdup(JS_GetClass(JSVAL_TO_OBJECT(aObject))->name); NS_ABORT_IF_FALSE(*aName, "NS_strdup should be infallible."); return NS_OK; } diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 0ea8e11e62dd..913052dea888 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -2195,7 +2195,7 @@ nsJSContext::GetGlobalObject() } #endif - JSClass *c = JS_GET_CLASS(mContext, global); + JSClass *c = JS_GetClass(global); if (!c || ((~c->flags) & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS))) { diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp index 5e533981f161..88975c86053e 100644 --- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -109,7 +109,7 @@ nsJSUtils::GetStaticScriptGlobal(JSContext* aContext, JSObject* aObj) glob = JS_GetGlobalForObject(aContext, glob); NS_ABORT_IF_FALSE(glob, "Infallible returns null"); - clazz = JS_GET_CLASS(aContext, glob); + clazz = JS_GetClass(glob); if (!clazz || !(clazz->flags & JSCLASS_HAS_PRIVATE) || diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 30f15d7d1b6f..fbc6089d01fe 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -1038,7 +1038,7 @@ IDBObjectStore::StructuredCloneWriteCallback(JSContext* aCx, StructuredCloneWriteInfo* cloneWriteInfo = reinterpret_cast(aClosure); - if (JS_GET_CLASS(aCx, aObj) == &gDummyPropClass) { + if (JS_GetClass(aObj) == &gDummyPropClass) { NS_ASSERTION(cloneWriteInfo->mOffsetToKeyProp == 0, "We should not have been here before!"); cloneWriteInfo->mOffsetToKeyProp = js_GetSCOffset(aWriter); diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index ccfcc7f16021..79f3efea137d 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -1067,7 +1067,7 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JSObject *obj) // class and private from the JSObject, neither of which cares about // compartments. - JSClass *clazz = JS_GET_CLASS(cx, obj); + JSClass *clazz = JS_GetClass(obj); if (clazz == &sNPObjectJSWrapperClass) { // obj is one of our own, its private data is the NPObject we're @@ -1156,7 +1156,7 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JSObject *obj) static NPObject * GetNPObject(JSContext *cx, JSObject *obj) { - while (obj && JS_GET_CLASS(cx, obj) != &sNPObjectJSWrapperClass) { + while (obj && JS_GetClass(obj) != &sNPObjectJSWrapperClass) { obj = ::JS_GetPrototype(cx, obj); } @@ -1392,7 +1392,7 @@ static JSBool CallNPMethodInternal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval, bool ctorCall) { - while (obj && JS_GET_CLASS(cx, obj) != &sNPObjectJSWrapperClass) { + while (obj && JS_GetClass(obj) != &sNPObjectJSWrapperClass) { obj = ::JS_GetPrototype(cx, obj); } @@ -1702,7 +1702,7 @@ NPObjWrapper_Convert(JSContext *cx, JSObject *obj, JSType hint, jsval *vp) } JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CONVERT_TO, - JS_GET_CLASS(cx, obj)->name, + JS_GetClass(obj)->name, hint == JSTYPE_VOID ? "primitive type" : hint == JSTYPE_NUMBER @@ -2075,7 +2075,7 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp) // more than one of the plugin's scriptable objects on the prototype // chain). while (obj && (proto = ::JS_GetPrototype(cx, obj))) { - if (JS_GET_CLASS(cx, proto) == &sNPObjectJSWrapperClass) { + if (JS_GetClass(proto) == &sNPObjectJSWrapperClass) { // We found an NPObject on the proto chain, get its prototype... proto = ::JS_GetPrototype(cx, proto); @@ -2174,7 +2174,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj, // npobjWrapper is the JSObject through which we make sure we don't // outlive the underlying NPObject, so make sure it points to the // real JSObject wrapper for the NPObject. - while (JS_GET_CLASS(cx, obj) != &sNPObjectJSWrapperClass) { + while (JS_GetClass(obj) != &sNPObjectJSWrapperClass) { obj = ::JS_GetPrototype(cx, obj); } diff --git a/dom/workers/EventTarget.cpp b/dom/workers/EventTarget.cpp index 52099b49fecc..83c7e9d3a60e 100644 --- a/dom/workers/EventTarget.cpp +++ b/dom/workers/EventTarget.cpp @@ -72,7 +72,7 @@ inline bool EnsureObjectIsEventTarget(JSContext* aCx, JSObject* aObj, char* aFunctionName) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (ClassIsWorker(classPtr) || ClassIsWorkerGlobalScope(classPtr) || ClassIsXMLHttpRequest(classPtr)) { return true; diff --git a/dom/workers/Events.cpp b/dom/workers/Events.cpp index eb42ac9addcb..8e6dc1887307 100644 --- a/dom/workers/Events.cpp +++ b/dom/workers/Events.cpp @@ -220,7 +220,7 @@ protected: } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } @@ -275,7 +275,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj))); + JS_ASSERT(IsThisClass(JS_GetClass(aObj))); delete GetJSPrivateSafeish(aCx, aObj); } @@ -526,7 +526,7 @@ private: static MessageEvent* GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (IsThisClass(classPtr)) { return GetJSPrivateSafeish(aCx, aObj); } @@ -568,7 +568,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj))); + JS_ASSERT(IsThisClass(JS_GetClass(aObj))); MessageEvent* priv = GetJSPrivateSafeish(aCx, aObj); if (priv) { JS_free(aCx, priv->mData); @@ -751,7 +751,7 @@ private: static ErrorEvent* GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (IsThisClass(classPtr)) { return GetJSPrivateSafeish(aCx, aObj); } @@ -792,7 +792,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj))); + JS_ASSERT(IsThisClass(JS_GetClass(aObj))); delete GetJSPrivateSafeish(aCx, aObj); } @@ -939,7 +939,7 @@ private: static ProgressEvent* GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { return GetJSPrivateSafeish(aCx, aObj); } @@ -978,7 +978,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete GetJSPrivateSafeish(aCx, aObj); } @@ -1054,7 +1054,7 @@ Event* Event::GetPrivate(JSContext* aCx, JSObject* aObj) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (IsThisClass(classPtr) || MessageEvent::IsThisClass(classPtr) || ErrorEvent::IsThisClass(classPtr) || diff --git a/dom/workers/Exceptions.cpp b/dom/workers/Exceptions.cpp index e2e15e009e9d..296a30dfb23b 100644 --- a/dom/workers/Exceptions.cpp +++ b/dom/workers/Exceptions.cpp @@ -113,7 +113,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete GetJSPrivateSafeish(aCx, aObj); } @@ -125,7 +125,7 @@ private: return false; } - JSClass* classPtr = JS_GET_CLASS(aCx, obj); + JSClass* classPtr = JS_GetClass(obj); if (classPtr != &sClass) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, "toString", @@ -164,7 +164,7 @@ private: int32 slot = JSID_TO_INT(aIdval); - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr != &sClass || !GetJSPrivateSafeish(aCx, aObj)) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, @@ -329,7 +329,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete GetJSPrivateSafeish(aCx, aObj); } @@ -340,7 +340,7 @@ private: int32 slot = JSID_TO_INT(aIdval); - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr != &sClass || !GetJSPrivateSafeish(aCx, aObj)) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, diff --git a/dom/workers/File.cpp b/dom/workers/File.cpp index 16a168a5910d..a6b1280c3e10 100644 --- a/dom/workers/File.cpp +++ b/dom/workers/File.cpp @@ -108,7 +108,7 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } @@ -123,7 +123,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); nsIDOMBlob* blob = GetPrivate(aCx, aObj); NS_IF_RELEASE(blob); @@ -272,7 +272,7 @@ public: GetPrivate(JSContext* aCx, JSObject* aObj) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { nsISupports* priv = static_cast(JS_GetPrivate(aCx, aObj)); nsCOMPtr file = do_QueryInterface(priv); @@ -300,7 +300,7 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } @@ -315,7 +315,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); nsIDOMFile* file = GetPrivate(aCx, aObj); NS_IF_RELEASE(file); @@ -389,7 +389,7 @@ nsIDOMBlob* Blob::GetPrivate(JSContext* aCx, JSObject* aObj) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass || classPtr == File::Class()) { nsISupports* priv = static_cast(JS_GetPrivate(aCx, aObj)); nsCOMPtr blob = do_QueryInterface(priv); diff --git a/dom/workers/FileReaderSync.cpp b/dom/workers/FileReaderSync.cpp index 606c51699db1..cc57e3e7d38d 100644 --- a/dom/workers/FileReaderSync.cpp +++ b/dom/workers/FileReaderSync.cpp @@ -88,7 +88,7 @@ GetDOMBlobFromJSObject(JSContext* aCx, JSObject* aObj) { } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE, - aObj ? JS_GET_CLASS(aCx, aObj)->name : "Object", "not a Blob."); + aObj ? JS_GetClass(aObj)->name : "Object", "not a Blob."); return NULL; } @@ -113,7 +113,7 @@ public: GetPrivate(JSContext* aCx, JSObject* aObj) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { FileReaderSyncPrivate* fileReader = GetJSPrivateSafeish(aCx, aObj); @@ -134,7 +134,7 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } @@ -161,7 +161,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); FileReaderSyncPrivate* fileReader = GetJSPrivateSafeish(aCx, aObj); NS_IF_RELEASE(fileReader); diff --git a/dom/workers/Location.cpp b/dom/workers/Location.cpp index 77347e25dfbd..e14ee0a08b21 100644 --- a/dom/workers/Location.cpp +++ b/dom/workers/Location.cpp @@ -140,7 +140,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete static_cast(JS_GetPrivate(aCx, aObj)); } @@ -152,7 +152,7 @@ private: return false; } - JSClass* classPtr = JS_GET_CLASS(aCx, obj); + JSClass* classPtr = JS_GetClass(obj); if (classPtr != &sClass) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, "toString", @@ -173,7 +173,7 @@ private: static JSBool GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr != &sClass) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, "GetProperty", diff --git a/dom/workers/Navigator.cpp b/dom/workers/Navigator.cpp index 40843814b837..eea82f5bbf34 100644 --- a/dom/workers/Navigator.cpp +++ b/dom/workers/Navigator.cpp @@ -151,14 +151,14 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete static_cast(JS_GetPrivate(aCx, aObj)); } static JSBool GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr != &sClass) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, "GetProperty", diff --git a/dom/workers/Worker.cpp b/dom/workers/Worker.cpp index 375b77095d8c..17e1a60fdf40 100644 --- a/dom/workers/Worker.cpp +++ b/dom/workers/Worker.cpp @@ -241,7 +241,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); WorkerPrivate* worker = GetJSPrivateSafeish(aCx, aObj); if (worker) { worker->FinalizeInstance(aCx, true); @@ -251,7 +251,7 @@ private: static void Trace(JSTracer* aTrc, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); WorkerPrivate* worker = GetJSPrivateSafeish(aTrc->context, aObj); if (worker) { @@ -378,7 +378,7 @@ private: GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { return GetJSPrivateSafeish(aCx, aObj); } @@ -396,7 +396,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); WorkerPrivate* worker = GetJSPrivateSafeish(aCx, aObj); if (worker) { worker->FinalizeInstance(aCx, true); @@ -406,7 +406,7 @@ private: static void Trace(JSTracer* aTrc, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); WorkerPrivate* worker = GetJSPrivateSafeish(aTrc->context, aObj); if (worker) { @@ -427,7 +427,7 @@ WorkerPrivate* Worker::GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass || classPtr == ChromeWorker::Class()) { return GetJSPrivateSafeish(aCx, aObj); } @@ -453,7 +453,7 @@ InitClass(JSContext* aCx, JSObject* aGlobal, JSObject* aProto, void ClearPrivateSlot(JSContext* aCx, JSObject* aObj, bool aSaveEventHandlers) { - JSClass* clasp = JS_GET_CLASS(aCx, aObj); + JSClass* clasp = JS_GetClass(aObj); JS_ASSERT(clasp == Worker::Class() || clasp == ChromeWorker::Class()); if (clasp == ChromeWorker::Class()) { diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index f8d0dfb23354..a0771f0fad09 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -659,7 +659,7 @@ public: static JSBool InitPrivate(JSContext* aCx, JSObject* aObj, WorkerPrivate* aWorkerPrivate) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); JS_ASSERT(!GetJSPrivateSafeish(aCx, aObj)); DedicatedWorkerGlobalScope* priv = @@ -722,7 +722,7 @@ private: static DedicatedWorkerGlobalScope* GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { return GetJSPrivateSafeish(aCx, aObj); } @@ -757,7 +757,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); DedicatedWorkerGlobalScope* scope = GetJSPrivateSafeish(aCx, aObj); if (scope) { @@ -769,7 +769,7 @@ private: static void Trace(JSTracer* aTrc, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); DedicatedWorkerGlobalScope* scope = GetJSPrivateSafeish(aTrc->context, aObj); if (scope) { @@ -827,7 +827,7 @@ WorkerGlobalScope* WorkerGlobalScope::GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass || classPtr == DedicatedWorkerGlobalScope::Class()) { return GetJSPrivateSafeish(aCx, aObj); } diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 7877efd6d14c..48b46fd87037 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -137,7 +137,7 @@ private: GetPrivate(JSContext* aCx, JSObject* aObj) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { return GetJSPrivateSafeish(aCx, aObj); } @@ -155,7 +155,7 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } @@ -170,7 +170,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); XMLHttpRequestUpload* priv = GetPrivate(aCx, aObj); if (priv) { priv->FinalizeInstance(aCx); @@ -181,7 +181,7 @@ private: static void Trace(JSTracer* aTrc, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); XMLHttpRequestUpload* priv = GetPrivate(aTrc->context, aObj); if (priv) { priv->TraceInstance(aTrc); @@ -356,7 +356,7 @@ private: GetPrivate(JSContext* aCx, JSObject* aObj) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { return GetJSPrivateSafeish(aCx, aObj); } @@ -374,7 +374,7 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } @@ -423,7 +423,7 @@ private: static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); XMLHttpRequestPrivate* priv = GetPrivate(aCx, aObj); if (priv) { priv->FinalizeInstance(aCx); @@ -434,7 +434,7 @@ private: static void Trace(JSTracer* aTrc, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); XMLHttpRequestPrivate* priv = GetPrivate(aTrc->context, aObj); if (priv) { priv->TraceInstance(aTrc); @@ -878,7 +878,7 @@ bool XMLHttpRequestUpload::UpdateState(JSContext* aCx, JSObject* aObj, const xhr::StateData& aNewState) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); jsval parentVal; if (!JS_GetReservedSlot(aCx, aObj, SLOT_xhrParent, &parentVal)) { diff --git a/js/jsd/jsd_val.c b/js/jsd/jsd_val.c index bd10708f74d2..8a13c9f30fcc 100644 --- a/js/jsd/jsd_val.c +++ b/js/jsd/jsd_val.c @@ -819,8 +819,7 @@ jsd_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval) return NULL; } - if(JS_GET_CLASS(jsdc->dumbContext, obj)) - jsdval->className = JS_GET_CLASS(jsdc->dumbContext, obj)->name; + jsdval->className = JS_GetClass(obj)->name; JS_LeaveCrossCompartmentCall(call); JS_EndRequest(jsdc->dumbContext); } diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 7e5295af432b..b1c49e369d8f 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -482,7 +482,7 @@ GetABICode(JSContext* cx, JSObject* obj) { // make sure we have an object representing a CABI class, // and extract the enumerated class type from the reserved slot. - if (JS_GET_CLASS(cx, obj) != &sCABIClass) + if (JS_GetClass(obj) != &sCABIClass) return INVALID_ABI; jsval result; @@ -923,16 +923,16 @@ InitTypeClasses(JSContext* cx, JSObject* parent) } bool -IsCTypesGlobal(JSContext* cx, JSObject* obj) +IsCTypesGlobal(JSObject* obj) { - return JS_GET_CLASS(cx, obj) == &sCTypesGlobalClass; + return JS_GetClass(obj) == &sCTypesGlobalClass; } // Get the JSCTypesCallbacks struct from the 'ctypes' object 'obj'. JSCTypesCallbacks* GetCallbacks(JSContext* cx, JSObject* obj) { - JS_ASSERT(IsCTypesGlobal(cx, obj)); + JS_ASSERT(IsCTypesGlobal(obj)); jsval result; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_CALLBACKS, &result)); @@ -974,7 +974,7 @@ JS_SetCTypesCallbacks(JSContext* cx, JSCTypesCallbacks* callbacks) { JS_ASSERT(callbacks); - JS_ASSERT(IsCTypesGlobal(cx, ctypesObj)); + JS_ASSERT(IsCTypesGlobal(ctypesObj)); // Set the callbacks on a reserved slot. return JS_SetReservedSlot(cx, ctypesObj, SLOT_CALLBACKS, @@ -1201,7 +1201,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result) } if (!JSVAL_IS_PRIMITIVE(val)) { JSObject* obj = JSVAL_TO_OBJECT(val); - if (CData::IsCData(cx, obj)) { + if (CData::IsCData(obj)) { JSObject* typeObj = CData::GetCType(cx, obj); void* data = CData::GetData(cx, obj); @@ -1235,13 +1235,13 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result) } } - if (Int64::IsInt64(cx, obj)) { + if (Int64::IsInt64(obj)) { // Make sure the integer fits in IntegerType. int64_t i = Int64Base::GetInt(cx, obj); return ConvertExact(i, result); } - if (UInt64::IsUInt64(cx, obj)) { + if (UInt64::IsUInt64(obj)) { // Make sure the integer fits in IntegerType. uint64_t i = Int64Base::GetInt(cx, obj); return ConvertExact(i, result); @@ -1282,7 +1282,7 @@ jsvalToFloat(JSContext *cx, jsval val, FloatType* result) } if (!JSVAL_IS_PRIMITIVE(val)) { JSObject* obj = JSVAL_TO_OBJECT(val); - if (CData::IsCData(cx, obj)) { + if (CData::IsCData(obj)) { JSObject* typeObj = CData::GetCType(cx, obj); void* data = CData::GetData(cx, obj); @@ -1407,13 +1407,13 @@ jsvalToBigInteger(JSContext* cx, // Allow conversion from an Int64 or UInt64 object directly. JSObject* obj = JSVAL_TO_OBJECT(val); - if (UInt64::IsUInt64(cx, obj)) { + if (UInt64::IsUInt64(obj)) { // Make sure the integer fits in IntegerType. uint64_t i = Int64Base::GetInt(cx, obj); return ConvertExact(i, result); } - if (Int64::IsInt64(cx, obj)) { + if (Int64::IsInt64(obj)) { // Make sure the integer fits in IntegerType. int64_t i = Int64Base::GetInt(cx, obj); return ConvertExact(i, result); @@ -1463,13 +1463,13 @@ jsidToBigInteger(JSContext* cx, // Allow conversion from an Int64 or UInt64 object directly. JSObject* obj = JSID_TO_OBJECT(val); - if (UInt64::IsUInt64(cx, obj)) { + if (UInt64::IsUInt64(obj)) { // Make sure the integer fits in IntegerType. uint64_t i = Int64Base::GetInt(cx, obj); return ConvertExact(i, result); } - if (Int64::IsInt64(cx, obj)) { + if (Int64::IsInt64(obj)) { // Make sure the integer fits in IntegerType. int64_t i = Int64Base::GetInt(cx, obj); return ConvertExact(i, result); @@ -1519,12 +1519,12 @@ jsvalToIntegerExplicit(JSContext* cx, jsval val, IntegerType* result) if (!JSVAL_IS_PRIMITIVE(val)) { // Convert Int64 and UInt64 values by C-style cast. JSObject* obj = JSVAL_TO_OBJECT(val); - if (Int64::IsInt64(cx, obj)) { + if (Int64::IsInt64(obj)) { int64_t i = Int64Base::GetInt(cx, obj); *result = IntegerType(i); return true; } - if (UInt64::IsUInt64(cx, obj)) { + if (UInt64::IsUInt64(obj)) { uint64_t i = Int64Base::GetInt(cx, obj); *result = IntegerType(i); return true; @@ -1563,7 +1563,7 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result) } if (!JSVAL_IS_PRIMITIVE(val)) { JSObject* obj = JSVAL_TO_OBJECT(val); - if (Int64::IsInt64(cx, obj)) { + if (Int64::IsInt64(obj)) { int64_t i = Int64Base::GetInt(cx, obj); intptr_t p = intptr_t(i); @@ -1574,7 +1574,7 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result) return true; } - if (UInt64::IsUInt64(cx, obj)) { + if (UInt64::IsUInt64(obj)) { uint64_t i = Int64Base::GetInt(cx, obj); // Make sure the integer fits in the alotted precision. @@ -1646,7 +1646,7 @@ ConvertToJS(JSContext* cx, bool ownResult, jsval* result) { - JS_ASSERT(!parentObj || CData::IsCData(cx, parentObj)); + JS_ASSERT(!parentObj || CData::IsCData(parentObj)); JS_ASSERT(!parentObj || !ownResult); JS_ASSERT(!wantPrimitive || !ownResult); @@ -1762,7 +1762,7 @@ ImplicitConvert(JSContext* cx, JSObject* sourceData = NULL; JSObject* sourceType = NULL; if (!JSVAL_IS_PRIMITIVE(val) && - CData::IsCData(cx, JSVAL_TO_OBJECT(val))) { + CData::IsCData(JSVAL_TO_OBJECT(val))) { sourceData = JSVAL_TO_OBJECT(val); sourceType = CData::GetCType(cx, sourceData); @@ -2567,7 +2567,7 @@ CType::ConstructData(JSContext* cx, { // get the callee object... JSObject* obj = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); - if (!CType::IsCType(cx, obj)) { + if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } @@ -2829,21 +2829,21 @@ CType::Trace(JSTracer* trc, JSObject* obj) } bool -CType::IsCType(JSContext* cx, JSObject* obj) +CType::IsCType(JSObject* obj) { - return JS_GET_CLASS(cx, obj) == &sCTypeClass; + return JS_GetClass(obj) == &sCTypeClass; } bool -CType::IsCTypeProto(JSContext* cx, JSObject* obj) +CType::IsCTypeProto(JSObject* obj) { - return JS_GET_CLASS(cx, obj) == &sCTypeProtoClass; + return JS_GetClass(obj) == &sCTypeProtoClass; } TypeCode CType::GetTypeCode(JSContext* cx, JSObject* typeObj) { - JS_ASSERT(IsCType(cx, typeObj)); + JS_ASSERT(IsCType(typeObj)); jsval result; ASSERT_OK(JS_GetReservedSlot(cx, typeObj, SLOT_TYPECODE, &result)); @@ -2853,7 +2853,7 @@ CType::GetTypeCode(JSContext* cx, JSObject* typeObj) bool CType::TypesEqual(JSContext* cx, JSObject* t1, JSObject* t2) { - JS_ASSERT(IsCType(cx, t1) && IsCType(cx, t2)); + JS_ASSERT(IsCType(t1) && IsCType(t2)); // Fast path: check for object equality. if (t1 == t2) @@ -2922,7 +2922,7 @@ CType::TypesEqual(JSContext* cx, JSObject* t1, JSObject* t2) bool CType::GetSafeSize(JSContext* cx, JSObject* obj, size_t* result) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); jsval size; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_SIZE, &size)); @@ -2945,7 +2945,7 @@ CType::GetSafeSize(JSContext* cx, JSObject* obj, size_t* result) size_t CType::GetSize(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); jsval size; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_SIZE, &size)); @@ -2963,7 +2963,7 @@ CType::GetSize(JSContext* cx, JSObject* obj) bool CType::IsSizeDefined(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); jsval size; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_SIZE, &size)); @@ -2977,7 +2977,7 @@ CType::IsSizeDefined(JSContext* cx, JSObject* obj) size_t CType::GetAlignment(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); jsval slot; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_ALIGN, &slot)); @@ -2987,7 +2987,7 @@ CType::GetAlignment(JSContext* cx, JSObject* obj) ffi_type* CType::GetFFIType(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); jsval slot; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_FFITYPE, &slot)); @@ -3020,7 +3020,7 @@ CType::GetFFIType(JSContext* cx, JSObject* obj) JSString* CType::GetName(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); jsval string; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_NAME, &string)); @@ -3044,7 +3044,7 @@ CType::GetProtoFromCtor(JSContext* cx, JSObject* obj, CTypeProtoSlot slot) jsval protoslot = js::GetFunctionNativeReserved(obj, SLOT_FN_CTORPROTO); JSObject* proto = JSVAL_TO_OBJECT(protoslot); JS_ASSERT(proto); - JS_ASSERT(CType::IsCTypeProto(cx, proto)); + JS_ASSERT(CType::IsCTypeProto(proto)); // Get the desired prototype. jsval result; @@ -3055,12 +3055,12 @@ CType::GetProtoFromCtor(JSContext* cx, JSObject* obj, CTypeProtoSlot slot) JSObject* CType::GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot) { - JS_ASSERT(IsCType(cx, obj)); + JS_ASSERT(IsCType(obj)); // Get the prototype of the type object. JSObject* proto = JS_GetPrototype(cx, obj); JS_ASSERT(proto); - JS_ASSERT(CType::IsCTypeProto(cx, proto)); + JS_ASSERT(CType::IsCTypeProto(proto)); // Get the requested ctypes.{Pointer,Array,Struct,Function}Type.prototype. jsval result; @@ -3071,13 +3071,13 @@ CType::GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot) JSBool CType::PrototypeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { - if (!(CType::IsCType(cx, obj) || CType::IsCTypeProto(cx, obj))) { + if (!(CType::IsCType(obj) || CType::IsCTypeProto(obj))) { JS_ReportError(cx, "not a CType or CTypeProto"); return JS_FALSE; } - unsigned slot = CType::IsCTypeProto(cx, obj) ? (unsigned) SLOT_OURDATAPROTO - : (unsigned) SLOT_PROTO; + unsigned slot = CType::IsCTypeProto(obj) ? (unsigned) SLOT_OURDATAPROTO + : (unsigned) SLOT_PROTO; ASSERT_OK(JS_GetReservedSlot(cx, obj, slot, vp)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(*vp) || JSVAL_IS_VOID(*vp)); return JS_TRUE; @@ -3086,7 +3086,7 @@ CType::PrototypeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) JSBool CType::NameGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { - if (!CType::IsCType(cx, obj)) { + if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } @@ -3102,7 +3102,7 @@ CType::NameGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) JSBool CType::SizeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { - if (!CType::IsCType(cx, obj)) { + if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } @@ -3115,7 +3115,7 @@ CType::SizeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) JSBool CType::PtrGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { - if (!CType::IsCType(cx, obj)) { + if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } @@ -3132,7 +3132,7 @@ JSBool CType::CreateArray(JSContext* cx, uintN argc, jsval* vp) { JSObject* baseType = JS_THIS_OBJECT(cx, vp); - if (!baseType || !CType::IsCType(cx, baseType)) { + if (!baseType || !CType::IsCType(baseType)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } @@ -3163,9 +3163,7 @@ JSBool CType::ToString(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || - !(CType::IsCType(cx, obj) || CType::IsCTypeProto(cx, obj))) - { + if (!obj || !(CType::IsCType(obj) || CType::IsCTypeProto(obj))) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } @@ -3173,7 +3171,7 @@ CType::ToString(JSContext* cx, uintN argc, jsval* vp) // Create the appropriate string depending on whether we're sCTypeClass or // sCTypeProtoClass. JSString* result; - if (CType::IsCType(cx, obj)) { + if (CType::IsCType(obj)) { AutoString type; AppendString(type, "type "); AppendString(type, GetName(cx, obj)); @@ -3194,7 +3192,7 @@ CType::ToSource(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj || - !(CType::IsCType(cx, obj) || CType::IsCTypeProto(cx, obj))) + !(CType::IsCType(obj) || CType::IsCTypeProto(obj))) { JS_ReportError(cx, "not a CType"); return JS_FALSE; @@ -3203,7 +3201,7 @@ CType::ToSource(JSContext* cx, uintN argc, jsval* vp) // Create the appropriate string depending on whether we're sCTypeClass or // sCTypeProtoClass. JSString* result; - if (CType::IsCType(cx, obj)) { + if (CType::IsCType(obj)) { AutoString source; BuildTypeSource(cx, obj, false, source); result = NewUCString(cx, source); @@ -3220,13 +3218,13 @@ CType::ToSource(JSContext* cx, uintN argc, jsval* vp) JSBool CType::HasInstance(JSContext* cx, JSObject* obj, const jsval* v, JSBool* bp) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); jsval slot; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_PROTO, &slot)); JSObject* prototype = JSVAL_TO_OBJECT(slot); JS_ASSERT(prototype); - JS_ASSERT(CData::IsCDataProto(cx, prototype)); + JS_ASSERT(CData::IsCDataProto(prototype)); *bp = JS_FALSE; if (JSVAL_IS_PRIMITIVE(*v)) @@ -3256,7 +3254,7 @@ PointerType::Create(JSContext* cx, uintN argc, jsval* vp) } jsval arg = JS_ARGV(cx, vp)[0]; - if (JSVAL_IS_PRIMITIVE(arg) || !CType::IsCType(cx, JSVAL_TO_OBJECT(arg))) { + if (JSVAL_IS_PRIMITIVE(arg) || !CType::IsCType(JSVAL_TO_OBJECT(arg))) { JS_ReportError(cx, "first argument must be a CType"); return JS_FALSE; } @@ -3311,7 +3309,7 @@ PointerType::ConstructData(JSContext* cx, uintN argc, jsval* vp) { - if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_pointer) { + if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; } @@ -3404,7 +3402,7 @@ PointerType::TargetTypeGetter(JSContext* cx, jsid idval, jsval* vp) { - if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_pointer) { + if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; } @@ -3418,7 +3416,7 @@ JSBool PointerType::IsNull(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !CData::IsCData(cx, obj)) { + if (!obj || !CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -3440,7 +3438,7 @@ JSBool PointerType::OffsetBy(JSContext* cx, intN offset, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !CData::IsCData(cx, obj)) { + if (!obj || !CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -3488,7 +3486,7 @@ PointerType::ContentsGetter(JSContext* cx, jsid idval, jsval* vp) { - if (!CData::IsCData(cx, obj)) { + if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -3527,7 +3525,7 @@ PointerType::ContentsSetter(JSContext* cx, JSBool strict, jsval* vp) { - if (!CData::IsCData(cx, obj)) { + if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -3569,7 +3567,7 @@ ArrayType::Create(JSContext* cx, uintN argc, jsval* vp) jsval* argv = JS_ARGV(cx, vp); if (JSVAL_IS_PRIMITIVE(argv[0]) || - !CType::IsCType(cx, JSVAL_TO_OBJECT(argv[0]))) { + !CType::IsCType(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "first argument must be a CType"); return JS_FALSE; } @@ -3650,7 +3648,7 @@ ArrayType::ConstructData(JSContext* cx, uintN argc, jsval* vp) { - if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_array) { + if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return JS_FALSE; } @@ -3751,7 +3749,7 @@ ArrayType::ConstructData(JSContext* cx, JSObject* ArrayType::GetBaseType(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_array); jsval type; @@ -3763,7 +3761,7 @@ ArrayType::GetBaseType(JSContext* cx, JSObject* obj) bool ArrayType::GetSafeLength(JSContext* cx, JSObject* obj, size_t* result) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_array); jsval length; @@ -3787,7 +3785,7 @@ ArrayType::GetSafeLength(JSContext* cx, JSObject* obj, size_t* result) size_t ArrayType::GetLength(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_array); jsval length; @@ -3806,7 +3804,7 @@ ArrayType::GetLength(JSContext* cx, JSObject* obj) ffi_type* ArrayType::BuildFFIType(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_array); JS_ASSERT(CType::IsSizeDefined(cx, obj)); @@ -3849,7 +3847,7 @@ ArrayType::BuildFFIType(JSContext* cx, JSObject* obj) JSBool ArrayType::ElementTypeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { - if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_array) { + if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return JS_FALSE; } @@ -3864,10 +3862,10 @@ ArrayType::LengthGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { // This getter exists for both CTypes and CDatas of the ArrayType persuasion. // If we're dealing with a CData, get the CType from it. - if (CData::IsCData(cx, obj)) + if (CData::IsCData(obj)) obj = CData::GetCType(cx, obj); - if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_array) { + if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return JS_FALSE; } @@ -3881,7 +3879,7 @@ JSBool ArrayType::Getter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { // This should never happen, but we'll check to be safe. - if (!CData::IsCData(cx, obj)) { + if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -3916,7 +3914,7 @@ JSBool ArrayType::Setter(JSContext* cx, JSObject* obj, jsid idval, JSBool strict, jsval* vp) { // This should never happen, but we'll check to be safe. - if (!CData::IsCData(cx, obj)) { + if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -3951,7 +3949,7 @@ JSBool ArrayType::AddressOfElement(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !CData::IsCData(cx, obj)) { + if (!obj || !CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -4043,7 +4041,7 @@ ExtractStructField(JSContext* cx, jsval val, JSObject** typeObj) return NULL; if (propVal.value().isPrimitive() || - !CType::IsCType(cx, JSVAL_TO_OBJECT(propVal.jsval_value()))) { + !CType::IsCType(JSVAL_TO_OBJECT(propVal.jsval_value()))) { JS_ReportError(cx, "struct field descriptors require a valid name and type"); return NULL; } @@ -4255,7 +4253,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj ffi_type* StructType::BuildFFIType(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct); JS_ASSERT(CType::IsSizeDefined(cx, obj)); @@ -4333,7 +4331,7 @@ StructType::Define(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj || - !CType::IsCType(cx, obj) || + !CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; @@ -4365,7 +4363,7 @@ StructType::ConstructData(JSContext* cx, uintN argc, jsval* vp) { - if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) { + if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; } @@ -4439,7 +4437,7 @@ StructType::ConstructData(JSContext* cx, const FieldInfoHash* StructType::GetFieldInfo(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct); jsval slot; @@ -4452,7 +4450,7 @@ StructType::GetFieldInfo(JSContext* cx, JSObject* obj) const FieldInfo* StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct); FieldInfoHash::Ptr ptr = GetFieldInfo(cx, obj)->lookup(name); @@ -4470,7 +4468,7 @@ StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name) JSObject* StructType::BuildFieldsArray(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct); JS_ASSERT(CType::IsSizeDefined(cx, obj)); @@ -4505,7 +4503,7 @@ StructType::BuildFieldsArray(JSContext* cx, JSObject* obj) JSBool StructType::FieldsArrayGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { - if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) { + if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; } @@ -4535,7 +4533,7 @@ StructType::FieldsArrayGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* v JSBool StructType::FieldGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { - if (!CData::IsCData(cx, obj)) { + if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -4557,7 +4555,7 @@ StructType::FieldGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) JSBool StructType::FieldSetter(JSContext* cx, JSObject* obj, jsid idval, JSBool strict, jsval* vp) { - if (!CData::IsCData(cx, obj)) { + if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -4580,7 +4578,7 @@ JSBool StructType::AddressOfField(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !CData::IsCData(cx, obj)) { + if (!obj || !CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -4686,7 +4684,7 @@ static JSObject* PrepareType(JSContext* cx, jsval type) { if (JSVAL_IS_PRIMITIVE(type) || - !CType::IsCType(cx, JSVAL_TO_OBJECT(type))) { + !CType::IsCType(JSVAL_TO_OBJECT(type))) { JS_ReportError(cx, "not a ctypes type"); return NULL; } @@ -4723,7 +4721,7 @@ static JSObject* PrepareReturnType(JSContext* cx, jsval type) { if (JSVAL_IS_PRIMITIVE(type) || - !CType::IsCType(cx, JSVAL_TO_OBJECT(type))) { + !CType::IsCType(JSVAL_TO_OBJECT(type))) { JS_ReportError(cx, "not a ctypes type"); return NULL; } @@ -5096,7 +5094,7 @@ FunctionType::Call(JSContext* cx, { // get the callee object... JSObject* obj = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); - if (!CData::IsCData(cx, obj)) { + if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } @@ -5125,7 +5123,7 @@ FunctionType::Call(JSContext* cx, // Check if we have a Library object. If we do, make sure it's open. jsval slot; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_REFERENT, &slot)); - if (!JSVAL_IS_VOID(slot) && Library::IsLibrary(cx, JSVAL_TO_OBJECT(slot))) { + if (!JSVAL_IS_VOID(slot) && Library::IsLibrary(JSVAL_TO_OBJECT(slot))) { PRLibrary* library = Library::GetLibrary(cx, JSVAL_TO_OBJECT(slot)); if (!library) { JS_ReportError(cx, "library is not open"); @@ -5157,7 +5155,7 @@ FunctionType::Call(JSContext* cx, for (uint32_t i = argcFixed; i < argc; ++i) { if (JSVAL_IS_PRIMITIVE(argv[i]) || - !CData::IsCData(cx, obj = JSVAL_TO_OBJECT(argv[i]))) { + !CData::IsCData(obj = JSVAL_TO_OBJECT(argv[i]))) { // Since we know nothing about the CTypes of the ... arguments, // they absolutely must be CData objects already. JS_ReportError(cx, "argument %d of type %s is not a CData object", @@ -5224,7 +5222,7 @@ FunctionType::Call(JSContext* cx, FunctionInfo* FunctionType::GetFunctionInfo(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(cx, obj)); + JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_function); jsval slot; @@ -5237,7 +5235,7 @@ FunctionType::GetFunctionInfo(JSContext* cx, JSObject* obj) static JSBool CheckFunctionType(JSContext* cx, JSObject* obj) { - if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_function) { + if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_function) { JS_ReportError(cx, "not a FunctionType"); return JS_FALSE; } @@ -5345,7 +5343,7 @@ CClosure::Create(JSContext* cx, // which stores our JSContext for use with the closure. JSObject* proto = JS_GetPrototype(cx, typeObj); JS_ASSERT(proto); - JS_ASSERT(CType::IsCTypeProto(cx, proto)); + JS_ASSERT(CType::IsCTypeProto(proto)); // Get a JSContext for use with the closure. jsval slot; @@ -5641,10 +5639,10 @@ CData::Create(JSContext* cx, bool ownResult) { JS_ASSERT(typeObj); - JS_ASSERT(CType::IsCType(cx, typeObj)); + JS_ASSERT(CType::IsCType(typeObj)); JS_ASSERT(CType::IsSizeDefined(cx, typeObj)); JS_ASSERT(ownResult || source); - JS_ASSERT_IF(refObj && CData::IsCData(cx, refObj), !ownResult); + JS_ASSERT_IF(refObj && CData::IsCData(refObj), !ownResult); // Get the 'prototype' property from the type. jsval slot; @@ -5734,19 +5732,19 @@ CData::Finalize(JSContext* cx, JSObject* obj) JSObject* CData::GetCType(JSContext* cx, JSObject* dataObj) { - JS_ASSERT(CData::IsCData(cx, dataObj)); + JS_ASSERT(CData::IsCData(dataObj)); jsval slot; ASSERT_OK(JS_GetReservedSlot(cx, dataObj, SLOT_CTYPE, &slot)); JSObject* typeObj = JSVAL_TO_OBJECT(slot); - JS_ASSERT(CType::IsCType(cx, typeObj)); + JS_ASSERT(CType::IsCType(typeObj)); return typeObj; } void* CData::GetData(JSContext* cx, JSObject* dataObj) { - JS_ASSERT(CData::IsCData(cx, dataObj)); + JS_ASSERT(CData::IsCData(dataObj)); jsval slot; ASSERT_OK(JS_GetReservedSlot(cx, dataObj, SLOT_DATA, &slot)); @@ -5758,21 +5756,21 @@ CData::GetData(JSContext* cx, JSObject* dataObj) } bool -CData::IsCData(JSContext* cx, JSObject* obj) +CData::IsCData(JSObject* obj) { - return JS_GET_CLASS(cx, obj) == &sCDataClass; + return JS_GetClass(obj) == &sCDataClass; } bool -CData::IsCDataProto(JSContext* cx, JSObject* obj) +CData::IsCDataProto(JSObject* obj) { - return JS_GET_CLASS(cx, obj) == &sCDataProtoClass; + return JS_GetClass(obj) == &sCDataProtoClass; } JSBool CData::ValueGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) { - if (!IsCData(cx, obj)) { + if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -5787,7 +5785,7 @@ CData::ValueGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) JSBool CData::ValueSetter(JSContext* cx, JSObject* obj, jsid idval, JSBool strict, jsval* vp) { - if (!IsCData(cx, obj)) { + if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -5804,7 +5802,7 @@ CData::Address(JSContext* cx, uintN argc, jsval* vp) } JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !IsCData(cx, obj)) { + if (!obj || !IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -5838,7 +5836,7 @@ CData::Cast(JSContext* cx, uintN argc, jsval* vp) jsval* argv = JS_ARGV(cx, vp); if (JSVAL_IS_PRIMITIVE(argv[0]) || - !CData::IsCData(cx, JSVAL_TO_OBJECT(argv[0]))) { + !CData::IsCData(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "first argument must be a CData"); return JS_FALSE; } @@ -5846,7 +5844,7 @@ CData::Cast(JSContext* cx, uintN argc, jsval* vp) JSObject* sourceType = CData::GetCType(cx, sourceData); if (JSVAL_IS_PRIMITIVE(argv[1]) || - !CType::IsCType(cx, JSVAL_TO_OBJECT(argv[1]))) { + !CType::IsCType(JSVAL_TO_OBJECT(argv[1]))) { JS_ReportError(cx, "second argument must be a CType"); return JS_FALSE; } @@ -5881,7 +5879,7 @@ CData::GetRuntime(JSContext* cx, uintN argc, jsval* vp) jsval* argv = JS_ARGV(cx, vp); if (JSVAL_IS_PRIMITIVE(argv[0]) || - !CType::IsCType(cx, JSVAL_TO_OBJECT(argv[0]))) { + !CType::IsCType(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "first argument must be a CType"); return JS_FALSE; } @@ -5912,7 +5910,7 @@ CData::ReadString(JSContext* cx, uintN argc, jsval* vp) } JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !IsCData(cx, obj)) { + if (!obj || !IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } @@ -6004,13 +6002,13 @@ CData::ToSource(JSContext* cx, uintN argc, jsval* vp) JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj || - !(CData::IsCData(cx, obj) || CData::IsCDataProto(cx, obj))) { + !(CData::IsCData(obj) || CData::IsCDataProto(obj))) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } JSString* result; - if (CData::IsCData(cx, obj)) { + if (CData::IsCData(obj)) { JSObject* typeObj = CData::GetCType(cx, obj); void* data = CData::GetData(cx, obj); @@ -6085,7 +6083,7 @@ Int64Base::Finalize(JSContext* cx, JSObject* obj) uint64_t Int64Base::GetInt(JSContext* cx, JSObject* obj) { - JS_ASSERT(Int64::IsInt64(cx, obj) || UInt64::IsUInt64(cx, obj)); + JS_ASSERT(Int64::IsInt64(obj) || UInt64::IsUInt64(obj)); jsval slot; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_INT64, &slot)); @@ -6182,7 +6180,7 @@ Int64::Construct(JSContext* cx, ASSERT_OK(JS_GetProperty(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)), "prototype", &slot)); JSObject* proto = JSVAL_TO_OBJECT(slot); - JS_ASSERT(JS_GET_CLASS(cx, proto) == &sInt64ProtoClass); + JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, i, false); if (!result) @@ -6193,16 +6191,16 @@ Int64::Construct(JSContext* cx, } bool -Int64::IsInt64(JSContext* cx, JSObject* obj) +Int64::IsInt64(JSObject* obj) { - return JS_GET_CLASS(cx, obj) == &sInt64Class; + return JS_GetClass(obj) == &sInt64Class; } JSBool Int64::ToString(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !Int64::IsInt64(cx, obj)) { + if (!obj || !Int64::IsInt64(obj)) { JS_ReportError(cx, "not an Int64"); return JS_FALSE; } @@ -6214,7 +6212,7 @@ JSBool Int64::ToSource(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !Int64::IsInt64(cx, obj)) { + if (!obj || !Int64::IsInt64(obj)) { JS_ReportError(cx, "not an Int64"); return JS_FALSE; } @@ -6229,8 +6227,8 @@ Int64::Compare(JSContext* cx, uintN argc, jsval* vp) if (argc != 2 || JSVAL_IS_PRIMITIVE(argv[0]) || JSVAL_IS_PRIMITIVE(argv[1]) || - !Int64::IsInt64(cx, JSVAL_TO_OBJECT(argv[0])) || - !Int64::IsInt64(cx, JSVAL_TO_OBJECT(argv[1]))) { + !Int64::IsInt64(JSVAL_TO_OBJECT(argv[0])) || + !Int64::IsInt64(JSVAL_TO_OBJECT(argv[1]))) { JS_ReportError(cx, "compare takes two Int64 arguments"); return JS_FALSE; } @@ -6260,7 +6258,7 @@ Int64::Lo(JSContext* cx, uintN argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) || - !Int64::IsInt64(cx, JSVAL_TO_OBJECT(argv[0]))) { + !Int64::IsInt64(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "lo takes one Int64 argument"); return JS_FALSE; } @@ -6282,7 +6280,7 @@ Int64::Hi(JSContext* cx, uintN argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) || - !Int64::IsInt64(cx, JSVAL_TO_OBJECT(argv[0]))) { + !Int64::IsInt64(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "hi takes one Int64 argument"); return JS_FALSE; } @@ -6322,7 +6320,7 @@ Int64::Join(JSContext* cx, uintN argc, jsval* vp) jsval slot = js::GetFunctionNativeReserved(callee, SLOT_FN_INT64PROTO); JSObject* proto = JSVAL_TO_OBJECT(slot); - JS_ASSERT(JS_GET_CLASS(cx, proto) == &sInt64ProtoClass); + JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, i, false); if (!result) @@ -6353,7 +6351,7 @@ UInt64::Construct(JSContext* cx, ASSERT_OK(JS_GetProperty(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)), "prototype", &slot)); JSObject* proto = JSVAL_TO_OBJECT(slot); - JS_ASSERT(JS_GET_CLASS(cx, proto) == &sUInt64ProtoClass); + JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, u, true); if (!result) @@ -6364,16 +6362,16 @@ UInt64::Construct(JSContext* cx, } bool -UInt64::IsUInt64(JSContext* cx, JSObject* obj) +UInt64::IsUInt64(JSObject* obj) { - return JS_GET_CLASS(cx, obj) == &sUInt64Class; + return JS_GetClass(obj) == &sUInt64Class; } JSBool UInt64::ToString(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !UInt64::IsUInt64(cx, obj)) { + if (!obj || !UInt64::IsUInt64(obj)) { JS_ReportError(cx, "not a UInt64"); return JS_FALSE; } @@ -6385,7 +6383,7 @@ JSBool UInt64::ToSource(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !UInt64::IsUInt64(cx, obj)) { + if (!obj || !UInt64::IsUInt64(obj)) { JS_ReportError(cx, "not a UInt64"); return JS_FALSE; } @@ -6400,8 +6398,8 @@ UInt64::Compare(JSContext* cx, uintN argc, jsval* vp) if (argc != 2 || JSVAL_IS_PRIMITIVE(argv[0]) || JSVAL_IS_PRIMITIVE(argv[1]) || - !UInt64::IsUInt64(cx, JSVAL_TO_OBJECT(argv[0])) || - !UInt64::IsUInt64(cx, JSVAL_TO_OBJECT(argv[1]))) { + !UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0])) || + !UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[1]))) { JS_ReportError(cx, "compare takes two UInt64 arguments"); return JS_FALSE; } @@ -6427,7 +6425,7 @@ UInt64::Lo(JSContext* cx, uintN argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) || - !UInt64::IsUInt64(cx, JSVAL_TO_OBJECT(argv[0]))) { + !UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "lo takes one UInt64 argument"); return JS_FALSE; } @@ -6449,7 +6447,7 @@ UInt64::Hi(JSContext* cx, uintN argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) || - !UInt64::IsUInt64(cx, JSVAL_TO_OBJECT(argv[0]))) { + !UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "hi takes one UInt64 argument"); return JS_FALSE; } @@ -6489,7 +6487,7 @@ UInt64::Join(JSContext* cx, uintN argc, jsval* vp) jsval slot = js::GetFunctionNativeReserved(callee, SLOT_FN_INT64PROTO); JSObject* proto = JSVAL_TO_OBJECT(slot); - JS_ASSERT(JS_GET_CLASS(cx, proto) == &sUInt64ProtoClass); + JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, u, true); if (!result) diff --git a/js/src/ctypes/CTypes.h b/js/src/ctypes/CTypes.h index 950b892033ec..45ceadf350fe 100644 --- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -348,7 +348,7 @@ struct ClosureInfo }; }; -bool IsCTypesGlobal(JSContext* cx, JSObject* obj); +bool IsCTypesGlobal(JSObject* obj); JSCTypesCallbacks* GetCallbacks(JSContext* cx, JSObject* obj); @@ -454,8 +454,8 @@ namespace CType { JSObject* typeProto, JSObject* dataProto, const char* name, TypeCode type, jsval size, jsval align, ffi_type* ffiType); - bool IsCType(JSContext* cx, JSObject* obj); - bool IsCTypeProto(JSContext* cx, JSObject* obj); + bool IsCType(JSObject* obj); + bool IsCTypeProto(JSObject* obj); TypeCode GetTypeCode(JSContext* cx, JSObject* typeObj); bool TypesEqual(JSContext* cx, JSObject* t1, JSObject* t2); size_t GetSize(JSContext* cx, JSObject* obj); @@ -518,8 +518,8 @@ namespace CData { JSObject* GetCType(JSContext* cx, JSObject* dataObj); void* GetData(JSContext* cx, JSObject* dataObj); - bool IsCData(JSContext* cx, JSObject* obj); - bool IsCDataProto(JSContext* cx, JSObject* obj); + bool IsCData(JSObject* obj); + bool IsCDataProto(JSObject* obj); // Attached by JSAPI as the function 'ctypes.cast' JSBool Cast(JSContext* cx, uintN argc, jsval* vp); @@ -528,11 +528,11 @@ namespace CData { } namespace Int64 { - bool IsInt64(JSContext* cx, JSObject* obj); + bool IsInt64(JSObject* obj); } namespace UInt64 { - bool IsUInt64(JSContext* cx, JSObject* obj); + bool IsUInt64(JSObject* obj); } } diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index 648a778f907b..69aa6a43996f 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -195,15 +195,15 @@ Library::Create(JSContext* cx, jsval path, JSCTypesCallbacks* callbacks) } bool -Library::IsLibrary(JSContext* cx, JSObject* obj) +Library::IsLibrary(JSObject* obj) { - return JS_GET_CLASS(cx, obj) == &sLibraryClass; + return JS_GetClass(obj) == &sLibraryClass; } PRLibrary* Library::GetLibrary(JSContext* cx, JSObject* obj) { - JS_ASSERT(IsLibrary(cx, obj)); + JS_ASSERT(IsLibrary(obj)); jsval slot; JS_GetReservedSlot(cx, obj, SLOT_LIBRARY, &slot); @@ -223,7 +223,7 @@ JSBool Library::Open(JSContext* cx, uintN argc, jsval *vp) { JSObject* ctypesObj = JS_THIS_OBJECT(cx, vp); - if (!ctypesObj || !IsCTypesGlobal(cx, ctypesObj)) { + if (!ctypesObj || !IsCTypesGlobal(ctypesObj)) { JS_ReportError(cx, "not a ctypes object"); return JS_FALSE; } @@ -245,7 +245,7 @@ JSBool Library::Close(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !IsLibrary(cx, obj)) { + if (!obj || !IsLibrary(obj)) { JS_ReportError(cx, "not a library"); return JS_FALSE; } @@ -267,7 +267,7 @@ JSBool Library::Declare(JSContext* cx, uintN argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); - if (!obj || !IsLibrary(cx, obj)) { + if (!obj || !IsLibrary(obj)) { JS_ReportError(cx, "not a library"); return JS_FALSE; } @@ -321,7 +321,7 @@ Library::Declare(JSContext* cx, uintN argc, jsval* vp) } else { // Case 2). if (JSVAL_IS_PRIMITIVE(argv[1]) || - !CType::IsCType(cx, JSVAL_TO_OBJECT(argv[1])) || + !CType::IsCType(JSVAL_TO_OBJECT(argv[1])) || !CType::IsSizeDefined(cx, JSVAL_TO_OBJECT(argv[1]))) { JS_ReportError(cx, "second argument must be a type of defined size"); return JS_FALSE; diff --git a/js/src/ctypes/Library.h b/js/src/ctypes/Library.h index 0293fd229ac9..b8056a49f3eb 100644 --- a/js/src/ctypes/Library.h +++ b/js/src/ctypes/Library.h @@ -58,7 +58,7 @@ namespace Library JSObject* Create(JSContext* cx, jsval path, JSCTypesCallbacks* callbacks); - bool IsLibrary(JSContext* cx, JSObject* obj); + bool IsLibrary(JSObject* obj); PRLibrary* GetLibrary(JSContext* cx, JSObject* obj); JSBool Open(JSContext* cx, uintN argc, jsval* vp); diff --git a/js/src/jsapi-tests/testNewObject.cpp b/js/src/jsapi-tests/testNewObject.cpp index be965398e4be..5974131f71e7 100644 --- a/js/src/jsapi-tests/testNewObject.cpp +++ b/js/src/jsapi-tests/testNewObject.cpp @@ -18,7 +18,7 @@ constructHook(JSContext *cx, uintN argc, jsval *vp) JS_ReportError(cx, "test failed, could not construct object"); return false; } - if (strcmp(JS_GET_CLASS(cx, obj)->name, "Object") != 0) { + if (strcmp(JS_GetClass(obj)->name, "Object") != 0) { JS_ReportError(cx, "test failed, wrong class for 'this'"); return false; } diff --git a/js/src/jsapi-tests/testSetProperty.cpp b/js/src/jsapi-tests/testSetProperty.cpp index 7b242ddffaf5..f4f960fc4d7d 100644 --- a/js/src/jsapi-tests/testSetProperty.cpp +++ b/js/src/jsapi-tests/testSetProperty.cpp @@ -70,7 +70,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. - JS_ASSERT(JS_GET_CLASS(cx, global)->resolve == &JS_ResolveStub); + JS_ASSERT(JS_GetClass(global)->resolve == &JS_ResolveStub); CHECK(JS_DefineProperty(cx, global, "HOTLOOP", INT_TO_JSVAL(8), NULL, NULL, 0)); EXEC("var n = 0;\n" diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 3e809cc55be4..62bb0c01a383 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -3143,19 +3143,11 @@ JS_LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor, JSObject *proto) return LinkConstructorAndPrototype(cx, ctor, proto); } -#ifdef JS_THREADSAFE -JS_PUBLIC_API(JSClass *) -JS_GetClass(JSContext *cx, JSObject *obj) -{ - return obj->getJSClass(); -} -#else JS_PUBLIC_API(JSClass *) JS_GetClass(JSObject *obj) { return obj->getJSClass(); } -#endif JS_PUBLIC_API(JSBool) JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 3ebf7295e523..e950d111b369 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -3646,18 +3646,9 @@ JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto, extern JS_PUBLIC_API(JSBool) JS_LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor, JSObject *proto); -#ifdef JS_THREADSAFE -extern JS_PUBLIC_API(JSClass *) -JS_GetClass(JSContext *cx, JSObject *obj); - -#define JS_GET_CLASS(cx,obj) JS_GetClass(cx, obj) -#else extern JS_PUBLIC_API(JSClass *) JS_GetClass(JSObject *obj); -#define JS_GET_CLASS(cx,obj) JS_GetClass(obj) -#endif - extern JS_PUBLIC_API(JSBool) JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv); @@ -5331,7 +5322,7 @@ JS_IsConstructing(JSContext *cx, const jsval *vp) JSFunction *fun = JS_ValueToFunction(cx, JS_CALLEE(cx, vp)); JS_ASSERT((JS_GetFunctionFlags(fun) & JSFUN_CONSTRUCTOR) != 0); } else { - JS_ASSERT(JS_GET_CLASS(cx, callee)->construct != NULL); + JS_ASSERT(JS_GetClass(callee)->construct != NULL); } #endif diff --git a/js/src/perf/jsperf.cpp b/js/src/perf/jsperf.cpp index 835c650ebc70..cf61fe3ddde4 100644 --- a/js/src/perf/jsperf.cpp +++ b/js/src/perf/jsperf.cpp @@ -236,7 +236,7 @@ GetPM(JSContext* cx, JSObject* obj, const char* fname) // JS_GetInstancePrivate only sets an exception if its last argument // is nonzero, so we have to do it by hand. JS_ReportErrorNumber(cx, js_GetErrorMessage, 0, JSMSG_INCOMPATIBLE_PROTO, - pm_class.name, fname, JS_GET_CLASS(cx, obj)->name); + pm_class.name, fname, JS_GetClass(obj)->name); return 0; } diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 1d94adb3bf0f..a21cf9db94e6 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -818,7 +818,7 @@ EvaluateWithLocation(JSContext *cx, uintN argc, jsval *vp) if (!thisobj) return false; - if ((JS_GET_CLASS(cx, thisobj)->flags & JSCLASS_IS_GLOBAL) != JSCLASS_IS_GLOBAL) { + if ((JS_GetClass(thisobj)->flags & JSCLASS_IS_GLOBAL) != JSCLASS_IS_GLOBAL) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE, "this-value passed to evalWithLocation()", "not a global object"); return false; @@ -860,7 +860,7 @@ Evaluate(JSContext *cx, uintN argc, jsval *vp) if (!thisobj) return false; - if ((JS_GET_CLASS(cx, thisobj)->flags & JSCLASS_IS_GLOBAL) != JSCLASS_IS_GLOBAL) { + if ((JS_GetClass(thisobj)->flags & JSCLASS_IS_GLOBAL) != JSCLASS_IS_GLOBAL) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE, "this-value passed to evaluate()", "not a global object"); return false; @@ -1627,7 +1627,7 @@ ValueToScript(JSContext *cx, jsval v, JSFunction **funp = NULL) if (!JSVAL_IS_PRIMITIVE(v)) { JSObject *obj = JSVAL_TO_OBJECT(v); - JSClass *clasp = JS_GET_CLASS(cx, obj); + JSClass *clasp = JS_GetClass(obj); if (clasp == Jsvalify(&GeneratorClass)) { if (JSGenerator *gen = (JSGenerator *) JS_GetPrivate(cx, obj)) { @@ -1686,7 +1686,7 @@ GetScriptAndPCArgs(JSContext *cx, uintN argc, jsval *argv, JSScript **scriptp, jsval v = argv[0]; uintN intarg = 0; if (!JSVAL_IS_PRIMITIVE(v) && - JS_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == Jsvalify(&FunctionClass)) { + JS_GetClass(JSVAL_TO_OBJECT(v)) == Jsvalify(&FunctionClass)) { script = ValueToScript(cx, v); if (!script) return JS_FALSE; @@ -1831,7 +1831,7 @@ LineToPC(JSContext *cx, uintN argc, jsval *vp) script = JS_GetFrameScript(cx, JS_GetScriptedCaller(cx, NULL)); jsval v = JS_ARGV(cx, vp)[0]; if (!JSVAL_IS_PRIMITIVE(v) && - JS_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == Jsvalify(&FunctionClass)) + JS_GetClass(JSVAL_TO_OBJECT(v)) == Jsvalify(&FunctionClass)) { script = ValueToScript(cx, v); if (!script) @@ -4541,7 +4541,7 @@ static JSClass its_class = { static JSBool its_getter(JSContext *cx, JSObject *obj, jsid id, jsval *vp) { - if (JS_GET_CLASS(cx, obj) == &its_class) { + if (JS_GetClass(obj) == &its_class) { jsval *val = (jsval *) JS_GetPrivate(cx, obj); *vp = val ? *val : JSVAL_VOID; } else { @@ -4554,7 +4554,7 @@ its_getter(JSContext *cx, JSObject *obj, jsid id, jsval *vp) static JSBool its_setter(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp) { - if (JS_GET_CLASS(cx, obj) != &its_class) + if (JS_GetClass(obj) != &its_class) return JS_TRUE; jsval *val = (jsval *) JS_GetPrivate(cx, obj); diff --git a/js/src/shell/jsworkers.cpp b/js/src/shell/jsworkers.cpp index c0b9d87a2191..2d48aeac1739 100644 --- a/js/src/shell/jsworkers.cpp +++ b/js/src/shell/jsworkers.cpp @@ -581,7 +581,7 @@ class ThreadPool public: static ThreadPool *unwrap(JSContext *cx, JSObject *obj) { - JS_ASSERT(JS_GET_CLASS(cx, obj) == &jsClass); + JS_ASSERT(JS_GetClass(obj) == &jsClass); return (ThreadPool *) JS_GetPrivate(cx, obj); } }; @@ -700,7 +700,7 @@ class Worker MOZ_FINAL : public WorkerParent } static void jsTraceWorker(JSTracer *trc, JSObject *obj) { - JS_ASSERT(JS_GET_CLASS(trc->context, obj) == &jsWorkerClass); + JS_ASSERT(JS_GetClass(obj) == &jsWorkerClass); if (Worker *w = (Worker *) JS_GetPrivate(trc->context, obj)) { w->parent->trace(trc); w->events.trace(trc); @@ -711,7 +711,7 @@ class Worker MOZ_FINAL : public WorkerParent } static void jsFinalize(JSContext *cx, JSObject *obj) { - JS_ASSERT(JS_GET_CLASS(cx, obj) == &jsWorkerClass); + JS_ASSERT(JS_GetClass(obj) == &jsWorkerClass); if (Worker *w = (Worker *) JS_GetPrivate(cx, obj)) delete w; } diff --git a/js/xpconnect/shell/xpcshell.cpp b/js/xpconnect/shell/xpcshell.cpp index d9db6dc2a64c..fe90261ed4c7 100644 --- a/js/xpconnect/shell/xpcshell.cpp +++ b/js/xpconnect/shell/xpcshell.cpp @@ -1234,7 +1234,7 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc) xpc_ActivateDebugMode(); break; case 'P': - if (JS_GET_CLASS(cx, JS_GetPrototype(cx, obj)) != &global_class) { + if (JS_GetClass(JS_GetPrototype(cx, obj)) != &global_class) { JSObject *gobj; if (!JS_DeepFreezeObject(cx, obj)) diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp index 13115335725a..bdae7a10efc6 100644 --- a/js/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -269,7 +269,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO GetProxyHandler(obj) == &WaiveXrayWrapperWrapper || js::GetObjectClass(obj)->ext.innerObject, "wrapped object passed to rewrap"); - NS_ASSERTION(JS_GET_CLASS(cx, obj) != &XrayUtils::HolderClass, "trying to wrap a holder"); + NS_ASSERTION(JS_GetClass(obj) != &XrayUtils::HolderClass, "trying to wrap a holder"); JSCompartment *origin = js::GetObjectCompartment(obj); JSCompartment *target = js::GetContextCompartment(cx);