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

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

Issue 473203002: DocumentParser should flush itself on finish (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: needs finish event when stopped Created 6 years, 4 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/dom/DocumentParser.h ('k') | Source/core/loader/DocumentWriter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLDocumentParser.cpp
diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp
index 5c78b8da1b9df2032bc0b121f5b8c57315bec37e..e430d15ea5b93ae29149cc2efc4918cb578472e7 100644
--- a/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -872,6 +872,12 @@ void HTMLDocumentParser::finish()
// makes sense to call any methods on DocumentParser once it's been stopped.
// However, FrameLoader::stop calls DocumentParser::finish unconditionally.
+ // flush may ending up executing arbitrary script, and possibly detach the parser.
+ RefPtr<HTMLDocumentParser> protect(this);
+ flush();
+ if (isDetached())
+ return;
+
// Empty documents never got an append() call, and thus have never started
// a background parser. In those cases, we ignore shouldUseThreading()
// and fall through to the non-threading case.
« no previous file with comments | « Source/core/dom/DocumentParser.h ('k') | Source/core/loader/DocumentWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698