Index: Source/core/html/parser/HTMLDocumentParser.cpp |
diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp |
index e0dfa89524655f0744cc7d8863a4958c941c38a3..f3a7f49f75121a265fcd27f833d2356e1963e752 100644 |
--- a/Source/core/html/parser/HTMLDocumentParser.cpp |
+++ b/Source/core/html/parser/HTMLDocumentParser.cpp |
@@ -557,6 +557,12 @@ void HTMLDocumentParser::pumpTokenizer(SynchronousMode mode) |
if (isStopped()) |
return; |
+ // There should only be PendingText left since the tree-builder always flushes |
+ // the task queue before returning. In case that ever changes, crash. |
+ if (mode == ForceSynchronous) |
+ m_treeBuilder->flush(); |
+ RELEASE_ASSERT(!isStopped()); |
+ |
if (session.needsYield) |
m_parserScheduler->scheduleForResume(); |