diff --git a/src/chrome/browser/thorium_flag_entries.h b/src/chrome/browser/thorium_flag_entries.h index fdabe588..0d79d2ac 100644 --- a/src/chrome/browser/thorium_flag_entries.h +++ b/src/chrome/browser/thorium_flag_entries.h @@ -29,10 +29,15 @@ "Disable Thorium Top Bar Icons", "Disables the custom colored top bar icons in Thorium, and restores the default grey Chromium icon colors.", kOsDesktop, SINGLE_VALUE_TYPE("disable-thorium-icons")}, + {"disable-thorium-dns-config", + "Disable Thorium Custom DNS Config", + "Disables the custom DNS configuration used by default in Thorium. Useful when this config breaks something, " + "due to external apps or a non-standard system DNS config setting.", + kOsDesktop, SINGLE_VALUE_TYPE("disable-thorium-dns-config")}, {"force-high-contrast", "Enable High Contrast Mode", "Enables high contrast mode for all Thorium instances.", - kOsAll, SINGLE_VALUE_TYPE(switches::kForceHighContrast)}, + kOsDesktop, SINGLE_VALUE_TYPE(switches::kForceHighContrast)}, #if BUILDFLAG(IS_WIN) {"disable-aero", diff --git a/src/net/dns/dns_client.cc b/src/net/dns/dns_client.cc index 1327052b..d5903e11 100644 --- a/src/net/dns/dns_client.cc +++ b/src/net/dns/dns_client.cc @@ -9,7 +9,9 @@ #include #include +#include "base/command_line.h" #include "base/functional/bind.h" +#include "base/logging.h" #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_macros.h" #include "base/rand_util.h" @@ -243,16 +245,28 @@ class DnsClientImpl : public DnsClient { private: std::optional BuildEffectiveConfig() const { DnsConfig config; - // in Bromite it is sufficient to have secure DoH enabled to give the overrides priority - if (config_overrides_.dns_over_https_config && config_overrides_.secure_dns_mode) { - config = config_overrides_.ApplyOverrides(DnsConfig()); + if (!base::CommandLine::ForCurrentProcess()->HasSwitch("disable-thorium-dns-config")) { + // in Bromite it is sufficient to have secure DoH enabled to give the overrides priority + if (config_overrides_.dns_over_https_config && config_overrides_.secure_dns_mode) { + config = config_overrides_.ApplyOverrides(DnsConfig()); + } else { + if (!system_config_) { + LOG(WARNING) << "BuildEffectiveConfig(): no system configuration"; + return std::nullopt; + } + + config = config_overrides_.ApplyOverrides(system_config_.value()); + } } else { - if (!system_config_) { - LOG(WARNING) << "BuildEffectiveConfig(): no system configuration"; - return std::nullopt; + if (config_overrides_.OverridesEverything()) { + config = config_overrides_.ApplyOverrides(DnsConfig()); + } else { + if (!system_config_) + LOG(WARNING) << "BuildEffectiveConfig(): system configuration not set"; + return std::nullopt; + + config = config_overrides_.ApplyOverrides(system_config_.value()); } - - config = config_overrides_.ApplyOverrides(system_config_.value()); } UpdateConfigForDohUpgrade(&config);