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

Unified Diff: Source/core/xml/parser/XMLDocumentParser.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/loader/DocumentWriter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/parser/XMLDocumentParser.cpp
diff --git a/Source/core/xml/parser/XMLDocumentParser.cpp b/Source/core/xml/parser/XMLDocumentParser.cpp
index 8ed8307aa3f33f9ab87f3c1c04a7d3fc444866af..96c1b79fad48f57326d44384fb8497958e825d9d 100644
--- a/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -441,6 +441,12 @@ void XMLDocumentParser::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<XMLDocumentParser> protect(this);
+ flush();
+ if (isDetached())
+ return;
+
if (m_parserPaused)
m_finishCalled = true;
else
« no previous file with comments | « Source/core/loader/DocumentWriter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698