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

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

Issue 2588293002: Fix a crash in HTMLFormElement::reset() due to <output>. (Closed)
Patch Set: Created 4 years 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/LayoutTests/fast/forms/form-reset-crash.html ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 return; 458 return;
459 459
460 m_isInResetFunction = true; 460 m_isInResetFunction = true;
461 461
462 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::reset)) != 462 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::reset)) !=
463 DispatchEventResult::NotCanceled) { 463 DispatchEventResult::NotCanceled) {
464 m_isInResetFunction = false; 464 m_isInResetFunction = false;
465 return; 465 return;
466 } 466 }
467 467
468 for (const auto& element : listedElements()) { 468 // Copy the element list because |reset()| implementation can update DOM
469 // structure.
kochi 2016/12/21 01:45:58 Is it guaranteed that none of |elements| will be d
tkent 2016/12/21 02:13:31 An element can be disconnected, but it keeps alive
kochi 2016/12/21 02:20:05 I see, thanks for the explanation!
470 ListedElement::List elements(listedElements());
471 for (const auto& element : elements) {
469 if (element->isFormControlElement()) 472 if (element->isFormControlElement())
470 toHTMLFormControlElement(element)->reset(); 473 toHTMLFormControlElement(element)->reset();
471 } 474 }
472 475
473 m_isInResetFunction = false; 476 m_isInResetFunction = false;
474 } 477 }
475 478
476 void HTMLFormElement::parseAttribute(const QualifiedName& name, 479 void HTMLFormElement::parseAttribute(const QualifiedName& name,
477 const AtomicString& oldValue, 480 const AtomicString& oldValue,
478 const AtomicString& value) { 481 const AtomicString& value) {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 for (const auto& control : listedElements()) { 807 for (const auto& control : listedElements()) {
805 if (!control->isFormControlElement()) 808 if (!control->isFormControlElement())
806 continue; 809 continue;
807 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) 810 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton())
808 toHTMLFormControlElement(control)->pseudoStateChanged( 811 toHTMLFormControlElement(control)->pseudoStateChanged(
809 CSSSelector::PseudoDefault); 812 CSSSelector::PseudoDefault);
810 } 813 }
811 } 814 }
812 815
813 } // namespace blink 816 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/form-reset-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698