summaryrefslogtreecommitdiffstats
path: root/src/core/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2021-12-03 12:11:06 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2021-12-08 11:40:32 +0100
commitca1074f7d0b91ccb9290acbfe51ecab54ad2efb9 (patch)
treec70c37c9db21a7c8baa53b75c427eca709dbeea6 /src/core/content_browser_client_qt.cpp
parentb6099cd9d1efab2af4a38476b3f543796f26f065 (diff)
Fix crash with disabled geolocation on macOS
QtWebEngine uses custom LocationProvider for geolocation. If geolocation is disabled, Chromium fallbacks to NetworkLocationProvider. NetworkLocationProvider uses GeolocationSystemPermissionManager and tThere is no nullptr check for the manager instance so QtWebEngine has to provide it. This fix implements a FakeSystemGeolocationPermissionManager what is meant to be used only on macOS if geolocation is disabled. LocationSystemPermissionStatus is always set to denied by the fake manager. Pick-to: 6.2 Change-Id: I25d51c9ce8911b95ff69cc72bc6aae7023e7edbe Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r--src/core/content_browser_client_qt.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 68f903154..8fbb2d668 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -72,6 +72,7 @@
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
#include "net/ssl/client_cert_identity.h"
#include "net/ssl/client_cert_store.h"
+#include "services/device/public/cpp/geolocation/geolocation_system_permission_mac.h"
#include "services/network/network_service.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
@@ -234,7 +235,10 @@ ContentBrowserClientQt::~ContentBrowserClientQt()
std::unique_ptr<content::BrowserMainParts> ContentBrowserClientQt::CreateBrowserMainParts(const content::MainFunctionParams&)
{
- return std::make_unique<BrowserMainPartsQt>();
+ Q_ASSERT(!m_browserMainParts);
+ auto browserMainParts = std::make_unique<BrowserMainPartsQt>();
+ m_browserMainParts = browserMainParts.get();
+ return browserMainParts;
}
void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost *host)
@@ -588,6 +592,15 @@ std::unique_ptr<device::LocationProvider> ContentBrowserClientQt::OverrideSystem
}
#endif
+device::GeolocationSystemPermissionManager *ContentBrowserClientQt::GetLocationPermissionManager()
+{
+#if defined(OS_MAC)
+ return m_browserMainParts->GetLocationPermissionManager();
+#else
+ return nullptr;
+#endif
+}
+
bool ContentBrowserClientQt::ShouldEnableStrictSiteIsolation()
{
// mirroring AwContentBrowserClient, CastContentBrowserClient and