Bug 1603032 - Only record the first failure status when cancelling an nsExtProtocolChannel. r=mayhemer

The only time we fire OnStart/StopRequest from nsExtProtocolChannel is when we cancel with NS_ERROR_NO_CONTENT, which DocumentLoadListener explicitly handles to avoid calling Suspend (which asserts).

Unfortunately we fire OnStart/StopRequest from a runnable, so it's possible for the channel to get Cancelled by something else in the middle. This Cancel doesn't really work, since we've already dispatched to the handler, so don't update mStatus.

Depends on D57030

Differential Revision: https://phabricator.services.mozilla.com/D57032

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-12-16 19:14:28 +00:00
Родитель 2d46b37055
Коммит 4b980ca6e4
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -166,7 +166,7 @@ nsresult nsExtProtocolChannel::OpenURL() {
rv = extProtService->LoadURI(mUrl, aggCallbacks);
if (NS_SUCCEEDED(rv) && mListener) {
Cancel(NS_ERROR_NO_CONTENT);
mStatus = NS_ERROR_NO_CONTENT;
RefPtr<nsExtProtocolChannel> self = this;
nsCOMPtr<nsIStreamListener> listener = mListener;
@ -331,7 +331,9 @@ NS_IMETHODIMP nsExtProtocolChannel::GetStatus(nsresult* status) {
}
NS_IMETHODIMP nsExtProtocolChannel::Cancel(nsresult status) {
mStatus = status;
if (NS_SUCCEEDED(mStatus)) {
mStatus = status;
}
return NS_OK;
}