mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1760580 - P2: Provide a reason when request is cancelled with NS_BINDING_ABORTED, r=necko-reviewers,media-playback-reviewers,valentin,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D156071
This commit is contained in:
parent
cc6c147f88
commit
d164608d66
@ -1239,7 +1239,8 @@ void CanonicalBrowsingContext::CanonicalDiscard() {
|
||||
}
|
||||
|
||||
if (mCurrentLoad) {
|
||||
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
|
||||
mCurrentLoad->Cancel(NS_BINDING_ABORTED,
|
||||
"CanonicalBrowsingContext::CanonicalDiscard"_ns);
|
||||
}
|
||||
|
||||
if (mWebProgress) {
|
||||
@ -1401,7 +1402,7 @@ void CanonicalBrowsingContext::GoBack(
|
||||
|
||||
// Stop any known network loads if necessary.
|
||||
if (mCurrentLoad) {
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD, ""_ns);
|
||||
}
|
||||
|
||||
if (nsDocShell* docShell = nsDocShell::Cast(GetDocShell())) {
|
||||
@ -1427,7 +1428,7 @@ void CanonicalBrowsingContext::GoForward(
|
||||
|
||||
// Stop any known network loads if necessary.
|
||||
if (mCurrentLoad) {
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD, ""_ns);
|
||||
}
|
||||
|
||||
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
|
||||
@ -1453,7 +1454,7 @@ void CanonicalBrowsingContext::GoToIndex(
|
||||
|
||||
// Stop any known network loads if necessary.
|
||||
if (mCurrentLoad) {
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD, ""_ns);
|
||||
}
|
||||
|
||||
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
|
||||
@ -1477,7 +1478,7 @@ void CanonicalBrowsingContext::Reload(uint32_t aReloadFlags) {
|
||||
|
||||
// Stop any known network loads if necessary.
|
||||
if (mCurrentLoad) {
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD, ""_ns);
|
||||
}
|
||||
|
||||
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
|
||||
@ -1494,7 +1495,8 @@ void CanonicalBrowsingContext::Stop(uint32_t aStopFlags) {
|
||||
|
||||
// Stop any known network loads if necessary.
|
||||
if (mCurrentLoad && (aStopFlags & nsIWebNavigation::STOP_NETWORK)) {
|
||||
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
|
||||
mCurrentLoad->Cancel(NS_BINDING_ABORTED,
|
||||
"CanonicalBrowsingContext::Stop"_ns);
|
||||
}
|
||||
|
||||
// Ask the docshell to stop to handle loads that haven't
|
||||
@ -2194,7 +2196,7 @@ bool CanonicalBrowsingContext::StartDocumentLoad(
|
||||
|
||||
// If we want to do a download, don't cancel the current navigation.
|
||||
if (!aLoad->IsDownload()) {
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
|
||||
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD, ""_ns);
|
||||
}
|
||||
}
|
||||
mCurrentLoad = aLoad;
|
||||
|
@ -13300,7 +13300,8 @@ nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) {
|
||||
nsDOMNavigationTiming* aTiming) {
|
||||
MOZ_ASSERT(aLoadState->GetPendingRedirectedChannel());
|
||||
if (NS_WARN_IF(self->mIsBeingDestroyed)) {
|
||||
aLoadState->GetPendingRedirectedChannel()->Cancel(NS_BINDING_ABORTED);
|
||||
aLoadState->GetPendingRedirectedChannel()->CancelWithReason(
|
||||
NS_BINDING_ABORTED, "nsDocShell::mIsBeingDestroyed"_ns);
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,8 @@ void BodyConsumer::ShutDownMainThreadConsuming() {
|
||||
mShuttingDown = true;
|
||||
|
||||
if (mConsumeBodyPump) {
|
||||
mConsumeBodyPump->Cancel(NS_BINDING_ABORTED);
|
||||
mConsumeBodyPump->CancelWithReason(
|
||||
NS_BINDING_ABORTED, "BodyConsumer::ShutDownMainThreadConsuming"_ns);
|
||||
mConsumeBodyPump = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1776,7 +1776,8 @@ nsresult nsObjectLoadingContent::CloseChannel() {
|
||||
nsCOMPtr<nsIStreamListener> listenerGrip(mFinalListener);
|
||||
mChannel = nullptr;
|
||||
mFinalListener = nullptr;
|
||||
channelGrip->Cancel(NS_BINDING_ABORTED);
|
||||
channelGrip->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"nsObjectLoadingContent::CloseChannel"_ns);
|
||||
if (listenerGrip) {
|
||||
// mFinalListener is only set by LoadObject after OnStartRequest, or
|
||||
// by OnStartRequest in the case of late-opened plugin streams
|
||||
|
@ -110,7 +110,8 @@ nsForceXMLListener::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
|
||||
|
||||
nsSyncLoader::~nsSyncLoader() {
|
||||
if (mLoading && mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"nsSyncLoader::~nsSyncLoader"_ns);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,8 @@ void AlternativeDataStreamListener::Cancel() {
|
||||
if (mChannel && mStatus != AlternativeDataStreamListener::FALLBACK) {
|
||||
// if mStatus is fallback, we need to keep channel to forward request back
|
||||
// to FetchDriver
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"AlternativeDataStreamListener::Cancel"_ns);
|
||||
mChannel = nullptr;
|
||||
}
|
||||
mStatus = AlternativeDataStreamListener::CANCELED;
|
||||
@ -923,7 +924,8 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest) {
|
||||
// channel will call in with an errored OnStartRequest().
|
||||
|
||||
if (mFromPreload && mAborted) {
|
||||
aRequest->Cancel(NS_BINDING_ABORTED);
|
||||
aRequest->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"FetchDriver::OnStartRequest aborted"_ns);
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
@ -1619,7 +1621,8 @@ void FetchDriver::RunAbortAlgorithm() {
|
||||
}
|
||||
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"FetchDriver::RunAbortAlgorithm"_ns);
|
||||
mChannel = nullptr;
|
||||
}
|
||||
|
||||
|
@ -1794,7 +1794,8 @@ class HTMLMediaElement::ChannelLoader final {
|
||||
void Cancel() {
|
||||
mCancelled = true;
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"HTMLMediaElement::ChannelLoader::Cancel"_ns);
|
||||
mChannel = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,8 @@ void HTMLTrackElement::SetSrc(const nsAString& aSrc, ErrorResult& aError) {
|
||||
// Stop WebVTTListener.
|
||||
mListener = nullptr;
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"HTMLTrackElement::SetSrc"_ns);
|
||||
mChannel = nullptr;
|
||||
}
|
||||
|
||||
@ -473,7 +474,8 @@ void HTMLTrackElement::DispatchTrustedEvent(const nsAString& aName) {
|
||||
|
||||
void HTMLTrackElement::CancelChannelAndListener() {
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"HTMLTrackElement::CancelChannelAndListener"_ns);
|
||||
mChannel->SetNotificationCallbacks(nullptr);
|
||||
mChannel = nullptr;
|
||||
}
|
||||
|
@ -128,7 +128,8 @@ nsresult FetchImageHelper::ImageFetchListener::FetchDecodedImageFromURI(
|
||||
void FetchImageHelper::ImageFetchListener::Clear() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(
|
||||
NS_BINDING_ABORTED, "FetchImageHelper::ImageFetchListener::Clear"_ns);
|
||||
mChannel = nullptr;
|
||||
}
|
||||
mHelper = nullptr;
|
||||
|
@ -799,7 +799,7 @@ void CompareNetwork::Abort() {
|
||||
mState = Finished;
|
||||
|
||||
MOZ_ASSERT(mChannel);
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED, "CompareNetwork::Abort"_ns);
|
||||
mChannel = nullptr;
|
||||
|
||||
if (mCC) {
|
||||
@ -1154,7 +1154,7 @@ void CompareCache::Abort() {
|
||||
mState = Finished;
|
||||
|
||||
if (mPump) {
|
||||
mPump->Cancel(NS_BINDING_ABORTED);
|
||||
mPump->CancelWithReason(NS_BINDING_ABORTED, "CompareCache::Abort"_ns);
|
||||
mPump = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ class MainThreadReleaseRunnable final : public Runnable {
|
||||
NS_IMETHOD
|
||||
Run() override {
|
||||
if (mLoadGroupToCancel) {
|
||||
mLoadGroupToCancel->Cancel(NS_BINDING_ABORTED);
|
||||
mLoadGroupToCancel->CancelWithReason(
|
||||
NS_BINDING_ABORTED, "WorkerLoadInfo::MainThreadReleaseRunnable"_ns);
|
||||
mLoadGroupToCancel = nullptr;
|
||||
}
|
||||
|
||||
|
@ -928,7 +928,8 @@ void XMLHttpRequestMainThread::CloseRequest() {
|
||||
mWaitingForOnStopRequest = false;
|
||||
mErrorLoad = ErrorType::eTerminated;
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"XMLHttpRequestMainThread::CloseRequest"_ns);
|
||||
}
|
||||
if (mTimeoutTimer) {
|
||||
mTimeoutTimer->Cancel();
|
||||
|
@ -219,7 +219,8 @@ void XMLDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
if (mChannelIsPending) {
|
||||
StopDocumentLoad();
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"XMLDocument::ResetToURI"_ns);
|
||||
mChannelIsPending = false;
|
||||
}
|
||||
|
||||
|
@ -3165,7 +3165,8 @@ imgCacheValidator::OnStartRequest(nsIRequest* aRequest) {
|
||||
// because OnStartRequest got delivered more than once), just bail.
|
||||
if (!mRequest) {
|
||||
MOZ_ASSERT_UNREACHABLE("OnStartRequest delivered more than once?");
|
||||
aRequest->Cancel(NS_BINDING_ABORTED);
|
||||
aRequest->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"OnStartRequest delivered more than once?"_ns);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -3191,7 +3192,8 @@ imgCacheValidator::OnStartRequest(nsIRequest* aRequest) {
|
||||
|
||||
if (isFromCache && sameURI) {
|
||||
// We don't need to load this any more.
|
||||
aRequest->Cancel(NS_BINDING_ABORTED);
|
||||
aRequest->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"imgCacheValidator::OnStartRequest"_ns);
|
||||
mNewRequest = nullptr;
|
||||
|
||||
// Clear the validator before updating the proxies. The notifications may
|
||||
|
@ -369,7 +369,8 @@ void nsFontFaceLoader::Cancel() {
|
||||
mLoadTimer = nullptr;
|
||||
}
|
||||
if (nsCOMPtr<nsIChannel> channel = std::move(mChannel)) {
|
||||
channel->Cancel(NS_BINDING_ABORTED);
|
||||
channel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"nsFontFaceLoader::OnStopRequest"_ns);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,8 @@ nsLoadGroup::nsLoadGroup()
|
||||
}
|
||||
|
||||
nsLoadGroup::~nsLoadGroup() {
|
||||
DebugOnly<nsresult> rv = Cancel(NS_BINDING_ABORTED);
|
||||
DebugOnly<nsresult> rv =
|
||||
CancelWithReason(NS_BINDING_ABORTED, "nsLoadGroup::~nsLoadGroup"_ns);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cancel failed");
|
||||
|
||||
mDefaultLoadRequest = nullptr;
|
||||
|
@ -455,13 +455,18 @@ DocumentChannelChild::OnRedirectVerifyCallback(nsresult aStatusCode) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentChannelChild::Cancel(nsresult aStatusCode) {
|
||||
return CancelWithReason(aStatusCode, "DocumentChannelChild::Cancel"_ns);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DocumentChannelChild::CancelWithReason(
|
||||
nsresult aStatusCode, const nsACString& aReason) {
|
||||
if (mCanceled) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mCanceled = true;
|
||||
if (CanSend()) {
|
||||
SendCancel(aStatusCode);
|
||||
SendCancel(aStatusCode, aReason);
|
||||
}
|
||||
|
||||
ShutdownListeners(aStatusCode);
|
||||
|
@ -34,6 +34,8 @@ class DocumentChannelChild final : public DocumentChannel,
|
||||
|
||||
NS_IMETHOD AsyncOpen(nsIStreamListener* aListener) override;
|
||||
NS_IMETHOD Cancel(nsresult aStatusCode) override;
|
||||
NS_IMETHOD CancelWithReason(nsresult aStatusCode,
|
||||
const nsACString& aReason) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvFailedAsyncOpen(const nsresult& aStatusCode);
|
||||
|
||||
|
@ -32,15 +32,16 @@ class DocumentChannelParent final
|
||||
const DocumentChannelCreationArgs& aArgs);
|
||||
|
||||
// PDocumentChannelParent
|
||||
ipc::IPCResult RecvCancel(const nsresult& aStatus) {
|
||||
ipc::IPCResult RecvCancel(const nsresult& aStatus, const nsCString& aReason) {
|
||||
if (mDocumentLoadListener) {
|
||||
mDocumentLoadListener->Cancel(aStatus);
|
||||
mDocumentLoadListener->Cancel(aStatus, aReason);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override {
|
||||
if (mDocumentLoadListener) {
|
||||
mDocumentLoadListener->Cancel(NS_BINDING_ABORTED);
|
||||
mDocumentLoadListener->Cancel(NS_BINDING_ABORTED,
|
||||
"DocumentChannelParent::ActorDestroy"_ns);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1091,7 +1091,8 @@ void DocumentLoadListener::NotifyDocumentChannelFailed() {
|
||||
},
|
||||
[]() {});
|
||||
|
||||
Cancel(NS_BINDING_ABORTED);
|
||||
Cancel(NS_BINDING_ABORTED,
|
||||
"DocumentLoadListener::NotifyDocumentChannelFailed"_ns);
|
||||
}
|
||||
|
||||
void DocumentLoadListener::Disconnect(bool aContinueNavigating) {
|
||||
@ -1117,7 +1118,8 @@ void DocumentLoadListener::Disconnect(bool aContinueNavigating) {
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentLoadListener::Cancel(const nsresult& aStatusCode) {
|
||||
void DocumentLoadListener::Cancel(const nsresult& aStatusCode,
|
||||
const nsACString& aReason) {
|
||||
LOG(
|
||||
("DocumentLoadListener Cancel [this=%p, "
|
||||
"aStatusCode=%" PRIx32 " ]",
|
||||
@ -1126,7 +1128,7 @@ void DocumentLoadListener::Cancel(const nsresult& aStatusCode) {
|
||||
return;
|
||||
}
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(aStatusCode);
|
||||
mChannel->CancelWithReason(aStatusCode, aReason);
|
||||
}
|
||||
|
||||
DisconnectListeners(aStatusCode, aStatusCode);
|
||||
@ -1739,14 +1741,16 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
|
||||
if (!browsingContext->IsOwnedByProcess(GetContentProcessId(mContentParent))) {
|
||||
MOZ_LOG(gProcessIsolationLog, LogLevel::Error,
|
||||
("Process Switch Abort: context no longer owned by creator"));
|
||||
Cancel(NS_BINDING_ABORTED);
|
||||
Cancel(NS_BINDING_ABORTED,
|
||||
"Process Switch Abort: context no longer owned by creator"_ns);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (browsingContext->IsReplaced()) {
|
||||
MOZ_LOG(gProcessIsolationLog, LogLevel::Warning,
|
||||
("Process Switch Abort: replaced browsing context"));
|
||||
Cancel(NS_BINDING_ABORTED);
|
||||
Cancel(NS_BINDING_ABORTED,
|
||||
"Process Switch Abort: replaced browsing context"_ns);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1764,7 +1768,8 @@ bool DocumentLoadListener::MaybeTriggerProcessSwitch(
|
||||
MOZ_LOG(gProcessIsolationLog, LogLevel::Error,
|
||||
("Process Switch Abort: CheckIsolationForNavigation Failed with %s",
|
||||
GetStaticErrorName(optionsResult.inspectErr())));
|
||||
Cancel(optionsResult.unwrapErr());
|
||||
Cancel(optionsResult.unwrapErr(),
|
||||
"Process Switch Abort: CheckIsolationForNavigation Failed"_ns);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2444,7 +2449,9 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
||||
LOG(
|
||||
("DocumentLoadListener::RedirectToRealChannel failed because "
|
||||
"browsingContext no longer owned by creator"));
|
||||
Cancel(NS_BINDING_ABORTED);
|
||||
Cancel(NS_BINDING_ABORTED,
|
||||
"DocumentLoadListener::RedirectToRealChannel failed because "
|
||||
"browsingContext no longer owned by creator"_ns);
|
||||
return NS_OK;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
|
@ -227,7 +227,7 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(DOCUMENT_LOAD_LISTENER_IID)
|
||||
|
||||
// Called by the DocumentChannel if cancelled.
|
||||
void Cancel(const nsresult& aStatusCode);
|
||||
void Cancel(const nsresult& aStatusCode, const nsACString& aReason);
|
||||
|
||||
nsIChannel* GetChannel() const { return mChannel; }
|
||||
|
||||
|
@ -28,7 +28,7 @@ protocol PDocumentChannel
|
||||
|
||||
parent:
|
||||
|
||||
async Cancel(nsresult status);
|
||||
async Cancel(nsresult status, nsCString reason);
|
||||
|
||||
async __delete__();
|
||||
|
||||
|
@ -248,7 +248,12 @@ NS_IMETHODIMP ParentProcessDocumentChannel::AsyncOpen(
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ParentProcessDocumentChannel::Cancel(nsresult aStatus) {
|
||||
LOG(("ParentProcessDocumentChannel Cancel [this=%p]", this));
|
||||
return CancelWithReason(aStatus, "ParentProcessDocumentChannel::Cancel"_ns);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ParentProcessDocumentChannel::CancelWithReason(
|
||||
nsresult aStatusCode, const nsACString& aReason) {
|
||||
LOG(("ParentProcessDocumentChannel CancelWithReason [this=%p]", this));
|
||||
if (mCanceled) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -256,7 +261,7 @@ NS_IMETHODIMP ParentProcessDocumentChannel::Cancel(nsresult aStatus) {
|
||||
mCanceled = true;
|
||||
// This will force the DocumentListener to abort the promise if there's one
|
||||
// pending.
|
||||
mDocumentLoadListener->Cancel(aStatus);
|
||||
mDocumentLoadListener->Cancel(aStatusCode, aReason);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ class ParentProcessDocumentChannel : public DocumentChannel,
|
||||
|
||||
NS_IMETHOD AsyncOpen(nsIStreamListener* aListener) override;
|
||||
NS_IMETHOD Cancel(nsresult aStatusCode) override;
|
||||
NS_IMETHOD CancelWithReason(nsresult aStatusCode,
|
||||
const nsACString& aReason) override;
|
||||
|
||||
RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
|
||||
RedirectToRealChannel(
|
||||
|
@ -1806,7 +1806,8 @@ HttpChannelChild::Cancel(nsresult aStatus) {
|
||||
#endif
|
||||
|
||||
if (remoteChannelExists) {
|
||||
SendCancel(aStatus, mLoadInfo->GetRequestBlockingReason(), logOnParent);
|
||||
SendCancel(aStatus, mLoadInfo->GetRequestBlockingReason(),
|
||||
mCanceledReason, logOnParent);
|
||||
} else if (MOZ_UNLIKELY(!LoadOnStartRequestCalled() ||
|
||||
!LoadOnStopRequestCalled())) {
|
||||
Unused << AsyncAbort(mStatus);
|
||||
|
@ -703,8 +703,9 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvResume() {
|
||||
|
||||
mozilla::ipc::IPCResult HttpChannelParent::RecvCancel(
|
||||
const nsresult& status, const uint32_t& requestBlockingReason,
|
||||
const mozilla::Maybe<nsCString>& logString) {
|
||||
LOG(("HttpChannelParent::RecvCancel [this=%p]\n", this));
|
||||
const nsACString& reason, const mozilla::Maybe<nsCString>& logString) {
|
||||
LOG(("HttpChannelParent::RecvCancel [this=%p, reason=%s]\n", this,
|
||||
PromiseFlatCString(reason).get()));
|
||||
|
||||
// logging child cancel reason on the parent side
|
||||
if (logString.isSome()) {
|
||||
@ -713,7 +714,7 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvCancel(
|
||||
|
||||
// May receive cancel before channel has been constructed!
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(status);
|
||||
mChannel->CancelWithReason(status, reason);
|
||||
|
||||
if (MOZ_UNLIKELY(requestBlockingReason !=
|
||||
nsILoadInfo::BLOCKING_REASON_NONE)) {
|
||||
|
@ -169,6 +169,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
|
||||
virtual mozilla::ipc::IPCResult RecvResume() override;
|
||||
virtual mozilla::ipc::IPCResult RecvCancel(
|
||||
const nsresult& status, const uint32_t& requestBlockingReason,
|
||||
const nsACString& reason,
|
||||
const mozilla::Maybe<nsCString>& logString) override;
|
||||
virtual mozilla::ipc::IPCResult RecvRedirect2Verify(
|
||||
const nsresult& result, const RequestHeaderTuples& changedHeaders,
|
||||
|
@ -39,8 +39,8 @@ parent:
|
||||
async Suspend();
|
||||
async Resume();
|
||||
|
||||
async Cancel(nsresult status, uint32_t requestBlockingReason,
|
||||
nsCString? logString);
|
||||
async Cancel(nsresult status, uint32_t requestBlockingReason,
|
||||
nsCString aReason, nsCString? logString);
|
||||
|
||||
// Reports approval/veto of redirect by child process redirect observers
|
||||
async Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,
|
||||
|
@ -5474,8 +5474,8 @@ nsHttpChannel::Cancel(nsresult status) {
|
||||
}
|
||||
#endif
|
||||
|
||||
LOG(("nsHttpChannel::Cancel [this=%p status=%" PRIx32 "]\n", this,
|
||||
static_cast<uint32_t>(status)));
|
||||
LOG(("nsHttpChannel::Cancel [this=%p status=%" PRIx32 ", reason=%s]\n", this,
|
||||
static_cast<uint32_t>(status), mCanceledReason.get()));
|
||||
MOZ_ASSERT_IF(!(mConnectionInfo && mConnectionInfo->UsingConnect()) &&
|
||||
NS_SUCCEEDED(mStatus),
|
||||
!AllowedErrorForHTTPSRRFallback(status));
|
||||
|
@ -279,12 +279,12 @@ ExtensionStreamGetter::Cancel(nsresult aStatus) {
|
||||
mStatus = aStatus;
|
||||
|
||||
if (mPump) {
|
||||
mPump->Cancel(aStatus);
|
||||
mPump->CancelWithReason(aStatus, "ExtensionStreamGetter::Cancel"_ns);
|
||||
mPump = nullptr;
|
||||
}
|
||||
|
||||
if (mIsJarChannel && mJarChannel) {
|
||||
mJarChannel->Cancel(aStatus);
|
||||
mJarChannel->CancelWithReason(aStatus, "ExtensionStreamGetter::Cancel"_ns);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -299,7 +299,8 @@ void ExtensionStreamGetter::CancelRequest(nsIStreamListener* aListener,
|
||||
|
||||
aListener->OnStartRequest(aChannel);
|
||||
aListener->OnStopRequest(aChannel, aResult);
|
||||
aChannel->Cancel(NS_BINDING_ABORTED);
|
||||
aChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"ExtensionStreamGetter::CancelRequest"_ns);
|
||||
}
|
||||
|
||||
// Handle an input stream sent from the parent.
|
||||
|
@ -78,7 +78,8 @@ void RemoteStreamGetter::CancelRequest(nsIStreamListener* aListener,
|
||||
|
||||
aListener->OnStartRequest(aChannel);
|
||||
aListener->OnStopRequest(aChannel, aResult);
|
||||
aChannel->Cancel(NS_BINDING_ABORTED);
|
||||
aChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"RemoteStreamGetter::CancelRequest"_ns);
|
||||
}
|
||||
|
||||
// Handle an input stream sent from the parent.
|
||||
|
@ -618,7 +618,8 @@ AsyncFetchAndSetIconForPage::Cancel() {
|
||||
}
|
||||
mCanceled = true;
|
||||
if (mRequest) {
|
||||
mRequest->Cancel(NS_BINDING_ABORTED);
|
||||
mRequest->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"AsyncFetchAndSetIconForPage::Cancel"_ns);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -644,7 +645,8 @@ AsyncFetchAndSetIconForPage::OnStartRequest(nsIRequest* aRequest) {
|
||||
!path.EqualsLiteral("/favicon.ico") &&
|
||||
NS_SUCCEEDED(httpChannel->IsNoStoreResponse(&isNoStore)) && isNoStore) {
|
||||
// Abandon the network fetch.
|
||||
mRequest->Cancel(NS_BINDING_ABORTED);
|
||||
mRequest->CancelWithReason(
|
||||
NS_BINDING_ABORTED, "AsyncFetchAndSetIconForPage::OnStartRequest"_ns);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -267,7 +267,8 @@ nsresult PageIconProtocolHandler::NewChannelInternal(nsIURI* aURI,
|
||||
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
channel->Cancel(NS_BINDING_ABORTED);
|
||||
channel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"GetFaviconData failed"_ns);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,8 @@ class faviconAsyncLoader : public AsyncStatementCallback, public nsICancelable {
|
||||
|
||||
aListener->OnStartRequest(aChannel);
|
||||
aListener->OnStopRequest(aChannel, aResult);
|
||||
aChannel->Cancel(NS_BINDING_ABORTED);
|
||||
aChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"faviconAsyncLoader::CancelRequest"_ns);
|
||||
}
|
||||
|
||||
NS_IMETHOD HandleCompletion(uint16_t aReason) override {
|
||||
|
@ -255,7 +255,10 @@ MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP nsDocLoader::Stop(void) {
|
||||
|
||||
NS_OBSERVER_ARRAY_NOTIFY_XPCOM_OBSERVERS(mChildList, Stop, ());
|
||||
|
||||
if (mLoadGroup) rv = mLoadGroup->Cancel(NS_BINDING_ABORTED);
|
||||
if (mLoadGroup) {
|
||||
rv = mLoadGroup->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"nsDocLoader::Stop"_ns);
|
||||
}
|
||||
|
||||
// Don't report that we're flushing layout so IsBusy returns false after a
|
||||
// Stop call.
|
||||
|
@ -282,7 +282,8 @@ void PreloaderBase::RemoveLinkPreloadNode(nsINode* aNode) {
|
||||
RemoveSelf(aNode->OwnerDoc());
|
||||
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
mChannel->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"PreloaderBase::RemoveLinkPreloadNode"_ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ nsresult IconLoader::LoadIcon(nsIURI* aIconURI, nsINode* aNode,
|
||||
bool aIsInternalIcon) {
|
||||
if (mIconRequest) {
|
||||
// Another icon request is already in flight. Kill it.
|
||||
mIconRequest->Cancel(NS_BINDING_ABORTED);
|
||||
mIconRequest->CancelWithReason(
|
||||
NS_BINDING_ABORTED, "Another icon request is already in flight"_ns);
|
||||
mIconRequest = nullptr;
|
||||
}
|
||||
|
||||
@ -91,7 +92,8 @@ void IconLoader::Notify(imgIRequest* aRequest, int32_t aType,
|
||||
uint32_t status = imgIRequest::STATUS_ERROR;
|
||||
if (NS_FAILED(aRequest->GetImageStatus(&status)) ||
|
||||
(status & imgIRequest::STATUS_ERROR)) {
|
||||
mIconRequest->Cancel(NS_BINDING_ABORTED);
|
||||
mIconRequest->CancelWithReason(NS_BINDING_ABORTED,
|
||||
"GetImageStatus failed"_ns);
|
||||
mIconRequest = nullptr;
|
||||
return;
|
||||
}
|
||||
@ -121,7 +123,7 @@ void IconLoader::Notify(imgIRequest* aRequest, int32_t aType,
|
||||
|
||||
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
|
||||
if (mIconRequest && mIconRequest == aRequest) {
|
||||
mIconRequest->Cancel(NS_BINDING_ABORTED);
|
||||
mIconRequest->CancelWithReason(NS_BINDING_ABORTED, "DECODE_COMPLETE"_ns);
|
||||
mIconRequest = nullptr;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user