mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1699998 - Extract the Enabled() check in TRRService::IsDomainBlocked into TRR::MaybeBlockRequest. r=necko-reviewers,valentin
Currently, we are checking Enabled() without passing the request mode in IsDomainBlocked. This isn't the right place to do this, it's cleaner if IsDomainBlocked trusts the caller to have checked Enabled already. We should call Enabled, with the request mode, in TRR::MaybeBlockDomain() and return early if it's false. Differential Revision: https://phabricator.services.mozilla.com/D109240
This commit is contained in:
parent
4e87b5392e
commit
acc81306ba
@ -167,6 +167,12 @@ bool TRR::MaybeBlockRequest() {
|
||||
// we also don't check the blocklist for TRR only requests
|
||||
MOZ_ASSERT(mRec);
|
||||
|
||||
// If TRRService isn't enabled anymore for the req, don't do TRR.
|
||||
if (!gTRRService->Enabled(mRec->mEffectiveTRRMode)) {
|
||||
RecordReason(TRRSkippedReason::TRR_MODE_NOT_ENABLED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (UseDefaultServer() &&
|
||||
gTRRService->IsTemporarilyBlocked(mHost, mOriginSuffix, mPB, true)) {
|
||||
if (mType == TRRTYPE_A) {
|
||||
|
@ -868,10 +868,6 @@ bool TRRService::MaybeBootstrap(const nsACString& aPossible,
|
||||
bool TRRService::IsDomainBlocked(const nsACString& aHost,
|
||||
const nsACString& aOriginSuffix,
|
||||
bool aPrivateBrowsing) {
|
||||
if (!Enabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto bl = mTRRBLStorage.Lock();
|
||||
if (bl->IsEmpty()) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user