author | Igor Bukanov <igor@mir2.org> |
Sat, 04 Feb 2012 01:54:57 +0100 | |
changeset 105711 | a4fd961eb3c9912720b32551523878a71309caef |
parent 105710 | cafc4176a68694aa42591f3836be7446a2b7e0e6 |
child 105712 | 661bf5efd10d10a6eb858013409523f2fb0e1ad4 |
child 105715 | 8daf32aebe3f5e0ef245aa58cac80983c57a4911 |
push id | 23447 |
push user | danderson@mozilla.com |
push date | Tue, 11 Sep 2012 17:34:27 +0000 |
treeherder | autoland@fdfaef738a00 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | luke |
bugs | 723517 |
milestone | 13.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/caps/src/nsSecurityManagerFactory.cpp +++ b/caps/src/nsSecurityManagerFactory.cpp @@ -334,17 +334,17 @@ nsSecurityNameSet::InitializeNameSet(nsI * Find Object.prototype's class by walking up the global object's * prototype chain. */ JSObject *obj = global; JSObject *proto; 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)) return NS_ERROR_FAILURE; JSObject *securityObj; if (JSVAL_IS_OBJECT(v)) { /* * "netscape" property of window object exists; get the
--- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -106,17 +106,17 @@ // static void XBLFinalize(JSContext *cx, JSObject *obj) { nsXBLDocumentInfo* docInfo = static_cast<nsXBLDocumentInfo*>(::JS_GetPrivate(cx, obj)); NS_RELEASE(docInfo); - nsXBLJSClass* c = static_cast<nsXBLJSClass*>(::JS_GET_CLASS(cx, obj)); + nsXBLJSClass* c = static_cast<nsXBLJSClass*>(::JS_GetClass(obj)); c->Drop(); } static JSBool XBLResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp) { // Note: if we get here, that means that the implementation for some binding @@ -144,17 +144,17 @@ XBLResolve(JSContext *cx, JSObject *obj, NS_ASSERTION(protoBinding, "Must have prototype binding!"); nsXBLProtoImplField* field = protoBinding->FindField(fieldName); if (!field) { return JS_TRUE; } // 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; } if (~nodeClass->flags & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) { nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED); return JS_FALSE; @@ -1088,17 +1088,17 @@ nsXBLBinding::ChangeDocument(nsIDocument } for ( ; true; base = proto) { // Will break out on null proto proto = ::JS_GetPrototype(cx, base); if (!proto) { break; } - JSClass* clazz = ::JS_GET_CLASS(cx, proto); + JSClass* clazz = ::JS_GetClass(proto); if (!clazz || (~clazz->flags & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) || JSCLASS_RESERVED_SLOTS(clazz) != 1 || clazz->resolve != (JSResolveOp)XBLResolve || clazz->finalize != XBLFinalize) { // Clearly not the right class continue;
--- a/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/content/xbl/src/nsXBLDocumentInfo.cpp @@ -116,25 +116,25 @@ nsXBLDocGlobalObject::doCheckAccess(JSCo nsIScriptSecurityManager *ssm = nsContentUtils::GetSecurityManager(); if (!ssm) { ::JS_ReportError(cx, "Unable to verify access to a global object property."); return JS_FALSE; } // 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."); return JS_FALSE; } } - 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); } static JSBool nsXBLDocGlobalObject_getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp) {
--- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -4893,17 +4893,17 @@ nsDOMClassInfo::PostCreatePrototype(JSCo // chance to monkey around with proto's prototype chain before this. if (!sObjectClass) { FindObjectClass(proto); NS_ASSERTION(sObjectClass && !strcmp(sObjectClass->name, "Object"), "Incorrect object class!"); } 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 if (mData->mHasClassInterface && mData->mProtoChainInterface && mData->mProtoChainInterface != &NS_GET_IID(nsISupports)) { nsCOMPtr<nsIInterfaceInfoManager> iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID)); @@ -5283,17 +5283,17 @@ nsWindowSH::GlobalScopePolluterNewResolv void nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj) { JSObject *proto; 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); ::JS_SetPrivate(cx, proto, nsnull); // Pull the global scope polluter out of the prototype chain so // that it can be freed. @@ -5325,17 +5325,17 @@ nsWindowSH::InstallGlobalScopePolluter(J } JSObject *o = obj, *proto; // Find the place in the prototype chain where we want this global // 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); break; } o = proto; } @@ -5442,17 +5442,17 @@ nsWindowSH::GetProperty(nsIXPConnectWrap // child frame in nsWindowSH::NewResolve() (*vp will tell us if // that's the case). If *vp is a window object (i.e. a child // frame), return without doing a security check. // // Calling GetWrappedNativeOfJSObject() is not all that cheap, so // 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 // XPCCrossOriginWrapper needs to be handled here too as XOWs // define child frame names with a XOW as the value, and thus // we'll need to get through here with XOWs class name too. if ((*name == 'W' && strcmp(name, "Window") == 0) || (*name == 'C' && strcmp(name, "ChromeWindow") == 0) || @@ -5901,17 +5901,17 @@ nsDOMConstructor::HasInstance(nsIXPConne // JS object. JSObject *wrapped_obj; nsresult rv = nsContentUtils::XPConnect()->GetJSObjectOfWrapper(cx, dom_obj, &wrapped_obj); if (NS_SUCCEEDED(rv)) { 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; } const nsGlobalNameStruct *name_struct; rv = GetNameStruct(NS_ConvertASCIItoUTF16(dom_class->name), &name_struct); if (NS_FAILED(rv)) { @@ -6300,17 +6300,17 @@ ResolvePrototype(nsIXPConnect *aXPConnec if (!ac.enter(cx, dot_prototype)) { return NS_ERROR_UNEXPECTED; } JSObject *xpc_proto_proto = ::JS_GetPrototype(cx, dot_prototype); 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; } } } else { JSAutoEnterCompartment ac; if (!ac.enter(cx, winobj)) { @@ -8972,17 +8972,17 @@ nsHTMLDocumentSH::CallToGetPropMapper(JS if (!str) { return JS_FALSE; } // If we are called via document.all(id) instead of document.all.item(i) or // 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); if (!self) return JS_FALSE; } size_t length; @@ -8993,17 +8993,17 @@ nsHTMLDocumentSH::CallToGetPropMapper(JS return ::JS_GetUCProperty(cx, self, chars, length, 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); } return obj; } static inline void * FlagsToPrivate(PRUint32 flags) @@ -9692,17 +9692,17 @@ nsHTMLPluginObjElementSH::SetupProtoChai rv = wrapper->GetJSObjectPrototype(&my_proto); NS_ENSURE_SUCCESS(rv, rv); // Set 'this.__proto__' to pi if (!::JS_SetPrototype(cx, obj, pi_obj)) { 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)) { return NS_ERROR_UNEXPECTED; } } else { // 'pi' didn't have a prototype, or pi's proto was // 'Object.prototype' (i.e. pi is an NPRuntime wrapped JS object)
--- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1521,17 +1521,17 @@ nsDOMWindowUtils::GetClassName(const JS: return NS_ERROR_DOM_SECURITY_ERR; } // Our argument must be a non-null object. if (JSVAL_IS_PRIMITIVE(aObject)) { 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; } NS_IMETHODIMP nsDOMWindowUtils::GetVisitedDependentComputedStyle( nsIDOMElement *aElement, const nsAString& aPseudoElement, const nsAString& aPropertyName, nsAString& aResult)
--- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -2190,17 +2190,17 @@ nsJSContext::GetGlobalObject() JSObject *inner = JS_ObjectToInnerObject(mContext, global); // If this assertion hits then it means that we have a window object as // our global, but we never called CreateOuterObject. NS_ASSERTION(inner == global, "Shouldn't be able to innerize here"); } #endif - JSClass *c = JS_GET_CLASS(mContext, global); + JSClass *c = JS_GetClass(global); if (!c || ((~c->flags) & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS))) { return nsnull; } nsISupports *priv = (nsISupports *)js::GetObjectPrivate(global);
--- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -104,17 +104,17 @@ nsJSUtils::GetStaticScriptGlobal(JSConte JSObject* glob = aObj; // starting point for search if (!glob) return nsnull; 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) || !(clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) || !(supports = (nsISupports*)::JS_GetPrivate(aContext, glob))) { return nsnull; }
--- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -1033,17 +1033,17 @@ JSBool IDBObjectStore::StructuredCloneWriteCallback(JSContext* aCx, JSStructuredCloneWriter* aWriter, JSObject* aObj, void* aClosure) { StructuredCloneWriteInfo* cloneWriteInfo = reinterpret_cast<StructuredCloneWriteInfo*>(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); PRUint64 value = 0; return JS_WriteBytes(aWriter, &value, sizeof(value)); }
--- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -1062,17 +1062,17 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JS return nsnull; } } // No need to enter the right compartment here as we only get the // 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 // looking for. NPObject *npobj = (NPObject *)::JS_GetPrivate(cx, obj); if (LookupNPP(npobj) == npp) @@ -1151,17 +1151,17 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JS } return wrapper; } 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); } if (!obj) { return nsnull; } return (NPObject *)::JS_GetPrivate(cx, obj); @@ -1387,17 +1387,17 @@ NPObjWrapper_GetProperty(JSContext *cx, return JS_TRUE; } 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); } if (!obj) { ThrowJSException(cx, "NPMethod called on non-NPObject wrapped JSObject!"); return JS_FALSE; } @@ -1697,17 +1697,17 @@ NPObjWrapper_Convert(JSContext *cx, JSOb if (!JSVAL_IS_PRIMITIVE(v) && JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(v))) { if (!JS_CallFunctionValue(cx, obj, v, 0, NULL, vp)) return false; if (JSVAL_IS_PRIMITIVE(*vp)) return true; } 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 ? "number" : "string"); return false; } @@ -2070,17 +2070,17 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp) } // Loop over the DOM element's JS object prototype chain and remove // all JS objects of the class sNPObjectJSWrapperClass (there should // be only one, but remove all instances found in case the page put // 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); // ... and pull it out of the chain. ::JS_SetPrototype(cx, obj, proto); } obj = proto; @@ -2169,17 +2169,17 @@ CreateNPObjectMember(NPP npp, JSContext } } fieldValue = NPVariantToJSVal(npp, cx, &npv); // 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); } memberPrivate->npobjWrapper = obj; memberPrivate->fieldValue = fieldValue; memberPrivate->methodName = identifier; memberPrivate->npp = npp;
--- a/dom/workers/EventTarget.cpp +++ b/dom/workers/EventTarget.cpp @@ -67,17 +67,17 @@ DECL_EVENTTARGET_CLASS(gClass, "EventTar DECL_EVENTTARGET_CLASS(gMainThreadClass, "WorkerEventTarget") #undef DECL_EVENTTARGET_CLASS 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; } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, "EventTarget", aFunctionName, classPtr->name); return false;
--- a/dom/workers/Events.cpp +++ b/dom/workers/Events.cpp @@ -215,17 +215,17 @@ protected: GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName) { Event* priv = GetPrivate(aCx, aObj); if (priv) { return priv; } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } static JSBool InitEventCommon(JSContext* aCx, JSObject* aObj, Event* aEvent, JSString* aType, JSBool aBubbles, JSBool aCancelable, bool aIsTrusted) { @@ -270,17 +270,17 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj))); + JS_ASSERT(IsThisClass(JS_GetClass(aObj))); delete GetJSPrivateSafeish<Event>(aCx, aObj); } static JSBool GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); @@ -521,17 +521,17 @@ protected: SLOT_COUNT, SLOT_FIRST = SLOT_data }; 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<MessageEvent>(aCx, aObj); } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; @@ -563,17 +563,17 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj))); + JS_ASSERT(IsThisClass(JS_GetClass(aObj))); MessageEvent* priv = GetJSPrivateSafeish<MessageEvent>(aCx, aObj); if (priv) { JS_free(aCx, priv->mData); #ifdef DEBUG priv->mData = NULL; #endif delete priv; } @@ -746,17 +746,17 @@ protected: SLOT_COUNT, SLOT_FIRST = SLOT_message }; 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<ErrorEvent>(aCx, aObj); } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; @@ -787,17 +787,17 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj))); + JS_ASSERT(IsThisClass(JS_GetClass(aObj))); delete GetJSPrivateSafeish<ErrorEvent>(aCx, aObj); } static JSBool GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); @@ -934,17 +934,17 @@ protected: SLOT_COUNT, SLOT_FIRST = SLOT_lengthComputable }; 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<ProgressEvent>(aCx, aObj); } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; @@ -973,17 +973,17 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete GetJSPrivateSafeish<ProgressEvent>(aCx, aObj); } static JSBool GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); @@ -1049,17 +1049,17 @@ JSFunctionSpec ProgressEvent::sFunctions JS_FN("initProgressEvent", InitProgressEvent, 6, FUNCTION_FLAGS), JS_FS_END }; 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) || classPtr == ProgressEvent::Class()) { return GetJSPrivateSafeish<Event>(aCx, aObj); } } return NULL;
--- a/dom/workers/Exceptions.cpp +++ b/dom/workers/Exceptions.cpp @@ -108,29 +108,29 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete GetJSPrivateSafeish<DOMException>(aCx, aObj); } static JSBool ToString(JSContext* aCx, uintN aArgc, jsval* aVp) { JSObject* obj = JS_THIS_OBJECT(aCx, aVp); if (!obj) { 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", classPtr->name); return false; } char buf[100]; @@ -159,17 +159,17 @@ private: static JSBool GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); int32 slot = JSID_TO_INT(aIdval); - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr != &sClass || !GetJSPrivateSafeish<DOMException>(aCx, aObj)) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, sProperties[slot].name, classPtr->name); return false; } @@ -324,28 +324,28 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete GetJSPrivateSafeish<FileException>(aCx, aObj); } static JSBool GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { JS_ASSERT(JSID_IS_INT(aIdval)); int32 slot = JSID_TO_INT(aIdval); - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr != &sClass || !GetJSPrivateSafeish<FileException>(aCx, aObj)) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, sProperties[slot].name, classPtr->name); return false; }
--- a/dom/workers/File.cpp +++ b/dom/workers/File.cpp @@ -103,32 +103,32 @@ private: { nsIDOMBlob* blob = GetPrivate(aCx, aObj); if (blob) { return blob; } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } static JSBool Construct(JSContext* aCx, uintN aArgc, jsval* aVp) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } 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); } static JSBool GetSize(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { @@ -267,17 +267,17 @@ public: } return obj; } static nsIDOMFile* 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<nsISupports*>(JS_GetPrivate(aCx, aObj)); nsCOMPtr<nsIDOMFile> file = do_QueryInterface(priv); JS_ASSERT_IF(priv, file); return file; } } return NULL; @@ -295,32 +295,32 @@ private: { nsIDOMFile* file = GetPrivate(aCx, aObj); if (file) { return file; } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } static JSBool Construct(JSContext* aCx, uintN aArgc, jsval* aVp) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } 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); } static JSBool GetMozFullPath(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) { @@ -384,17 +384,17 @@ JSPropertySpec File::sProperties[] = { js_GetterOnlyPropertyStub }, { 0, 0, 0, NULL, NULL } }; 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<nsISupports*>(JS_GetPrivate(aCx, aObj)); nsCOMPtr<nsIDOMBlob> blob = do_QueryInterface(priv); JS_ASSERT_IF(priv, blob); return blob; } } return NULL;
--- a/dom/workers/FileReaderSync.cpp +++ b/dom/workers/FileReaderSync.cpp @@ -83,17 +83,17 @@ GetDOMBlobFromJSObject(JSContext* aCx, J if (aObj) { nsIDOMBlob* blob = file::GetDOMBlobFromJSObject(aCx, aObj); if (blob) { return blob; } } 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; } class FileReaderSync { // FileReaderSync should not be instantiated. FileReaderSync(); ~FileReaderSync(); @@ -108,17 +108,17 @@ public: return JS_InitClass(aCx, aObj, NULL, &sClass, Construct, 0, NULL, sFunctions, NULL, NULL); } static FileReaderSyncPrivate* 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<FileReaderSyncPrivate>(aCx, aObj); return fileReader; } } return NULL; } @@ -129,17 +129,17 @@ private: { FileReaderSyncPrivate* fileReader = GetPrivate(aCx, aObj); if (fileReader) { return fileReader; } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } static JSBool Construct(JSContext* aCx, uintN aArgc, jsval* aVp) { JSObject* obj = JS_NewObject(aCx, &sClass, NULL, NULL); if (!obj) { @@ -156,17 +156,17 @@ private: JS_SET_RVAL(aCx, aVp, OBJECT_TO_JSVAL(obj)); return true; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); FileReaderSyncPrivate* fileReader = GetJSPrivateSafeish<FileReaderSyncPrivate>(aCx, aObj); NS_IF_RELEASE(fileReader); } static JSBool ReadAsArrayBuffer(JSContext* aCx, uintN aArgc, jsval* aVp) {
--- a/dom/workers/Location.cpp +++ b/dom/workers/Location.cpp @@ -135,29 +135,29 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete static_cast<Location*>(JS_GetPrivate(aCx, aObj)); } static JSBool ToString(JSContext* aCx, uintN aArgc, jsval* aVp) { JSObject* obj = JS_THIS_OBJECT(aCx, aVp); if (!obj) { 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", classPtr); return false; } @@ -168,17 +168,17 @@ private: JS_SET_RVAL(aCx, aVp, href); return true; } 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", classPtr->name); return false; } JS_ASSERT(JSID_IS_INT(aIdval));
--- a/dom/workers/Navigator.cpp +++ b/dom/workers/Navigator.cpp @@ -146,24 +146,24 @@ private: JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); delete static_cast<Navigator*>(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", classPtr->name); return false; } JS_ASSERT(JSID_IS_INT(aIdval));
--- a/dom/workers/Worker.cpp +++ b/dom/workers/Worker.cpp @@ -236,27 +236,27 @@ private: Construct(JSContext* aCx, uintN aArgc, jsval* aVp) { return ConstructInternal(aCx, aArgc, aVp, false); } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); WorkerPrivate* worker = GetJSPrivateSafeish<WorkerPrivate>(aCx, aObj); if (worker) { worker->FinalizeInstance(aCx, true); } } 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<WorkerPrivate>(aTrc->context, aObj); if (worker) { worker->TraceInstance(aTrc); } } static JSBool @@ -373,17 +373,17 @@ private: // make one. ChromeWorker(); ~ChromeWorker(); static WorkerPrivate* 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<WorkerPrivate>(aCx, aObj); } } return Worker::GetInstancePrivate(aCx, aObj, aFunctionName); } @@ -391,27 +391,27 @@ private: Construct(JSContext* aCx, uintN aArgc, jsval* aVp) { return ConstructInternal(aCx, aArgc, aVp, true); } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); WorkerPrivate* worker = GetJSPrivateSafeish<WorkerPrivate>(aCx, aObj); if (worker) { worker->FinalizeInstance(aCx, true); } } 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<WorkerPrivate>(aTrc->context, aObj); if (worker) { worker->TraceInstance(aTrc); } } }; @@ -422,17 +422,17 @@ JSClass ChromeWorker::sClass = { JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize, NULL, NULL, NULL, NULL, NULL, NULL, Trace, NULL }; 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<WorkerPrivate>(aCx, aObj); } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; } @@ -448,17 +448,17 @@ InitClass(JSContext* aCx, JSObject* aGlo bool aMainRuntime) { return Worker::InitClass(aCx, aGlobal, aProto, aMainRuntime); } 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()) { ChromeWorker::ClearPrivateSlot(aCx, aObj, aSaveEventHandlers); } else { Worker::ClearPrivateSlot(aCx, aObj, aSaveEventHandlers); }
--- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -654,17 +654,17 @@ public: { return JS_InitClass(aCx, aObj, aParentProto, &sClass, Construct, 0, sProperties, sFunctions, NULL, NULL); } 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<DedicatedWorkerGlobalScope>(aCx, aObj)); DedicatedWorkerGlobalScope* priv = new DedicatedWorkerGlobalScope(aWorkerPrivate); if (!SetJSPrivateSafeish(aCx, aObj, priv)) { delete priv; return false; } @@ -717,17 +717,17 @@ private: } return scope->SetEventListenerOnEventTarget(aCx, name + 2, aVp); } 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<DedicatedWorkerGlobalScope>(aCx, aObj); } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; @@ -752,29 +752,29 @@ private: *aObjp = resolved ? aObj : NULL; return true; } static void Finalize(JSContext* aCx, JSObject* aObj) { - JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass); + JS_ASSERT(JS_GetClass(aObj) == &sClass); DedicatedWorkerGlobalScope* scope = GetJSPrivateSafeish<DedicatedWorkerGlobalScope>(aCx, aObj); if (scope) { scope->FinalizeInstance(aCx); delete scope; } } 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<DedicatedWorkerGlobalScope>(aTrc->context, aObj); if (scope) { scope->TraceInstance(aTrc); } } static JSBool @@ -822,17 +822,17 @@ JSFunctionSpec DedicatedWorkerGlobalScop const char* const DedicatedWorkerGlobalScope::sEventStrings[STRING_COUNT] = { "onmessage", }; 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<WorkerGlobalScope>(aCx, aObj); } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, classPtr->name); return NULL; }
--- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -132,17 +132,17 @@ private: { MOZ_COUNT_DTOR(mozilla::dom::workers::xhr::XMLHttpRequestUpload); } static XMLHttpRequestUpload* GetPrivate(JSContext* aCx, JSObject* aObj) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { return GetJSPrivateSafeish<XMLHttpRequestUpload>(aCx, aObj); } } return NULL; } static XMLHttpRequestUpload* @@ -150,43 +150,43 @@ private: { XMLHttpRequestUpload* priv = GetPrivate(aCx, aObj); if (priv) { return priv; } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } static JSBool Construct(JSContext* aCx, uintN aArgc, jsval* aVp) { JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_WRONG_CONSTRUCTOR, sClass.name); return false; } 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); delete priv; } } 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); } } static JSBool GetEventListener(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) @@ -351,17 +351,17 @@ private: // make one. XMLHttpRequest(); ~XMLHttpRequest(); static XMLHttpRequestPrivate* GetPrivate(JSContext* aCx, JSObject* aObj) { if (aObj) { - JSClass* classPtr = JS_GET_CLASS(aCx, aObj); + JSClass* classPtr = JS_GetClass(aObj); if (classPtr == &sClass) { return GetJSPrivateSafeish<XMLHttpRequestPrivate>(aCx, aObj); } } return NULL; } static XMLHttpRequestPrivate* @@ -369,17 +369,17 @@ private: { XMLHttpRequestPrivate* priv = GetPrivate(aCx, aObj); if (priv) { return priv; } JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName, - JS_GET_CLASS(aCx, aObj)->name); + JS_GetClass(aObj)->name); return NULL; } static JSBool Construct(JSContext* aCx, uintN aArgc, jsval* aVp) { JSObject* obj = JS_NewObject(aCx, &sClass, NULL, NULL); if (!obj) { @@ -418,28 +418,28 @@ private: JS_SET_RVAL(aCx, aVp, OBJECT_TO_JSVAL(obj)); return true; } 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); delete priv; } } 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); } } static JSBool GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp) @@ -873,17 +873,17 @@ const char* const XMLHttpRequest::sEvent "onloadend" }; // static 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)) { return false; } if (!JSVAL_IS_PRIMITIVE(parentVal)) { return XMLHttpRequest::UpdateState(aCx, JSVAL_TO_OBJECT(parentVal),
--- a/js/jsd/jsd_val.c +++ b/js/jsd/jsd_val.c @@ -814,18 +814,17 @@ jsd_GetValueClassName(JSDContext* jsdc, return NULL; JS_BeginRequest(jsdc->dumbContext); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, obj); if(!call) { JS_EndRequest(jsdc->dumbContext); 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); } return jsdval->className; } JSDScript* jsd_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval)
--- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -477,17 +477,17 @@ Align(size_t val, size_t align) return ((val - 1) | (align - 1)) + 1; } static ABICode 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; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_ABICODE, &result)); return ABICode(JSVAL_TO_INT(result)); } @@ -918,26 +918,26 @@ InitTypeClasses(JSContext* cx, JSObject* if (!JS_DefineProperty(cx, parent, "voidptr_t", OBJECT_TO_JSVAL(typeObj), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; return true; } bool -IsCTypesGlobal(JSContext* cx, JSObject* obj) -{ - return JS_GET_CLASS(cx, obj) == &sCTypesGlobalClass; +IsCTypesGlobal(JSObject* obj) +{ + 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)); if (JSVAL_IS_VOID(result)) return NULL; return static_cast<JSCTypesCallbacks*>(JSVAL_TO_PRIVATE(result)); } @@ -969,17 +969,17 @@ JS_InitCTypesClass(JSContext* cx, JSObje } JS_PUBLIC_API(JSBool) JS_SetCTypesCallbacks(JSContext* cx, JSObject* ctypesObj, 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, PRIVATE_TO_JSVAL(callbacks)); } JS_END_EXTERN_C @@ -1196,17 +1196,17 @@ jsvalToInteger(JSContext* cx, jsval val, if (JSVAL_IS_DOUBLE(val)) { // Don't silently lose bits here -- check that val really is an // integer value, and has the right sign. jsdouble d = JSVAL_TO_DOUBLE(val); return ConvertExact(d, 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); // Check whether the source type is always representable, with exact // precision, by the target type. If it is, convert the value. switch (CType::GetTypeCode(cx, typeObj)) { #define DEFINE_INT_TYPE(name, fromType, ffiType) \ case TYPE_##name: \ @@ -1230,23 +1230,23 @@ jsvalToInteger(JSContext* cx, jsval val, case TYPE_function: case TYPE_array: case TYPE_struct: // Not a compatible number type. return false; } } - 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); } return false; } if (JSVAL_IS_BOOLEAN(val)) { @@ -1277,17 +1277,17 @@ jsvalToFloat(JSContext *cx, jsval val, F return true; } if (JSVAL_IS_DOUBLE(val)) { *result = FloatType(JSVAL_TO_DOUBLE(val)); return true; } 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); // Check whether the source type is always representable, with exact // precision, by the target type. If it is, convert the value. switch (CType::GetTypeCode(cx, typeObj)) { #define DEFINE_FLOAT_TYPE(name, fromType, ffiType) \ case TYPE_##name: \ @@ -1402,23 +1402,23 @@ jsvalToBigInteger(JSContext* cx, // to the JS array element operator, which will automatically call // toString() on the object for us.) return StringToInteger(cx, JSVAL_TO_STRING(val), result); } if (!JSVAL_IS_PRIMITIVE(val)) { // 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); } } return false; } @@ -1458,23 +1458,23 @@ jsidToBigInteger(JSContext* cx, // to the JS array element operator, which will automatically call // toString() on the object for us.) return StringToInteger(cx, JSID_TO_STRING(val), result); } if (JSID_IS_OBJECT(val)) { // 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); } } return false; } @@ -1514,22 +1514,22 @@ jsvalToIntegerExplicit(JSContext* cx, js // Convert -Inf, Inf, and NaN to 0; otherwise, convert by C-style cast. jsdouble d = JSVAL_TO_DOUBLE(val); *result = FloatIsFinite(d) ? IntegerType(d) : 0; return true; } 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; } } return false; } @@ -1558,28 +1558,28 @@ jsvalToPtrExplicit(JSContext* cx, jsval // Don't silently lose bits here -- check that val really is an // integer value, and has the right sign. *result = Convert<uintptr_t>(d); return jsdouble(*result) == d; } 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); // Make sure the integer fits in the alotted precision. if (int64_t(p) != i) return false; *result = uintptr_t(p); 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. *result = uintptr_t(i); return uint64_t(*result) == i; } } return false; @@ -1641,17 +1641,17 @@ JSBool ConvertToJS(JSContext* cx, JSObject* typeObj, JSObject* parentObj, void* data, bool wantPrimitive, 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); TypeCode typeCode = CType::GetTypeCode(cx, typeObj); switch (typeCode) { case TYPE_void_t: *result = JSVAL_VOID; @@ -1757,17 +1757,17 @@ ImplicitConvert(JSContext* cx, bool* freePointer) { JS_ASSERT(CType::IsSizeDefined(cx, targetType)); // First, check if val is a CData object of type targetType. 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); // If the types are equal, copy the buffer contained within the CData. // (Note that the buffers may overlap partially or completely.) if (CType::TypesEqual(cx, sourceType, targetType)) { size_t size = CType::GetSize(cx, sourceType); memmove(buffer, CData::GetData(cx, sourceData), size); @@ -2562,17 +2562,17 @@ ConstructAbstract(JSContext* cx, JSBool CType::ConstructData(JSContext* cx, uintN argc, jsval* vp) { // 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; } // How we construct the CData object depends on what type we represent. // An instance 'd' of a CData object of type 't' has: // * [[Class]] "CData" // * __proto__ === t.prototype @@ -2824,41 +2824,41 @@ CType::Trace(JSTracer* trc, JSObject* ob } default: // Nothing to do here. break; } } bool -CType::IsCType(JSContext* cx, JSObject* obj) -{ - return JS_GET_CLASS(cx, obj) == &sCTypeClass; +CType::IsCType(JSObject* obj) +{ + return JS_GetClass(obj) == &sCTypeClass; } bool -CType::IsCTypeProto(JSContext* cx, JSObject* obj) -{ - return JS_GET_CLASS(cx, obj) == &sCTypeProtoClass; +CType::IsCTypeProto(JSObject* obj) +{ + 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)); return TypeCode(JSVAL_TO_INT(result)); } 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) return true; // First, perform shallow comparison. TypeCode c1 = GetTypeCode(cx, t1); TypeCode c2 = GetTypeCode(cx, t2); @@ -2917,17 +2917,17 @@ CType::TypesEqual(JSContext* cx, JSObjec // Shallow comparison is sufficient. return true; } } 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)); // The "size" property can be a jsint, a jsdouble, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. if (JSVAL_IS_INT(size)) { *result = JSVAL_TO_INT(size); @@ -2940,17 +2940,17 @@ CType::GetSafeSize(JSContext* cx, JSObje JS_ASSERT(JSVAL_IS_VOID(size)); return false; } 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)); JS_ASSERT(!JSVAL_IS_VOID(size)); // The "size" property can be a jsint, a jsdouble, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. @@ -2958,41 +2958,41 @@ CType::GetSize(JSContext* cx, JSObject* if (JSVAL_IS_INT(size)) return JSVAL_TO_INT(size); return Convert<size_t>(JSVAL_TO_DOUBLE(size)); } 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)); // The "size" property can be a jsint, a jsdouble, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. JS_ASSERT(JSVAL_IS_INT(size) || JSVAL_IS_DOUBLE(size) || JSVAL_IS_VOID(size)); return !JSVAL_IS_VOID(size); } 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)); return static_cast<size_t>(JSVAL_TO_INT(slot)); } 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)); if (!JSVAL_IS_VOID(slot)) { return static_cast<ffi_type*>(JSVAL_TO_PRIVATE(slot)); } @@ -3015,17 +3015,17 @@ CType::GetFFIType(JSContext* cx, JSObjec return NULL; return result.forget(); } 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)); if (JSVAL_IS_VOID(string)) { // Build the type name lazily. JSString* name = BuildTypeName(cx, obj); if (!name || !JS_SetReservedSlot(cx, obj, SLOT_NAME, STRING_TO_JSVAL(name))) return NULL; @@ -3039,105 +3039,105 @@ CType::GetName(JSContext* cx, JSObject* JSObject* CType::GetProtoFromCtor(JSContext* cx, JSObject* obj, CTypeProtoSlot slot) { // Get ctypes.{Pointer,Array,Struct}Type.prototype from a reserved slot // on the type constructor. 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; ASSERT_OK(JS_GetReservedSlot(cx, proto, slot, &result)); return JSVAL_TO_OBJECT(result); } 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; ASSERT_OK(JS_GetReservedSlot(cx, proto, slot, &result)); return JSVAL_TO_OBJECT(result); } 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; } 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; } JSString* name = CType::GetName(cx, obj); if (!name) return JS_FALSE; *vp = STRING_TO_JSVAL(name); return JS_TRUE; } 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; } ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_SIZE, vp)); JS_ASSERT(JSVAL_IS_NUMBER(*vp) || JSVAL_IS_VOID(*vp)); return JS_TRUE; } 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; } JSObject* pointerType = PointerType::CreateInternal(cx, obj); if (!pointerType) return JS_FALSE; *vp = OBJECT_TO_JSVAL(pointerType); return JS_TRUE; } 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; } // Construct and return a new ArrayType object. if (argc > 1) { JS_ReportError(cx, "array takes zero or one argument"); return JS_FALSE; @@ -3158,27 +3158,25 @@ CType::CreateArray(JSContext* cx, uintN JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } 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; } // 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)); result = NewUCString(cx, type); } else { result = JS_NewStringCopyZ(cx, "[CType proto object]"); } @@ -3189,49 +3187,49 @@ CType::ToString(JSContext* cx, uintN arg return JS_TRUE; } JSBool 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; } // 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); } else { result = JS_NewStringCopyZ(cx, "[CType proto object]"); } if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } 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)) return JS_TRUE; JSObject* proto = JSVAL_TO_OBJECT(*v); while ((proto = JS_GetPrototype(cx, proto))) { if (proto == prototype) { @@ -3251,17 +3249,17 @@ PointerType::Create(JSContext* cx, uintN { // Construct and return a new PointerType object. if (argc != 1) { JS_ReportError(cx, "PointerType takes one argument"); return JS_FALSE; } 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; } JSObject* result = CreateInternal(cx, JSVAL_TO_OBJECT(arg)); if (!result) return JS_FALSE; @@ -3306,17 +3304,17 @@ PointerType::CreateInternal(JSContext* c } JSBool PointerType::ConstructData(JSContext* cx, JSObject* obj, 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; } if (argc > 3) { JS_ReportError(cx, "constructor takes 0, 1, 2, or 3 arguments"); return JS_FALSE; } @@ -3399,31 +3397,31 @@ PointerType::GetBaseType(JSContext* cx, } JSBool PointerType::TargetTypeGetter(JSContext* cx, JSObject* obj, 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; } ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_TARGET_T, vp)); JS_ASSERT(JSVAL_IS_OBJECT(*vp)); return JS_TRUE; } 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; } // Get pointer type and base type. JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); @@ -3435,17 +3433,17 @@ PointerType::IsNull(JSContext* cx, uintN JS_SET_RVAL(cx, vp, result); return JS_TRUE; } 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; } JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; @@ -3483,17 +3481,17 @@ PointerType::Decrement(JSContext* cx, ui } JSBool PointerType::ContentsGetter(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; } // Get pointer type and base type. JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); @@ -3522,17 +3520,17 @@ PointerType::ContentsGetter(JSContext* c JSBool PointerType::ContentsSetter(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; } // Get pointer type and base type. JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); @@ -3564,17 +3562,17 @@ ArrayType::Create(JSContext* cx, uintN a // Construct and return a new ArrayType object. if (argc < 1 || argc > 2) { JS_ReportError(cx, "ArrayType takes one or two arguments"); return JS_FALSE; } 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; } // Convert the length argument to a size_t. size_t length = 0; if (argc == 2 && !jsvalToSize(cx, argv[1], false, &length)) { JS_ReportError(cx, "second argument must be a nonnegative integer"); @@ -3645,17 +3643,17 @@ ArrayType::CreateInternal(JSContext* cx, } JSBool ArrayType::ConstructData(JSContext* cx, JSObject* obj, 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; } // Decide whether we have an object to initialize from. We'll override this // if we get a length argument instead. bool convertObject = argc == 1; @@ -3746,29 +3744,29 @@ ArrayType::ConstructData(JSContext* cx, } return JS_TRUE; } 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; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_ELEMENT_T, &type)); JS_ASSERT(!JSVAL_IS_NULL(type)); return JSVAL_TO_OBJECT(type); } 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; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_LENGTH, &length)); // The "length" property can be a jsint, a jsdouble, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. if (JSVAL_IS_INT(length)) { @@ -3782,17 +3780,17 @@ ArrayType::GetSafeLength(JSContext* cx, JS_ASSERT(JSVAL_IS_VOID(length)); return false; } 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; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_LENGTH, &length)); JS_ASSERT(!JSVAL_IS_VOID(length)); // The "length" property can be a jsint, a jsdouble, or JSVAL_VOID @@ -3801,17 +3799,17 @@ ArrayType::GetLength(JSContext* cx, JSOb if (JSVAL_IS_INT(length)) return JSVAL_TO_INT(length); return Convert<size_t>(JSVAL_TO_DOUBLE(length)); } 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)); JSObject* baseType = ArrayType::GetBaseType(cx, obj); ffi_type* ffiBaseType = CType::GetFFIType(cx, baseType); if (!ffiBaseType) return NULL; @@ -3844,49 +3842,49 @@ ArrayType::BuildFFIType(JSContext* cx, J ffiType->elements[length] = NULL; return ffiType.forget(); } 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; } ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_ELEMENT_T, vp)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(*vp)); return JS_TRUE; } JSBool 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; } ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_LENGTH, vp)); JS_ASSERT(JSVAL_IS_NUMBER(*vp) || JSVAL_IS_VOID(*vp)); return JS_TRUE; } 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; } // Bail early if we're not an ArrayType. (This setter is present for all // CData, regardless of CType.) JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_array) @@ -3911,17 +3909,17 @@ ArrayType::Getter(JSContext* cx, JSObjec char* data = static_cast<char*>(CData::GetData(cx, obj)) + elementSize * index; return ConvertToJS(cx, baseType, obj, data, false, false, vp); } 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; } // Bail early if we're not an ArrayType. (This setter is present for all // CData, regardless of CType.) JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_array) @@ -3946,17 +3944,17 @@ ArrayType::Setter(JSContext* cx, JSObjec char* data = static_cast<char*>(CData::GetData(cx, obj)) + elementSize * index; return ImplicitConvert(cx, *vp, baseType, data, false, NULL); } 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; } JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return JS_FALSE; @@ -4038,17 +4036,17 @@ ExtractStructField(JSContext* cx, jsval return NULL; } js::AutoValueRooter propVal(cx); if (!JS_GetPropertyById(cx, obj, nameid, propVal.jsval_addr())) 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; } // Undefined size or zero size struct members are illegal. // (Zero-size arrays are legal as struct members in C++, but libffi will // choke on a zero-size struct, so we disallow them.) *typeObj = JSVAL_TO_OBJECT(propVal.jsval_value()); @@ -4250,17 +4248,17 @@ StructType::DefineInternal(JSContext* cx return JS_FALSE; return JS_TRUE; } 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)); const FieldInfoHash* fields = GetFieldInfo(cx, obj); size_t len = fields->count(); size_t structSize = CType::GetSize(cx, obj); size_t structAlign = CType::GetAlignment(cx, obj); @@ -4328,17 +4326,17 @@ StructType::BuildFFIType(JSContext* cx, return ffiType.forget(); } JSBool 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; } if (CType::IsSizeDefined(cx, obj)) { JS_ReportError(cx, "StructType has already been defined"); return JS_FALSE; @@ -4360,17 +4358,17 @@ StructType::Define(JSContext* cx, uintN } JSBool StructType::ConstructData(JSContext* cx, JSObject* obj, 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; } if (!CType::IsSizeDefined(cx, obj)) { JS_ReportError(cx, "cannot construct an opaque StructType"); return JS_FALSE; } @@ -4434,30 +4432,30 @@ StructType::ConstructData(JSContext* cx, JS_ReportError(cx, "constructor takes 0, 1, or %u arguments", fields->count()); return JS_FALSE; } 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; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_FIELDINFO, &slot)); JS_ASSERT(!JSVAL_IS_VOID(slot) && JSVAL_TO_PRIVATE(slot)); return static_cast<const FieldInfoHash*>(JSVAL_TO_PRIVATE(slot)); } 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); if (ptr) return &ptr->value; JSAutoByteString bytes(cx, name); if (!bytes) @@ -4465,17 +4463,17 @@ StructType::LookupField(JSContext* cx, J JS_ReportError(cx, "%s does not name a field", bytes.ptr()); return NULL; } 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)); const FieldInfoHash* fields = GetFieldInfo(cx, obj); size_t len = fields->count(); // Prepare a new array for the 'fields' property of the StructType. Array<jsval, 16> fieldsVec; @@ -4500,17 +4498,17 @@ StructType::BuildFieldsArray(JSContext* return NULL; return fieldsProp; } 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; } ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_FIELDS, vp)); if (!CType::IsSizeDefined(cx, obj)) { JS_ASSERT(JSVAL_IS_VOID(*vp)); @@ -4530,17 +4528,17 @@ StructType::FieldsArrayGetter(JSContext* JS_ASSERT(!JSVAL_IS_PRIMITIVE(*vp) && JS_IsArrayObject(cx, JSVAL_TO_OBJECT(*vp))); return JS_TRUE; } 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; } JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; @@ -4552,17 +4550,17 @@ StructType::FieldGetter(JSContext* cx, J char* data = static_cast<char*>(CData::GetData(cx, obj)) + field->mOffset; return ConvertToJS(cx, field->mType, obj, data, false, false, 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; } JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; @@ -4575,17 +4573,17 @@ StructType::FieldSetter(JSContext* cx, J char* data = static_cast<char*>(CData::GetData(cx, obj)) + field->mOffset; return ImplicitConvert(cx, *vp, field->mType, data, false, NULL); } 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; } JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; @@ -4681,17 +4679,17 @@ GetABI(JSContext* cx, jsval abiType, ffi } return false; } 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; } JSObject* result = JSVAL_TO_OBJECT(type); TypeCode typeCode = CType::GetTypeCode(cx, result); if (typeCode == TYPE_array) { @@ -4718,17 +4716,17 @@ PrepareType(JSContext* cx, jsval type) return result; } 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; } JSObject* result = JSVAL_TO_OBJECT(type); TypeCode typeCode = CType::GetTypeCode(cx, result); // Arrays and functions can never be return types. @@ -5091,17 +5089,17 @@ ConvertArgument(JSContext* cx, JSBool FunctionType::Call(JSContext* cx, uintN argc, jsval* vp) { // 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; } JSObject* typeObj = CData::GetCType(cx, obj); if (CType::GetTypeCode(cx, typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a FunctionType.ptr"); return false; @@ -5120,17 +5118,17 @@ FunctionType::Call(JSContext* cx, (fninfo->mIsVariadic && argc < argcFixed)) { JS_ReportError(cx, "Number of arguments does not match declaration"); return false; } // 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"); return false; } } // prepare the values for each argument @@ -5152,17 +5150,17 @@ FunctionType::Call(JSContext* cx, return false; } JSObject* obj; // Could reuse obj instead of declaring a second JSObject* type; // JSObject*, but readability would suffer. 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", i, JS_GetTypeName(cx, JS_TypeOfValue(cx, argv[i]))); return false; } if (!(type = CData::GetCType(cx, obj)) || !(type = PrepareType(cx, OBJECT_TO_JSVAL(type))) || @@ -5219,30 +5217,30 @@ FunctionType::Call(JSContext* cx, // prepare a JS object from the result return ConvertToJS(cx, fninfo->mReturnType, NULL, returnValue.mData, false, true, vp); } 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; ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_FNINFO, &slot)); JS_ASSERT(!JSVAL_IS_VOID(slot) && JSVAL_TO_PRIVATE(slot)); return static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot)); } 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; } return JS_TRUE; } JSBool FunctionType::ArgTypesGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp) @@ -5340,17 +5338,17 @@ CClosure::Create(JSContext* cx, JS_ReportOutOfMemory(cx); return NULL; } // Get the prototype of the FunctionType object, of class CTypeProto, // 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; ASSERT_OK(JS_GetReservedSlot(cx, proto, SLOT_CLOSURECX, &slot)); if (!JSVAL_IS_VOID(slot)) { // Use the existing JSContext. cinfo->cx = static_cast<JSContext*>(JSVAL_TO_PRIVATE(slot)); JS_ASSERT(cinfo->cx); @@ -5636,20 +5634,20 @@ CClosure::ClosureStub(ffi_cif* cif, void JSObject* CData::Create(JSContext* cx, JSObject* typeObj, JSObject* refObj, void* source, 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; ASSERT_OK(JS_GetReservedSlot(cx, typeObj, SLOT_PROTO, &slot)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(slot)); JSObject* proto = JSVAL_TO_OBJECT(slot); JSObject* parent = JS_GetParent(cx, typeObj); @@ -5729,87 +5727,87 @@ CData::Finalize(JSContext* cx, JSObject* if (owns) cx->array_delete(*buffer); cx->delete_(buffer); } 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)); void** buffer = static_cast<void**>(JSVAL_TO_PRIVATE(slot)); JS_ASSERT(buffer); JS_ASSERT(*buffer); return *buffer; } bool -CData::IsCData(JSContext* cx, JSObject* obj) -{ - return JS_GET_CLASS(cx, obj) == &sCDataClass; +CData::IsCData(JSObject* obj) +{ + return JS_GetClass(obj) == &sCDataClass; } bool -CData::IsCDataProto(JSContext* cx, JSObject* obj) -{ - return JS_GET_CLASS(cx, obj) == &sCDataProtoClass; +CData::IsCDataProto(JSObject* obj) +{ + 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; } // Convert the value to a primitive; do not create a new CData object. if (!ConvertToJS(cx, GetCType(cx, obj), NULL, GetData(cx, obj), true, false, vp)) return JS_FALSE; return JS_TRUE; } 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; } return ImplicitConvert(cx, *vp, GetCType(cx, obj), GetData(cx, obj), false, NULL); } JSBool CData::Address(JSContext* cx, uintN argc, jsval* vp) { if (argc != 0) { JS_ReportError(cx, "address takes zero arguments"); return JS_FALSE; } 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; } JSObject* typeObj = CData::GetCType(cx, obj); JSObject* pointerType = PointerType::CreateInternal(cx, typeObj); if (!pointerType) return JS_FALSE; @@ -5833,25 +5831,25 @@ CData::Cast(JSContext* cx, uintN argc, j { if (argc != 2) { JS_ReportError(cx, "cast takes two arguments"); return JS_FALSE; } 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; } JSObject* sourceData = JSVAL_TO_OBJECT(argv[0]); 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; } JSObject* targetType = JSVAL_TO_OBJECT(argv[1]); size_t targetSize; if (!CType::GetSafeSize(cx, targetType, &targetSize) || targetSize > CType::GetSize(cx, sourceType)) { @@ -5876,17 +5874,17 @@ CData::GetRuntime(JSContext* cx, uintN a { if (argc != 1) { JS_ReportError(cx, "getRuntime takes one argument"); return JS_FALSE; } 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; } JSObject* targetType = JSVAL_TO_OBJECT(argv[0]); size_t targetSize; if (!CType::GetSafeSize(cx, targetType, &targetSize) || targetSize != sizeof(void*)) { @@ -5907,17 +5905,17 @@ JSBool CData::ReadString(JSContext* cx, uintN argc, jsval* vp) { if (argc != 0) { JS_ReportError(cx, "readString takes zero arguments"); return JS_FALSE; } 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; } // Make sure we are a pointer to, or an array of, an 8-bit or 16-bit // character or integer type. JSObject* baseType; JSObject* typeObj = GetCType(cx, obj); @@ -5999,23 +5997,23 @@ CData::ToSource(JSContext* cx, uintN arg { if (argc != 0) { JS_ReportError(cx, "toSource takes zero arguments"); return JS_FALSE; } 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); // Walk the types, building up the toSource() string. // First, we build up the type expression: // 't.ptr' for pointers; // 't.array([n])' for arrays; // 'n' for structs, where n = t.name, the struct's name. (We assume this is @@ -6080,17 +6078,17 @@ Int64Base::Finalize(JSContext* cx, JSObj if (!JS_GetReservedSlot(cx, obj, SLOT_INT64, &slot) || JSVAL_IS_VOID(slot)) return; cx->delete_(static_cast<uint64_t*>(JSVAL_TO_PRIVATE(slot))); } 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)); return *static_cast<uint64_t*>(JSVAL_TO_PRIVATE(slot)); } JSBool Int64Base::ToString(JSContext* cx, @@ -6177,65 +6175,65 @@ Int64::Construct(JSContext* cx, if (!jsvalToBigInteger(cx, argv[0], true, &i)) return TypeError(cx, "int64", argv[0]); // Get ctypes.Int64.prototype from the 'prototype' property of the ctor. jsval slot; 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) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } bool -Int64::IsInt64(JSContext* cx, JSObject* obj) -{ - return JS_GET_CLASS(cx, obj) == &sInt64Class; +Int64::IsInt64(JSObject* obj) +{ + 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; } return Int64Base::ToString(cx, obj, argc, vp, false); } 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; } return Int64Base::ToSource(cx, obj, argc, vp, false); } JSBool Int64::Compare(JSContext* cx, uintN argc, jsval* vp) { jsval* argv = JS_ARGV(cx, 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; } JSObject* obj1 = JSVAL_TO_OBJECT(argv[0]); JSObject* obj2 = JSVAL_TO_OBJECT(argv[1]); int64_t i1 = Int64Base::GetInt(cx, obj1); @@ -6255,17 +6253,17 @@ Int64::Compare(JSContext* cx, uintN argc #define INT64_LO(i) ((i) & LO_MASK) #define INT64_HI(i) ((i) >> 32) JSBool 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; } JSObject* obj = JSVAL_TO_OBJECT(argv[0]); int64_t u = Int64Base::GetInt(cx, obj); jsdouble d = uint32_t(INT64_LO(u)); @@ -6277,17 +6275,17 @@ Int64::Lo(JSContext* cx, uintN argc, jsv return JS_TRUE; } JSBool 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; } JSObject* obj = JSVAL_TO_OBJECT(argv[0]); int64_t u = Int64Base::GetInt(cx, obj); jsdouble d = int32_t(INT64_HI(u)); @@ -6317,17 +6315,17 @@ Int64::Join(JSContext* cx, uintN argc, j int64_t i = (int64_t(hi) << 32) + int64_t(lo); // Get Int64.prototype from the function's reserved slot. JSObject* callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, 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) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } @@ -6348,65 +6346,65 @@ UInt64::Construct(JSContext* cx, if (!jsvalToBigInteger(cx, argv[0], true, &u)) return TypeError(cx, "uint64", argv[0]); // Get ctypes.UInt64.prototype from the 'prototype' property of the ctor. jsval slot; 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) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } bool -UInt64::IsUInt64(JSContext* cx, JSObject* obj) -{ - return JS_GET_CLASS(cx, obj) == &sUInt64Class; +UInt64::IsUInt64(JSObject* obj) +{ + 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; } return Int64Base::ToString(cx, obj, argc, vp, true); } 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; } return Int64Base::ToSource(cx, obj, argc, vp, true); } JSBool UInt64::Compare(JSContext* cx, uintN argc, jsval* vp) { jsval* argv = JS_ARGV(cx, 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; } JSObject* obj1 = JSVAL_TO_OBJECT(argv[0]); JSObject* obj2 = JSVAL_TO_OBJECT(argv[1]); uint64_t u1 = Int64Base::GetInt(cx, obj1); @@ -6422,17 +6420,17 @@ UInt64::Compare(JSContext* cx, uintN arg return JS_TRUE; } JSBool 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; } JSObject* obj = JSVAL_TO_OBJECT(argv[0]); uint64_t u = Int64Base::GetInt(cx, obj); jsdouble d = uint32_t(INT64_LO(u)); @@ -6444,17 +6442,17 @@ UInt64::Lo(JSContext* cx, uintN argc, js return JS_TRUE; } JSBool 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; } JSObject* obj = JSVAL_TO_OBJECT(argv[0]); uint64_t u = Int64Base::GetInt(cx, obj); jsdouble d = uint32_t(INT64_HI(u)); @@ -6484,17 +6482,17 @@ UInt64::Join(JSContext* cx, uintN argc, uint64_t u = (uint64_t(hi) << 32) + uint64_t(lo); // Get UInt64.prototype from the function's reserved slot. JSObject* callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, 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) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; }
--- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -343,17 +343,17 @@ struct ClosureInfo ~ClosureInfo() { if (closure) ffi_closure_free(closure); if (errResult) rt->free_(errResult); }; }; -bool IsCTypesGlobal(JSContext* cx, JSObject* obj); +bool IsCTypesGlobal(JSObject* obj); JSCTypesCallbacks* GetCallbacks(JSContext* cx, JSObject* obj); JSBool InitTypeClasses(JSContext* cx, JSObject* parent); JSBool ConvertToJS(JSContext* cx, JSObject* typeObj, JSObject* dataObj, void* data, bool wantPrimitive, bool ownResult, jsval* result); @@ -449,18 +449,18 @@ enum Int64FunctionSlot { namespace CType { JSObject* Create(JSContext* cx, JSObject* typeProto, JSObject* dataProto, TypeCode type, JSString* name, jsval size, jsval align, ffi_type* ffiType); JSObject* DefineBuiltin(JSContext* cx, JSObject* parent, const char* propName, 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); bool GetSafeSize(JSContext* cx, JSObject* obj, size_t* result); bool IsSizeDefined(JSContext* cx, JSObject* obj); size_t GetAlignment(JSContext* cx, JSObject* obj); ffi_type* GetFFIType(JSContext* cx, JSObject* obj); JSString* GetName(JSContext* cx, JSObject* obj); @@ -513,29 +513,29 @@ namespace CClosure { } namespace CData { JSObject* Create(JSContext* cx, JSObject* typeObj, JSObject* refObj, void* data, bool ownResult); 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); // Attached by JSAPI as the function 'ctypes.getRuntime' JSBool GetRuntime(JSContext* cx, uintN argc, jsval* vp); } namespace Int64 { - bool IsInt64(JSContext* cx, JSObject* obj); + bool IsInt64(JSObject* obj); } namespace UInt64 { - bool IsUInt64(JSContext* cx, JSObject* obj); + bool IsUInt64(JSObject* obj); } } } #endif
--- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -190,25 +190,25 @@ Library::Create(JSContext* cx, jsval pat if (!JS_SetReservedSlot(cx, libraryObj, SLOT_LIBRARY, PRIVATE_TO_JSVAL(library))) return NULL; return libraryObj; } 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); return static_cast<PRLibrary*>(JSVAL_TO_PRIVATE(slot)); } void Library::Finalize(JSContext* cx, JSObject* obj) @@ -218,17 +218,17 @@ Library::Finalize(JSContext* cx, JSObjec if (library) PR_UnloadLibrary(library); } 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; } if (argc != 1 || JSVAL_IS_VOID(JS_ARGV(cx, vp)[0])) { JS_ReportError(cx, "open requires a single argument"); return JS_FALSE; } @@ -240,17 +240,17 @@ Library::Open(JSContext* cx, uintN argc, JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(library)); return JS_TRUE; } 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; } if (argc != 0) { JS_ReportError(cx, "close doesn't take any arguments"); return JS_FALSE; } @@ -262,17 +262,17 @@ Library::Close(JSContext* cx, uintN argc JS_SET_RVAL(cx, vp, JSVAL_VOID); return JS_TRUE; } 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; } PRLibrary* library = GetLibrary(cx, obj); if (!library) { JS_ReportError(cx, "library not open"); return JS_FALSE; @@ -316,17 +316,17 @@ Library::Declare(JSContext* cx, uintN ar typeObj = PointerType::CreateInternal(cx, fnObj); if (!typeObj) return JS_FALSE; root.setObject(typeObj); } 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; } typeObj = JSVAL_TO_OBJECT(argv[1]); if (CType::GetTypeCode(cx, typeObj) == TYPE_pointer) { fnObj = PointerType::GetBaseType(cx, typeObj);
--- a/js/src/ctypes/Library.h +++ b/js/src/ctypes/Library.h @@ -53,17 +53,17 @@ enum LibrarySlot { }; namespace Library { JSBool Name(JSContext* cx, uintN argc, jsval *vp); 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); } } }
--- a/js/src/jsapi-tests/testNewObject.cpp +++ b/js/src/jsapi-tests/testNewObject.cpp @@ -13,17 +13,17 @@ constructHook(JSContext *cx, uintN argc, // Check that arguments were passed properly from JS_New. JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); JSObject *obj = JS_NewObjectForConstructor(cx, vp); if (!obj) { 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; } if (argc != 3) { JS_ReportError(cx, "test failed, argc == %d", argc); return false; } if (!JSVAL_IS_INT(argv[2]) || JSVAL_TO_INT(argv[2]) != 2) {
--- a/js/src/jsapi-tests/testSetProperty.cpp +++ b/js/src/jsapi-tests/testSetProperty.cpp @@ -65,17 +65,17 @@ BEGIN_TEST(testSetProperty_NativeGetterS } END_TEST(testSetProperty_NativeGetterStubSetter) 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" "var global = this;\n" "function f() { n++; }\n" "Object.defineProperty(Object.prototype, 'x', {set: f});\n" "for (var i = 0; i < HOTLOOP; i++)\n" " global.x = i;\n");
--- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -3156,29 +3156,21 @@ JS_InitClass(JSContext *cx, JSObject *ob } JS_PUBLIC_API(JSBool) 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) { AssertNoGC(cx); CHECK_REQUEST(cx); #ifdef DEBUG if (argv) {
--- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -3642,28 +3642,19 @@ JS_InitClass(JSContext *cx, JSObject *ob /* * Set up ctor.prototype = proto and proto.constructor = ctor with the * right property flags. */ 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); extern JS_PUBLIC_API(JSBool) JS_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp); extern JS_PUBLIC_API(void *) JS_GetPrivate(JSContext *cx, JSObject *obj); @@ -5327,17 +5318,17 @@ static JS_ALWAYS_INLINE JSBool JS_IsConstructing(JSContext *cx, const jsval *vp) { #ifdef DEBUG JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); if (JS_ObjectIsFunction(cx, callee)) { 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 return JSVAL_IS_MAGIC_IMPL(JSVAL_TO_IMPL(vp[1])); } /* * If a constructor does not have any static knowledge about the type of
--- a/js/src/perf/jsperf.cpp +++ b/js/src/perf/jsperf.cpp @@ -231,17 +231,17 @@ GetPM(JSContext* cx, JSObject* obj, cons PerfMeasurement* p = (PerfMeasurement*) JS_GetInstancePrivate(cx, obj, &pm_class, 0); if (p) return p; // 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; } static PerfMeasurement* GetPMFromThis(JSContext* cx, jsval* vp) { JSObject* this_ = JS_THIS_OBJECT(cx, vp); if (!this_)
--- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -814,17 +814,17 @@ EvaluateWithLocation(JSContext *cx, uint uint32_t lineno; if (!JS_ValueToECMAUint32(cx, JS_ARGV(cx, vp)[2], &lineno)) return false; JSObject *thisobj = JS_THIS_OBJECT(cx, 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; } char *filenameBytes = JS_EncodeString(cx, filename); if (!filenameBytes) return false; @@ -856,17 +856,17 @@ Evaluate(JSContext *cx, uintN argc, jsva const jschar *codeChars = JS_GetStringCharsAndLength(cx, code, &codeLength); if (!codeChars) return false; JSObject *thisobj = JS_THIS_OBJECT(cx, 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; } JS_SET_RVAL(cx, vp, JSVAL_VOID); return JS_EvaluateUCScript(cx, thisobj, codeChars, codeLength, "@evaluate", 0, NULL); } @@ -1623,17 +1623,17 @@ FinalizeCount(JSContext *cx, uintN argc, static JSScript * ValueToScript(JSContext *cx, jsval v, JSFunction **funp = NULL) { JSScript *script = NULL; JSFunction *fun = 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)) { fun = gen->floatingFrame()->fun(); script = fun->script(); } } } @@ -1682,17 +1682,17 @@ GetScriptAndPCArgs(JSContext *cx, uintN int32_t *ip) { JSScript *script = JS_GetFrameScript(cx, JS_GetScriptedCaller(cx, NULL)); *ip = 0; if (argc != 0) { 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; intarg++; } if (argc > intarg) { if (!JS_ValueToInt32(cx, argv[intarg], ip)) return JS_FALSE; @@ -1827,17 +1827,17 @@ LineToPC(JSContext *cx, uintN argc, jsva if (argc == 0) { JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_LINE2PC_USAGE); return JS_FALSE; } 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) return JS_FALSE; lineArg++; } if (!JS_ValueToECMAUint32(cx, JS_ARGV(cx, vp)[lineArg], &lineno)) return JS_FALSE; @@ -4537,30 +4537,30 @@ static JSClass its_class = { (JSEnumerateOp)its_enumerate, (JSResolveOp)its_resolve, its_convert, its_finalize, JSCLASS_NO_OPTIONAL_MEMBERS }; 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 { *vp = JSVAL_VOID; } return JS_TRUE; } 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); if (val) { *val = *vp; return JS_TRUE; }
--- a/js/src/shell/jsworkers.cpp +++ b/js/src/shell/jsworkers.cpp @@ -576,17 +576,17 @@ class ThreadPool static void jsFinalize(JSContext *cx, JSObject *obj) { if (ThreadPool *tp = unwrap(cx, obj)) delete tp; } 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); } }; /* * A Worker is always in one of 4 states, except when it is being initialized * or destroyed, or its lock is held: * - idle (!terminated && current == NULL && events.empty()) @@ -695,28 +695,28 @@ class Worker MOZ_FINAL : public WorkerPa bad: JS_EndRequest(context); JS_DestroyContext(context); context = NULL; return false; } 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); if (w->current) w->current->trace(trc); JS_CALL_OBJECT_TRACER(trc, JS_GetGlobalObject(w->context), "Worker global"); } } 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; } static JSBool jsOperationCallback(JSContext *cx) { Worker *w = (Worker *) JS_GetContextPrivate(cx); JSAutoSuspendRequest suspend(cx); // avoid nesting w->lock in a request return !w->checkTermination();
--- a/js/xpconnect/shell/xpcshell.cpp +++ b/js/xpconnect/shell/xpcshell.cpp @@ -1229,17 +1229,17 @@ ProcessArgs(JSContext *cx, JSObject *obj break; case 'x': JS_ToggleOptions(cx, JSOPTION_XML); break; case 'd': 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)) return false; gobj = JS_NewGlobalObject(cx, &global_class); if (!gobj || !JS_SplicePrototype(cx, gobj, obj)) return false; JS_SetParent(cx, gobj, NULL);
--- a/js/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -264,17 +264,17 @@ CanXray(JSObject *obj, bool *proxy) JSObject * WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSObject *parent, uintN flags) { NS_ASSERTION(!IsWrapper(obj) || 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); JSObject *xrayHolder = nsnull; Wrapper *wrapper; CompartmentPrivate *targetdata = static_cast<CompartmentPrivate *>(JS_GetCompartmentPrivate(cx, target));