Bug 1238801 - Don't set a timer for the default geolocation timeout. r=jdm, r=smaug
authorJinank Jain <jinank94@gmail.com>
Sun, 26 Jun 2016 10:24:54 -0400
changeset 330200 e1b1f1362a6c0d09061c06759aa03fb62bf6ab3e
parent 330199 1254b1288956b90865c746f416b387417dea773e
child 330201 54af298e7b99675e51d950f277e2529187bdc0f4
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm, smaug
bugs1238801
milestone50.0a1
Bug 1238801 - Don't set a timer for the default geolocation timeout. r=jdm, r=smaug
dom/geolocation/nsGeolocation.cpp
dom/webidl/Geolocation.webidl
--- a/dom/geolocation/nsGeolocation.cpp
+++ b/dom/geolocation/nsGeolocation.cpp
@@ -558,28 +558,20 @@ nsGeolocationRequest::GetRequester(nsICo
   return NS_OK;
 }
 
 void
 nsGeolocationRequest::SetTimeoutTimer()
 {
   StopTimeoutTimer();
 
-  int32_t timeout;
-  if (mOptions && (timeout = mOptions->mTimeout) != 0) {
-
-    if (timeout < 0) {
-      timeout = 0;
-    } else if (timeout < 10) {
-      timeout = 10;
-    }
-
+  if (mOptions && mOptions->mTimeout != 0 && mOptions->mTimeout != 0x7fffffff) {
     mTimeoutTimer = do_CreateInstance("@mozilla.org/timer;1");
     RefPtr<TimerCallbackHolder> holder = new TimerCallbackHolder(this);
-    mTimeoutTimer->InitWithCallback(holder, timeout, nsITimer::TYPE_ONE_SHOT);
+    mTimeoutTimer->InitWithCallback(holder, mOptions->mTimeout, nsITimer::TYPE_ONE_SHOT);
   }
 }
 
 void
 nsGeolocationRequest::StopTimeoutTimer()
 {
   if (mTimeoutTimer) {
     mTimeoutTimer->Cancel();
--- a/dom/webidl/Geolocation.webidl
+++ b/dom/webidl/Geolocation.webidl
@@ -7,18 +7,18 @@
  * http://www.w3.org/TR/geolocation-API
  *
  * 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 = 0;
+  [Clamp] unsigned long timeout = 0x7fffffff;
+  [Clamp] unsigned long maximumAge = 0;
 };
 
 [NoInterfaceObject]
 interface Geolocation {
   [Throws]
   void getCurrentPosition(PositionCallback successCallback,
                           optional PositionErrorCallback? errorCallback = null,
                           optional PositionOptions options);