From 3d4696c36ba6389923a68f1d2889bd68480f1c07 Mon Sep 17 00:00:00 2001 From: brave-builds <45370463+brave-builds@users.noreply.github.com> Date: Fri, 12 Jan 2024 01:55:14 +0100 Subject: [PATCH] Fix #35137 - Fix Safe-browsing crashing iOS (uplift to 1.61.x) (#21537) Uplift of #21511 (squashed) to release --- ios/app/BUILD.gn | 1 + ios/app/DEPS | 1 + ios/app/brave_core_main.mm | 5 +++++ .../application_context/brave_application_context_impl.h | 1 - .../application_context/brave_application_context_impl.mm | 4 ---- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ios/app/BUILD.gn b/ios/app/BUILD.gn index 5847b8002505..eac8e33b267e 100644 --- a/ios/app/BUILD.gn +++ b/ios/app/BUILD.gn @@ -61,6 +61,7 @@ source_set("app") { "//components/history/core/browser", "//components/keyed_service/core", "//components/password_manager/core/browser", + "//components/safe_browsing/core/common:safe_browsing_prefs", "//components/send_tab_to_self", "//components/sync/base", "//components/sync/service", diff --git a/ios/app/DEPS b/ios/app/DEPS index d7745c59a192..a4fcc61a615e 100644 --- a/ios/app/DEPS +++ b/ios/app/DEPS @@ -15,6 +15,7 @@ include_rules = [ "+components/history/core/browser", "+components/keyed_service/core", "+components/password_manager/core", + "+components/safe_browsing/core/common/safe_browsing_prefs.h", "+components/send_tab_to_self", "+ios/public/provider/chrome/browser/chrome_browser_provider.h", "+ios/public/provider/chrome/browser/overrides/overrides_api.h", diff --git a/ios/app/brave_core_main.mm b/ios/app/brave_core_main.mm index 1030a876a5cd..fb78221efe43 100644 --- a/ios/app/brave_core_main.mm +++ b/ios/app/brave_core_main.mm @@ -49,6 +49,7 @@ #include "components/keyed_service/core/service_access_type.h" #include "components/password_manager/core/browser/password_store.h" #include "components/prefs/pref_service.h" +#include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/send_tab_to_self/send_tab_to_self_sync_service.h" #include "ios/chrome/app/startup/provider_registration.h" #include "ios/chrome/browser/bookmarks/model/bookmark_undo_service_factory.h" @@ -202,6 +203,10 @@ - (instancetype)initWithUserAgent:(NSString*)userAgent browserStateManager->GetLastUsedBrowserState(); _mainBrowserState = chromeBrowserState; + // Disable Safe-Browsing via Prefs + chromeBrowserState->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, + false); + // Setup main browser _browserList = BrowserListFactory::GetForBrowserState(_mainBrowserState); _browser = Browser::Create(_mainBrowserState); diff --git a/ios/browser/application_context/brave_application_context_impl.h b/ios/browser/application_context/brave_application_context_impl.h index ac03b18d13a1..ef0859d7d15d 100644 --- a/ios/browser/application_context/brave_application_context_impl.h +++ b/ios/browser/application_context/brave_application_context_impl.h @@ -36,7 +36,6 @@ class BraveApplicationContextImpl : public ApplicationContextImpl { // ApplicationContextImpl ukm::UkmRecorder* GetUkmRecorder() override; - SafeBrowsingService* GetSafeBrowsingService() override; BrowserPolicyConnectorIOS* GetBrowserPolicyConnector() override; gcm::GCMDriver* GetGCMDriver() override; diff --git a/ios/browser/application_context/brave_application_context_impl.mm b/ios/browser/application_context/brave_application_context_impl.mm index bc36b8f3ee48..9b17cd0460a7 100644 --- a/ios/browser/application_context/brave_application_context_impl.mm +++ b/ios/browser/application_context/brave_application_context_impl.mm @@ -33,10 +33,6 @@ return nullptr; } -SafeBrowsingService* BraveApplicationContextImpl::GetSafeBrowsingService() { - return nullptr; -} - BrowserPolicyConnectorIOS* BraveApplicationContextImpl::GetBrowserPolicyConnector() { return nullptr;