Bug 1343877 Don't allow an extra timer callback beyond configured pref value. r=smaug
authorBen Kelly <ben@wanderview.com>
Thu, 02 Mar 2017 11:33:11 -0500
changeset 374661 370ba5872bf650d33034e2d60e6dc307e738562e
parent 374660 429ff39f3d28b195fb5ee1467cd8126bab3d89b8
child 374662 7facce0be4a3f664c6c2bce80fe7487b2c53035b
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1343877
milestone54.0a1
Bug 1343877 Don't allow an extra timer callback beyond configured pref value. r=smaug
dom/base/TimeoutManager.cpp
--- a/dom/base/TimeoutManager.cpp
+++ b/dom/base/TimeoutManager.cpp
@@ -469,16 +469,18 @@ TimeoutManager::RunTimeout(Timeout* aTim
         timeout->mFiringDepth = firingDepth;
         last_expired_timeout_is_normal = expiredIter.PickedNormalIter();
         if (last_expired_timeout_is_normal) {
           last_expired_normal_timeout = timeout;
         } else {
           last_expired_tracking_timeout = timeout;
         }
 
+        numTimersToRun += 1;
+
         // Note that we have seen our target timer.  This means we can now
         // stop processing timers once we hit our threshold below.
         if (timeout == aTimeout) {
           targetTimerSeen = true;
         }
 
         // Run only a limited number of timers based on the configured
         // maximum.  Note, we must always run our target timer however.
@@ -490,18 +492,16 @@ TimeoutManager::RunTimeout(Timeout* aTim
         // trust chrome windows not to misbehave and partly because a
         // number of browser chrome tests have races that depend on this
         // coalescing.
         if (targetTimerSeen &&
             numTimersToRun >= gTargetMaxConsecutiveCallbacks &&
             !mWindow.IsChromeWindow()) {
           break;
         }
-
-        numTimersToRun += 1;
       }
 
       expiredIter.UpdateIterator();
     }
   }
 
   // Maybe the timeout that the event was fired for has been deleted
   // and there are no others timeouts with deadlines that make them