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

Unified Diff: Source/WebCore/html/parser/HTMLTreeBuilder.cpp

Issue 7155003: Merge 88411 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/742/
Patch Set: Created 9 years, 6 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/WebCore/html/parser/HTMLToken.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/html/parser/HTMLTreeBuilder.cpp
===================================================================
--- Source/WebCore/html/parser/HTMLTreeBuilder.cpp (revision 88826)
+++ Source/WebCore/html/parser/HTMLTreeBuilder.cpp (working copy)
@@ -434,7 +434,26 @@
void HTMLTreeBuilder::constructTreeFromToken(HTMLToken& rawToken)
{
AtomicHTMLToken token(rawToken);
+
+ // We clear the rawToken in case constructTreeFromAtomicToken
+ // synchronously re-enters the parser. We don't clear the token immedately
+ // for Character tokens because the AtomicHTMLToken avoids copying the
+ // characters by keeping a pointer to the underlying buffer in the
+ // HTMLToken. Fortuantely, Character tokens can't cause use to re-enter
+ // the parser.
+ //
+ // FIXME: Top clearing the rawToken once we start running the parser off
+ // the main thread or once we stop allowing synchronous JavaScript
+ // execution from parseMappedAttribute.
+ if (rawToken.type() != HTMLToken::Character)
+ rawToken.clear();
+
constructTreeFromAtomicToken(token);
+
+ if (!rawToken.isUninitialized()) {
+ ASSERT(rawToken.type() == HTMLToken::Character);
+ rawToken.clear();
+ }
}
void HTMLTreeBuilder::constructTreeFromAtomicToken(AtomicHTMLToken& token)
« no previous file with comments | « Source/WebCore/html/parser/HTMLToken.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698