Event loops in navigated-away-from windows

Anne van Kesteren annevk at annevk.nl
Sat Sep 27 07:49:56 PDT 2014


On Sat, Sep 27, 2014 at 4:02 PM, Mark S. Miller <erights at google.com> wrote:
> My intent was not to refer to a nonstd api. Instead, what happens with
>
>     (function f() {setTimeout(f, 0);})();
>
> in a web page that is navigated away from?

Now we get to why having two loops is bad...

Tasks in a browsing context's event loop have an associated document.
If that document is not fully active, those tasks are skipped when
selecting the oldest task to run for that event loop. Meaning that if
you navigate away the tasks for the document you navigated away from
stop executing, until you navigate back to it.

https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-9
covers this processing model.


-- 
https://annevankesteren.nl/


More information about the es-discuss mailing list