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

Unified Diff: third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp

Issue 1366983003: Prevent CheckboxInputType from being freed by change event handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests again Created 5 years, 3 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 | « third_party/WebKit/LayoutTests/fast/forms/checkbox/checkbox-change-event-free-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp b/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp
index 2be0d9608d086caf5c0fbfb318c8b87ee08f9411..5e5ce039976bbd2b026853713c107e6431c1e932 100644
--- a/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp
+++ b/third_party/WebKit/Source/core/html/forms/CheckboxInputType.cpp
@@ -88,6 +88,11 @@ PassOwnPtrWillBeRawPtr<ClickHandlingState> CheckboxInputType::willDispatchClick(
void CheckboxInputType::didDispatchClick(Event* event, const ClickHandlingState& state)
{
+ // Prevent change event handlers from indirectly freeing the
+ // CheckboxInputType via a modification of the "type" attribute on the
+ // HTMLInputElement.
+ RefPtrWillBeRawPtr<CheckboxInputType> protect(this);
+
if (event->defaultPrevented() || event->defaultHandled()) {
element().setIndeterminate(state.indeterminate);
element().setChecked(state.checked);
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/checkbox/checkbox-change-event-free-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698