Bug 714353 - Remove nsIXPCScriptable::Trace (r=mrbkap)
authorBill McCloskey <wmccloskey@mozilla.com>
Wed, 04 Jan 2012 14:13:15 -0800
changeset 85037 99d43af273a8d2560d63896488252775be639c53
parent 85036 922ff16773a27801b5412db73c453b914313cc8a
child 85038 1dc627b6158d0ecbc231dab918df24d941a9d772
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs714353
milestone12.0a1
Bug 714353 - Remove nsIXPCScriptable::Trace (r=mrbkap)
dom/base/nsDOMClassInfo.cpp
js/xpconnect/idl/nsIXPCScriptable.idl
js/xpconnect/public/xpc_map_end.h
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/xpcprivate.h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -4679,25 +4679,16 @@ nsDOMClassInfo::HasInstance(nsIXPConnect
                             bool *_retval)
 {
   NS_WARNING("nsDOMClassInfo::HasInstance Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
-nsDOMClassInfo::Trace(nsIXPConnectWrappedNative *wrapper, JSTracer *trc,
-                      JSObject *obj)
-{
-  NS_WARNING("nsDOMClassInfo::Trace Don't call me!");
-
-  return NS_ERROR_UNEXPECTED;
-}
-
-NS_IMETHODIMP
 nsDOMClassInfo::Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
                          JSObject * obj, const jsval &val, bool *bp)
 {
   NS_WARNING("nsDOMClassInfo::Equality Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
--- a/js/xpconnect/idl/nsIXPCScriptable.idl
+++ b/js/xpconnect/idl/nsIXPCScriptable.idl
@@ -36,18 +36,16 @@
  * 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 ***** */
 
 #include "nsISupports.idl"
 #include "nsIXPConnect.idl"
 
-[ptr] native JSTracerPtr(JSTracer);
-
 %{ C++
 #define NS_SUCCESS_I_DID_SOMETHING \
    (NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCONNECT,1))
 
 /**
  * Classes that want to only be touched by chrome (or from code whose filename
  * begins with chrome://global/) shoudl return this from their scriptable
  * helper's PreCreate hook.
@@ -68,17 +66,17 @@
 
 /**
  * Note: This is not really an XPCOM interface.  For example, callers must
  * guarantee that they set the *_retval of the various methods that return a
  * boolean to PR_TRUE before making the call.  Implementations may skip writing
  * to *_retval unless they want to return PR_FALSE.
  */
 
-[uuid(a40ce52e-2d8c-400f-9af2-f8784a656070)]
+[uuid(fca22e1e-a2bf-456e-83db-f73e8de0f7c5)]
 interface nsIXPCScriptable : nsISupports
 {
     /* bitflags used for 'flags' (only 32 bits available!) */
 
     const PRUint32 WANT_PRECREATE                   = 1 <<  0;
     const PRUint32 WANT_CREATE                      = 1 <<  1;
     const PRUint32 WANT_POSTCREATE                  = 1 <<  2;
     const PRUint32 WANT_ADDPROPERTY                 = 1 <<  3;
@@ -89,17 +87,16 @@ interface nsIXPCScriptable : nsISupports
     const PRUint32 WANT_NEWENUMERATE                = 1 <<  8;
     const PRUint32 WANT_NEWRESOLVE                  = 1 <<  9;
     const PRUint32 WANT_CONVERT                     = 1 << 10;
     const PRUint32 WANT_FINALIZE                    = 1 << 11;
     const PRUint32 WANT_CHECKACCESS                 = 1 << 12;
     const PRUint32 WANT_CALL                        = 1 << 13;
     const PRUint32 WANT_CONSTRUCT                   = 1 << 14;
     const PRUint32 WANT_HASINSTANCE                 = 1 << 15;
-    const PRUint32 WANT_TRACE                       = 1 << 16;
     const PRUint32 USE_JSSTUB_FOR_ADDPROPERTY       = 1 << 17;
     const PRUint32 USE_JSSTUB_FOR_DELPROPERTY       = 1 << 18;
     const PRUint32 USE_JSSTUB_FOR_SETPROPERTY       = 1 << 19;
     const PRUint32 DONT_ENUM_STATIC_PROPS           = 1 << 20;
     const PRUint32 DONT_ENUM_QUERY_INTERFACE        = 1 << 21;
     const PRUint32 DONT_ASK_INSTANCE_FOR_SCRIPTABLE = 1 << 22;
     const PRUint32 CLASSINFO_INTERFACES_ONLY        = 1 << 23;
     const PRUint32 ALLOW_PROP_MODS_DURING_RESOLVE   = 1 << 24;
@@ -176,19 +173,16 @@ interface nsIXPCScriptable : nsISupports
     boolean construct(in nsIXPConnectWrappedNative wrapper,
                      in JSContextPtr cx, in JSObjectPtr obj,
                      in PRUint32 argc, in JSValPtr argv, in JSValPtr vp);
 
     boolean hasInstance(in nsIXPConnectWrappedNative wrapper,
                        in JSContextPtr cx, in JSObjectPtr obj,
                        in jsval val, out boolean bp);
 
-    void trace(in nsIXPConnectWrappedNative wrapper,
-               in JSTracerPtr trc, in JSObjectPtr obj);
-
     boolean equality(in nsIXPConnectWrappedNative wrapper,
                     in JSContextPtr cx, in JSObjectPtr obj, in jsval val);
 
     JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper,
                             in JSContextPtr cx, in JSObjectPtr obj);
 
     void postCreatePrototype(in JSContextPtr cx, in JSObjectPtr proto);
 };
--- a/js/xpconnect/public/xpc_map_end.h
+++ b/js/xpconnect/public/xpc_map_end.h
@@ -104,19 +104,16 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::GetScri
     nsIXPCScriptable::WANT_CALL |
 #endif
 #ifdef XPC_MAP_WANT_CONSTRUCT
     nsIXPCScriptable::WANT_CONSTRUCT |
 #endif
 #ifdef XPC_MAP_WANT_HASINSTANCE
     nsIXPCScriptable::WANT_HASINSTANCE |
 #endif
-#ifdef XPC_MAP_WANT_TRACE
-    nsIXPCScriptable::WANT_TRACE |
-#endif
 #ifdef XPC_MAP_WANT_EQUALITY
     nsIXPCScriptable::WANT_EQUALITY |
 #endif
 #ifdef XPC_MAP_WANT_OUTER_OBJECT
     nsIXPCScriptable::WANT_OUTER_OBJECT |
 #endif
 #ifdef XPC_MAP_FLAGS
     XPC_MAP_FLAGS |
@@ -203,21 +200,16 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::Constru
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_HASINSTANCE
 NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, const jsval &val, bool *bp, bool *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
-#ifndef XPC_MAP_WANT_TRACE
-NS_IMETHODIMP XPC_MAP_CLASSNAME::Trace(nsIXPConnectWrappedNative *wrapper, JSTracer *trc, JSObject * obj)
-    {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
-#endif
-
 #ifndef XPC_MAP_WANT_EQUALITY
 NS_IMETHODIMP XPC_MAP_CLASSNAME::Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, const jsval &val, bool *bp)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
 #endif
 
 #ifndef XPC_MAP_WANT_OUTER_OBJECT
 NS_IMETHODIMP XPC_MAP_CLASSNAME::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, JSObject * *_retval)
     {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
@@ -292,20 +284,16 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCre
 #ifdef XPC_MAP_WANT_CONSTRUCT
 #undef XPC_MAP_WANT_CONSTRUCT
 #endif
 
 #ifdef XPC_MAP_WANT_HASINSTANCE
 #undef XPC_MAP_WANT_HASINSTANCE
 #endif
 
-#ifdef XPC_MAP_WANT_TRACE
-#undef XPC_MAP_WANT_TRACE
-#endif
-
 #ifdef XPC_MAP_WANT_EQUALITY
 #undef XPC_MAP_WANT_EQUALITY
 #endif
 
 #ifdef XPC_MAP_WANT_OUTER_OBJECT
 #undef XPC_MAP_WANT_OUTER_OBJECT
 #endif
 
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -683,40 +683,37 @@ TraceForValidWrapper(JSTracer *trc, XPCW
     // need to use the JSClass. So, some marking is required for protection.
 
     wrapper->TraceJS(trc);
 
     TraceScopeJSObjects(trc, wrapper->GetScope());
 }
 
 static void
-MarkWrappedNative(JSTracer *trc, JSObject *obj, bool helper)
+MarkWrappedNative(JSTracer *trc, JSObject *obj)
 {
     JSObject *obj2;
 
     // Pass null for the first JSContext* parameter  to skip any security
     // checks and to avoid potential state change there.
     XPCWrappedNative* wrapper =
         XPCWrappedNative::GetWrappedNativeOfJSObject(nsnull, obj, nsnull, &obj2);
 
     if (wrapper) {
-        if (wrapper->IsValid()) {
-            if (helper)
-                wrapper->GetScriptableCallback()->Trace(wrapper, trc, obj);
+        if (wrapper->IsValid())
              TraceForValidWrapper(trc, wrapper);
-        }
     } else if (obj2) {
         GetSlimWrapperProto(obj2)->TraceJS(trc);
     }
 }
 
 static void
-XPC_WN_Shared_Trace(JSTracer *trc, JSObject *obj)
+XPC_WN_NoHelper_Trace(JSTracer *trc, JSObject *obj)
 {
-    MarkWrappedNative(trc, obj, false);
+    MarkWrappedNative(trc, obj);
 }
 
 static JSBool
 XPC_WN_NoHelper_Resolve(JSContext *cx, JSObject *obj, jsid id)
 {
     MORPH_SLIM_WRAPPER(cx, obj);
     XPCCallContext ccx(JS_CALLER, cx, obj, nsnull, id);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
@@ -835,17 +832,17 @@ js::Class XPC_WN_NoHelper_JSClass = {
 
     /* Optionally non-null members start here. */
     nsnull,                         // reserved0
     nsnull,                         // checkAccess
     nsnull,                         // call
     nsnull,                         // construct
     nsnull,                         // xdrObject;
     nsnull,                         // hasInstance
-    XPC_WN_Shared_Trace,            // trace
+    XPC_WN_NoHelper_Trace,          // trace
 
     // ClassExtension
     {
         XPC_WN_Equality,
         nsnull, // outerObject
         nsnull, // innerObject
         nsnull, // iteratorObject
         nsnull, // unused
@@ -1060,22 +1057,16 @@ XPC_WN_Helper_Finalize(JSContext *cx, JS
 
     XPCWrappedNative* wrapper = (XPCWrappedNative*)p;
     if (!wrapper)
         return;
     wrapper->GetScriptableCallback()->Finalize(wrapper, cx, obj);
     wrapper->FlatJSObjectFinalized(cx);
 }
 
-static void
-XPC_WN_Helper_Trace(JSTracer *trc, JSObject *obj)
-{
-    MarkWrappedNative(trc, obj, true);
-}
-
 static JSBool
 XPC_WN_Helper_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
                          JSObject **objp)
 {
     nsresult rv = NS_OK;
     bool retval = true;
     JSObject* obj2FromScriptable = nsnull;
     if (IS_SLIM_WRAPPER(obj)) {
@@ -1496,20 +1487,17 @@ XPCNativeScriptableShared::PopulateJSCla
         mJSClass.base.ext.equality = nsnull;
     } else {
         mJSClass.base.ext.equality = XPC_WN_Equality;
     }
 
     if (mFlags.WantHasInstance())
         mJSClass.base.hasInstance = XPC_WN_Helper_HasInstance;
 
-    if (mFlags.WantTrace())
-        mJSClass.base.trace = XPC_WN_Helper_Trace;
-    else
-        mJSClass.base.trace = XPC_WN_Shared_Trace;
+    mJSClass.base.trace = XPC_WN_NoHelper_Trace;
 
     if (mFlags.WantOuterObject())
         mJSClass.base.ext.outerObject = XPC_WN_OuterObject;
 
     if (!(mFlags & nsIXPCScriptable::WANT_OUTER_OBJECT))
         mCanBeSlim = true;
 
     mJSClass.base.ext.isWrappedNative = true;
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -2008,17 +2008,16 @@ public:
     JSBool WantNewEnumerate()             GET_IT(WANT_NEWENUMERATE)
     JSBool WantNewResolve()               GET_IT(WANT_NEWRESOLVE)
     JSBool WantConvert()                  GET_IT(WANT_CONVERT)
     JSBool WantFinalize()                 GET_IT(WANT_FINALIZE)
     JSBool WantCheckAccess()              GET_IT(WANT_CHECKACCESS)
     JSBool WantCall()                     GET_IT(WANT_CALL)
     JSBool WantConstruct()                GET_IT(WANT_CONSTRUCT)
     JSBool WantHasInstance()              GET_IT(WANT_HASINSTANCE)
-    JSBool WantTrace()                    GET_IT(WANT_TRACE)
     JSBool WantEquality()                 GET_IT(WANT_EQUALITY)
     JSBool WantOuterObject()              GET_IT(WANT_OUTER_OBJECT)
     JSBool UseJSStubForAddProperty()      GET_IT(USE_JSSTUB_FOR_ADDPROPERTY)
     JSBool UseJSStubForDelProperty()      GET_IT(USE_JSSTUB_FOR_DELPROPERTY)
     JSBool UseJSStubForSetProperty()      GET_IT(USE_JSSTUB_FOR_SETPROPERTY)
     JSBool DontEnumStaticProps()          GET_IT(DONT_ENUM_STATIC_PROPS)
     JSBool DontEnumQueryInterface()       GET_IT(DONT_ENUM_QUERY_INTERFACE)
     JSBool DontAskInstanceForScriptable() GET_IT(DONT_ASK_INSTANCE_FOR_SCRIPTABLE)