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

Unified Diff: third_party/WebKit/Source/core/events/EventDispatcher.cpp

Issue 2655803006: INPUT element: avoid crash in EventDispatcher::dispatchEventPostProcess(). (Closed)
Patch Set: . Created 3 years, 11 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/external/wpt/dom/events/Event-dispatch-click-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/events/EventDispatcher.cpp
diff --git a/third_party/WebKit/Source/core/events/EventDispatcher.cpp b/third_party/WebKit/Source/core/events/EventDispatcher.cpp
index c89649f3c44697088bd24e4a20ce8274dc907697..dafd657b6d9d2bf08914fa1efbbed7e067bd96b6 100644
--- a/third_party/WebKit/Source/core/events/EventDispatcher.cpp
+++ b/third_party/WebKit/Source/core/events/EventDispatcher.cpp
@@ -243,11 +243,6 @@ inline void EventDispatcher::dispatchEventPostProcess(
// 16. Set event’s currentTarget attribute to null.
m_event->setCurrentTarget(nullptr);
- // Pass the data from the preDispatchEventHandler to the
- // postDispatchEventHandler.
- m_node->postDispatchEventHandler(m_event.get(),
- preDispatchEventHandlerResult);
-
bool isClick = m_event->isMouseEvent() &&
toMouseEvent(*m_event).type() == EventTypeNames::click;
if (isClick) {
@@ -257,6 +252,14 @@ inline void EventDispatcher::dispatchEventPostProcess(
cache->handleClicked(m_event->target()->toNode());
}
+ // Pass the data from the preDispatchEventHandler to the
+ // postDispatchEventHandler.
+ // This may dispatch an event, and m_node and m_event might be altered.
+ m_node->postDispatchEventHandler(m_event.get(),
+ preDispatchEventHandlerResult);
+ // TODO(tkent): Is it safe to kick defaultEventHandler() with such altered
+ // m_event?
+
// The DOM Events spec says that events dispatched by JS (other than "click")
// should not have their default handlers invoked.
bool isTrustedOrClick =
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/dom/events/Event-dispatch-click-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698