From 0c4cb34391ab53f5b5ef9e2959bf1dd089957875 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Tue, 29 Sep 2020 16:33:55 +0200 Subject: [PATCH] Define speculative HTML parsing (WIP) --- source | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source b/source index 97abc1f8269..d677ac05762 100644 --- a/source +++ b/source @@ -111086,6 +111086,8 @@ document.body.appendChild(text); invocations of the tokenizer, yielding control back to the caller. (Tokenization will resume when the caller returns to the "outer" tree construction stage.)

+

Speculatively parse the remainder of the document.write string here?

+

The tree construction stage of this particular parser is being called reentrantly, say from a call to document.write().

@@ -111101,6 +111103,9 @@ document.body.appendChild(text);
  • Let the script be the pending parsing-blocking script. There is no longer a pending parsing-blocking script.

  • +
  • Start the speculative HTML parser for this instance of the HTML + parser.

  • +
  • Block the tokenizer for this instance of the HTML parser, such that the event loop will not run tasks that invoke the Document.

  • +
  • Stop the speculative HTML parser for this instance of the HTML + parser.

  • +
  • Unblock the tokenizer for this instance of the HTML parser, such that tasks that invoke the tokenizer can again be run.

  • @@ -112657,6 +112665,14 @@ document.body.appendChild(text); +
    + +

    Speculative HTML parsing

    + +

    Speculative HTML parser, start the speculative HTML parser, + stop the speculative HTML parser...

    + +
    @@ -112781,6 +112797,9 @@ document.body.appendChild(text);
  • Throw away any pending content in the input stream, and discard any future content that would have been added to it.

  • +
  • If there is an active speculative HTML parser, stop the speculative + HTML parser for this HTML parser.

  • +
  • Set the current document readiness to "interactive".