From cac526ae7057d6958c3be82b62026a3dbccca04b Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Thu, 28 Apr 2016 09:28:57 -0700 Subject: [PATCH] Allow arbitrary inter-document callback ordering Closes #29. --- index.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index ac9d0a1..7522e6b 100644 --- a/index.html +++ b/index.html @@ -359,9 +359,9 @@

Processing Model

  • Let runlist be document's Window object's list of runnable idle callbacks.
  • Append all entries from doclist into runlist preserving order.
  • Clear doclist.
  • -
  • Queue a task which performs the steps defined in the invoke idle callbacks algorithm with parameters runlist and deadline.
  • +
  • Queue a task which performs the steps defined in the invoke idle callbacks algorithm with deadline as parameter.
  • Save deadline as the last idle period deadline associated with the current event loop.
  • @@ -391,14 +391,17 @@

    Processing Model

    The invoke idle callbacks algorithm:

      +
    1. Let docs be the list of fully active Document objects whose Window object's list of runnable idle callbacks is not empty.
    2. Let now be the current time.
    3. If now is less than deadline:
        -
      1. Pop callback from the runlist.
      2. +
      3. Select any document from docs.
      4. +
      5. Pop callback from document's Window object's list of runnable idle callbacks.
      6. +
      7. If document's Window object's list of runnable idle callbacks is now empty, remove document from docs.
      8. Let deadlineArg be an IdleDeadline constructed -with the given deadline and the didTimeout attribute set to false
      9. +with the given deadline and the didTimeout attribute set to false.
      10. Call callback with deadlineArg as its argument. If an uncaught runtime script error occurs, then report the error.
      11. -
      12. If runlist is not empty, the user agent SHOULD queue a task which performs the steps in the invoke idle callbacks algorithm with parameters runlist and deadline.
      13. +
      14. If docs is not empty, the user agent SHOULD queue a task which performs the steps in the invoke idle callbacks algorithm with deadline as parameter.