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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp

Issue 1372343002: Crash fix: Avoid using stale HTMLToken after tree construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add TODO about mutation Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * Copyright (C) 2011, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2014 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 || token->name() == embedTag 786 || token->name() == embedTag
787 || token->name() == imgTag 787 || token->name() == imgTag
788 || token->name() == keygenTag 788 || token->name() == keygenTag
789 || token->name() == wbrTag) { 789 || token->name() == wbrTag) {
790 m_tree.reconstructTheActiveFormattingElements(); 790 m_tree.reconstructTheActiveFormattingElements();
791 m_tree.insertSelfClosingHTMLElement(token); 791 m_tree.insertSelfClosingHTMLElement(token);
792 m_framesetOk = false; 792 m_framesetOk = false;
793 return; 793 return;
794 } 794 }
795 if (token->name() == inputTag) { 795 if (token->name() == inputTag) {
796 // Per spec https://html.spec.whatwg.org/#parsing-main-inbody,
797 // section "A start tag whose tag name is "input""
798
796 Attribute* typeAttribute = token->getAttributeItem(typeAttr); 799 Attribute* typeAttribute = token->getAttributeItem(typeAttr);
800 bool disableFrameset = !typeAttribute || !equalIgnoringCase(typeAttribut e->value(), "hidden");
801
797 m_tree.reconstructTheActiveFormattingElements(); 802 m_tree.reconstructTheActiveFormattingElements();
803 // TODO(kouhei): Make it obvious that insertSelfClosingHTMLElement may m utate the token.
798 m_tree.insertSelfClosingHTMLElement(token); 804 m_tree.insertSelfClosingHTMLElement(token);
799 if (!typeAttribute || !equalIgnoringCase(typeAttribute->value(), "hidden ")) 805
806 if (disableFrameset)
800 m_framesetOk = false; 807 m_framesetOk = false;
801 return; 808 return;
802 } 809 }
803 if ((RuntimeEnabledFeatures::contextMenuEnabled() && token->name() == menuit emTag) 810 if ((RuntimeEnabledFeatures::contextMenuEnabled() && token->name() == menuit emTag)
804 || token->name() == paramTag 811 || token->name() == paramTag
805 || token->name() == sourceTag 812 || token->name() == sourceTag
806 || token->name() == trackTag) { 813 || token->name() == trackTag) {
807 m_tree.insertSelfClosingHTMLElement(token); 814 m_tree.insertSelfClosingHTMLElement(token);
808 return; 815 return;
809 } 816 }
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after
2804 ASSERT(m_isAttached); 2811 ASSERT(m_isAttached);
2805 // Warning, this may detach the parser. Do not do anything else after this. 2812 // Warning, this may detach the parser. Do not do anything else after this.
2806 m_tree.finishedParsing(); 2813 m_tree.finishedParsing();
2807 } 2814 }
2808 2815
2809 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) 2816 void HTMLTreeBuilder::parseError(AtomicHTMLToken*)
2810 { 2817 {
2811 } 2818 }
2812 2819
2813 } // namespace blink 2820 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698