Commit 73ba5348 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

[HTMLParser] Always start pumping new chunks after unpausing.

Pauses may happen while the parser has already yielded, and in
particular when a script-inserted style sheet appears that has
an external resource.

The failure mode before this patch was:
1. Yield & schedule unyield
2. Script task runs
3. Script task inserts stylesheet with external resource
4. Resource finished
5. ResumeParsingAfterPause called, but there is no last_chunk_before_pause_
because there was a yield, not a pause.

Bug:902237

Change-Id: Id65c721fc193ecec7190e6b466a6794b65ea6acc
Reviewed-on: https://chromium-review.googlesource.com/c/1389502Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622099}
parent af99c7c0
...@@ -1028,10 +1028,16 @@ void HTMLDocumentParser::ResumeParsingAfterPause() { ...@@ -1028,10 +1028,16 @@ void HTMLDocumentParser::ResumeParsingAfterPause() {
return; return;
if (have_background_parser_) { if (have_background_parser_) {
// If we paused in the middle of processing a token chunk,
// deal with that before starting to pump.
if (last_chunk_before_pause_) { if (last_chunk_before_pause_) {
ValidateSpeculations(std::move(last_chunk_before_pause_)); ValidateSpeculations(std::move(last_chunk_before_pause_));
DCHECK(!last_chunk_before_pause_); DCHECK(!last_chunk_before_pause_);
PumpPendingSpeculations(); PumpPendingSpeculations();
} else if (!IsScheduledForUnpause()) {
// Otherwise, start pumping if we're not already scheduled to unpause
// already.
PumpPendingSpeculations();
} }
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment