Bug 913851 - Minimize the #includes in js/xpconnect; r=bholley
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 09 Sep 2013 23:14:10 +0200
changeset 146398 77cd72a836e60548db0ae4013fca6786f5ac8c8f
parent 146397 32e968bcba07e2296ea6ab9f9a7c20a939f5b025
child 146399 6776e4836c045ca1dc9125a0b815436f71a67470
push id25260
push userryanvm@gmail.com
push dateWed, 11 Sep 2013 00:29:30 +0000
treeherdermozilla-central@f73bed2856a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs913851
milestone26.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
Bug 913851 - Minimize the #includes in js/xpconnect; r=bholley X-Git-Commit-ID: 78e6843063b303780a7dd2695dd2824a0a9c9a3c
dom/system/OSFileConstants.cpp
js/xpconnect/idl/xpcIJSModuleLoader.idl
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/loader/mozJSComponentLoader.h
js/xpconnect/loader/mozJSLoaderUtils.cpp
js/xpconnect/loader/mozJSSubScriptLoader.cpp
js/xpconnect/loader/mozJSSubScriptLoader.h
js/xpconnect/shell/xpcshell.cpp
js/xpconnect/shell/xpcshellMacUtils.mm
js/xpconnect/src/BackstagePass.h
js/xpconnect/src/Sandbox.cpp
js/xpconnect/src/XPCCallContext.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCJSContextStack.cpp
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCLocale.cpp
js/xpconnect/src/XPCLog.cpp
js/xpconnect/src/XPCLog.h
js/xpconnect/src/XPCQuickStubs.cpp
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/XPCRuntimeService.cpp
js/xpconnect/src/XPCString.cpp
js/xpconnect/src/XPCThrower.cpp
js/xpconnect/src/XPCVariant.cpp
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/XPCWrapper.cpp
js/xpconnect/src/XPCWrapper.h
js/xpconnect/src/dictionary_helper_gen.conf
js/xpconnect/src/dictionary_helper_gen.py
js/xpconnect/src/dom_quickstubs.qsconf
js/xpconnect/src/event_impl_gen.py
js/xpconnect/src/nsCxPusher.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/qsgen.py
js/xpconnect/tests/components/native/xpctest_module.cpp
js/xpconnect/wrappers/AccessCheck.cpp
js/xpconnect/wrappers/ChromeObjectWrapper.h
js/xpconnect/wrappers/FilteringWrapper.cpp
js/xpconnect/wrappers/WaiveXrayWrapper.cpp
js/xpconnect/wrappers/XrayWrapper.cpp
js/xpconnect/wrappers/XrayWrapper.h
layout/build/nsLayoutModule.cpp
toolkit/components/ctypes/ctypes.cpp
toolkit/components/perf/PerfMeasurement.cpp
--- a/dom/system/OSFileConstants.cpp
+++ b/dom/system/OSFileConstants.cpp
@@ -39,16 +39,17 @@
 #include "nsString.h"
 #include "nsAutoPtr.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "mozJSComponentLoader.h"
 
 #include "OSFileConstants.h"
 #include "nsIOSFileConstantsService.h"
+#include "nsZipArchive.h"
 
 #if defined(__DragonFly__) || defined(__FreeBSD__) \
   || defined(__NetBSD__) || defined(__OpenBSD__)
 #define __dd_fd dd_fd
 #endif
 
 /**
  * This module defines the basic libc constants (error numbers, open modes,
--- a/js/xpconnect/idl/xpcIJSModuleLoader.idl
+++ b/js/xpconnect/idl/xpcIJSModuleLoader.idl
@@ -4,16 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 [ptr] native nsAXPCNativeCallContextPtr(nsAXPCNativeCallContext);
 
 %{C++
 #include "js/TypeDecls.h"
+
+class nsAXPCNativeCallContext;
 %}
 
 [ptr] native JSObjectPtr(JSObject);
 
 [scriptable, uuid(243d1a31-db9f-47a1-9922-55a1ad5515fb)]
 interface xpcIJSModuleLoader : nsISupports
 {
   /**
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -18,57 +18,40 @@
 #endif
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 #include "jsapi.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
-#include "nsICategoryManager.h"
 #include "nsIComponentManager.h"
 #include "mozilla/Module.h"
 #include "nsIFile.h"
-#include "nsIServiceManager.h"
-#include "nsISupports.h"
 #include "mozJSComponentLoader.h"
 #include "mozJSLoaderUtils.h"
 #include "nsIJSRuntimeService.h"
 #include "nsIXPConnect.h"
-#include "nsCRT.h"
-#include "nsMemory.h"
 #include "nsIObserverService.h"
-#include "nsIXPCScriptable.h"
-#include "nsString.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIURI.h"
 #include "nsIFileURL.h"
 #include "nsIJARURI.h"
 #include "nsNetUtil.h"
 #include "nsDOMBlobBuilder.h"
 #include "jsprf.h"
 #include "nsJSPrincipals.h"
-// For reporting errors with the console service
-#include "nsIScriptError.h"
-#include "nsIConsoleService.h"
-#include "nsIStorageStream.h"
-#include "nsIStringStream.h"
-#if defined(XP_WIN)
-#include "nsILocalFileWin.h"
-#endif
 #include "xpcprivate.h"
 #include "xpcpublic.h"
-#include "nsIResProtocolHandler.h"
 #include "nsContentUtils.h"
 #include "nsCxPusher.h"
 #include "WrapperFactory.h"
 
 #include "mozilla/scache/StartupCache.h"
 #include "mozilla/scache/StartupCacheUtils.h"
-#include "mozilla/Omnijar.h"
 #include "mozilla/Preferences.h"
 
 #include "js/OldDebugAPI.h"
 
 using namespace mozilla;
 using namespace mozilla::scache;
 using namespace xpc;
 using namespace JS;
--- a/js/xpconnect/loader/mozJSComponentLoader.h
+++ b/js/xpconnect/loader/mozJSComponentLoader.h
@@ -1,33 +1,29 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "plhash.h"
 #include "mozilla/ModuleLoader.h"
-#include "nsIJSRuntimeService.h"
 #include "nsISupports.h"
-#include "nsIXPConnect.h"
-#include "nsIFile.h"
-#include "nsAutoPtr.h"
-#include "nsIObjectInputStream.h"
-#include "nsIObjectOutputStream.h"
-#include "nsITimer.h"
 #include "nsIObserver.h"
 #include "xpcIJSModuleLoader.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
-#include "nsIPrincipal.h"
-#include "mozilla/scache/StartupCache.h"
+#include "jsapi.h"
 
 #include "xpcIJSGetFactory.h"
 
+class nsIFile;
+class nsIJSRuntimeService;
+class nsIPrincipal;
+class nsIXPConnectJSObjectHolder;
+
 /* 6bd13476-1dd2-11b2-bbef-f0ccb5fa64b6 (thanks, mozbot) */
 
 #define MOZJSCOMPONENTLOADER_CID                                              \
   {0x6bd13476, 0x1dd2, 0x11b2,                                                \
     { 0xbb, 0xef, 0xf0, 0xcc, 0xb5, 0xfa, 0x64, 0xb6 }}
 #define MOZJSCOMPONENTLOADER_CONTRACTID "@mozilla.org/moz/jsloader;1"
 
 class JSCLContextHelper;
--- a/js/xpconnect/loader/mozJSLoaderUtils.cpp
+++ b/js/xpconnect/loader/mozJSLoaderUtils.cpp
@@ -1,22 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAutoPtr.h"
-#include "nsScriptLoader.h"
 
 #include "jsapi.h"
 #include "js/OldDebugAPI.h"
 
 #include "nsJSPrincipals.h"
 
 #include "mozilla/scache/StartupCache.h"
-#include "mozilla/scache/StartupCacheUtils.h"
 
 using namespace mozilla::scache;
 
 // We only serialize scripts with system principals. So we don't serialize the
 // principals when writing a script. Instead, when reading it back, we set the
 // principals to the system principals.
 nsresult
 ReadCachedScript(StartupCache* cache, nsACString &uri, JSContext *cx,
--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp
+++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp
@@ -4,40 +4,34 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozJSSubScriptLoader.h"
 #include "mozJSComponentLoader.h"
 #include "mozJSLoaderUtils.h"
 
-#include "nsIServiceManager.h"
-#include "nsIXPConnect.h"
-
 #include "nsIURI.h"
 #include "nsIIOService.h"
 #include "nsIChannel.h"
 #include "nsIInputStream.h"
 #include "nsNetCID.h"
-#include "nsDependentString.h"
-#include "nsAutoPtr.h"
 #include "nsNetUtil.h"
-#include "nsIProtocolHandler.h"
 #include "nsIFileURL.h"
 #include "nsScriptLoader.h"
+#include "nsIScriptSecurityManager.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "js/OldDebugAPI.h"
 #include "nsJSPrincipals.h"
 #include "xpcpublic.h" // For xpc::SystemErrorReporter
 
 #include "mozilla/scache/StartupCache.h"
 #include "mozilla/scache/StartupCacheUtils.h"
-#include "mozilla/Preferences.h"
 
 using namespace mozilla::scache;
 using namespace JS;
 
 /* load() error msgs, XXX localize? */
 #define LOAD_ERROR_NOSERVICE "Error creating IO Service."
 #define LOAD_ERROR_NOURI "Error creating URI (invalid URL scheme?)"
 #define LOAD_ERROR_NOSCHEME "Failed to get URI scheme.  This is bad."
--- a/js/xpconnect/loader/mozJSSubScriptLoader.h
+++ b/js/xpconnect/loader/mozJSSubScriptLoader.h
@@ -1,17 +1,19 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsCOMPtr.h"
 #include "mozIJSSubScriptLoader.h"
-#include "nsIScriptSecurityManager.h"
+
+class nsIPrincipal;
+class nsIURI;
 
 #define MOZ_JSSUBSCRIPTLOADER_CID                                             \
 { /* 829814d6-1dd2-11b2-8e08-82fa0a339b00 */                                  \
     0x929814d6,                                                               \
     0x1dd2,                                                                   \
     0x11b2,                                                                   \
     {0x8e, 0x08, 0x82, 0xfa, 0x0a, 0x33, 0x9b, 0x00}                          \
 }
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -13,44 +13,33 @@
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "jsprf.h"
 #include "js/OldDebugAPI.h"
 #include "nsXULAppAPI.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
-#include "nsStringAPI.h"
 #include "nsIXPConnect.h"
-#include "nsIXPCScriptable.h"
-#include "nsIInterfaceInfo.h"
-#include "nsIInterfaceInfoManager.h"
 #include "nsIJSNativeInitializer.h"
-#include "nsIXPCScriptable.h"
 #include "nsIServiceManager.h"
-#include "nsIComponentManager.h"
-#include "nsIComponentRegistrar.h"
 #include "nsIFile.h"
 #include "nsStringAPI.h"
 #include "nsIDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nscore.h"
 #include "nsArrayEnumerator.h"
 #include "nsCOMArray.h"
 #include "nsDirectoryServiceUtils.h"
-#include "nsMemory.h"
-#include "nsISupportsImpl.h"
 #include "nsIJSRuntimeService.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
-#include "nsIXPCSecurityManager.h"
 #include "nsJSPrincipals.h"
 #include "xpcpublic.h"
-#include "nsXULAppAPI.h"
 #include "BackstagePass.h"
 #include "nsCxPusher.h"
 #ifdef XP_MACOSX
 #include "xpcshellMacUtils.h"
 #endif
 #ifdef XP_WIN
 #include <windows.h>
 #include <shlobj.h>
--- a/js/xpconnect/shell/xpcshellMacUtils.mm
+++ b/js/xpconnect/shell/xpcshellMacUtils.mm
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 sw=2 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "xpcshellMacUtils.h"
 #include <Foundation/Foundation.h>
 
 static NSAutoreleasePool *pool = NULL;
 
 void InitAutoreleasePool()
 {
   pool = [[NSAutoreleasePool alloc] init];
 }
--- a/js/xpconnect/src/BackstagePass.h
+++ b/js/xpconnect/src/BackstagePass.h
@@ -5,16 +5,17 @@
 
 #ifndef BackstagePass_h__
 #define BackstagePass_h__
 
 #include "nsISupports.h"
 #include "nsWeakReference.h"
 #include "nsIGlobalObject.h"
 #include "nsIScriptObjectPrincipal.h"
+#include "nsIXPCScriptable.h"
 
 class BackstagePass : public nsIGlobalObject,
                       public nsIScriptObjectPrincipal,
                       public nsIXPCScriptable,
                       public nsIClassInfo,
                       public nsSupportsWeakReference
 {
 public:
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -11,29 +11,25 @@
 #include "AccessCheck.h"
 #include "jsfriendapi.h"
 #include "jsproxy.h"
 #include "js/OldDebugAPI.h"
 #include "js/StructuredClone.h"
 #include "nsContentUtils.h"
 #include "nsCxPusher.h"
 #include "nsGlobalWindow.h"
-#include "nsIDOMWindow.h"
 #include "nsIScriptContext.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIURI.h"
-#include "nsJSEnvironment.h"
 #include "nsJSUtils.h"
 #include "nsNetUtil.h"
-#include "nsNullPrincipal.h"
 #include "nsPrincipal.h"
 #include "nsXMLHttpRequest.h"
 #include "WrapperFactory.h"
-#include "XPCJSWeakReference.h"
 #include "xpcprivate.h"
 #include "XPCQuickStubs.h"
 #include "XPCWrapper.h"
 #include "XrayWrapper.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/TextDecoderBinding.h"
 #include "mozilla/dom/TextEncoderBinding.h"
 
--- a/js/xpconnect/src/XPCCallContext.cpp
+++ b/js/xpconnect/src/XPCCallContext.cpp
@@ -2,20 +2,18 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Call context. */
 
-#include "mozilla/Util.h"
-#include "AccessCheck.h"
-
 #include "xpcprivate.h"
+#include "jswrapper.h"
 
 using namespace mozilla;
 using namespace xpc;
 using namespace JS;
 
 #define IS_TEAROFF_CLASS(clazz) ((clazz) == &XPC_WN_Tearoff_JSClass)
 
 XPCCallContext::XPCCallContext(XPCContext::LangType callerLanguage,
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -2,50 +2,31 @@
  * vim: set ts=8 sw=4 et tw=78:
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* The "Components" xpcom objects for JavaScript. */
 
-#include "mozilla/unused.h"
-
 #include "xpcprivate.h"
-#include "XPCQuickStubs.h"
-#include "nsReadableUtils.h"
 #include "xpcIJSModuleLoader.h"
-#include "nsIScriptObjectPrincipal.h"
-#include "nsIDOMWindow.h"
 #include "XPCJSWeakReference.h"
-#include "XPCWrapper.h"
-#include "jsproxy.h"
-#include "js/OldDebugAPI.h"
 #include "WrapperFactory.h"
-#include "XrayWrapper.h"
-#include "nsNullPrincipal.h"
 #include "nsJSUtils.h"
 #include "mozJSComponentLoader.h"
 #include "nsContentUtils.h"
-#include "nsCxPusher.h"
 #include "jsfriendapi.h"
-#include "AccessCheck.h"
-#include "mozilla/dom/BindingUtils.h"
-#include "mozilla/Preferences.h"
-#include "nsPrincipal.h"
 #include "mozilla/Attributes.h"
-#include "nsIScriptContext.h"
 #include "nsJSEnvironment.h"
-#include "nsXMLHttpRequest.h"
-#include "mozilla/Telemetry.h"
 #include "mozilla/XPTInterfaceInfoManager.h"
-#include "nsDOMClassInfoID.h"
-#include "nsGlobalWindow.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMExceptionBinding.h"
+#include "mozilla/dom/BindingUtils.h"
+#include "nsZipArchive.h"
 
 using namespace mozilla;
 using namespace JS;
 using namespace js;
 using namespace xpc;
 using mozilla::dom::Exception;
 
 /***************************************************************************/
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -5,22 +5,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Data conversion between native and JavaScript types. */
 
 #include "mozilla/Util.h"
 
 #include "xpcprivate.h"
-#include "nsString.h"
 #include "nsIAtom.h"
-#include "XPCWrapper.h"
-#include "nsJSPrincipals.h"
 #include "nsWrapperCache.h"
-#include "AccessCheck.h"
 #include "nsJSUtils.h"
 #include "WrapperFactory.h"
 
 #include "nsWrapperCacheInlines.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "jsprf.h"
--- a/js/xpconnect/src/XPCJSContextStack.cpp
+++ b/js/xpconnect/src/XPCJSContextStack.cpp
@@ -4,19 +4,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Implement global service to track stack of JSContext. */
 
 #include "xpcprivate.h"
 #include "XPCWrapper.h"
-#include "mozilla/Mutex.h"
 #include "nsDOMJSUtils.h"
-#include "nsIScriptGlobalObject.h"
 #include "nsNullPrincipal.h"
 #include "mozilla/dom/BindingUtils.h"
 
 using namespace mozilla;
 using namespace JS;
 using namespace xpc;
 using mozilla::dom::DestroyProtoAndIfaceCache;
 
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -4,17 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* An xpcom implementation of the JavaScript nsIID and nsCID objects. */
 
 #include "xpcprivate.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Attributes.h"
-#include "XPCWrapper.h"
 #include "JavaScriptParent.h"
 
 using namespace mozilla::dom;
 using namespace JS;
 
 /***************************************************************************/
 // nsJSID
 
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2,54 +2,51 @@
 /* vim: set ts=8 sts=4 et sw=4 tw=99: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Per JSRuntime object */
 
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/Util.h"
 
 #include "xpcprivate.h"
 #include "xpcpublic.h"
 #include "XPCJSMemoryReporter.h"
 #include "WrapperFactory.h"
 #include "dom_quickstubs.h"
 
 #include "nsIMemoryReporter.h"
 #include "nsIObserverService.h"
 #include "nsIDebug2.h"
 #include "amIAddonManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsPrintfCString.h"
-#include "prsystem.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Services.h"
 
 #include "nsContentUtils.h"
 #include "nsCxPusher.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsCycleCollectionNoteRootCallback.h"
 #include "nsScriptLoader.h"
 #include "jsfriendapi.h"
 #include "jsprf.h"
 #include "js/MemoryMetrics.h"
 #include "js/OldDebugAPI.h"
-#include "mozilla/dom/AtomList.h"
+#include "mozilla/dom/GeneratedAtomList.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/Attributes.h"
 #include "AccessCheck.h"
 #include "nsGlobalWindow.h"
 
 #include "GeckoProfiler.h"
 #include "nsJSPrincipals.h"
-#include <algorithm>
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 
 using namespace mozilla;
 using namespace xpc;
 using namespace JS;
--- a/js/xpconnect/src/XPCLocale.cpp
+++ b/js/xpconnect/src/XPCLocale.cpp
@@ -2,28 +2,27 @@
  * vim: sw=2 ts=8 et :
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Assertions.h"
 
-#include "plstr.h"
-
 #include "jsapi.h"
 
 #include "nsCollationCID.h"
 #include "nsJSUtils.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIPlatformCharset.h"
 #include "nsILocaleService.h"
 #include "nsICollation.h"
-#include "nsIServiceManager.h"
 #include "nsUnicharUtils.h"
+#include "nsComponentManagerUtils.h"
+#include "nsServiceManagerUtils.h"
 
 #include "xpcpublic.h"
 
 using namespace JS;
 
 /**
  * JS locale callbacks implemented by XPCOM modules.  These are theoretically
  * safe for use on multiple threads.  Unfortunately, the intl code underlying
--- a/js/xpconnect/src/XPCLog.cpp
+++ b/js/xpconnect/src/XPCLog.cpp
@@ -1,17 +1,23 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Debug Logging support. */
 
-#include "xpcprivate.h"
+#include "XPCLog.h"
+#include "prlog.h"
+#include "prprf.h"
+#include "mozilla/mozalloc.h"
+#include "mozilla/NullPtr.h"
+#include <string.h>
+#include <stdarg.h>
 
 // this all only works for DEBUG...
 #ifdef DEBUG
 
 #define SPACE_COUNT     200
 #define LINE_LEN        200
 #define INDENT_FACTOR   2
 
--- a/js/xpconnect/src/XPCLog.h
+++ b/js/xpconnect/src/XPCLog.h
@@ -4,18 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Debug Logging support. */
 
 #ifndef xpclog_h___
 #define xpclog_h___
 
-#include "nsIXPConnect.h"
-#include "prtypes.h"
 #include "prlog.h"
 
 /*
  * This uses prlog.h See prlog.h for environment settings for output.
  * The module name used here is 'xpclog'. These environment settings
  * should work...
  *
  * SET NSPR_LOG_MODULES=xpclog:5
--- a/js/xpconnect/src/XPCQuickStubs.cpp
+++ b/js/xpconnect/src/XPCQuickStubs.cpp
@@ -1,15 +1,13 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/Util.h"
-
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "jsprf.h"
 #include "nsCOMPtr.h"
 #include "xpcprivate.h"
 #include "XPCInlines.h"
 #include "XPCQuickStubs.h"
 #include "mozilla/dom/BindingUtils.h"
--- a/js/xpconnect/src/XPCQuickStubs.h
+++ b/js/xpconnect/src/XPCQuickStubs.h
@@ -2,26 +2,28 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef xpcquickstubs_h___
 #define xpcquickstubs_h___
 
-#include "xpcpublic.h"
 #include "XPCForwards.h"
-#include "qsObjectHelper.h"
-#include "mozilla/dom/BindingUtils.h"
+
+class qsObjectHelper;
+namespace mozilla {
+namespace dom {
+class NativeProperties;
+}
+}
 
 /* XPCQuickStubs.h - Support functions used only by quick stubs. */
 
 class XPCCallContext;
-class XPCLazyCallContext;
-class XPCWrappedNativeJSClass;
 
 #define XPC_QS_NULL_INDEX  ((uint16_t) -1)
 
 struct xpc_qsPropertySpec {
     uint16_t name_index;
     JSNative getter;
     JSNative setter;
 };
--- a/js/xpconnect/src/XPCRuntimeService.cpp
+++ b/js/xpconnect/src/XPCRuntimeService.cpp
@@ -1,19 +1,20 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "xpcprivate.h"
-
 #include "mozilla/dom/workers/Workers.h"
-#include "nsIScriptSecurityManager.h"
 #include "nsContentUtils.h"
+#include "BackstagePass.h"
+#include "nsIProgrammingLanguage.h"
+#include "nsDOMClassInfo.h"
+#include "nsIPrincipal.h"
 
 using mozilla::dom::workers::ResolveWorkerClasses;
 
 NS_INTERFACE_MAP_BEGIN(BackstagePass)
   NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
   NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
   NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
--- a/js/xpconnect/src/XPCString.cpp
+++ b/js/xpconnect/src/XPCString.cpp
@@ -13,18 +13,21 @@
  * reference to the buffer handle until the JSString is finalized.
  *
  * Exporting a JSString as an nsAReadable:
  * Wrap the JSString with a root-holding XPCJSReadableStringWrapper, which roots
  * the string and exposes its buffer via the nsAString interface, as
  * well as providing refcounting support.
  */
 
-#include "xpcprivate.h"
+#include "nscore.h"
+#include "nsStringGlue.h"
 #include "nsStringBuffer.h"
+#include "jsapi.h"
+#include "xpcpublic.h"
 
 // One-slot cache, because it turns out it's common for web pages to
 // get the same string a few times in a row.  We get about a 40% cache
 // hit rate on this cache last it was measured.  We'd get about 70%
 // hit rate with a hashtable with removal on finalization, but that
 // would take a lot more machinery.
 nsStringBuffer* XPCStringConvert::sCachedBuffer = nullptr;
 JSString* XPCStringConvert::sCachedString = nullptr;
--- a/js/xpconnect/src/XPCThrower.cpp
+++ b/js/xpconnect/src/XPCThrower.cpp
@@ -2,17 +2,16 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Code for throwing errors into JavaScript. */
 
 #include "xpcprivate.h"
-#include "xpcpublic.h"
 #include "XPCWrapper.h"
 #include "jsprf.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/Exceptions.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -2,21 +2,21 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* nsIVariant implementation for xpconnect. */
 
 #include "xpcprivate.h"
-#include "XPCWrapper.h"
 #include "nsCxPusher.h"
 
 #include "jsfriendapi.h"
 #include "jsprf.h"
+#include "jswrapper.h"
 
 using namespace JS;
 using namespace mozilla;
 
 NS_IMPL_CLASSINFO(XPCVariant, NULL, 0, XPCVARIANT_CID)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(XPCVariant)
   NS_INTERFACE_MAP_ENTRY(XPCVariant)
   NS_INTERFACE_MAP_ENTRY(nsIVariant)
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -7,17 +7,16 @@
 
 /* Sharable code and data for wrapper around JSObjects. */
 
 #include "xpcprivate.h"
 #include "jsprf.h"
 #include "nsArrayEnumerator.h"
 #include "nsContentUtils.h"
 #include "nsWrapperCache.h"
-#include "XPCWrapper.h"
 #include "AccessCheck.h"
 #include "nsJSUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMExceptionBinding.h"
 
 #include "jsapi.h"
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -3,34 +3,29 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Wrapper object for reflecting native xpcom objects into JavaScript. */
 
 #include "xpcprivate.h"
-#include "nsCRT.h"
-#include "XPCWrapper.h"
 #include "nsWrapperCacheInlines.h"
 #include "XPCLog.h"
-#include "nsINode.h"
-#include "XPCQuickStubs.h"
 #include "jsprf.h"
-#include "jsproxy.h"
 #include "AccessCheck.h"
 #include "WrapperFactory.h"
 #include "XrayWrapper.h"
 
 #include "nsContentUtils.h"
 #include "nsCxPusher.h"
 
 #include <stdint.h>
-#include "mozilla/Util.h"
 #include "mozilla/Likely.h"
+#include "mozilla/dom/BindingUtils.h"
 #include <algorithm>
 
 using namespace xpc;
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace JS;
 
 bool
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -3,20 +3,17 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* JavaScript JSClasses and JSOps for our Wrapped Native JS Objects. */
 
 #include "xpcprivate.h"
-#include "XPCWrapper.h"
-#include "AccessCheck.h"
 #include "jsprf.h"
-#include "nsWrapperCacheInlines.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Preferences.h"
 
 using namespace mozilla;
 using namespace JS;
 
 /***************************************************************************/
 
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Class used to manage the wrapped native objects within a JS scope. */
 
 #include "xpcprivate.h"
-#include "XPCWrapper.h"
-#include "jsproxy.h"
 #include "nsContentUtils.h"
 #include "nsCycleCollectionNoteRootCallback.h"
 #include "nsPrincipal.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Preferences.h"
 
 #include "mozilla/dom/BindingUtils.h"
 
--- a/js/xpconnect/src/XPCWrapper.cpp
+++ b/js/xpconnect/src/XPCWrapper.cpp
@@ -1,20 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 sw=2 et tw=78: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "xpcprivate.h"
 #include "XPCWrapper.h"
-#include "AccessCheck.h"
 #include "WrapperFactory.h"
 #include "AccessCheck.h"
-#include "nsCxPusher.h"
 
 using namespace xpc;
 using namespace mozilla;
 
 namespace XPCNativeWrapper {
 
 static inline
 bool
--- a/js/xpconnect/src/XPCWrapper.h
+++ b/js/xpconnect/src/XPCWrapper.h
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef XPC_WRAPPER_H
 #define XPC_WRAPPER_H 1
 
 #include "xpcprivate.h"
-#include "xpcpublic.h"
 #include "jswrapper.h"
 
 class nsIScriptSecurityManager;
 
 namespace XPCNativeWrapper {
 
 // Given an XPCWrappedNative pointer and the name of the function on
 // XPCNativeScriptableFlags corresponding with a flag, returns 'true'
--- a/js/xpconnect/src/dictionary_helper_gen.conf
+++ b/js/xpconnect/src/dictionary_helper_gen.conf
@@ -11,20 +11,17 @@ dictionaries = [
      [ 'CameraSelector', 'nsIDOMCameraManager.idl' ],
      [ 'CameraRecordingOptions', 'nsIDOMCameraManager.idl' ],
      [ 'SmsThreadListItem', 'nsIMobileMessageCallback.idl' ],
      [ 'MmsAttachment', 'nsIDOMMozMmsMessage.idl' ]
    ]
 
 # include file names
 special_includes = [
-    'nsContentUtils.h',
-    'xpcprivate.h',
     'XPCQuickStubs.h',
-    'nsIDOMApplicationRegistry.h',
     'nsIDOMFile.h'
   ]
 
 # name of the type to not include using #include "typename.h"
 exclude_automatic_type_include = [
     'nsISupports',
     'mozIDOMApplication',
     'nsIDOMBlob'
--- a/js/xpconnect/src/dictionary_helper_gen.py
+++ b/js/xpconnect/src/dictionary_helper_gen.py
@@ -84,19 +84,20 @@ def print_header(idl, fd, conf, dictname
                 dicts.append(p.name)
                 write_header(p, fd)
 
 def print_header_file(fd, conf):
     fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n"
              "#ifndef _gen_mozilla_idl_dictionary_helpers_h_\n"
              "#define _gen_mozilla_idl_dictionary_helpers_h_\n\n")
 
-    fd.write("#include \"jsapi.h\"\n"
+    fd.write("#include \"js/TypeDecls.h\"\n"
+             "#include \"js/Value.h\"\n"
              "#include \"nsError.h\"\n"
-             "#include \"nsString.h\"\n"
+             "#include \"nsStringGlue.h\"\n"
              "#include \"nsCOMPtr.h\"\n\n")
 
     forwards = []
     attrnames = []
     for d in conf.dictionaries:
         idl = loadIDL(p, options.incdirs, d[1])
         collect_names_and_non_primitive_attribute_types(idl, d[0], attrnames, forwards)
     
@@ -165,16 +166,17 @@ def print_cpp(idl, fd, conf, dictname, d
                 write_cpp(p, fd)
 
 def get_jsid(name):
     return ("gDictionary_id_%s" % name)
 
 def print_cpp_file(fd, conf):
     fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n")
     fd.write('#include "DictionaryHelpers.h"\n')
+    fd.write('#include "mozilla/dom/BindingUtils.h"\n')
 
     includes = []
     for s in conf.special_includes:
         if not s in includes:
             includes.append(strip_end(s, ".h"))
     
     for d in conf.dictionaries:
         if not d[1] in includes:
--- a/js/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/xpconnect/src/dom_quickstubs.qsconf
@@ -105,18 +105,19 @@ irregularFilenames = {
     # stowaways
     'nsIDOMBlob': 'nsIDOMFile',
     'nsIIndexedDatabaseUsageCallback': 'nsIIndexedDatabaseManager',
     'nsITelephoneCallback': 'nsITelephone',
     'nsIDOMWindowPerformance': 'nsIDOMWindow',
     }
 
 customIncludes = [
-    'nsDOMQS.h',
     'nsPerformance.h',
+    'nsPIDOMWindow.h',
+    'mozilla/dom/BindingUtils.h',
     'mozilla/dom/EventTargetBinding.h',
     ]
 
 nsIDOMStorage_Clear_customMethodCallCode = """
     rv = self->Clear();
     if (NS_SUCCEEDED(rv))
         JS_ClearNonGlobalObject(cx, obj);
 """
--- a/js/xpconnect/src/event_impl_gen.py
+++ b/js/xpconnect/src/event_impl_gen.py
@@ -246,18 +246,16 @@ def print_cpp(idl, fd, conf, eventname):
     for p in idl.productions:
         if p.kind == 'interface':
             write_cpp(eventname, p, fd, conf)
 
 def print_cpp_file(fd, conf):
     fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n")
     fd.write('#include "GeneratedEventClasses.h"\n')
     fd.write('#include "xpcprivate.h"\n');
-    fd.write('#include "nsPresContext.h"\n')
-    fd.write('#include "nsGUIEvent.h"\n')
     fd.write('#include "nsDOMEvent.h"\n');
     fd.write('#include "mozilla/dom/EventTarget.h"\n');
 
     for e in conf.simple_events:
         idl = loadEventIDL(p, options.incdirs, e)
         print_cpp(idl, fd, conf, e)
 
 def init_value(attribute):
--- a/js/xpconnect/src/nsCxPusher.cpp
+++ b/js/xpconnect/src/nsCxPusher.cpp
@@ -3,19 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsCxPusher.h"
 
 #include "nsIScriptContext.h"
 #include "mozilla/dom/EventTarget.h"
-#include "nsJSUtils.h"
 #include "nsDOMJSUtils.h"
-#include "mozilla/Util.h"
 #include "xpcprivate.h"
 
 using mozilla::dom::EventTarget;
 using mozilla::DebugOnly;
 
 NS_EXPORT
 nsCxPusher::~nsCxPusher() {}
 
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -5,32 +5,25 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* High level class and public functions implementation. */
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Base64.h"
 #include "mozilla/Likely.h"
-#include "mozilla/Util.h"
 
 #include "xpcprivate.h"
 #include "XPCWrapper.h"
-#include "nsBaseHashtable.h"
-#include "nsHashKeys.h"
 #include "jsfriendapi.h"
 #include "js/OldDebugAPI.h"
-#include "dom_quickstubs.h"
-#include "nsNullPrincipal.h"
-#include "nsIURI.h"
 #include "nsJSEnvironment.h"
 #include "nsThreadUtils.h"
 #include "nsDOMJSUtils.h"
 
-#include "XrayWrapper.h"
 #include "WrapperFactory.h"
 #include "AccessCheck.h"
 
 #ifdef MOZ_JSDEBUGGER
 #include "jsdIDebuggerService.h"
 #endif
 
 #include "XPCQuickStubs.h"
@@ -42,19 +35,16 @@
 #include "mozilla/dom/IDBOpenDBRequestBinding.h"
 #include "mozilla/dom/IDBRequestBinding.h"
 #include "mozilla/dom/IDBTransactionBinding.h"
 #include "mozilla/dom/IDBVersionChangeEventBinding.h"
 #include "mozilla/dom/TextDecoderBinding.h"
 #include "mozilla/dom/TextEncoderBinding.h"
 #include "mozilla/dom/DOMErrorBinding.h"
 
-#include "nsWrapperCacheInlines.h"
-#include "nsCycleCollectionNoteRootCallback.h"
-#include "nsCycleCollector.h"
 #include "nsDOMMutationObserver.h"
 #include "nsICycleCollectorListener.h"
 #include "nsThread.h"
 #include "mozilla/XPTInterfaceInfoManager.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 
 using namespace mozilla;
--- a/js/xpconnect/src/qsgen.py
+++ b/js/xpconnect/src/qsgen.py
@@ -1202,25 +1202,22 @@ def writeDefiner(f, conf, stringtable, i
     f.write("}\n")
     f.write("} // namespace xpc\n\n\n")
 
 
 stubTopTemplate = '''\
 /* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
 #include "jsapi.h"
 #include "qsWinUndefs.h"
-#include "prtypes.h"
+#include "qsObjectHelper.h"
 #include "nsID.h"
 #include "%s"
-#include "nscore.h"
 #include "nsCOMPtr.h"
-#include "nsDependentString.h"
 #include "xpcprivate.h"  // for XPCCallContext
 #include "XPCQuickStubs.h"
-#include "nsWrapperCacheInlines.h"
 #include <algorithm>
 '''
 
 def writeStubFile(filename, headerFilename, conf, interfaces):
     print "Creating stub file", filename
     makeutils.targets.append(filename)
 
     f = open(filename, 'w')
--- a/js/xpconnect/tests/components/native/xpctest_module.cpp
+++ b/js/xpconnect/tests/components/native/xpctest_module.cpp
@@ -1,21 +1,17 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* module registration and factory code. */
 
-#include "nsCOMPtr.h"
-#include "nsIModule.h"
 #include "mozilla/ModuleUtils.h"
-#include "nsCRT.h"
-#include "nsIClassInfoImpl.h"
 #include "xpctest_private.h"
 
 #define NS_XPCTESTOBJECTREADONLY_CID                                          \
 { 0x492609a7, 0x2582, 0x436b,                                                 \
    { 0xb0, 0xef, 0x92, 0xe2, 0x9b, 0xb9, 0xe1, 0x43 } }
 
 #define NS_XPCTESTOBJECTREADWRITE_CID                                         \
 { 0x8f37f760, 0x3686, 0x4dbb,                                                 \
--- a/js/xpconnect/wrappers/AccessCheck.cpp
+++ b/js/xpconnect/wrappers/AccessCheck.cpp
@@ -1,29 +1,23 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=4 sw=4 et tw=99 ft=cpp:
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/Util.h"
-
 #include "AccessCheck.h"
 
 #include "nsJSPrincipals.h"
-#include "nsIDocument.h"
 #include "nsIDOMWindow.h"
-#include "nsPIDOMWindow.h"
 #include "nsIDOMWindowCollection.h"
-#include "nsJSUtils.h"
 
 #include "XPCWrapper.h"
 #include "XrayWrapper.h"
-#include "FilteringWrapper.h"
 
 #include "jsfriendapi.h"
 #include "mozilla/dom/BindingUtils.h"
 
 using namespace mozilla;
 using namespace JS;
 using namespace js;
 
--- a/js/xpconnect/wrappers/ChromeObjectWrapper.h
+++ b/js/xpconnect/wrappers/ChromeObjectWrapper.h
@@ -6,20 +6,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __ChromeObjectWrapper_h__
 #define __ChromeObjectWrapper_h__
 
 #include "mozilla/Attributes.h"
 
 #include "FilteringWrapper.h"
-#include "AccessCheck.h"
 
 namespace xpc {
 
+struct ExposedPropertiesOnly;
+
 // When chrome JS objects are exposed to content, they get a ChromeObjectWrapper.
 //
 // The base filtering wrapper here does most of the work for us. We define a
 // custom class here to introduce custom behavior with respect to the prototype
 // chain.
 #define ChromeObjectWrapperBase \
   FilteringWrapper<js::CrossCompartmentSecurityWrapper, ExposedPropertiesOnly>
 
--- a/js/xpconnect/wrappers/FilteringWrapper.cpp
+++ b/js/xpconnect/wrappers/FilteringWrapper.cpp
@@ -1,22 +1,18 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=4 sw=4 et tw=99 ft=cpp: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FilteringWrapper.h"
 #include "AccessCheck.h"
-#include "WaiveXrayWrapper.h"
 #include "ChromeObjectWrapper.h"
 #include "XrayWrapper.h"
-#include "WrapperFactory.h"
-
-#include "XPCWrapper.h"
 
 #include "jsapi.h"
 
 using namespace JS;
 using namespace js;
 
 namespace xpc {
 
--- a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp
+++ b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp
@@ -1,22 +1,18 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=4 sw=4 et tw=99 ft=cpp:
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsJSPrincipals.h"
-
-#include "XPCWrapper.h"
-
 #include "WaiveXrayWrapper.h"
-#include "AccessCheck.h"
 #include "WrapperFactory.h"
+#include "jsapi.h"
 
 using namespace JS;
 
 namespace xpc {
 
 static bool
 WaiveAccessors(JSContext *cx, JS::MutableHandle<JSPropertyDescriptor> desc)
 {
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -2,18 +2,16 @@
  * vim: set ts=4 sw=4 et tw=99 ft=cpp:
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "XrayWrapper.h"
 #include "AccessCheck.h"
-#include "FilteringWrapper.h"
-#include "WaiveXrayWrapper.h"
 #include "WrapperFactory.h"
 
 #include "nsIContent.h"
 #include "nsContentUtils.h"
 
 #include "XPCWrapper.h"
 #include "xpcprivate.h"
 
--- a/js/xpconnect/wrappers/XrayWrapper.h
+++ b/js/xpconnect/wrappers/XrayWrapper.h
@@ -1,28 +1,25 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=4 sw=4 et tw=99 ft=cpp:
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Attributes.h"
-#include "mozilla/GuardObjects.h"
 
 #include "jswrapper.h"
 
 // Xray wrappers re-resolve the original native properties on the native
 // object and always directly access to those properties.
 // Because they work so differently from the rest of the wrapper hierarchy,
 // we pull them out of the Wrapper inheritance hierarchy and create a
 // little world around them.
 
-class XPCWrappedNative;
-
 namespace xpc {
 
 bool
 holder_get(JSContext *cx, JS::HandleObject holder, JS::HandleId id, JS::MutableHandleValue vp);
 bool
 holder_set(JSContext *cx, JS::HandleObject holder, JS::HandleId id, bool strict,
            JS::MutableHandleValue vp);
 
@@ -43,17 +40,16 @@ IsXrayResolving(JSContext *cx, JS::Handl
 
 bool
 HasNativeProperty(JSContext *cx, JS::HandleObject wrapper, JS::HandleId id,
                   bool *hasProp);
 }
 
 class XrayTraits;
 class XPCWrappedNativeXrayTraits;
-class ProxyXrayTraits;
 class DOMXrayTraits;
 
 
 enum XrayType {
     XrayForDOMObject,
     XrayForWrappedNative,
     NotXray
 };
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -76,16 +76,17 @@
 #include "nsGlobalWindowCommands.h"
 #include "nsIControllerCommandTable.h"
 #include "nsJSProtocolHandler.h"
 #include "nsScriptNameSpaceManager.h"
 #include "nsIControllerContext.h"
 #include "nsDOMScriptObjectFactory.h"
 #include "DOMStorageManager.h"
 #include "nsJSON.h"
+#include "nsZipArchive.h"
 #include "mozIApplicationClearPrivateDataParams.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Activity.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMRequest.h"
 #include "mozilla/dom/EventSource.h"
 #include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
 #include "mozilla/dom/network/TCPSocketChild.h"
--- a/toolkit/components/ctypes/ctypes.cpp
+++ b/toolkit/components/ctypes/ctypes.cpp
@@ -6,16 +6,17 @@
 #include "ctypes.h"
 #include "jsapi.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsMemory.h"
 #include "nsString.h"
 #include "nsNativeCharsetUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozJSComponentLoader.h"
+#include "nsZipArchive.h"
 
 #define JSCTYPES_CONTRACTID \
   "@mozilla.org/jsctypes;1"
 
 
 #define JSCTYPES_CID \
 { 0xc797702, 0x1c60, 0x4051, { 0x9d, 0xd7, 0x4d, 0x74, 0x5, 0x60, 0x56, 0x42 } }
 
--- a/toolkit/components/perf/PerfMeasurement.cpp
+++ b/toolkit/components/perf/PerfMeasurement.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "PerfMeasurement.h"
 #include "jsperf.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsMemory.h"
 #include "mozilla/Preferences.h"
 #include "mozJSComponentLoader.h"
+#include "nsZipArchive.h"
 
 #define JSPERF_CONTRACTID \
   "@mozilla.org/jsperf;1"
 
 #define JSPERF_CID            \
 { 0x421c38e6, 0xaee0, 0x4509, \
   { 0xa0, 0x25, 0x13, 0x0f, 0x43, 0x78, 0x03, 0x5a } }