fix: geolocation crashes electron on macOS (#29343) (#29913)

This commit is contained in:
Omar Kilani 2021-06-28 20:26:57 -07:00 committed by GitHub
commit 1b4ce6c69a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 1 deletions

View file

@ -882,7 +882,13 @@ ElectronBrowserClient::GetSystemNetworkContext() {
std::unique_ptr<content::BrowserMainParts>
ElectronBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& params) {
return std::make_unique<ElectronBrowserMainParts>(params);
auto browser_main_parts = std::make_unique<ElectronBrowserMainParts>(params);
#if defined(OS_MAC)
browser_main_parts_ = browser_main_parts.get();
#endif
return browser_main_parts;
}
void ElectronBrowserClient::WebNotificationAllowed(
@ -1618,4 +1624,12 @@ void ElectronBrowserClient::RegisterBrowserInterfaceBindersForServiceWorker(
base::BindRepeating(&BindBadgeServiceForServiceWorker));
}
device::GeolocationManager* ElectronBrowserClient::GetGeolocationManager() {
#if defined(OS_MAC)
return browser_main_parts_->GetGeolocationManager();
#else
return nullptr;
#endif
}
} // namespace electron