/* 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/. */
RefPtr<RedirectToRealChannelPromise> p = mPromise.Ensure(__func__); // We make the promise use direct task dispatch in order to reduce the number // of event loops iterations.
mPromise.UseDirectTaskDispatch(__func__);
if (NS_FAILED(aResult)) {
Cancel(aResult);
} elseif (mCanceled) {
aResult = NS_ERROR_ABORT;
} else { const nsCOMPtr<nsIChannel> channel = mDocumentLoadListener->GetChannel();
mLoadGroup->AddRequest(channel, nullptr); // Adding the channel to the loadgroup could have triggered a status // change with an observer being called destroying the docShell, resulting // in the PPDC to be canceled. if (mCanceled) {
aResult = NS_ERROR_ABORT;
} else {
mLoadGroup->RemoveRequest(this, nullptr, NS_BINDING_REDIRECTED); for (auto& endpoint : mStreamFilterEndpoints) {
extensions::StreamFilterParent::Attach(channel, std::move(endpoint));
}
RefPtr<ParentChannelWrapper> wrapper = new ParentChannelWrapper(channel, mListener);
if (isDocumentLoad) { // Return value of setting synced field should be checked. See bug 1656492.
Unused << GetDocShell()->GetBrowsingContext()->SetCurrentLoadIdentifier(
Some(mLoadState->GetLoadIdentifier()));
}
// The DLL is waiting for us to resolve the // RedirectToRealChannelPromise given as parameter.
RefPtr<RedirectToRealChannelPromise> p =
self->RedirectToRealChannel(
std::move(aResolveValue.mStreamFilterEndpoints),
aResolveValue.mRedirectFlags, aResolveValue.mLoadFlags,
earlyHints)
->Then(
GetCurrentSerialEventTarget(), __func__,
[self](RedirectToRealChannelPromise::ResolveOrRejectValue&&
aValue) -> RefPtr<RedirectToRealChannelPromise> {
MOZ_ASSERT(aValue.IsResolve());
nsresult rv = aValue.ResolveValue(); if (NS_FAILED(rv)) {
self->DisconnectChildListeners(rv, rv);
}
self->mLoadGroup = nullptr;
self->mListener = nullptr;
self->mCallbacks = nullptr;
self->RemoveObserver(); auto p =
MakeRefPtr<RedirectToRealChannelPromise::Private>(
__func__);
p->UseDirectTaskDispatch(__func__);
p->ResolveOrReject(std::move(aValue), __func__); return p;
}); // We chain the promise the DLL is waiting on to the one returned by // RedirectToRealChannel. As soon as the promise returned is // resolved or rejected, so will the DLL's promise.
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.mContinueNavigating) {
self->DisconnectChildListeners(aRejectValue.mStatus,
aRejectValue.mLoadGroupStatus);
}
self->RemoveObserver();
}); return NS_OK;
}
mCanceled = true; // This will force the DocumentListener to abort the promise if there's one // pending.
mDocumentLoadListener->Cancel(aStatusCode, aReason);
if (mRequestObserversCalled) { // We have already emitted the event, we don't want to emit it again. // We only care about forwarding the first NS_HTTP_ON_MODIFY_REQUEST_TOPIC // encountered. return NS_OK;
}
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aSubject); if (!channel || mDocumentLoadListener->GetChannel() != channel) { // Not a channel we are interested with. return NS_OK;
}
LOG(("DocumentChannelParent Observe [this=%p aChannel=%p]", this,
channel.get())); if (!nsCRT::strcmp(aTopic, NS_HTTP_ON_MODIFY_REQUEST_TOPIC)) {
mRequestObserversCalled = true;
gHttpHandler->OnModifyDocumentRequest(this);
}
return NS_OK;
}
} // namespace net
} // namespace mozilla
#undef LOG
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.