Bug 615834 warning: inline function ‘JSCompartment* JSObject::getCompartment() const’ used but never defined. r=gal
authortimeless@mozdev.org
Tue, 18 Jan 2011 14:25:46 -0800
changeset 61451 c098265c18e28ea1ff0cb82ec9be7ce6a4366014
parent 61450 dd71c1b1159e4b8deed8fc22309c6f5a04e82f4e
child 61452 68931522981d42fd4ca3b8b5f8447d5e73cc52fe
push idunknown
push userunknown
push dateunknown
reviewersgal
bugs615834
milestone2.0b10pre
Bug 615834 warning: inline function ‘JSCompartment* JSObject::getCompartment() const’ used but never defined. r=gal r=mrbkap
js/src/jscntxt.h
js/src/jsgc.h
js/src/jsobj.h
js/src/xpconnect/src/nsXPConnect.cpp
js/src/xpconnect/src/xpccomponents.cpp
js/src/xpconnect/src/xpcconvert.cpp
js/src/xpconnect/src/xpcpublic.h
js/src/xpconnect/src/xpcwrappedjsclass.cpp
js/src/xpconnect/wrappers/CrossOriginWrapper.cpp
js/src/xpconnect/wrappers/WrapperFactory.cpp
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -42,17 +42,17 @@
 #define jscntxt_h___
 /*
  * JS execution context.
  */
 #include <string.h>
 
 /* Gross special case for Gecko, which defines malloc/calloc/free. */
 #ifdef mozilla_mozalloc_macro_wrappers_h
-#  define JS_UNDEFD_MOZALLOC_WRAPPERS
+#  define JS_CNTXT_UNDEFD_MOZALLOC_WRAPPERS
 /* The "anti-header" */
 #  include "mozilla/mozalloc_undef_macro_wrappers.h"
 #endif
 
 #include "jsprvtd.h"
 #include "jsarena.h"
 #include "jsclist.h"
 #include "jslong.h"
@@ -3387,13 +3387,13 @@ NewIdArray(JSContext *cx, jsint length);
 
 } /* namespace js */
 
 #ifdef _MSC_VER
 #pragma warning(pop)
 #pragma warning(pop)
 #endif
 
-#ifdef JS_UNDEFD_MOZALLOC_WRAPPERS
+#ifdef JS_CNTXT_UNDEFD_MOZALLOC_WRAPPERS
 #  include "mozilla/mozalloc_macro_wrappers.h"
 #endif
 
 #endif /* jscntxt_h___ */
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -34,16 +34,24 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef jsgc_h___
 #define jsgc_h___
+
+/* Gross special case for Gecko, which defines malloc/calloc/free. */
+#ifdef mozilla_mozalloc_macro_wrappers_h
+#  define JS_GC_UNDEFD_MOZALLOC_WRAPPERS
+/* The "anti-header" */
+#  include "mozilla/mozalloc_undef_macro_wrappers.h"
+#endif
+
 /*
  * JS Garbage Collector.
  */
 #include <setjmp.h>
 
 #include "jstypes.h"
 #include "jsprvtd.h"
 #include "jspubtd.h"
@@ -1081,9 +1089,13 @@ NewCompartment(JSContext *cx, JSPrincipa
 } /* namespace gc */
 
 inline JSCompartment *
 JSObject::getCompartment() const
 {
     return compartment();
 }
 
+#ifdef JS_GC_UNDEFD_MOZALLOC_WRAPPERS
+#  include "mozilla/mozalloc_macro_wrappers.h"
+#endif
+
 #endif /* jsgc_h___ */
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -35,16 +35,24 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef jsobj_h___
 #define jsobj_h___
+
+/* Gross special case for Gecko, which defines malloc/calloc/free. */
+#ifdef mozilla_mozalloc_macro_wrappers_h
+#  define JS_OBJ_UNDEFD_MOZALLOC_WRAPPERS
+/* The "anti-header" */
+#  include "mozilla/mozalloc_undef_macro_wrappers.h"
+#endif
+
 /*
  * JS object definitions.
  *
  * A JS object consists of a possibly-shared object descriptor containing
  * ordered property names, called the map; and a dense vector of property
  * values, called slots.  The map/slot pointer pair is GC'ed, while the map
  * is reference counted and the slot vector is malloc'ed.
  */
@@ -1872,9 +1880,14 @@ enum EvalType { INDIRECT_EVAL, DIRECT_EV
 extern bool
 EvalKernel(JSContext *cx, uintN argc, js::Value *vp, EvalType evalType, JSStackFrame *caller,
            JSObject *scopeobj);
 
 extern JS_FRIEND_API(bool)
 IsBuiltinEvalFunction(JSFunction *fun);
 
 }
+
+#ifdef JS_OBJ_UNDEFD_MOZALLOC_WRAPPERS
+#  include "mozilla/mozalloc_macro_wrappers.h"
+#endif
+
 #endif /* jsobj_h___ */
--- a/js/src/xpconnect/src/nsXPConnect.cpp
+++ b/js/src/xpconnect/src/nsXPConnect.cpp
@@ -965,17 +965,17 @@ CreateNewCompartment(JSContext *cx, JSCl
     JSObject *tempGlobal = JS_NewCompartmentAndGlobalObject(cx, clasp, principals);
     if(principals)
         JSPRINCIPALS_DROP(cx, principals);
 
     if(!tempGlobal)
         return false;
 
     *global = tempGlobal;
-    *compartment = tempGlobal->getCompartment();
+    *compartment = tempGlobal->compartment();
 
     js::SwitchToCompartment sc(cx, *compartment);
     JS_SetCompartmentPrivate(cx, *compartment, priv_holder.forget());
     return true;
 }
 
 nsresult
 xpc_CreateGlobalObject(JSContext *cx, JSClass *clasp,
--- a/js/src/xpconnect/src/xpccomponents.cpp
+++ b/js/src/xpconnect/src/xpccomponents.cpp
@@ -3752,17 +3752,17 @@ xpc_EvalInSandbox(JSContext *cx, JSObjec
             JSAutoRequest req(cx);
             JSAutoEnterCompartment ac;
             if (str) {
                 v = STRING_TO_JSVAL(str);
             }
 
             xpc::CompartmentPrivate *sandboxdata =
                 static_cast<xpc::CompartmentPrivate *>
-                           (JS_GetCompartmentPrivate(cx, sandbox->getCompartment()));
+                           (JS_GetCompartmentPrivate(cx, sandbox->compartment()));
             if (!ac.enter(cx, callingScope) ||
                 !WrapForSandbox(cx, sandboxdata->wantXrays, &v)) {
                 rv = NS_ERROR_FAILURE;
             }
 
             if (NS_SUCCEEDED(rv)) {
                 *rval = v;
             }
--- a/js/src/xpconnect/src/xpcconvert.cpp
+++ b/js/src/xpconnect/src/xpcconvert.cpp
@@ -1416,17 +1416,17 @@ XPCConvert::NativeInterface2JSObject(XPC
             }
 
             flat = sowWrapper;
         }
         else
         {
             OBJ_TO_OUTER_OBJECT(cx, flat);
             NS_ASSERTION(flat, "bad outer object hook!");
-            NS_ASSERTION(flat->getCompartment() == cx->compartment,
+            NS_ASSERTION(flat->compartment() == cx->compartment,
                          "bad compartment");
         }
     }
 
     *d = OBJECT_TO_JSVAL(flat);
 
     if(dest)
     {
--- a/js/src/xpconnect/src/xpcpublic.h
+++ b/js/src/xpconnect/src/xpcpublic.h
@@ -112,17 +112,17 @@ inline JSObject*
 xpc_GetCachedSlimWrapper(nsWrapperCache *cache, JSObject *scope, jsval *vp)
 {
     if (cache) {
         JSObject* wrapper = cache->GetWrapper();
         // FIXME: Bug 585786, the check for IS_SLIM_WRAPPER_OBJECT should go
         //        away
         if (wrapper &&
             IS_SLIM_WRAPPER_OBJECT(wrapper) &&
-            wrapper->getCompartment() == scope->getCompartment()) {
+            wrapper->compartment() == scope->getCompartment()) {
             *vp = OBJECT_TO_JSVAL(wrapper);
 
             return wrapper;
         }
     }
 
     return nsnull;
 }
--- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp
+++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp
@@ -255,17 +255,17 @@ nsXPCWrappedJSClass::CallQueryInterfaceO
     if(!ac.enter(cx, jsobj))
         return nsnull;
 
     // Don't call the actual function on a content object. We'll determine
     // whether or not a content object is capable of implementing the
     // interface (i.e. whether the interface is scriptable) and most content
     // objects don't have QI implementations anyway. Also see bug 503926.
     if(XPCPerThreadData::IsMainThread(ccx) &&
-       !xpc::AccessCheck::isChrome(jsobj->getCompartment()))
+       !xpc::AccessCheck::isChrome(jsobj->compartment()))
     {
         return nsnull;
     }
 
     // check upfront for the existence of the function property
     funid = mRuntime->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE);
     if(!JS_GetPropertyById(cx, jsobj, funid, &fun) || JSVAL_IS_PRIMITIVE(fun))
         return nsnull;
@@ -1332,17 +1332,17 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra
 
     if(XPCPerThreadData::IsMainThread(ccx))
     {
         // TODO Remove me in favor of security wrappers.
         nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager();
         if(ssm)
         {
             nsIPrincipal *objPrincipal =
-                xpc::AccessCheck::getPrincipal(obj->getCompartment());
+                xpc::AccessCheck::getPrincipal(obj->compartment());
             if(objPrincipal)
             {
                 JSStackFrame* fp = nsnull;
                 nsresult rv =
                     ssm->PushContextPrincipal(ccx, JS_FrameIterator(ccx, &fp),
                                               objPrincipal);
                 if(NS_FAILED(rv))
                 {
--- a/js/src/xpconnect/wrappers/CrossOriginWrapper.cpp
+++ b/js/src/xpconnect/wrappers/CrossOriginWrapper.cpp
@@ -102,17 +102,17 @@ CrossOriginWrapper::construct(JSContext 
 bool
 CrossOriginWrapper::enter(JSContext *cx, JSObject *wrapper, jsid id, Action act)
 {
     nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager();
     if (!ssm) {
         return true;
     }
     JSStackFrame *fp = NULL;
-    nsIPrincipal *principal = GetCompartmentPrincipal(wrappedObject(wrapper)->getCompartment());
+    nsIPrincipal *principal = GetCompartmentPrincipal(wrappedObject(wrapper)->compartment());
     nsresult rv = ssm->PushContextPrincipal(cx, JS_FrameIterator(cx, &fp), principal);
     if (NS_FAILED(rv)) {
         NS_WARNING("Not allowing call because we're out of memory");
         JS_ReportOutOfMemory(cx);
         return false;
     }
     return true;
 }
--- a/js/src/xpconnect/wrappers/WrapperFactory.cpp
+++ b/js/src/xpconnect/wrappers/WrapperFactory.cpp
@@ -185,17 +185,17 @@ WrapperFactory::PrepareForWrapping(JSCon
         nsresult rv = wn->GetScriptableInfo()->GetCallback()->
             PreCreate(wn->Native(), cx, scope, &scope);
         NS_ENSURE_SUCCESS(rv, DoubleWrap(cx, obj, flags));
 
         // If the handed back scope differs from the passed-in scope and is in
         // a separate compartment, then this object is explicitly requesting
         // that we don't create a second JS object for it: create a security
         // wrapper.
-        if (originalScope->getCompartment() != scope->getCompartment())
+        if (originalScope->compartment() != scope->getCompartment())
             return DoubleWrap(cx, obj, flags);
 
         // Note: this penalizes objects that only have one wrapper, but are
         // being accessed across compartments. We would really prefer to
         // replace the above code with a test that says "do you only have one
         // wrapper?"
     }
 
@@ -232,17 +232,17 @@ WrapperFactory::Rewrap(JSContext *cx, JS
 {
     NS_ASSERTION(!obj->isWrapper() ||
                  (obj->isWrapper() &&
                   obj->getProxyHandler() == &WaiveXrayWrapperWrapper) ||
                  obj->getClass()->ext.innerObject,
                  "wrapped object passed to rewrap");
     NS_ASSERTION(JS_GET_CLASS(cx, obj) != &XrayUtils::HolderClass, "trying to wrap a holder");
 
-    JSCompartment *origin = obj->getCompartment();
+    JSCompartment *origin = obj->compartment();
     JSCompartment *target = cx->compartment;
     JSObject *xrayHolder = nsnull;
 
     JSWrapper *wrapper;
     CompartmentPrivate *targetdata = static_cast<CompartmentPrivate *>(target->data);
     if (AccessCheck::isChrome(target)) {
         if (AccessCheck::isChrome(origin)) {
             wrapper = &JSCrossCompartmentWrapper::singleton;