Don't include JS-engine internal header files in header files outside the JS engine (bug 549440, r=jst).
authorAndreas Gal <gal@mozilla.com>
Thu, 04 Mar 2010 16:17:05 -0800
changeset 39924 1859f8c3cab7040e95f0e890a075f1455250d64f
parent 39923 a9a2c087926375634613a85b3acb57013cdf53a7
child 39925 ddf8ebbf37fb698639909b337a2b98887613f108
push id12462
push userrsayre@mozilla.com
push dateFri, 26 Mar 2010 22:57:33 +0000
treeherdermozilla-central@03136ff6b1a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs549440
milestone1.9.3a2pre
Don't include JS-engine internal header files in header files outside the JS engine (bug 549440, r=jst).
content/base/public/nsContentUtils.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/src/json/nsJSON.h
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -42,17 +42,16 @@
 #ifndef nsContentUtils_h___
 #define nsContentUtils_h___
 
 #include <math.h>
 #if defined(XP_WIN) || defined(XP_OS2)
 #include <float.h>
 #endif
 
-#include "jsprvtd.h"
 #include "nsAString.h"
 #include "nsIStatefulFrame.h"
 #include "nsINodeInfo.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentList.h"
 #include "nsDOMClassInfoID.h"
 #include "nsIClassInfo.h"
 #include "nsIDOM3Node.h"
@@ -60,16 +59,18 @@
 #include "nsIScriptRuntime.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIDOMEvent.h"
 #include "nsTArray.h"
 #include "nsTextFragment.h"
 #include "nsReadableUtils.h"
 #include "nsIPrefBranch2.h"
 
+#include "jsapi.h"
+
 struct nsNativeKeyEvent; // Don't include nsINativeKeyBindings.h here: it will force strange compilation error!
 
 class nsIDOMScriptObjectFactory;
 class nsIXPConnect;
 class nsINode;
 class nsIContent;
 class nsIDOMNode;
 class nsIDOMKeyEvent;
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -61,16 +61,17 @@
 #include "nsCSSValue.h"
 #include "nsIRunnable.h"
 #include "nsThreadUtils.h"
 
 // JavaScript includes
 #include "jsapi.h"
 #include "jsprvtd.h"    // we are using private JS typedefs...
 #include "jscntxt.h"
+#include "jsobj.h"
 #include "jsdbgapi.h"
 
 // General helper includes
 #include "nsGlobalWindow.h"
 #include "nsIContent.h"
 #include "nsIAttribute.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
@@ -1559,16 +1560,23 @@ GetInternedJSVal(JSContext *cx, const ch
   if (!s) {
     return JSVAL_VOID;
   }
 
   return STRING_TO_JSVAL(s);
 }
 
 // static
+
+nsISupports *
+nsDOMClassInfo::GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj)
+{
+  return wrapper ? wrapper->Native() : static_cast<nsISupports*>(obj->getPrivate());
+}
+
 nsresult
 nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
 {
 #define SET_JSVAL_TO_STRING(_val, _cx, _str)                                  \
   _val = GetInternedJSVal(_cx, _str);                                         \
   if (!JSVAL_IS_STRING(_val)) {                                               \
     return NS_ERROR_OUT_OF_MEMORY;                                            \
   }
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -38,17 +38,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsDOMClassInfo_h___
 #define nsDOMClassInfo_h___
 
 #include "nsIDOMClassInfo.h"
 #include "nsIXPCScriptable.h"
 #include "jsapi.h"
-#include "jsobj.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIScriptContext.h"
 #include "nsDOMJSUtils.h" // for GetScriptContextFromJSContext
 #include "nsIScriptGlobalObject.h"
 #include "nsContentUtils.h"
 
 class nsIDOMWindow;
 class nsIDOMNSHTMLOptionCollection;
@@ -201,22 +200,17 @@ public:
 #endif
 
     return sXPCNativeWrapperClass &&
       ::JS_GET_CLASS(cx, obj) == sXPCNativeWrapperClass;
   }
 
   static void PreserveNodeWrapper(nsIXPConnectWrappedNative *aWrapper);
 
-  static inline nsISupports *GetNative(nsIXPConnectWrappedNative *wrapper,
-                                       JSObject *obj)
-  {
-    return wrapper ? wrapper->Native() :
-                     static_cast<nsISupports*>(obj->getPrivate());
-  }
+  static nsISupports *GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj);
 
   static nsIXPConnect *XPConnect()
   {
     return sXPConnect;
   }
 
 protected:
   friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
--- a/dom/src/json/nsJSON.h
+++ b/dom/src/json/nsJSON.h
@@ -34,17 +34,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 ***** */
 
 #ifndef nsJSON_h__
 #define nsJSON_h__
 
-#include "jsprvtd.h"
 #include "jsapi.h"
 #include "nsIJSON.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIOutputStream.h"
 #include "nsIUnicodeEncoder.h"
 #include "nsIUnicodeDecoder.h"
 #include "nsIRequestObserver.h"