mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1732961 - TRR should not be ignoring enterprise policy value of network.trr.uri/mode r=nhnt11
In bug 1626057 we added support for steering. There we made the distinction between a default network.trr.uri pref, and a user-set one by using `Preferences::HasUserValue`. However, it seems that enterprise policies change the default branch of the pref, so this would lead to it having a lower priority than DoHRollout or steering. In bug 1713036 we introduced `network.trr.default_provider_uri` and made `network.trr.uri` an empty string, so checking hasUserValue isn't required anymore. Differential Revision: https://phabricator.services.mozilla.com/D126961
This commit is contained in:
parent
2ec278d9e1
commit
6cd518bee9
@ -231,9 +231,9 @@ bool TRRService::GetParentalControlEnabledInternal() {
|
||||
void TRRService::SetDetectedTrrURI(const nsACString& aURI) {
|
||||
LOG(("SetDetectedTrrURI(%s", nsPromiseFlatCString(aURI).get()));
|
||||
// If the user has set a custom URI then we don't want to override that.
|
||||
// If the URI is set via doh-rollout.uri, mURIPrefHasUserValue will be false
|
||||
// If the URI is set via doh-rollout.uri, mURIPref will be empty
|
||||
// (see TRRServiceBase::OnTRRURIChange)
|
||||
if (mURIPrefHasUserValue) {
|
||||
if (!mURIPref.IsEmpty()) {
|
||||
LOG(("Already has user value. Not setting URI"));
|
||||
return;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void TRRServiceBase::CheckURIPrefs() {
|
||||
mURISetByDetection = false;
|
||||
|
||||
// The user has set a custom URI so it takes precedence.
|
||||
if (mURIPrefHasUserValue) {
|
||||
if (!mURIPref.IsEmpty()) {
|
||||
MaybeSetPrivateURI(mURIPref);
|
||||
return;
|
||||
}
|
||||
@ -142,7 +142,6 @@ void TRRServiceBase::OnTRRModeChange() {
|
||||
}
|
||||
|
||||
void TRRServiceBase::OnTRRURIChange() {
|
||||
mURIPrefHasUserValue = Preferences::HasUserValue("network.trr.uri");
|
||||
Preferences::GetCString("network.trr.uri", mURIPref);
|
||||
Preferences::GetCString(kRolloutURIPref, mRolloutURIPref);
|
||||
Preferences::GetCString("network.trr.default_provider_uri", mDefaultURIPref);
|
||||
|
@ -41,7 +41,6 @@ class TRRServiceBase {
|
||||
|
||||
nsCString mPrivateURI;
|
||||
// Pref caches should only be used on the main thread.
|
||||
bool mURIPrefHasUserValue = false;
|
||||
nsCString mURIPref;
|
||||
nsCString mRolloutURIPref;
|
||||
nsCString mDefaultURIPref;
|
||||
|
@ -106,15 +106,15 @@ bool TRRServiceParent::MaybeSetPrivateURI(const nsACString& aURI) {
|
||||
}
|
||||
|
||||
void TRRServiceParent::SetDetectedTrrURI(const nsACString& aURI) {
|
||||
if (mURIPrefHasUserValue) {
|
||||
if (!mURIPref.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mURISetByDetection = MaybeSetPrivateURI(aURI);
|
||||
RefPtr<TRRServiceParent> self = this;
|
||||
nsCString uri(aURI);
|
||||
gIOService->CallOrWaitForSocketProcess(
|
||||
[self, uri]() { Unused << self->SendSetDetectedTrrURI(uri); });
|
||||
[self = RefPtr{this}, uri = nsAutoCString(aURI)]() {
|
||||
Unused << self->SendSetDetectedTrrURI(uri);
|
||||
});
|
||||
}
|
||||
|
||||
void TRRServiceParent::GetTrrURI(nsACString& aURI) { aURI = mPrivateURI; }
|
||||
|
Loading…
Reference in New Issue
Block a user