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

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

Issue 2040123002: SELECT popup: Fix a crash by DOM mutation during opening popup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select/menulist-popup-mutation-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) 2010 Nokia Corporation and/or its subsidiary(-ies). 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * (C) 1999 Antti Koivisto (koivisto@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * 10 *
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 DECLARE_VIRTUAL_TRACE(); 2008 DECLARE_VIRTUAL_TRACE();
2009 2009
2010 void dispose() 2010 void dispose()
2011 { 2011 {
2012 m_observer->disconnect(); 2012 m_observer->disconnect();
2013 } 2013 }
2014 2014
2015 private: 2015 private:
2016 void call(const HeapVector<Member<MutationRecord>>&, MutationObserver*) over ride 2016 void call(const HeapVector<Member<MutationRecord>>&, MutationObserver*) over ride
2017 { 2017 {
2018 // We disconnect the MutationObserver when a popuup is closed. However
2019 // MutationObserver can call back after disconnection.
2020 if (!m_select->popupIsVisible())
2021 return;
2018 m_select->didMutateSubtree(); 2022 m_select->didMutateSubtree();
2019 } 2023 }
2020 2024
2021 ExecutionContext* getExecutionContext() const override 2025 ExecutionContext* getExecutionContext() const override
2022 { 2026 {
2023 return &m_select->document(); 2027 return &m_select->document();
2024 } 2028 }
2025 2029
2026 Member<HTMLSelectElement> m_select; 2030 Member<HTMLSelectElement> m_select;
2027 Member<MutationObserver> m_observer; 2031 Member<MutationObserver> m_observer;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 } 2073 }
2070 2074
2071 void HTMLSelectElement::didMutateSubtree() 2075 void HTMLSelectElement::didMutateSubtree()
2072 { 2076 {
2073 DCHECK(popupIsVisible()); 2077 DCHECK(popupIsVisible());
2074 DCHECK(m_popup); 2078 DCHECK(m_popup);
2075 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2079 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2076 } 2080 }
2077 2081
2078 } // namespace blink 2082 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select/menulist-popup-mutation-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698