Bug 590030 - Both success and error geolocation callbacks can be called. r=dougt a=bsmedberg
authorJosh Matthews <josh@joshmatthews.net>
Tue, 24 Aug 2010 00:52:17 -0400
changeset 58095 9fb7937e306d2b2c9fb35d96b1d9396acade8dde
parent 58094 1d4e3afd67e718a036aa7ef9cb99a95284de16c8
child 58096 5538d32b4faef4b751c7825f1c18582553fb759b
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersdougt, bsmedberg
bugs590030
milestone2.0b8pre
Bug 590030 - Both success and error geolocation callbacks can be called. r=dougt a=bsmedberg
dom/src/geolocation/nsGeolocation.cpp
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -285,19 +285,19 @@ nsGeolocationRequest::NotifyError(PRInt1
 
 NS_IMETHODIMP
 nsGeolocationRequest::Notify(nsITimer* aTimer)
 {
   // If we haven't gotten an answer from the geolocation
   // provider yet, cancel the request.  Same logic as
   // ::Cancel, just a different error
   
-  NotifyError(nsIDOMGeoPositionError::TIMEOUT);
   // remove ourselves from the locator's callback lists.
   mLocator->RemoveRequest(this);
+  NotifyError(nsIDOMGeoPositionError::TIMEOUT);
 
   mTimeoutTimer = nsnull;
   return NS_OK;
 }
  
 NS_IMETHODIMP
 nsGeolocationRequest::GetUri(nsIURI * *aRequestingURI)
 {
@@ -333,20 +333,20 @@ nsGeolocationRequest::GetElement(nsIDOME
   NS_ENSURE_ARG_POINTER(aRequestingElement);
   *aRequestingElement = nsnull;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGeolocationRequest::Cancel()
 {
-  NotifyError(nsIDOMGeoPositionError::PERMISSION_DENIED);
-
   // remove ourselves from the locators callback lists.
   mLocator->RemoveRequest(this);
+
+  NotifyError(nsIDOMGeoPositionError::PERMISSION_DENIED);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGeolocationRequest::Allow()
 {
   nsRefPtr<nsGeolocationService> geoService = nsGeolocationService::GetInstance();