From e9ba78f3e1590664f492d8bd4fdb70dc96b83113 Mon Sep 17 00:00:00 2001 From: Andreu Botella Date: Tue, 30 Nov 2021 23:13:52 +0100 Subject: [PATCH] Remove a setTimeout()'s entry in the map of active timers after it runs It used to be unobservable whether a non-repeating timer that had already run its callback had an entry in the list of active timers or not, and so those entries were never removed from the list. However, calculation of the idle deadline, meaning that if a timer expires and is never cancelled, the deadline will be in the past. This change avoids this case by removing non-repeating timers from the map of active timers after their callback runs. Closes #7376. --- source | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/source b/source index ac8a64077f8..1848f28ff2b 100644 --- a/source +++ b/source @@ -96875,6 +96875,9 @@ enum DOMParserSupportedType {
  • If repeat is true, then perform the timer initialization steps again, given global, handler, timeout, arguments, true, and id.

  • + +
  • Otherwise, remove global's map of + active timers[id].

  • @@ -96886,16 +96889,9 @@ enum DOMParserSupportedType { task">queues a global task on the timer task source given global to run task.

    -
  • -

    Run steps after a timeout given global, "setTimeout/setInterval", timeout, completionStep, and - id.

    - -

    Once the task has been processed, if repeat is false, it is safe to - remove the entry for id from the map of active timers (there is no way - for the entry's existence to be detected past this point, so it does not technically matter one - way or the other).

    -
  • +
  • Run steps after a timeout given global, "setTimeout/setInterval", timeout, completionStep, and + id.

  • Return id.

  • @@ -96996,6 +96992,9 @@ scheduleWork(); // queues a task to do lots of work
  • Perform completionSteps.

  • + +
  • If timerKey is a non-numeric value, remove + global's map of active timers[timerKey].