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 id17153
push userjmatthews@mozilla.com
push dateTue, 23 Nov 2010 20:49:49 +0000
treeherdermozilla-central@5538d32b4fae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt, bsmedberg
bugs590030
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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();