diff --git a/browser/profiles/BUILD.gn b/browser/profiles/BUILD.gn index 308175d9deef..d4ae8d015e62 100644 --- a/browser/profiles/BUILD.gn +++ b/browser/profiles/BUILD.gn @@ -7,6 +7,7 @@ source_set("profiles") { "//base", "//chrome/browser", "//chrome/common", + "//content/public/common", "//brave/browser/extensions", "//brave/browser/tor", "//brave/common/tor", diff --git a/browser/profiles/brave_profile_manager.cc b/browser/profiles/brave_profile_manager.cc index 7235aca54638..70412ed926d6 100644 --- a/browser/profiles/brave_profile_manager.cc +++ b/browser/profiles/brave_profile_manager.cc @@ -17,6 +17,7 @@ #include "chrome/grit/generated_resources.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_thread.h" +#include "content/public/common/webrtc_ip_handling_policy.h" #include "ui/base/l10n/l10n_util.h" using content::BrowserThread; @@ -43,6 +44,8 @@ void BraveProfileManager::InitTorProfileUserPrefs(Profile* profile) { ->SetString(prefs::kProfileName, l10n_util::GetStringUTF8(IDS_PROFILES_TOR_PROFILE_NAME)); pref_service->SetBoolean(tor::prefs::kProfileUsingTor, true); + pref_service->SetString(prefs::kWebRTCIPHandlingPolicy, + content::kWebRTCIPHandlingDisableNonProxiedUdp); } void BraveProfileManager::InitProfileUserPrefs(Profile* profile) { diff --git a/browser/profiles/brave_profile_manager_unittest.cc b/browser/profiles/brave_profile_manager_unittest.cc index 4778fe23d364..148f9cd07066 100644 --- a/browser/profiles/brave_profile_manager_unittest.cc +++ b/browser/profiles/brave_profile_manager_unittest.cc @@ -23,6 +23,7 @@ #include "chrome/test/base/test_browser_window.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" +#include "content/public/common/webrtc_ip_handling_policy.h" #include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_utils.h" #include "testing/gmock/include/gmock/gmock.h" @@ -134,6 +135,11 @@ TEST_F(BraveProfileManagerTest, InitProfileUserPrefs) { EXPECT_FALSE( profile->GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultName)); EXPECT_TRUE(profile->GetPrefs()->GetBoolean(tor::prefs::kProfileUsingTor)); + + // Check WebRTC IP handling policy. + EXPECT_EQ( + profile->GetPrefs()->GetString(prefs::kWebRTCIPHandlingPolicy), + content::kWebRTCIPHandlingDisableNonProxiedUdp); } // This is for tor guest window, remove it when we have persistent tor profiles