diff --git a/source b/source index 57fad65139c..49b4e94d999 100644 --- a/source +++ b/source @@ -93943,7 +93943,7 @@ import "https://example.com/foo/../module2.mjs"; -
If all of the following are true
Objects that implement the WindowOrWorkerGlobalScope
mixin have a map of active timers, which is a map, initially empty. Each
- key in this map is identified by a number, which must be unique
- within the list for the lifetime of the object that implements the
- WindowOrWorkerGlobalScope
mixin, and each value is a
+ key in this map is an identifier for a timer, and each value is a
DOMHighResTimeStamp
, representing the expiry time for that timer.
For entries put in the map of active timers by the timer
+ initialization steps, i.e., by setTimeout()
and setInterval()
, the keys are numbers. For other specifications
+ that use the wait for a timeout algorithm, the identifier is a unique opaque value.
+ Only the numeric-keyed timers are affected by clearTimeout()
and clearInterval()
, but all timers contribute to idle deadline computation, and are cleared when the
+ relevant global is destroyed.
The DOMParserSupportedType
{
Set task's timer nesting level to nesting level.
Let completionStep be an algorithm step which queues a global task on the timer task source given + global to run task.
Wait for a timeout given global, "setTimeout/setInterval
", timeout, completionStep, and
+ handle.
Once the task has been processed, if repeat is false, it is safe to + remove the entry for handle 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).
+Return handle.
Argument conversion as defined by Web IDL (for example, invoking toString()
methods on objects passed as the first argument) happens in the
+ algorithms defined in Web IDL, before this algorithm is invoked.
So for example, the following rather silly code will result in the log containing "ONE TWO
":
var log = '';
+function logger(s) { log += s + ' '; }
+
+setTimeout({ toString: function () {
+setTimeout("logger('ONE')", 100);
+return "logger('TWO')";
+} }, 100);
+ To wait for a timeout, given a WindowOrWorkerGlobalScope
+ global, a string orderingIdentifier, a number milliseconds, a
+ set of steps completionSteps, and an optional value timerKey:
Assert: if timerKey is given, then the caller of this algorithm is the + timer initialization steps. (Other specifications must not pass + timerKey.)
If timerKey is not given, set it to a new unique non-numeric value.
Let startTime be the current high resolution time.
Set global's - map of active timers[handle] to startTime plus - timeout.
Set global's map of active + timers[timerKey] to startTime plus + milliseconds.
Run the following steps in parallel:
@@ -96607,17 +96661,17 @@ enum DOMParserSupportedType {If global is a Window
object, wait until global's associated Document
has been fully
- active for a further timeout milliseconds (not necessarily
+ active for a further milliseconds milliseconds (not necessarily
consecutively).
Otherwise, global is a WorkerGlobalScope
object; wait
- until timeout milliseconds have passed with the worker not suspended (not
+
Otherwise, global is a WorkerGlobalScope
object; wait until
+ milliseconds milliseconds have passed with the worker not suspended (not
necessarily consecutively).
Wait until any invocations of this algorithm that had the same global, that - started before this one, and whose timeout is equal to or less than this one's, - have completed.
Wait until any invocations of this algorithm that had the same global and + orderingIdentifier, that started before this one, and whose milliseconds + is equal to or less than this one's, have completed.
Optionally, wait a further implementation-defined length of time.
@@ -96629,37 +96683,17 @@ enum DOMParserSupportedType { associated higher power usage.Queue a global task on the timer task source given - global to run task.
- -Once the task has been processed, if repeat is false, it is safe - to remove the entry for handle 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).
-Perform completionSteps.
Return handle.
Argument conversion as defined by Web IDL (for example, invoking toString()
methods on objects passed as the first argument) happens in the
- algorithms defined in Web IDL, before this algorithm is invoked.
So for example, the following rather silly code will result in the log containing "ONE TWO
":
var log = '';
-function logger(s) { log += s + ' '; }
-
-setTimeout({ toString: function () {
-setTimeout("logger('ONE')", 100);
-return "logger('TWO')";
-} }, 100);
- Wait for a timeout is meant to be used by other specifications that
+ want to wait on developer-supplied timeouts, in a similar manner to setTimeout()
. (Note, however, it does not have the nesting and
+ clamping behavior of setTimeout()
.) Such specifications can
+ choose an orderingIdentifier to ensure ordering within their specification's timeouts,
+ while not constraining ordering with respect to other specification's timeouts.