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

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

Issue 1377673002: Properly fix use-after-free of InputTypeViews when the type attribute is modified in the change eve… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp » ('j') | 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, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 // FIXME: Check whether there are any cases where this actually ends up leak ing. 1174 // FIXME: Check whether there are any cases where this actually ends up leak ing.
1175 return m_inputTypeView->willDispatchClick().leakPtr(); 1175 return m_inputTypeView->willDispatchClick().leakPtr();
1176 #endif 1176 #endif
1177 } 1177 }
1178 1178
1179 void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreD ispatch) 1179 void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreD ispatch)
1180 { 1180 {
1181 OwnPtrWillBeRawPtr<ClickHandlingState> state = adoptPtrWillBeNoop(static_cas t<ClickHandlingState*>(dataFromPreDispatch)); 1181 OwnPtrWillBeRawPtr<ClickHandlingState> state = adoptPtrWillBeNoop(static_cas t<ClickHandlingState*>(dataFromPreDispatch));
1182 if (!state) 1182 if (!state)
1183 return; 1183 return;
1184 // m_inputTypeView could be freed if the type attribute is modified through a change event handler.
1185 RefPtrWillBeRawPtr<InputTypeView> protect(m_inputTypeView);
1184 m_inputTypeView->didDispatchClick(event, *state); 1186 m_inputTypeView->didDispatchClick(event, *state);
1185 } 1187 }
1186 1188
1187 void HTMLInputElement::defaultEventHandler(Event* evt) 1189 void HTMLInputElement::defaultEventHandler(Event* evt)
1188 { 1190 {
1189 if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEv ent(evt)->button() == LeftButton) { 1191 if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEv ent(evt)->button() == LeftButton) {
1190 m_inputTypeView->handleClickEvent(toMouseEvent(evt)); 1192 m_inputTypeView->handleClickEvent(toMouseEvent(evt));
1191 if (evt->defaultHandled()) 1193 if (evt->defaultHandled())
1192 return; 1194 return;
1193 } 1195 }
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 void HTMLInputElement::ensurePrimaryContent() 1941 void HTMLInputElement::ensurePrimaryContent()
1940 { 1942 {
1941 m_inputTypeView->ensurePrimaryContent(); 1943 m_inputTypeView->ensurePrimaryContent();
1942 } 1944 }
1943 1945
1944 bool HTMLInputElement::hasFallbackContent() const 1946 bool HTMLInputElement::hasFallbackContent() const
1945 { 1947 {
1946 return m_inputTypeView->hasFallbackContent(); 1948 return m_inputTypeView->hasFallbackContent();
1947 } 1949 }
1948 } // namespace 1950 } // namespace
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698