Bug 417710 - "Use JS_GET_CLASS, not JS_GetClass" [p=gyuyoung.kim@samsung.com (gyu-young kim) r=jorendorff r=jst sr+a1.9=brendan]
authorreed@reedloden.com
Mon, 25 Feb 2008 00:59:20 -0800
changeset 12197 a69d974c964f6d17a4723827cb29618187cdf691
parent 12196 58eb910a9f1c42dc850a390b6fd1531329aa666b
child 12198 32d658c33a2cfff8a15ef642a3115a1897e3296a
push idunknown
push userunknown
push dateunknown
reviewersjorendorff, jst
bugs417710
milestone1.9b4pre
Bug 417710 - "Use JS_GET_CLASS, not JS_GetClass" [p=gyuyoung.kim@samsung.com (gyu-young kim) r=jorendorff r=jst sr+a1.9=brendan]
caps/src/nsSecurityManagerFactory.cpp
content/xbl/src/nsXBLBinding.cpp
dom/src/base/nsDOMClassInfo.h
dom/src/base/nsJSEnvironment.cpp
embedding/components/windowwatcher/src/nsWWJSUtils.cpp
js/src/liveconnect/jsj_JavaClass.c
xpinstall/src/nsXPITriggerInfo.cpp
--- a/caps/src/nsSecurityManagerFactory.cpp
+++ b/caps/src/nsSecurityManagerFactory.cpp
@@ -296,17 +296,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_GetClass(cx, obj);
+    JSClass *objectClass = JS_GET_CLASS(cx, 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; must be LiveConnect
--- a/content/xbl/src/nsXBLBinding.cpp
+++ b/content/xbl/src/nsXBLBinding.cpp
@@ -115,17 +115,17 @@
 //
 JS_STATIC_DLL_CALLBACK(void)
 XBLFinalize(JSContext *cx, JSObject *obj)
 {
   nsIXBLDocumentInfo* docInfo =
     static_cast<nsIXBLDocumentInfo*>(::JS_GetPrivate(cx, obj));
   NS_RELEASE(docInfo);
   
-  nsXBLJSClass* c = static_cast<nsXBLJSClass*>(::JS_GetClass(cx, obj));
+  nsXBLJSClass* c = static_cast<nsXBLJSClass*>(::JS_GET_CLASS(cx, obj));
   c->Drop();
 }
 
 JS_STATIC_DLL_CALLBACK(JSBool)
 XBLResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
            JSObject **objp)
 {
   // Note: if we get here, that means that the implementation for some binding
@@ -153,17 +153,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_GetClass(cx, origObj);
+  JSClass* nodeClass = ::JS_GET_CLASS(cx, 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;
@@ -1080,17 +1080,17 @@ nsXBLBinding::ChangeDocument(nsIDocument
             JSObject* proto;
             JSAutoRequest ar(cx);
             for ( ; true; base = proto) { // Will break out on null proto
               proto = ::JS_GetPrototype(cx, base);
               if (!proto) {
                 break;
               }
 
-              JSClass* clazz = ::JS_GetClass(cx, proto);
+              JSClass* clazz = ::JS_GET_CLASS(cx, proto);
               if (!clazz ||
                   (~clazz->flags &
                    (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) ||
                   JSCLASS_RESERVED_SLOTS(clazz) != 1) {
                 // Clearly not the right class
                 continue;
               }
 
--- a/dom/src/base/nsDOMClassInfo.h
+++ b/dom/src/base/nsDOMClassInfo.h
@@ -164,17 +164,17 @@ public:
 
       NS_PRECONDITION(!scx || !scx->IsContextInitialized() ||
                       sXPCNativeWrapperClass,
                       "Must know what the XPCNativeWrapper class is!");
     }
 #endif
 
     return sXPCNativeWrapperClass &&
-      ::JS_GetClass(cx, obj) == sXPCNativeWrapperClass;
+      ::JS_GET_CLASS(cx, obj) == sXPCNativeWrapperClass;
   }
 
   static nsresult PreserveNodeWrapper(nsIXPConnectWrappedNative *aWrapper);
 
 protected:
   friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
 
   const nsDOMClassInfoData* mData;
--- a/dom/src/base/nsJSEnvironment.cpp
+++ b/dom/src/base/nsJSEnvironment.cpp
@@ -2819,17 +2819,17 @@ nsJSContext::FindXPCNativeWrapperClass(n
     // No need to notify about pending exceptions here; we don't
     // expect any other than out of memory, really.
     return NS_ERROR_FAILURE;
   }
 
   NS_ASSERTION(JSVAL_IS_OBJECT(wrapper), "This should be an object!");
 
   NS_DOMClassInfo_SetXPCNativeWrapperClass(
-    ::JS_GetClass(mContext, JSVAL_TO_OBJECT(wrapper)));
+    ::JS_GET_CLASS(mContext, JSVAL_TO_OBJECT(wrapper)));
   return NS_OK;
 }
 
 static JSPropertySpec OptionsProperties[] = {
   {"strict",    (int8)JSOPTION_STRICT,   JSPROP_ENUMERATE | JSPROP_PERMANENT},
   {"werror",    (int8)JSOPTION_WERROR,   JSPROP_ENUMERATE | JSPROP_PERMANENT},
   {"relimit",   (int8)JSOPTION_RELIMIT,  JSPROP_ENUMERATE | JSPROP_PERMANENT},
   {0}
--- a/embedding/components/windowwatcher/src/nsWWJSUtils.cpp
+++ b/embedding/components/windowwatcher/src/nsWWJSUtils.cpp
@@ -55,21 +55,17 @@ nsWWJSUtils::GetStaticScriptGlobal(JSCon
   JSObject* glob = aObj; // starting point for search
 
   if (!glob)
     return nsnull;
 
   while (nsnull != (parent = JS_GetParent(aContext, glob)))
     glob = parent;
 
-#ifdef JS_THREADSAFE
-  clazz = JS_GetClass(aContext, glob);
-#else
-  clazz = JS_GetClass(glob);
-#endif
+  clazz = JS_GET_CLASS(aContext, glob);
 
   if (!clazz ||
       !(clazz->flags & JSCLASS_HAS_PRIVATE) ||
       !(clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) ||
       !(supports = (nsISupports*) JS_GetPrivate(aContext, glob))) {
     return nsnull;
   }
  
--- a/js/src/liveconnect/jsj_JavaClass.c
+++ b/js/src/liveconnect/jsj_JavaClass.c
@@ -507,21 +507,17 @@ JavaClass_hasInstance(JSContext *cx, JSO
 
     /*
      * Make sure that the thing to the left of the instanceof operator is a
      * Java object.
      */
     if (!JSVAL_IS_OBJECT(candidate_jsval))
         goto done;
     candidate_obj = JSVAL_TO_OBJECT(candidate_jsval);
-#ifdef JS_THREADSAFE
-    js_class = JS_GetClass(cx, candidate_obj);
-#else
-    js_class = JS_GetClass(candidate_obj);
-#endif
+    js_class = JS_GET_CLASS(cx, candidate_obj);
     if ((js_class != &JavaObject_class) && (js_class != &JavaArray_class))
         goto done;
 
     java_class = class_descriptor->java_class;
     java_wrapper = JS_GetPrivate(cx, candidate_obj);
     if (!java_wrapper) {
         JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL, 
                                                 JSJMSG_BAD_OP_PROTO);
--- a/xpinstall/src/nsXPITriggerInfo.cpp
+++ b/xpinstall/src/nsXPITriggerInfo.cpp
@@ -206,21 +206,17 @@ nsXPITriggerInfo::~nsXPITriggerInfo()
 void nsXPITriggerInfo::SaveCallback( JSContext *aCx, jsval aVal )
 {
     NS_ASSERTION( mCx == 0, "callback set twice, memory leak" );
     mCx = aCx;
     JSObject *obj = JS_GetGlobalObject( mCx );
 
     JSClass* clazz;
 
-#ifdef JS_THREADSAFE
-    clazz = ::JS_GetClass(aCx, obj);
-#else
-    clazz = ::JS_GetClass(obj);
-#endif
+    clazz = ::JS_GET_CLASS(aCx, obj);
 
     if (clazz &&
         (clazz->flags & JSCLASS_HAS_PRIVATE) &&
         (clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS)) {
       mGlobalWrapper =
         do_QueryInterface((nsISupports*)::JS_GetPrivate(aCx, obj));
     }