Bug 1341897 - Harmonize Geolocation providers. r=jdm

MozReview-Commit-ID: DZbFDsklbq0

--HG--
extra : rebase_source : 94dbf472c9201baba9c78f01c9fbe0443a24992b
This commit is contained in:
Michelangelo De Simone 2017-02-22 15:09:02 -08:00
Родитель 70a775766d
Коммит bdc7703a03
2 изменённых файлов: 26 добавлений и 24 удалений

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

@ -1247,19 +1247,15 @@ pref("dom.debug.propagate_gesture_events_through_content", false);
// All the Geolocation preferences are here.
//
// The request URL of the GeoLocation backend.
#ifdef RELEASE_OR_BETA
// Geolocation preferences for the RELEASE channel.
// Some of these prefs are specified even though they are redundant; they are
// here for clarity and end-user experiments.
#ifdef RELEASE
pref("geo.wifi.uri", "https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_API_KEY%");
#else
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%");
#endif
#ifdef XP_MACOSX
#ifdef RELEASE_OR_BETA
pref("geo.provider.use_corelocation", false);
#else
pref("geo.provider.use_corelocation", true);
#endif
#endif
#ifdef XP_WIN
@ -1267,13 +1263,28 @@ pref("geo.provider.ms-windows-location", false);
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_GPSD
#ifdef RELEASE_OR_BETA
pref("geo.provider.use_gpsd", false);
#endif
#else
// Geolocation preferences for Nightly/Aurora/Beta.
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%");
#ifdef XP_MACOSX
pref("geo.provider.use_corelocation", true);
#endif
// The native Windows location provider is only enabled in Nightly and likely to
// be unstable. Set to false if things are really broken.
#if defined(XP_WIN) && defined(NIGHTLY_BUILD)
pref("geo.provider.ms-windows-location", true);
#endif
#if defined(MOZ_WIDGET_GTK) && defined(MOZ_GPSD)
pref("geo.provider.use_gpsd", true);
#endif
#endif
#endif
// We keep allowing non-HTTPS geo requests on all the release

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

@ -693,15 +693,6 @@ nsresult nsGeolocationService::Init()
mProvider = new AndroidLocationProvider();
#endif
#ifdef MOZ_WIDGET_GONK
// GonkGPSGeolocationProvider can be started at boot up time for initialization reasons.
// do_getService gets hold of the already initialized component and starts
// processing location requests immediately.
// do_Createinstance will create multiple instances of the provider which is not right.
// bug 993041
mProvider = do_GetService(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID);
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_GPSD
if (Preferences::GetBool("geo.provider.use_gpsd", false)) {
@ -733,11 +724,11 @@ nsresult nsGeolocationService::Init()
// "geo.provider.testing" is always set for all plain and browser chrome
// mochitests, and also for xpcshell tests.
if (!mProvider || Preferences::GetBool("geo.provider.testing", false)) {
nsCOMPtr<nsIGeolocationProvider> geo_net_provider =
nsCOMPtr<nsIGeolocationProvider> geoTestProvider =
do_GetService(NS_GEOLOCATION_PROVIDER_CONTRACTID);
if (geo_net_provider) {
mProvider = geo_net_provider;
if (geoTestProvider) {
mProvider = geoTestProvider;
}
}