зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 3e349b00a1e4 (bug 1649349) for causing failures in browser_CORS-console-warnings.js
This commit is contained in:
Родитель
355f38ec2f
Коммит
d60357a61d
|
@ -123,15 +123,8 @@ IPCResult DocumentChannelChild::RecvFailedAsyncOpen(
|
|||
}
|
||||
|
||||
IPCResult DocumentChannelChild::RecvDisconnectChildListeners(
|
||||
const nsresult& aStatus, const nsresult& aLoadGroupStatus,
|
||||
bool aSwitchedProcess) {
|
||||
// If this is a normal failure, then we want to disconnect our listeners and
|
||||
// notify them of the failure. If this is a process switch, then we can just
|
||||
// ignore it silently, and trust that the switch will shut down our docshell
|
||||
// and cancel us when it's ready.
|
||||
if (!aSwitchedProcess) {
|
||||
DisconnectChildListeners(aStatus, aLoadGroupStatus);
|
||||
}
|
||||
const nsresult& aStatus, const nsresult& aLoadGroupStatus) {
|
||||
DisconnectChildListeners(aStatus, aLoadGroupStatus);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,7 @@ class DocumentChannelChild final : public DocumentChannel,
|
|||
mozilla::ipc::IPCResult RecvFailedAsyncOpen(const nsresult& aStatusCode);
|
||||
|
||||
mozilla::ipc::IPCResult RecvDisconnectChildListeners(
|
||||
const nsresult& aStatus, const nsresult& aLoadGroupStatus,
|
||||
bool aSwitchedProcess);
|
||||
const nsresult& aStatus, const nsresult& aLoadGroupStatus);
|
||||
|
||||
mozilla::ipc::IPCResult RecvDeleteSelf();
|
||||
|
||||
|
|
|
@ -79,11 +79,11 @@ bool DocumentChannelParent::Init(dom::CanonicalBrowsingContext* aContext,
|
|||
self->mDocumentLoadListener = nullptr;
|
||||
},
|
||||
[self](DocumentLoadListener::OpenPromiseFailedType&& aRejectValue) {
|
||||
if (self->CanSend()) {
|
||||
Unused << self->SendDisconnectChildListeners(
|
||||
aRejectValue.mStatus, aRejectValue.mLoadGroupStatus,
|
||||
aRejectValue.mSwitchedProcess);
|
||||
if (!self->CanSend()) {
|
||||
return;
|
||||
}
|
||||
Unused << self->SendDisconnectChildListeners(
|
||||
aRejectValue.mStatus, aRejectValue.mLoadGroupStatus);
|
||||
self->mDocumentLoadListener = nullptr;
|
||||
});
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "mozilla/StaticPrefs_extensions.h"
|
||||
#include "mozilla/StaticPrefs_fission.h"
|
||||
#include "mozilla/StaticPrefs_security.h"
|
||||
#include "mozilla/dom/BrowserParent.h"
|
||||
#include "mozilla/dom/BrowsingContextGroup.h"
|
||||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
||||
#include "mozilla/dom/ChildProcessChannelListener.h"
|
||||
|
@ -798,9 +797,15 @@ void DocumentLoadListener::Cancel(const nsresult& aStatusCode) {
|
|||
("DocumentLoadListener Cancel [this=%p, "
|
||||
"aStatusCode=%" PRIx32 " ]",
|
||||
this, static_cast<uint32_t>(aStatusCode)));
|
||||
if (mOpenPromiseResolved) {
|
||||
mCancelled = true;
|
||||
|
||||
if (mDoingProcessSwitch) {
|
||||
// If we've already initiated process-switching
|
||||
// then we can no longer be cancelled and we'll
|
||||
// disconnect the old listeners when done.
|
||||
return;
|
||||
}
|
||||
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(aStatusCode);
|
||||
}
|
||||
|
@ -821,16 +826,12 @@ void DocumentLoadListener::DisconnectListeners(nsresult aStatus,
|
|||
|
||||
Disconnect();
|
||||
|
||||
if (!aSwitchedProcess) {
|
||||
// If we're not going to send anything else to the content process, and
|
||||
// we haven't yet consumed a stream filter promise, then we're never going
|
||||
// to. If we're disconnecting the old content process due to a proces
|
||||
// switch, then we can rely on FinishReplacementChannelSetup being called
|
||||
// (even if the switch failed), so we clear at that point instead.
|
||||
// TODO: This might be because we retargeted the stream to the download
|
||||
// handler or similar. Do we need to attach a stream filter to that?
|
||||
mStreamFilterRequests.Clear();
|
||||
}
|
||||
// If we're not going to send anything else to the content process, and
|
||||
// we haven't yet consumed a stream filter promise, then we're never going
|
||||
// to.
|
||||
// TODO: This might be because we retargeted the stream to the download
|
||||
// handler or similar. Do we need to attach a stream filter to that?
|
||||
mStreamFilterRequests.Clear();
|
||||
}
|
||||
|
||||
void DocumentLoadListener::RedirectToRealChannelFinished(nsresult aRv) {
|
||||
|
@ -886,7 +887,11 @@ void DocumentLoadListener::FinishReplacementChannelSetup(nsresult aResult) {
|
|||
ctx->EndDocumentLoad(false);
|
||||
}
|
||||
});
|
||||
mStreamFilterRequests.Clear();
|
||||
|
||||
if (mDoingProcessSwitch) {
|
||||
DisconnectListeners(NS_BINDING_ABORTED, NS_BINDING_ABORTED,
|
||||
NS_SUCCEEDED(aResult));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRedirectChannelRegistrar> registrar =
|
||||
RedirectChannelRegistrar::GetOrCreate();
|
||||
|
@ -1304,8 +1309,8 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
|
|||
|
||||
// Get information about the current document loaded in our BrowsingContext.
|
||||
nsCOMPtr<nsIPrincipal> currentPrincipal;
|
||||
RefPtr<WindowGlobalParent> wgp = browsingContext->GetCurrentWindowGlobal();
|
||||
if (wgp) {
|
||||
if (RefPtr<WindowGlobalParent> wgp =
|
||||
browsingContext->GetCurrentWindowGlobal()) {
|
||||
currentPrincipal = wgp->DocumentPrincipal();
|
||||
}
|
||||
RefPtr<ContentParent> contentParent = browsingContext->GetContentParent();
|
||||
|
@ -1424,18 +1429,7 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
|
|||
NS_ConvertUTF16toUTF8(currentRemoteType).get(),
|
||||
NS_ConvertUTF16toUTF8(remoteType).get()));
|
||||
|
||||
// We're now committing to a process switch, so we can disconnect from
|
||||
// the listeners in the old process.
|
||||
mDoingProcessSwitch = true;
|
||||
if (wgp) {
|
||||
if (RefPtr<BrowserParent> browserParent = wgp->GetBrowserParent()) {
|
||||
// This load has already started, so we want to filter out any 'stop'
|
||||
// progress events coming from the old process as a result of us
|
||||
// disconnecting from it.
|
||||
browserParent->SuspendProgressEventsUntilAfterNextLoadStarts();
|
||||
}
|
||||
}
|
||||
DisconnectListeners(NS_BINDING_ABORTED, NS_BINDING_ABORTED, true);
|
||||
|
||||
LOG(("Process Switch: Calling ChangeRemoteness"));
|
||||
browsingContext
|
||||
|
|
|
@ -468,6 +468,9 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
|||
// passed to the childChannel in order to identify it in the new process.
|
||||
uint64_t mLoadIdentifier = 0;
|
||||
|
||||
// True if cancelled.
|
||||
bool mCancelled = false;
|
||||
|
||||
Maybe<nsCString> mOriginalUriString;
|
||||
|
||||
bool mSupportsRedirectToRealChannel = true;
|
||||
|
|
|
@ -46,7 +46,7 @@ child:
|
|||
// the loadgroup (but aStatus is passed as the parameter to RemoveRequest).
|
||||
// We do this so we can remove using NS_BINDING_RETARGETED, but still have the
|
||||
// channel not be in an error state.
|
||||
async DisconnectChildListeners(nsresult aStatus, nsresult aLoadGroupReason, bool aSwitchedProcess);
|
||||
async DisconnectChildListeners(nsresult aStatus, nsresult aLoadGroupReason);
|
||||
|
||||
// Triggers replacing this DocumentChannel with a 'real' channel (like PHttpChannel),
|
||||
// and notifies the listener via a redirect to the new channel.
|
||||
|
|
|
@ -204,14 +204,8 @@ NS_IMETHODIMP ParentProcessDocumentChannel::AsyncOpen(
|
|||
p->ChainTo(aResolveValue.mPromise.forget(), __func__);
|
||||
},
|
||||
[self](DocumentLoadListener::OpenPromiseFailedType&& aRejectValue) {
|
||||
// If this is a normal failure, then we want to disconnect our listeners
|
||||
// and notify them of the failure. If this is a process switch, then we
|
||||
// can just ignore it silently, and trust that the switch will shut down
|
||||
// our docshell and cancel us when it's ready.
|
||||
if (!aRejectValue.mSwitchedProcess) {
|
||||
self->DisconnectChildListeners(aRejectValue.mStatus,
|
||||
aRejectValue.mLoadGroupStatus);
|
||||
}
|
||||
self->DisconnectChildListeners(aRejectValue.mStatus,
|
||||
aRejectValue.mLoadGroupStatus);
|
||||
self->RemoveObserver();
|
||||
});
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче