Bug 1633644 - P2. Do not call RedirectToRealChannel if the channel got cancelled. r=mattwoodrow.

Depends on D72795

Differential Revision: https://phabricator.services.mozilla.com/D72809
This commit is contained in:
Jean-Yves Avenard 2020-04-28 22:31:55 +00:00
Родитель f7bbf64d0e
Коммит 94a3210fdf
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -700,6 +700,8 @@ void DocumentLoadListener::Cancel(const nsresult& aStatusCode) {
("DocumentLoadListener Cancel [this=%p, "
"aStatusCode=%" PRIx32 " ]",
this, static_cast<uint32_t>(aStatusCode)));
mCancelled = true;
if (mDoingProcessSwitch) {
// If we've already initiated process-switching
// then we can no longer be cancelled and we'll
@ -1431,8 +1433,13 @@ DocumentLoadListener::RedirectToRealChannel(
return EnsureBridge()->Then(
GetCurrentThreadSerialEventTarget(), __func__,
[endpoints = std::move(aStreamFilterEndpoints), aRedirectFlags,
[self = RefPtr<DocumentLoadListener>(this),
endpoints = std::move(aStreamFilterEndpoints), aRedirectFlags,
aLoadFlags](ADocumentChannelBridge* aBridge) mutable {
if (self->mCancelled) {
return PDocumentChannelParent::RedirectToRealChannelPromise::
CreateAndResolve(NS_BINDING_ABORTED, __func__);
}
return aBridge->RedirectToRealChannel(std::move(endpoints),
aRedirectFlags, aLoadFlags);
},

Просмотреть файл

@ -434,6 +434,9 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
// This identifier is set by MaybeTriggerProcessSwitch, and is later
// passed to the childChannel in order to identify it in the new process.
uint64_t mCrossProcessRedirectIdentifier = 0;
// True if cancelled.
bool mCancelled = false;
};
NS_DEFINE_STATIC_IID_ACCESSOR(DocumentLoadListener, DOCUMENT_LOAD_LISTENER_IID)