Bug 1482117 - Part 1: Make FastBlock happen after tailing; r=mayhemer

move the FastBlock checking block to |TriggerNetwork|

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Liang-Heng Chen 2018-08-15 16:32:34 +00:00
Родитель e60252016a
Коммит 837bec1102
1 изменённых файлов: 15 добавлений и 5 удалений

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

@ -638,11 +638,6 @@ nsHttpChannel::Connect()
NS_SUCCEEDED(thirdPartyUtil->IsThirdPartyChannel(this, nullptr,
&result)) &&
result) {
if (CheckFastBlocked()) {
Unused << AsyncAbort(NS_ERROR_ABORT);
CloseCacheEntry(false);
return NS_OK;
}
AddClassFlags(nsIClassOfService::Tail);
}
@ -699,6 +694,14 @@ nsHttpChannel::CheckFastBlocked()
Preferences::AddUintVarCache(&sFastBlockTimeout, "browser.fastblock.timeout");
}
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
bool result = false;
if (!thirdPartyUtil ||
NS_FAILED(thirdPartyUtil->IsThirdPartyChannel(this, nullptr, &result)) ||
!result) {
return false;
}
TimeStamp timestamp;
if (NS_FAILED(GetNavigationStartTimeStamp(&timestamp))) {
return false;
@ -726,6 +729,13 @@ nsHttpChannel::ConnectOnTailUnblock()
LOG(("nsHttpChannel::ConnectOnTailUnblock [this=%p]\n", this));
bool isTrackingResource = mIsTrackingResource; // is atomic
if (isTrackingResource && CheckFastBlocked()) {
Unused << AsyncAbort(NS_ERROR_ABORT);
CloseCacheEntry(false);
return NS_OK;
}
// Consider opening a TCP connection right away.
SpeculativeConnect();