Skip to content

Commit

Permalink
Bug 1600545 - Remove useless inclusions of header files generated fro…
Browse files Browse the repository at this point in the history
…m IDL files in modules/, netwerk/, parser/, security/, startupcache/, storage/, toolkit/, tools/, uriloader/, widget/, xpcom/ and xpfe/ r=Ehsan

The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55444
  • Loading branch information
gabrielesvelto committed Dec 6, 2019
1 parent ffbfa64 commit 398a809
Show file tree
Hide file tree
Showing 503 changed files with 92 additions and 939 deletions.
2 changes: 1 addition & 1 deletion modules/libjar/nsJAR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "nsJARInputStream.h"
#include "nsJAR.h"
#include "nsIFile.h"
#include "nsIConsoleService.h"
#include "nsIObserverService.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Omnijar.h"
#include "mozilla/Unused.h"
Expand Down
2 changes: 0 additions & 2 deletions modules/libjar/nsJAR.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "mozilla/Atomics.h"
#include "mozilla/Mutex.h"
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsClassHashtable.h"
#include "nsString.h"
Expand All @@ -25,7 +24,6 @@
#include "nsTHashtable.h"
#include "nsIZipReader.h"
#include "nsZipArchive.h"
#include "nsIObserverService.h"
#include "nsWeakReference.h"
#include "nsIObserver.h"
#include "mozilla/Attributes.h"
Expand Down
6 changes: 0 additions & 6 deletions modules/libjar/nsJARChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,15 @@
#include "nsMimeTypes.h"
#include "nsNetUtil.h"
#include "nsEscape.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIViewSourceChannel.h"
#include "nsContentUtils.h"
#include "nsProxyRelease.h"
#include "nsContentSecurityManager.h"

#include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h"
#include "nsIFileURL.h"

#include "mozilla/BasePrincipal.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h"
#include "nsIBrowserChild.h"
#include "private/pprio.h"
#include "nsInputStreamPump.h"
#include "nsThreadUtils.h"
Expand Down
1 change: 0 additions & 1 deletion modules/libjar/nsJARInputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "MmapFaultHandler.h"

#include "nsEscape.h"
#include "nsIFile.h"
#include "nsDebug.h"
#include <algorithm>
#if defined(XP_WIN)
Expand Down
4 changes: 0 additions & 4 deletions modules/libjar/nsJARProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
#include "mozilla/ClearOnShutdown.h"
#include "nsAutoPtr.h"
#include "nsJARProtocolHandler.h"
#include "nsIIOService.h"
#include "nsCRT.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsJARURI.h"
#include "nsIURL.h"
#include "nsJARChannel.h"
#include "nsString.h"
#include "nsNetCID.h"
Expand Down
1 change: 0 additions & 1 deletion modules/libjar/nsJARProtocolHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "mozilla/StaticPtr.h"
#include "nsIProtocolHandler.h"
#include "nsIJARURI.h"
#include "nsIZipReader.h"
#include "nsIMIMEService.h"
#include "nsWeakReference.h"
Expand Down
3 changes: 0 additions & 3 deletions modules/libjar/nsJARURI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#include "nsIIOService.h"
#include "nsIStandardURL.h"
#include "nsCRT.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIZipReader.h"
#include "nsReadableUtils.h"
#include "nsAutoPtr.h"
#include "nsNetCID.h"
Expand Down
1 change: 0 additions & 1 deletion modules/libjar/zipwriter/nsDeflateConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "StreamFunctions.h"
#include "nsDeflateConverter.h"
#include "nsStringStream.h"
#include "nsIInputStreamPump.h"
#include "nsComponentManagerUtils.h"
#include "nsMemory.h"
#include "plstr.h"
Expand Down
1 change: 0 additions & 1 deletion modules/libjar/zipwriter/nsDeflateConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "nsIStreamConverter.h"
#include "nsCOMPtr.h"
#include "nsIPipe.h"
#include "zlib.h"
#include "mozilla/Attributes.h"

Expand Down
2 changes: 0 additions & 2 deletions modules/libjar/zipwriter/nsZipWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
#include "StreamFunctions.h"
#include "nsZipDataStream.h"
#include "nsISeekableStream.h"
#include "nsIAsyncStreamCopier.h"
#include "nsIStreamListener.h"
#include "nsIInputStreamPump.h"
#include "nsILoadInfo.h"
#include "nsComponentManagerUtils.h"
#include "nsMemory.h"
#include "nsError.h"
Expand Down
2 changes: 0 additions & 2 deletions modules/libjar/zipwriter/nsZipWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#define _nsZipWriter_h_

#include "nsIZipWriter.h"
#include "nsIFileStreams.h"
#include "nsIBufferedStreams.h"
#include "nsIRequestObserver.h"
#include "nsZipHeader.h"
#include "nsCOMPtr.h"
Expand Down
4 changes: 0 additions & 4 deletions modules/libpref/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@
#include "nsDataHashtable.h"
#include "nsDirectoryServiceDefs.h"
#include "nsHashKeys.h"
#include "nsICategoryManager.h"
#include "nsIConsoleService.h"
#include "nsIDirectoryService.h"
#include "nsIFile.h"
#include "nsIInputStream.h"
#include "nsIMemoryReporter.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
Expand All @@ -69,7 +66,6 @@
#include "nsISafeOutputStream.h"
#include "nsISimpleEnumerator.h"
#include "nsIStringBundle.h"
#include "nsIStringEnumerator.h"
#include "nsISupportsImpl.h"
#include "nsISupportsPrimitives.h"
#include "nsIZipReader.h"
Expand Down
1 change: 1 addition & 0 deletions netwerk/base/BackgroundFileSaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "mozilla/Logging.h"
#include "mozilla/Telemetry.h"
#include "nsCOMArray.h"
#include "nsComponentManagerUtils.h"
#include "nsDependentSubstring.h"
#include "nsIAsyncInputStream.h"
#include "nsIFile.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/ChannelDiverterChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "mozilla/net/FTPChannelChild.h"
#include "mozilla/net/PHttpChannelChild.h"
#include "mozilla/net/PFTPChannelChild.h"
#include "nsIDivertableChannel.h"

namespace mozilla {
namespace net {} // namespace net
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/Dashboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "nsIInputStream.h"
#include "nsINamed.h"
#include "nsISocketTransport.h"
#include "nsIThread.h"
#include "nsProxyRelease.h"
#include "nsSocketTransportService2.h"
#include "nsThreadUtils.h"
Expand Down
4 changes: 0 additions & 4 deletions netwerk/base/Dashboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
#include "mozilla/net/DashboardTypes.h"
#include "nsIDashboard.h"
#include "nsIDashboardEventNotifier.h"
#include "nsIDNSListener.h"
#include "nsIServiceManager.h"
#include "nsITimer.h"
#include "nsITransport.h"

class nsIDNSService;

Expand Down
2 changes: 0 additions & 2 deletions netwerk/base/IOActivityMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* 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 "IOActivityMonitor.h"
#include "nsIObserverService.h"
#include "nsPISocketTransportService.h"
#include "nsPrintfCString.h"
#include "nsSocketTransport2.h"
#include "nsSocketTransportService2.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/LoadInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "nsIDocShell.h"
#include "mozilla/dom/Document.h"
#include "nsCookiePermission.h"
#include "nsICookieService.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsISupportsImpl.h"
#include "nsISupportsUtils.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/LoadInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#define mozilla_LoadInfo_h

#include "nsIContentSecurityPolicy.h"
#include "nsIContentPolicy.h"
#include "nsILoadInfo.h"
#include "nsIPrincipal.h"
#include "nsIWeakReferenceUtils.h" // for nsWeakPtr
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/NetworkConnectivityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "mozilla/Services.h"
#include "xpcpublic.h"
#include "nsSocketTransport2.h"
#include "nsIURIMutator.h"
#include "nsINetworkLinkService.h"

static LazyLogModule gNCSLog("NetworkConnectivityService");
Expand Down
4 changes: 0 additions & 4 deletions netwerk/base/Predictor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "nsAppDirectoryServiceDefs.h"
#include "nsICacheStorage.h"
#include "nsICacheStorageService.h"
#include "nsICachingChannel.h"
#include "nsICancelable.h"
#include "nsIChannel.h"
Expand All @@ -19,14 +18,11 @@
#include "nsIFile.h"
#include "nsIHttpChannel.h"
#include "nsIInputStream.h"
#include "nsIIOService.h"
#include "nsILoadContext.h"
#include "nsILoadContextInfo.h"
#include "nsILoadGroup.h"
#include "nsINetworkPredictorVerifier.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsISpeculativeConnect.h"
#include "nsITimer.h"
#include "nsIURI.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/SimpleBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "prtypes.h"
#include "mozilla/LinkedList.h"
#include "nsIThreadInternal.h"

namespace mozilla {
namespace net {
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/TLSServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "nsComponentManagerUtils.h"
#include "nsDependentSubstring.h"
#include "nsIServerSocket.h"
#include "nsITimer.h"
#include "nsIX509Cert.h"
#include "nsIX509CertDB.h"
#include "nsNetCID.h"
Expand Down
2 changes: 0 additions & 2 deletions netwerk/base/Tickler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#ifdef MOZ_USE_WIFI_TICKLER
# include "nsComponentManagerUtils.h"
# include "nsINamed.h"
# include "nsIPrefBranch.h"
# include "nsIPrefService.h"
# include "nsServiceManagerUtils.h"
# include "nsThreadUtils.h"
# include "prnetdb.h"
Expand Down
2 changes: 0 additions & 2 deletions netwerk/base/nsAsyncRedirectVerifyHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
#define nsAsyncRedirectVerifyHelper_h

#include "nsIRunnable.h"
#include "nsIThread.h"
#include "nsIChannelEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/nsBaseChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "nsUnknownDecoder.h"
#include "nsIScriptSecurityManager.h"
#include "nsMimeTypes.h"
#include "nsIHttpChannel.h"
#include "nsIChannelEventSink.h"
#include "nsIStreamConverterService.h"
#include "nsChannelClassifier.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/nsDirectoryIndexStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "nsDirectoryIndexStream.h"
#include "mozilla/Logging.h"
#include "prtime.h"
#include "nsISimpleEnumerator.h"
#ifdef THREADSAFE_I18N
# include "nsCollationCID.h"
# include "nsICollation.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/nsDownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "nsDownloader.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsNetUtil.h"
Expand Down
4 changes: 0 additions & 4 deletions netwerk/base/nsIOService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "nsErrorService.h"
#include "netCore.h"
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "nsXPCOM.h"
#include "nsIProxiedProtocolHandler.h"
#include "nsIProxyInfo.h"
Expand All @@ -28,18 +27,15 @@
#include "nsIConsoleService.h"
#include "nsIUploadChannel2.h"
#include "nsXULAppAPI.h"
#include "nsIScriptSecurityManager.h"
#include "nsIProtocolProxyCallback.h"
#include "nsICancelable.h"
#include "nsINetworkLinkService.h"
#include "nsPISocketTransportService.h"
#include "nsAsyncRedirectVerifyHelper.h"
#include "nsURLHelper.h"
#include "nsIProtocolProxyService2.h"
#include "MainThreadUtils.h"
#include "nsINode.h"
#include "nsIWidget.h"
#include "nsIHttpChannel.h"
#include "nsThreadUtils.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/net/NeckoCommon.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/nsInputStreamPump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "nsIOService.h"
#include "nsInputStreamPump.h"
#include "nsIStreamTransportService.h"
#include "nsISeekableStream.h"
#include "nsITransport.h"
#include "nsIThreadRetargetableStreamListener.h"
#include "nsThreadUtils.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/nsLoadGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "nsITimedChannel.h"
#include "nsIInterfaceRequestor.h"
#include "nsIRequestObserver.h"
#include "nsIRequestContext.h"
#include "CacheObserver.h"
#include "MainThreadUtils.h"
#include "RequestContextService.h"
Expand Down
2 changes: 0 additions & 2 deletions netwerk/base/nsMIMEInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#ifndef _nsMIMEInputStream_h_
#define _nsMIMEInputStream_h_

#include "nsIMIMEInputStream.h"

#define NS_MIMEINPUTSTREAM_CONTRACTID "@mozilla.org/network/mime-input-stream;1"
#define NS_MIMEINPUTSTREAM_CID \
{ /* 58a1c31c-1dd2-11b2-a3f6-d36949d48268 */ \
Expand Down
9 changes: 0 additions & 9 deletions netwerk/base/nsNetUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "nsHashKeys.h"
#include "nsHttp.h"
#include "nsMimeTypes.h"
#include "nsIAsyncStreamCopier.h"
#include "nsIAuthPrompt.h"
#include "nsIAuthPrompt2.h"
#include "nsIAuthPromptAdapterFactory.h"
Expand All @@ -36,7 +35,6 @@
#include "nsIChannelEventSink.h"
#include "nsIContentSniffer.h"
#include "mozilla/dom/Document.h"
#include "nsICookieService.h"
#include "nsIDownloader.h"
#include "nsIFileProtocolHandler.h"
#include "nsIFileStreams.h"
Expand All @@ -47,7 +45,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsILoadContext.h"
#include "nsIMIMEHeaderParam.h"
#include "nsIMutable.h"
#include "nsINode.h"
#include "nsIObjectLoadingContent.h"
#include "nsIOfflineCacheUpdate.h"
Expand All @@ -57,21 +54,15 @@
#include "nsIProtocolProxyService.h"
#include "mozilla/net/RedirectChannelRegistrar.h"
#include "nsRequestObserverProxy.h"
#include "nsIScriptSecurityManager.h"
#include "nsISensitiveInfoHiddenURI.h"
#include "nsISimpleStreamListener.h"
#include "nsISocketProvider.h"
#include "nsISocketProviderService.h"
#include "nsIStandardURL.h"
#include "nsIStreamLoader.h"
#include "nsIIncrementalStreamLoader.h"
#include "nsIStreamTransportService.h"
#include "nsStringStream.h"
#include "nsSyncStreamListener.h"
#include "nsITransport.h"
#include "nsIURIWithSpecialOrigin.h"
#include "nsIURLParser.h"
#include "nsIUUIDGenerator.h"
#include "nsIViewSourceChannel.h"
#include "nsInterfaceRequestorAgg.h"
#include "plstr.h"
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/nsPACMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "nsIAuthPrompt.h"
#include "nsIDHCPClient.h"
#include "nsIHttpChannel.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPromptFactory.h"
#include "nsIProtocolProxyService.h"
Expand Down
Loading

0 comments on commit 398a809

Please sign in to comment.