Bug 1333106. Stop leaking in the prefetch service if the prefetch is blocked by security checks. r=mcmanus

This commit is contained in:
Boris Zbarsky 2017-01-24 10:02:46 -05:00
Родитель 5e4160791e
Коммит b7cf5b83fd
2 изменённых файлов: 12 добавлений и 2 удалений

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

@ -5755,6 +5755,7 @@ nsHttpChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *context)
if (!gHttpHandler->Active()) {
LOG((" after HTTP shutdown..."));
ReleaseListeners();
return NS_ERROR_NOT_AVAILABLE;
}
@ -5833,7 +5834,10 @@ nsHttpChannel::AsyncOpen2(nsIStreamListener *aListener)
{
nsCOMPtr<nsIStreamListener> listener = aListener;
nsresult rv = nsContentSecurityManager::doContentSecurityCheck(this, listener);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
ReleaseListeners();
return rv;
}
return AsyncOpen(listener, nullptr);
}

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

@ -156,7 +156,13 @@ nsPrefetchNode::OpenChannel()
false);
}
return mChannel->AsyncOpen2(this);
rv = mChannel->AsyncOpen2(this);
if (NS_WARN_IF(NS_FAILED(rv))) {
// Drop the ref to the channel, because we don't want to end up with
// cycles through it.
mChannel = nullptr;
}
return rv;
}
nsresult