| Index: Source/core/html/parser/HTMLScriptRunner.cpp
|
| diff --git a/Source/core/html/parser/HTMLScriptRunner.cpp b/Source/core/html/parser/HTMLScriptRunner.cpp
|
| index c16d06a1fbb413d501abf0206158d9cca8a4e80f..32d5af0c77f010bfbad3bf3336339c1b94e3aa1d 100644
|
| --- a/Source/core/html/parser/HTMLScriptRunner.cpp
|
| +++ b/Source/core/html/parser/HTMLScriptRunner.cpp
|
| @@ -113,10 +113,10 @@ void HTMLScriptRunner::executeParsingBlockingScript()
|
| ASSERT(isPendingScriptReady(m_parserBlockingScript));
|
|
|
| InsertionPointRecord insertionPointRecord(m_host->inputStream());
|
| - executePendingScriptAndDispatchEvent(m_parserBlockingScript);
|
| + executePendingScriptAndDispatchEvent(m_parserBlockingScript, PendingScriptBlockingParser);
|
| }
|
|
|
| -void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendingScript)
|
| +void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendingScript, PendingScriptType pendingScriptType)
|
| {
|
| bool errorOccurred = false;
|
| ScriptSourceCode sourceCode = sourceFromPendingScript(pendingScript, errorOccurred);
|
| @@ -125,8 +125,15 @@ void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendi
|
| if (pendingScript.resource() && pendingScript.watchingForLoad())
|
| stopWatchingForLoad(pendingScript);
|
|
|
| - if (!isExecutingScript())
|
| + if (!isExecutingScript()) {
|
| Microtask::performCheckpoint();
|
| + if (pendingScriptType == PendingScriptBlockingParser) {
|
| + m_hasScriptsWaitingForResources = !m_document->haveStylesheetsAndImportsLoaded();
|
| + // The parser cannot be unblocked as a microtask requested another resource
|
| + if (m_hasScriptsWaitingForResources)
|
| + return;
|
| + }
|
| + }
|
|
|
| // Clear the pending script before possible rentrancy from executeScript()
|
| RefPtr<Element> element = pendingScript.releaseElementAndClear();
|
| @@ -223,7 +230,7 @@ bool HTMLScriptRunner::executeScriptsWaitingForParsing()
|
| return false;
|
| }
|
| PendingScript first = m_scriptsToExecuteAfterParsing.takeFirst();
|
| - executePendingScriptAndDispatchEvent(first);
|
| + executePendingScriptAndDispatchEvent(first, PendingScriptDeferred);
|
| // FIXME: What is this m_document check for?
|
| if (!m_document)
|
| return false;
|
|
|