diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build index 9631512ab98c..2c3f3dc50c5d 100644 --- a/netwerk/base/moz.build +++ b/netwerk/base/moz.build @@ -35,7 +35,6 @@ XPIDL_SOURCES += [ 'nsIClassifiedChannel.idl', 'nsIClassOfService.idl', 'nsIContentSniffer.idl', - 'nsICrossProcessSwitchChannel.idl', 'nsIDashboard.idl', 'nsIDashboardEventNotifier.idl', 'nsIDeprecationWarner.idl', @@ -76,6 +75,7 @@ XPIDL_SOURCES += [ 'nsIPermission.idl', 'nsIPermissionManager.idl', 'nsIPrivateBrowsingChannel.idl', + 'nsIProcessSwitchRequestor.idl', 'nsIProgressEventSink.idl', 'nsIPrompt.idl', 'nsIProtocolHandler.idl', diff --git a/netwerk/base/nsICrossProcessSwitchChannel.idl b/netwerk/base/nsIProcessSwitchRequestor.idl similarity index 73% rename from netwerk/base/nsICrossProcessSwitchChannel.idl rename to netwerk/base/nsIProcessSwitchRequestor.idl index e2740a69a3a1..7e1973b07c71 100644 --- a/netwerk/base/nsICrossProcessSwitchChannel.idl +++ b/netwerk/base/nsIProcessSwitchRequestor.idl @@ -4,26 +4,7 @@ * 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 "nsISupports.idl" -#include "nsIAsyncVerifyRedirectCallback.idl" -#include "nsIHttpChannel.idl" - -[scriptable, uuid(d2471b64-0292-4cb5-b801-914e34b31af0)] -interface nsICrossProcessSwitchChannel : nsISupports -{ - /** - * When a process switch is about to start, - * nsHttpChannel will call this method on DocumentChannelParent or - * HttpChannelParent - * - * @param channel - * nsIHttpChannel caller. - * @param identifier - * identifier from SessionStore to be passed to the childChannel in - * order to identify it. - */ - void triggerCrossProcessSwitch(in nsIHttpChannel channel, in uint64_t identifier); -}; +#include "nsIChannel.idl" /** * The nsIProcessSwitchRequestor interface allows clients to instruct diff --git a/netwerk/ipc/DocumentChannelParent.cpp b/netwerk/ipc/DocumentChannelParent.cpp index 0e3b13248817..b6b7092a4b69 100644 --- a/netwerk/ipc/DocumentChannelParent.cpp +++ b/netwerk/ipc/DocumentChannelParent.cpp @@ -39,7 +39,6 @@ NS_INTERFACE_MAP_BEGIN(DocumentChannelParent) NS_INTERFACE_MAP_ENTRY(nsIStreamListener) NS_INTERFACE_MAP_ENTRY(nsIParentChannel) NS_INTERFACE_MAP_ENTRY(nsIAsyncVerifyRedirectReadyCallback) - NS_INTERFACE_MAP_ENTRY(nsICrossProcessSwitchChannel) NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink) NS_INTERFACE_MAP_ENTRY(nsIProcessSwitchRequestor) NS_INTERFACE_MAP_ENTRY_CONCRETE(DocumentChannelParent) @@ -359,14 +358,6 @@ void DocumentChannelParent::FinishReplacementChannelSetup(bool aSucceeded) { } } -nsresult DocumentChannelParent::TriggerCrossProcessSwitch( - nsIHttpChannel* aChannel, uint64_t aIdentifier) { - MOZ_ASSERT_UNREACHABLE( - "We can no longer be called from nsHttpChannel, this interface will be " - "removed in a follow-up patch"); - return NS_OK; -} - void DocumentChannelParent::TriggerCrossProcessSwitch() { MOZ_ASSERT(mRedirectContentProcessIdPromise); CancelChildForProcessSwitch(); diff --git a/netwerk/ipc/DocumentChannelParent.h b/netwerk/ipc/DocumentChannelParent.h index 0d91323cccef..cf7844a0afbf 100644 --- a/netwerk/ipc/DocumentChannelParent.h +++ b/netwerk/ipc/DocumentChannelParent.h @@ -13,11 +13,11 @@ #include "mozilla/net/NeckoParent.h" #include "mozilla/net/PDocumentChannelParent.h" #include "mozilla/net/ParentChannelListener.h" -#include "nsICrossProcessSwitchChannel.h" #include "nsIInterfaceRequestor.h" #include "nsIObserver.h" #include "nsIParentChannel.h" #include "nsIParentRedirectingChannel.h" +#include "nsIProcessSwitchRequestor.h" #include "nsIRedirectResultListener.h" #define DOCUMENT_CHANNEL_PARENT_IID \ @@ -37,7 +37,6 @@ class DocumentChannelParent : public nsIInterfaceRequestor, public nsIAsyncVerifyRedirectReadyCallback, public nsIParentChannel, public nsIChannelEventSink, - public nsICrossProcessSwitchChannel, public HttpChannelSecurityWarningReporter, public nsIProcessSwitchRequestor { public: @@ -54,7 +53,6 @@ class DocumentChannelParent : public nsIInterfaceRequestor, NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIASYNCVERIFYREDIRECTREADYCALLBACK NS_DECL_NSICHANNELEVENTSINK - NS_DECL_NSICROSSPROCESSSWITCHCHANNEL NS_DECL_NSIPROCESSSWITCHREQUESTOR NS_DECLARE_STATIC_IID_ACCESSOR(DOCUMENT_CHANNEL_PARENT_IID) diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 5ae5885569ce..7c28f5bf284f 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -289,7 +289,6 @@ NS_INTERFACE_MAP_BEGIN(HttpChannelParent) NS_INTERFACE_MAP_ENTRY(nsIAsyncVerifyRedirectReadyCallback) NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink) NS_INTERFACE_MAP_ENTRY(nsIRedirectResultListener) - NS_INTERFACE_MAP_ENTRY(nsICrossProcessSwitchChannel) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIParentRedirectingChannel) NS_INTERFACE_MAP_ENTRY_CONCRETE(HttpChannelParent) NS_INTERFACE_MAP_END diff --git a/netwerk/protocol/http/HttpChannelParent.h b/netwerk/protocol/http/HttpChannelParent.h index f64fa74c427d..926ed07e4f84 100644 --- a/netwerk/protocol/http/HttpChannelParent.h +++ b/netwerk/protocol/http/HttpChannelParent.h @@ -14,7 +14,6 @@ #include "mozilla/net/NeckoCommon.h" #include "mozilla/net/NeckoParent.h" #include "mozilla/MozPromise.h" -#include "nsICrossProcessSwitchChannel.h" #include "nsIObserver.h" #include "nsIParentRedirectingChannel.h" #include "nsIProgressEventSink.h" @@ -61,8 +60,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor, public HttpChannelSecurityWarningReporter, public nsIAsyncVerifyRedirectReadyCallback, public nsIChannelEventSink, - public nsIRedirectResultListener, - public nsICrossProcessSwitchChannel { + public nsIRedirectResultListener { virtual ~HttpChannelParent(); public: @@ -78,7 +76,6 @@ class HttpChannelParent final : public nsIInterfaceRequestor, NS_DECL_NSIASYNCVERIFYREDIRECTREADYCALLBACK NS_DECL_NSICHANNELEVENTSINK NS_DECL_NSIREDIRECTRESULTLISTENER - NS_DECL_NSICROSSPROCESSSWITCHCHANNEL NS_DECLARE_STATIC_IID_ACCESSOR(HTTP_CHANNEL_PARENT_IID) @@ -132,6 +129,13 @@ class HttpChannelParent final : public nsIInterfaceRequestor, base::ProcessId OtherPid() const; + // Called by nsHttpChannel when a process switch is about to start. + // aChannel: nsIHttpChannel caller. + // aIdentifier: identifier from SessionStore to be passed to the childChannel + // in order to identify it. + nsresult TriggerCrossProcessSwitch(nsIHttpChannel* aChannel, + uint64_t aIdentifier); + // Calling this method will cancel the HttpChannelChild because the consumer // needs to be relocated to another process. // Any OnStart/Stop/DataAvailable calls that follow will not be sent to the diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 730b8e28ff12..761389194b55 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -7298,8 +7298,7 @@ nsresult nsHttpChannel::StartCrossProcessRedirect() { nsCOMPtr parentChannel; NS_QueryNotificationCallbacks(this, parentChannel); - nsCOMPtr httpParent = - do_QueryInterface(parentChannel); + RefPtr httpParent = do_QueryObject(parentChannel); MOZ_ASSERT(httpParent); NS_ENSURE_TRUE(httpParent, NS_ERROR_UNEXPECTED); diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index 863fcb70cb2a..948bdc1d5a0d 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -33,8 +33,8 @@ #include "nsIRaceCacheWithNetwork.h" #include "mozilla/extensions/PStreamFilterParent.h" #include "mozilla/Mutex.h" +#include "nsIProcessSwitchRequestor.h" #include "nsIRemoteTab.h" -#include "nsICrossProcessSwitchChannel.h" class nsDNSPrefetch; class nsICancelable; diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 593894d4b0ba..b813aea0931d 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -15,7 +15,6 @@ #include "nsHttpChannel.h" #include "nsHttpAuthCache.h" #include "nsStandardURL.h" -#include "nsICrossProcessSwitchChannel.h" #include "nsIDOMWindow.h" #include "nsIHttpChannel.h" #include "nsIStandardURL.h" @@ -24,6 +23,7 @@ #include "nsIPrefService.h" #include "nsIPrefBranch.h" #include "nsIPrefLocalizedString.h" +#include "nsIProcessSwitchRequestor.h" #include "nsSocketProviderService.h" #include "nsISocketProvider.h" #include "nsPrintfCString.h"