Bug 1520062 - Don't exit HttpChannelChild::DoOnStopRequest if call returns error code r=kershaw

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Valentin Gosu 2019-01-22 09:16:11 +00:00
Родитель da92d03579
Коммит e143910fde
1 изменённых файлов: 22 добавлений и 19 удалений

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

@ -1187,29 +1187,32 @@ void HttpChannelChild::DoOnStopRequest(nsIRequest* aRequest,
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mIsPending);
// NB: We use aChannelStatus here instead of mStatus because if there was an
// nsCORSListenerProxy on this request, it will override the tracking
// protection's return value.
if (aChannelStatus == NS_ERROR_TRACKING_URI ||
aChannelStatus == NS_ERROR_MALWARE_URI ||
aChannelStatus == NS_ERROR_UNWANTED_URI ||
aChannelStatus == NS_ERROR_BLOCKED_URI ||
aChannelStatus == NS_ERROR_HARMFUL_URI ||
aChannelStatus == NS_ERROR_PHISHING_URI) {
nsCString list, provider, fullhash;
auto checkForBlockedContent = [&]() {
// NB: We use aChannelStatus here instead of mStatus because if there was an
// nsCORSListenerProxy on this request, it will override the tracking
// protection's return value.
if (aChannelStatus == NS_ERROR_TRACKING_URI ||
aChannelStatus == NS_ERROR_MALWARE_URI ||
aChannelStatus == NS_ERROR_UNWANTED_URI ||
aChannelStatus == NS_ERROR_BLOCKED_URI ||
aChannelStatus == NS_ERROR_HARMFUL_URI ||
aChannelStatus == NS_ERROR_PHISHING_URI) {
nsCString list, provider, fullhash;
nsresult rv = GetMatchedList(list);
NS_ENSURE_SUCCESS_VOID(rv);
nsresult rv = GetMatchedList(list);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedProvider(provider);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedProvider(provider);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedFullHash(fullhash);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedFullHash(fullhash);
NS_ENSURE_SUCCESS_VOID(rv);
UrlClassifierCommon::SetBlockedContent(this, aChannelStatus, list, provider,
fullhash);
}
UrlClassifierCommon::SetBlockedContent(this, aChannelStatus, list,
provider, fullhash);
}
};
checkForBlockedContent();
MOZ_ASSERT(!mOnStopRequestCalled, "We should not call OnStopRequest twice");