Bug 1900225: Part 4 - Add geo.prompt.open_system_prefs to block opening system preferences r=gstoll

Also adds this as the default for mochitests, in anticipation of the day that
the implementation is supported by the computers in automation.

Differential Revision: https://phabricator.services.mozilla.com/D216475
This commit is contained in:
David P 2024-08-27 22:47:32 +00:00
Родитель cacd3ce9eb
Коммит 5a9e60b4de
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -1432,7 +1432,14 @@ void Geolocation::NotifyAllowedRequest(nsGeolocationRequest* aRequest) {
/* static */ geolocation::SystemGeolocationPermissionBehavior
Geolocation::GetLocationOSPermission() {
return geolocation::GetGeolocationPermissionBehavior();
auto permission = geolocation::GetGeolocationPermissionBehavior();
if (!StaticPrefs::geo_prompt_open_system_prefs() &&
permission == geolocation::SystemGeolocationPermissionBehavior::
GeckoWillPromptUser) {
return geolocation::SystemGeolocationPermissionBehavior::NoPrompt;
}
return permission;
}
void Geolocation::RequestIfPermitted(nsGeolocationRequest* request) {

Просмотреть файл

@ -5756,6 +5756,13 @@
mirror: always
#endif
# If true, open system preferences for the user when geolocation is requested
# by the user but OS geolocation permission is not available.
- name: geo.prompt.open_system_prefs
type: bool
value: true
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "gfx."
#---------------------------------------------------------------------------

Просмотреть файл

@ -31,3 +31,8 @@ user_pref("app.update.disabledForTesting", true);
// Therefore, in the mochitest, as the frequently in common browser tests can be
// super higher than the real user, we disable this feature.
user_pref("places.history.floodingPrevention.enabled", false);
// If we are on a platform where we can detect that we don't have OS geolocation
// permission, and we can open it and wait for the user to give permission, then
// don't do that.
user_pref("geo.prompt.open_system_prefs", false);