Bug 857330 - Geolocation uses a wrong default value for maximumAge. r=jdm
☠☠ backed out by 9d7b0dc99acf ☠ ☠
authorTareq Khandaker <tareqakhandaker@gmail.com>
Fri, 27 Sep 2013 14:47:19 -0400
changeset 149040 72a979eba5646739b231aed42893557dd9fcadb0
parent 149039 0a39f82ca67b064f4dca0ddd5e1352d27fd331d4
child 149041 4b17cbb36bb8d61b4d0d81739d3b51ca6157b7a0
push id25366
push userkwierso@gmail.com
push dateSat, 28 Sep 2013 02:13:38 +0000
treeherdermozilla-central@e1914e294152 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs857330
milestone27.0a1
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 857330 - Geolocation uses a wrong default value for maximumAge. r=jdm
dom/src/geolocation/nsGeolocation.cpp
dom/webidl/Geolocation.webidl
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -449,25 +449,21 @@ nsGeolocationRequest::Allow()
 
   nsCOMPtr<nsIDOMGeoPosition> lastPosition = gs->GetCachedPosition();
   DOMTimeStamp cachedPositionTime;
   if (lastPosition) {
     lastPosition->GetTimestamp(&cachedPositionTime);
   }
 
   // check to see if we can use a cached value
-  //
-  // either:
-  // a) the user has specified a maximumAge which allows us to return a cached value,
-  // -or-
-  // b) the cached position time is some reasonable value to return to the user (<30s)
+  // if the user has specified a maximumAge, return a cached value.
 
-  uint32_t maximumAge = 30 * PR_MSEC_PER_SEC;
+  uint32_t maximumAge = 0;
   if (mOptions) {
-    if (mOptions->mMaximumAge >= 0) {
+    if (mOptions->mMaximumAge > 0) {
       maximumAge = mOptions->mMaximumAge;
     }
   }
   gs->SetHigherAccuracy(mOptions && mOptions->mEnableHighAccuracy);
 
   bool canUseCache = lastPosition && maximumAge > 0 &&
     (PRTime(PR_Now() / PR_USEC_PER_MSEC) - maximumAge <=
     PRTime(cachedPositionTime));
--- a/dom/webidl/Geolocation.webidl
+++ b/dom/webidl/Geolocation.webidl
@@ -8,17 +8,17 @@
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
 dictionary PositionOptions {
   boolean enableHighAccuracy = false;
   long timeout = 0x7fffffff;
-  long maximumAge = 30000; /* non-conformant, should be 0 */
+  long maximumAge = 0;
 };
 
 [NoInterfaceObject]
 interface Geolocation {
   [Throws]
   void getCurrentPosition(PositionCallback successCallback,
                           optional PositionErrorCallback? errorCallback = null,
                           optional PositionOptions options);