Bug 688158 - Make navigator.geolocation return null if geolocation is disabled. r=jst
authorJosh Matthews <josh@joshmatthews.net>
Wed, 21 Sep 2011 11:07:41 -0400
changeset 77907 8232007db7e5
parent 77906 10298b25af4e
child 77908 831df43787ef
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersjst
bugs688158
milestone10.0a1
Bug 688158 - Make navigator.geolocation return null if geolocation is disabled. r=jst
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -11316,16 +11316,19 @@ nsNavigator::MozIsLocallyAvailable(const
 //    nsNavigator::nsIDOMNavigatorGeolocation
 //*****************************************************************************
 
 NS_IMETHODIMP nsNavigator::GetGeolocation(nsIDOMGeoGeolocation **_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
   *_retval = nsnull;
 
+  if (!Preferences::GetBool("geo.enabled", PR_TRUE))
+    return NS_OK;
+
   if (mGeolocation) {
     NS_ADDREF(*_retval = mGeolocation);
     return NS_OK;
   }
 
   if (!mDocShell)
     return NS_ERROR_FAILURE;