From ca89db9c3e970d189b0fe96ad1316ac96ccb189d Mon Sep 17 00:00:00 2001 From: Aleksey Khoroshilov Date: Fri, 16 Sep 2022 18:23:51 +0700 Subject: [PATCH 1/2] Cleanup permission contexts on PermissionManager::Shutdown(). --- components/permissions/brave_permission_manager.cc | 5 +++++ components/permissions/brave_permission_manager.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/components/permissions/brave_permission_manager.cc b/components/permissions/brave_permission_manager.cc index 7e6ffeca821f..e59ec702f918 100644 --- a/components/permissions/brave_permission_manager.cc +++ b/components/permissions/brave_permission_manager.cc @@ -19,6 +19,11 @@ BravePermissionManager::BravePermissionManager( PermissionContextMap permission_contexts) : PermissionManager(browser_context, std::move(permission_contexts)) {} +void BravePermissionManager::Shutdown() { + PermissionManager::Shutdown(); + permission_contexts_.clear(); +} + void BravePermissionManager::RequestPermissionsForOrigin( const std::vector& permissions, content::RenderFrameHost* render_frame_host, diff --git a/components/permissions/brave_permission_manager.h b/components/permissions/brave_permission_manager.h index c39e3d0c0bbe..1cefc604a338 100644 --- a/components/permissions/brave_permission_manager.h +++ b/components/permissions/brave_permission_manager.h @@ -21,6 +21,8 @@ class BravePermissionManager : public PermissionManager { BravePermissionManager(const BravePermissionManager&) = delete; BravePermissionManager& operator=(const BravePermissionManager&) = delete; + void Shutdown() override; + void RequestPermissionsForOrigin( const std::vector& permissions, content::RenderFrameHost* render_frame_host, From f48a74c6f22675f8c6c7bd6cbf108b2336820368 Mon Sep 17 00:00:00 2001 From: Aleksey Khoroshilov Date: Fri, 16 Sep 2022 18:43:52 +0700 Subject: [PATCH 2/2] Fix EthereumProviderImplUnitTest shutdown. --- browser/brave_wallet/ethereum_provider_impl_unittest.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/brave_wallet/ethereum_provider_impl_unittest.cc b/browser/brave_wallet/ethereum_provider_impl_unittest.cc index c7dc7c3a5d03..f7c08f5b0dde 100644 --- a/browser/brave_wallet/ethereum_provider_impl_unittest.cc +++ b/browser/brave_wallet/ethereum_provider_impl_unittest.cc @@ -190,6 +190,7 @@ class EthereumProviderImplUnitTest : public testing::Test { void TearDown() override { provider_.reset(); web_contents_.reset(); + profile_.SetPermissionControllerDelegate(nullptr); } void SetUp() override {