Bug 1341897 - Harmonize Geolocation providers. r?jdm
MozReview-Commit-ID: DZbFDsklbq0
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1242,43 +1242,54 @@ pref("security.cert_pinning.enforcement_
pref("plain_text.wrap_long_lines", true);
// If this turns true, Moz*Gesture events are not called stopPropagation()
// before content.
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
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
// channels, for now.
// TODO: default to false (or remove altogether) for #1072859.
pref("geo.security.allowinsecure", true);
// Necko IPC security checks only needed for app isolation for cookies/cache/etc:
--- a/dom/geolocation/nsGeolocation.cpp
+++ b/dom/geolocation/nsGeolocation.cpp
@@ -688,25 +688,16 @@ nsresult nsGeolocationService::Init()
}
obs->AddObserver(this, "xpcom-shutdown", false);
#ifdef MOZ_WIDGET_ANDROID
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)) {
mProvider = new GpsdLocationProvider();
}
#endif
#endif
@@ -728,21 +719,21 @@ nsresult nsGeolocationService::Init()
}
// Override platform-specific providers with the default (network)
// provider while testing. Our tests are currently not meant to exercise
// the provider, and some tests rely on the network provider being used.
// "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;
}
}
return NS_OK;
}
nsGeolocationService::~nsGeolocationService() = default;