Using microtask checkpoints for resetting the slow script dialog timer
Boris Zbarsky <[email protected]> Fri, 14 Jun 2013 21:24:56 -0400
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
Right now we use the ScriptEvaluated call to reset the "time we have
been running script" state. This requires us to have hacks for modal
state in there, and still has problems if we bounce in and out of
scripts (like event listeners, say) each of which is quick but which
cumulatively take lots of time.
Would it make any sense to reset the timer off a microtask checkpoint
instead? So conceptually we'd do it like so:
1) A call to the operation callback records the current time if we're
in the "reset" state.
2) Following calls compare the "now" time to the recorded time and put
up the slow script dialog as needed.
3) Clicking "stop script" disables script on the page (so if this
happens inside an event listener, that will not run any more script
for that event dispatch).
4) A microtask checkpoint resets our state and reenables script if it
was disabled due to item 3. Probably after doing the mutation
handlers and whatnot.
Thoughts?
-Boris