зеркало из https://github.com/mozilla/gecko-dev.git
bug 1450630 - use DataStorage in main thread only r=mcmanus
Move the TRR blacklist check to the main thread, and since it is now done a little later and for each separate request, make sure to only do the telemetry counting for one of the record types (A) so that we don't count them twice. MozReview-Commit-ID: BgvU4TzrpCq --HG-- extra : rebase_source : 304bc75a6f22963b51e89034de1b30506337b6ec
This commit is contained in:
Родитель
cbc63d130a
Коммит
cc57e08b25
|
@ -140,6 +140,22 @@ TRR::SendHTTPRequest()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if ((mType == TRRTYPE_A) || (mType == TRRTYPE_AAAA)) {
|
||||
// let NS resolves skip the blacklist check
|
||||
if (gTRRService->IsTRRBlacklisted(mHost, mPB, true)) {
|
||||
if (mType == TRRTYPE_A) {
|
||||
// count only blacklist for A records to avoid double counts
|
||||
Telemetry::Accumulate(Telemetry::DNS_TRR_BLACKLISTED, true);
|
||||
}
|
||||
// not really an error but no TRR is issued
|
||||
return NS_ERROR_UNKNOWN_HOST;
|
||||
} else {
|
||||
if (mType == TRRTYPE_A) {
|
||||
Telemetry::Accumulate(Telemetry::DNS_TRR_BLACKLISTED, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIIOService> ios(do_GetIOService(&rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -384,13 +384,6 @@ bool
|
|||
TRRService::IsTRRBlacklisted(const nsACString &aHost, bool privateBrowsing,
|
||||
bool aParentsToo) // false if domain
|
||||
{
|
||||
if (mClearTRRBLStorage) {
|
||||
if (mTRRBLStorage) {
|
||||
mTRRBLStorage->Clear();
|
||||
}
|
||||
mClearTRRBLStorage = false;
|
||||
}
|
||||
|
||||
if (mMode == MODE_TRRONLY) {
|
||||
return false; // might as well try
|
||||
}
|
||||
|
@ -408,6 +401,15 @@ TRRService::IsTRRBlacklisted(const nsACString &aHost, bool privateBrowsing,
|
|||
return false;
|
||||
}
|
||||
|
||||
// Only use the Storage API in the main thread
|
||||
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
|
||||
|
||||
if (mClearTRRBLStorage) {
|
||||
mTRRBLStorage->Clear();
|
||||
mClearTRRBLStorage = false;
|
||||
return false; // just cleared!
|
||||
}
|
||||
|
||||
int32_t dot = aHost.FindChar('.');
|
||||
if ((dot == kNotFound) && aParentsToo) {
|
||||
// Only if a full host name. Domains can be dotless to be able to
|
||||
|
|
|
@ -1114,15 +1114,6 @@ nsHostResolver::TrrLookup(nsHostRecord *aRec, TRR *pushedTRR)
|
|||
rec->mTRRSuccess = 0; // bump for each successful TRR response
|
||||
rec->mTrrAUsed = nsHostRecord::INIT;
|
||||
rec->mTrrAAAAUsed = nsHostRecord::INIT;
|
||||
|
||||
if (gTRRService && gTRRService->IsTRRBlacklisted(rec->host, rec->pb, true)) {
|
||||
Telemetry::Accumulate(Telemetry::DNS_TRR_BLACKLISTED, true);
|
||||
MOZ_ASSERT(!rec->mTRRUsed);
|
||||
// not really an error but no TRR is issued
|
||||
return NS_ERROR_UNKNOWN_HOST;
|
||||
}
|
||||
Telemetry::Accumulate(Telemetry::DNS_TRR_BLACKLISTED, false);
|
||||
|
||||
rec->mTrrStart = TimeStamp::Now();
|
||||
rec->mTRRUsed = true; // this record gets TRR treatment
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче