зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1576714 - Part 4: Delay canceling original http channel during process switch, r=mattwoodrow
This patch changes when the original HttpChannelChild gets canceled during a process switch to be after when the process switch is completed. This is needed to prevent the load event firing too early in the original content process. Differential Revision: https://phabricator.services.mozilla.com/D47311 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f55d088ec3
Коммит
5a6a1b3307
|
@ -2104,16 +2104,6 @@ HttpChannelParent::StartRedirect(nsIChannel* newChannel, uint32_t redirectFlags,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void HttpChannelParent::CancelChildCrossProcessRedirect() {
|
||||
MOZ_ASSERT(!mDoingCrossProcessRedirect, "Already redirected");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mDoingCrossProcessRedirect = true;
|
||||
if (!mIPCClosed) {
|
||||
Unused << SendCancelRedirected();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelParent::CompleteRedirect(bool succeeded) {
|
||||
LOG(("HttpChannelParent::CompleteRedirect [this=%p succeeded=%d]\n", this,
|
||||
|
@ -2632,7 +2622,13 @@ HttpChannelParent::OnRedirectResult(bool succeeded) {
|
|||
|
||||
nsresult HttpChannelParent::TriggerCrossProcessSwitch(nsIHttpChannel* aChannel,
|
||||
uint64_t aIdentifier) {
|
||||
CancelChildCrossProcessRedirect();
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Mark ourselves as performing a cross-process redirect. This will prevent
|
||||
// messages being communicated to the underlying channel, allowing us to keep
|
||||
// it open.
|
||||
MOZ_ASSERT(!mDoingCrossProcessRedirect, "Already redirected");
|
||||
mDoingCrossProcessRedirect = true;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = aChannel;
|
||||
RefPtr<nsHttpChannel> httpChannel = do_QueryObject(channel);
|
||||
|
@ -2663,6 +2659,12 @@ nsresult HttpChannelParent::TriggerCrossProcessSwitch(nsIHttpChannel* aChannel,
|
|||
[=](uint64_t cpId) {
|
||||
nsresult rv;
|
||||
|
||||
// Cancel the channel in the original process, as the switch is
|
||||
// happening in earnest.
|
||||
if (!self->mIPCClosed) {
|
||||
Unused << self->SendCancelRedirected();
|
||||
}
|
||||
|
||||
// Register the new channel and obtain id for it
|
||||
nsCOMPtr<nsIRedirectChannelRegistrar> registrar =
|
||||
RedirectChannelRegistrar::GetOrCreate();
|
||||
|
@ -2732,8 +2734,14 @@ nsresult HttpChannelParent::TriggerCrossProcessSwitch(nsIHttpChannel* aChannel,
|
|||
self->CrossProcessRedirectDone(NS_ERROR_FAILURE, Nothing());
|
||||
});
|
||||
},
|
||||
[httpChannel](nsresult aStatus) {
|
||||
[=](nsresult aStatus) {
|
||||
MOZ_ASSERT(NS_FAILED(aStatus), "Status should be error");
|
||||
|
||||
// We failed to do a process switch. Make sure the content process has
|
||||
// canceled the channel, and then resume the load process with an error.
|
||||
if (!self->mIPCClosed) {
|
||||
Unused << self->SendCancelRedirected();
|
||||
}
|
||||
httpChannel->OnRedirectVerifyCallback(aStatus);
|
||||
});
|
||||
|
||||
|
|
|
@ -136,12 +136,6 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
|
|||
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
|
||||
// child channel.
|
||||
void CancelChildCrossProcessRedirect();
|
||||
|
||||
protected:
|
||||
// used to connect redirected-to channel in parent with just created
|
||||
// ChildChannel. Used during redirects.
|
||||
|
|
Загрузка…
Ссылка в новой задаче