зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625513 - Part 2: Completely remove nsIProcessSwitchRequestor, r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D69240 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e7ed7401ba
Коммит
d023f7c03a
|
@ -75,7 +75,6 @@ XPIDL_SOURCES += [
|
|||
'nsIPermission.idl',
|
||||
'nsIPermissionManager.idl',
|
||||
'nsIPrivateBrowsingChannel.idl',
|
||||
'nsIProcessSwitchRequestor.idl',
|
||||
'nsIProgressEventSink.idl',
|
||||
'nsIPrompt.idl',
|
||||
'nsIProtocolHandler.idl',
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/* -*- Mode: IDL; 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 "nsIChannel.idl"
|
||||
|
||||
/**
|
||||
* The nsIProcessSwitchRequestor interface allows clients to instruct
|
||||
* SessionStore.jsm that a channel setup has completed and a process switch
|
||||
* may be required. This works alongside the on-may-change-process observer
|
||||
* notification.
|
||||
* This interface must be used only from the XPCOM main thread.
|
||||
*/
|
||||
[scriptable, uuid(fce8497b-c57c-4557-b360-3efefc83eff5)]
|
||||
interface nsIProcessSwitchRequestor : nsISupports
|
||||
{
|
||||
/**
|
||||
* The underlying channel object that was intercepted and that could trigger
|
||||
* a process.
|
||||
*/
|
||||
readonly attribute nsIChannel channel;
|
||||
|
||||
/**
|
||||
* Used to determine if there is a Cross-Origin-Opener-Policy mismatch
|
||||
* that would require switching the channel to another process.
|
||||
* @throws NS_ERROR_NOT_AVAILABLE if we don't have a responseHead
|
||||
*/
|
||||
[must_use] boolean hasCrossOriginOpenerPolicyMismatch();
|
||||
|
||||
/**
|
||||
* Returns a cached CrossOriginOpenerPolicy that is computed just before we
|
||||
* determine if there is a policy mismatch.
|
||||
* @throws NS_ERROR_NOT_AVAILABLE if called before onStartRequest
|
||||
*/
|
||||
[must_use, binaryname(CachedCrossOriginOpenerPolicy)] readonly attribute nsILoadInfo_CrossOriginOpenerPolicy crossOriginOpenerPolicy;
|
||||
};
|
|
@ -233,7 +233,6 @@ NS_INTERFACE_MAP_BEGIN(DocumentLoadListener)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIParentChannel)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAsyncVerifyRedirectReadyCallback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIProcessSwitchRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMultiPartChannelListener)
|
||||
NS_INTERFACE_MAP_ENTRY_CONCRETE(DocumentLoadListener)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -900,11 +899,12 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch() {
|
|||
|
||||
// Determine our COOP status, which will be used to determine our preferred
|
||||
// remote type.
|
||||
bool isCOOPSwitch = false;
|
||||
bool isCOOPSwitch = HasCrossOriginOpenerPolicyMismatch();
|
||||
nsILoadInfo::CrossOriginOpenerPolicy coop =
|
||||
nsILoadInfo::OPENER_POLICY_UNSAFE_NONE;
|
||||
MOZ_ALWAYS_SUCCEEDS(HasCrossOriginOpenerPolicyMismatch(&isCOOPSwitch));
|
||||
MOZ_ALWAYS_SUCCEEDS(GetCachedCrossOriginOpenerPolicy(&coop));
|
||||
if (RefPtr<nsHttpChannel> httpChannel = do_QueryObject(mChannel)) {
|
||||
MOZ_ALWAYS_SUCCEEDS(httpChannel->GetCrossOriginOpenerPolicy(&coop));
|
||||
}
|
||||
|
||||
nsAutoString preferredRemoteType(currentProcess->GetRemoteType());
|
||||
if (coop ==
|
||||
|
@ -1308,10 +1308,8 @@ DocumentLoadListener::AsyncOnChannelRedirect(
|
|||
// include the state of all channels we redirected through.
|
||||
RefPtr<nsHttpChannel> httpChannel = do_QueryObject(aOldChannel);
|
||||
if (httpChannel) {
|
||||
bool mismatch = false;
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
httpChannel->HasCrossOriginOpenerPolicyMismatch(&mismatch));
|
||||
mHasCrossOriginOpenerPolicyMismatch |= mismatch;
|
||||
mHasCrossOriginOpenerPolicyMismatch |=
|
||||
httpChannel->HasCrossOriginOpenerPolicyMismatch();
|
||||
}
|
||||
|
||||
// We don't need to confirm internal redirects or record any
|
||||
|
@ -1396,59 +1394,22 @@ DocumentLoadListener::AsyncOnChannelRedirect(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DocumentLoadListener::nsIProcessSwitchRequestor
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP DocumentLoadListener::GetChannel(nsIChannel** aChannel) {
|
||||
MOZ_ASSERT(mChannel);
|
||||
nsCOMPtr<nsIChannel> channel(mChannel);
|
||||
channel.forget(aChannel);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This method returns the cached result of running the Cross-Origin-Opener
|
||||
// policy compare algorithm by calling ComputeCrossOriginOpenerPolicyMismatch
|
||||
NS_IMETHODIMP
|
||||
DocumentLoadListener::HasCrossOriginOpenerPolicyMismatch(bool* aMismatch) {
|
||||
MOZ_ASSERT(aMismatch);
|
||||
|
||||
if (!aMismatch) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
bool DocumentLoadListener::HasCrossOriginOpenerPolicyMismatch() {
|
||||
// If we found a COOP mismatch on an earlier channel and then
|
||||
// redirected away from that, we should use that result.
|
||||
if (mHasCrossOriginOpenerPolicyMismatch) {
|
||||
*aMismatch = true;
|
||||
return NS_OK;
|
||||
return true;
|
||||
}
|
||||
|
||||
RefPtr<nsHttpChannel> httpChannel = do_QueryObject(mChannel);
|
||||
if (!httpChannel) {
|
||||
// Not an nsHttpChannel assume it's okay to switch.
|
||||
*aMismatch = false;
|
||||
return NS_OK;
|
||||
return false;
|
||||
}
|
||||
|
||||
return httpChannel->HasCrossOriginOpenerPolicyMismatch(aMismatch);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentLoadListener::GetCachedCrossOriginOpenerPolicy(
|
||||
nsILoadInfo::CrossOriginOpenerPolicy* aPolicy) {
|
||||
MOZ_ASSERT(aPolicy);
|
||||
if (!aPolicy) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
RefPtr<nsHttpChannel> httpChannel = do_QueryObject(mChannel);
|
||||
if (!httpChannel) {
|
||||
*aPolicy = nsILoadInfo::OPENER_POLICY_UNSAFE_NONE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return httpChannel->GetCrossOriginOpenerPolicy(aPolicy);
|
||||
return httpChannel->HasCrossOriginOpenerPolicyMismatch();
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "nsIObserver.h"
|
||||
#include "nsIParentChannel.h"
|
||||
#include "nsIParentRedirectingChannel.h"
|
||||
#include "nsIProcessSwitchRequestor.h"
|
||||
#include "nsIRedirectResultListener.h"
|
||||
#include "nsIMultiPartChannel.h"
|
||||
|
||||
|
@ -60,7 +59,6 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
|||
public nsIParentChannel,
|
||||
public nsIChannelEventSink,
|
||||
public HttpChannelSecurityWarningReporter,
|
||||
public nsIProcessSwitchRequestor,
|
||||
public nsIMultiPartChannelListener {
|
||||
public:
|
||||
explicit DocumentLoadListener(dom::CanonicalBrowsingContext* aBrowsingContext,
|
||||
|
@ -81,7 +79,6 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
|||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIASYNCVERIFYREDIRECTREADYCALLBACK
|
||||
NS_DECL_NSICHANNELEVENTSINK
|
||||
NS_DECL_NSIPROCESSSWITCHREQUESTOR
|
||||
NS_DECL_NSIMULTIPARTCHANNELLISTENER
|
||||
|
||||
// We suspend the underlying channel when replacing ourselves with
|
||||
|
@ -194,6 +191,8 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
|||
dom::CanonicalBrowsingContext* aBrowsingContext,
|
||||
nsDocShellLoadState* aLoadState, uint64_t aOuterWindowId);
|
||||
|
||||
bool HasCrossOriginOpenerPolicyMismatch();
|
||||
|
||||
// This defines a variant that describes all the attribute setters (and their
|
||||
// parameters) from nsIParentChannel
|
||||
//
|
||||
|
|
|
@ -6215,7 +6215,6 @@ NS_INTERFACE_MAP_BEGIN(nsHttpChannel)
|
|||
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIChannelWithDivertableParentListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRequestTailUnblockCallback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIProcessSwitchRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY_CONCRETE(nsHttpChannel)
|
||||
NS_INTERFACE_MAP_END_INHERITING(HttpBaseChannel)
|
||||
|
||||
|
@ -7395,34 +7394,6 @@ nsHttpChannel::GetRequestMethod(nsACString& aMethod) {
|
|||
return HttpBaseChannel::GetRequestMethod(aMethod);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsHttpChannel::nsIProcessSwitchRequestor
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP nsHttpChannel::GetChannel(nsIChannel** aChannel) {
|
||||
*aChannel = do_AddRef(this).take();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This method returns the cached result of running the Cross-Origin-Opener
|
||||
// policy compare algorithm by calling ComputeCrossOriginOpenerPolicyMismatch
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::HasCrossOriginOpenerPolicyMismatch(bool* aMismatch) {
|
||||
MOZ_ASSERT(aMismatch);
|
||||
if (!aMismatch) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aMismatch = mHasCrossOriginOpenerPolicyMismatch;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetCachedCrossOriginOpenerPolicy(
|
||||
nsILoadInfo::CrossOriginOpenerPolicy* aPolicy) {
|
||||
return HttpBaseChannel::GetCrossOriginOpenerPolicy(aPolicy);
|
||||
}
|
||||
|
||||
// See https://gist.github.com/annevk/6f2dd8c79c77123f39797f6bdac43f3e
|
||||
// This method runs steps 1-4 of the algorithm to compare
|
||||
// cross-origin-opener policies
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/extensions/PStreamFilterParent.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "nsIProcessSwitchRequestor.h"
|
||||
|
||||
class nsDNSPrefetch;
|
||||
class nsICancelable;
|
||||
|
@ -79,8 +78,7 @@ class nsHttpChannel final : public HttpBaseChannel,
|
|||
public nsIChannelWithDivertableParentListener,
|
||||
public nsIRaceCacheWithNetwork,
|
||||
public nsIRequestTailUnblockCallback,
|
||||
public nsITimerCallback,
|
||||
public nsIProcessSwitchRequestor {
|
||||
public nsITimerCallback {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
|
@ -102,7 +100,6 @@ class nsHttpChannel final : public HttpBaseChannel,
|
|||
NS_DECL_NSIRACECACHEWITHNETWORK
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
NS_DECL_NSIREQUESTTAILUNBLOCKCALLBACK
|
||||
NS_DECL_NSIPROCESSSWITCHREQUESTOR
|
||||
|
||||
// nsIHttpAuthenticableChannel. We can't use
|
||||
// NS_DECL_NSIHTTPAUTHENTICABLECHANNEL because it duplicates cancel() and
|
||||
|
@ -485,6 +482,11 @@ class nsHttpChannel final : public HttpBaseChannel,
|
|||
nsresult ProcessCrossOriginResourcePolicyHeader();
|
||||
|
||||
nsresult ComputeCrossOriginOpenerPolicyMismatch();
|
||||
// This method returns the cached result of running the Cross-Origin-Opener
|
||||
// policy compare algorithm by calling ComputeCrossOriginOpenerPolicyMismatch
|
||||
bool HasCrossOriginOpenerPolicyMismatch() {
|
||||
return mHasCrossOriginOpenerPolicyMismatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function to process a single security header (STS or PKP), assumes
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsStandardURL.h"
|
||||
#include "LoadContextInfo.h"
|
||||
#include "nsCategoryManagerUtils.h"
|
||||
#include "nsIProcessSwitchRequestor.h"
|
||||
#include "nsSocketProviderService.h"
|
||||
#include "nsISocketProvider.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
|
|
@ -35,7 +35,6 @@ class nsIHttpUpgradeListener;
|
|||
class nsIPrefBranch;
|
||||
class nsICancelable;
|
||||
class nsICookieService;
|
||||
class nsIProcessSwitchRequestor;
|
||||
class nsIIOService;
|
||||
class nsIRequestContextService;
|
||||
class nsISiteSecurityService;
|
||||
|
|
Загрузка…
Ссылка в новой задаче