| Index: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
|
| index 0f3b3f7612ee27f0d72d0d18f6e233807a888608..55c5ccd9fe0ea4fd6293e40e1b5a3c4f9f98d14d 100644
|
| --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
|
| +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
|
| @@ -398,10 +398,6 @@
|
| void HTMLDocumentParser::validateSpeculations(
|
| std::unique_ptr<TokenizedChunk> chunk) {
|
| ASSERT(chunk);
|
| - // TODO(kouhei): We should simplify codepath here by disallowing
|
| - // validateSpeculations
|
| - // while isWaitingForScripts, and m_lastChunkBeforeScript can simply be
|
| - // pushed to m_speculations.
|
| if (isWaitingForScripts()) {
|
| // We're waiting on a network script, just save the chunk, we'll get a
|
| // second validateSpeculations call after the script completes. This call
|
| @@ -1065,11 +1061,9 @@
|
| ASSERT(!isWaitingForScripts());
|
|
|
| if (m_haveBackgroundParser) {
|
| - if (m_lastChunkBeforeScript) {
|
| - validateSpeculations(std::move(m_lastChunkBeforeScript));
|
| - DCHECK(!m_lastChunkBeforeScript);
|
| - pumpPendingSpeculations();
|
| - }
|
| + validateSpeculations(std::move(m_lastChunkBeforeScript));
|
| + ASSERT(!m_lastChunkBeforeScript);
|
| + pumpPendingSpeculations();
|
| return;
|
| }
|
|
|
| @@ -1104,11 +1098,14 @@
|
| }
|
|
|
| void HTMLDocumentParser::executeScriptsWaitingForResources() {
|
| - DCHECK(document()->isScriptExecutionReady());
|
| -
|
| // Document only calls this when the Document owns the DocumentParser so this
|
| // will not be called in the DocumentFragment case.
|
| - DCHECK(m_scriptRunner);
|
| + ASSERT(m_scriptRunner);
|
| + // Ignore calls unless we have a script blocking the parser waiting on a
|
| + // stylesheet load. Otherwise we are currently parsing and this is a
|
| + // re-entrant call from encountering a </ style> tag.
|
| + if (!m_scriptRunner->hasScriptsWaitingForResources())
|
| + return;
|
| m_scriptRunner->executeScriptsWaitingForResources();
|
| if (!isWaitingForScripts())
|
| resumeParsingAfterScriptExecution();
|
|
|