Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: Source/core/html/parser/HTMLScriptRunner.cpp

Issue 202813002: [HTML Import] Let script block by pending resources created by lifecycle callback (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Re-landing with another fix Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/parser/HTMLScriptRunner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/html/parser/HTMLScriptRunner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698