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 345634 370ba5872bf650d33034e2d60e6dc307e738562e
parent 345633 429ff39f3d28b195fb5ee1467cd8126bab3d89b8
child 345635 7facce0be4a3f664c6c2bce80fe7487b2c53035b
push id31441
push userkwierso@gmail.com
push dateThu, 02 Mar 2017 22:57:54 +0000
treeherdermozilla-central@b23d6277acca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1343877
milestone54.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 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