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

Side by Side Diff: third_party/WebKit/Source/core/events/EventDispatcher.cpp

Issue 2655803006: INPUT element: avoid crash in EventDispatcher::dispatchEventPostProcess(). (Closed)
Patch Set: . Created 3 years, 10 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/external/wpt/dom/events/Event-dispatch-click-expected.txt ('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, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // https://dom.spec.whatwg.org/#concept-event-dispatch 236 // https://dom.spec.whatwg.org/#concept-event-dispatch
237 // 14. Unset event’s dispatch flag, stop propagation flag, and stop immediate 237 // 14. Unset event’s dispatch flag, stop propagation flag, and stop immediate
238 // propagation flag. 238 // propagation flag.
239 m_event->setStopPropagation(false); 239 m_event->setStopPropagation(false);
240 m_event->setStopImmediatePropagation(false); 240 m_event->setStopImmediatePropagation(false);
241 // 15. Set event’s eventPhase attribute to NONE. 241 // 15. Set event’s eventPhase attribute to NONE.
242 m_event->setEventPhase(0); 242 m_event->setEventPhase(0);
243 // 16. Set event’s currentTarget attribute to null. 243 // 16. Set event’s currentTarget attribute to null.
244 m_event->setCurrentTarget(nullptr); 244 m_event->setCurrentTarget(nullptr);
245 245
246 // Pass the data from the preDispatchEventHandler to the
247 // postDispatchEventHandler.
248 m_node->postDispatchEventHandler(m_event.get(),
249 preDispatchEventHandlerResult);
250
251 bool isClick = m_event->isMouseEvent() && 246 bool isClick = m_event->isMouseEvent() &&
252 toMouseEvent(*m_event).type() == EventTypeNames::click; 247 toMouseEvent(*m_event).type() == EventTypeNames::click;
253 if (isClick) { 248 if (isClick) {
254 // Fire an accessibility event indicating a node was clicked on. This is 249 // Fire an accessibility event indicating a node was clicked on. This is
255 // safe if m_event->target()->toNode() returns null. 250 // safe if m_event->target()->toNode() returns null.
256 if (AXObjectCache* cache = m_node->document().existingAXObjectCache()) 251 if (AXObjectCache* cache = m_node->document().existingAXObjectCache())
257 cache->handleClicked(m_event->target()->toNode()); 252 cache->handleClicked(m_event->target()->toNode());
258 } 253 }
259 254
255 // Pass the data from the preDispatchEventHandler to the
256 // postDispatchEventHandler.
257 // This may dispatch an event, and m_node and m_event might be altered.
258 m_node->postDispatchEventHandler(m_event.get(),
259 preDispatchEventHandlerResult);
260 // TODO(tkent): Is it safe to kick defaultEventHandler() with such altered
261 // m_event?
262
260 // The DOM Events spec says that events dispatched by JS (other than "click") 263 // The DOM Events spec says that events dispatched by JS (other than "click")
261 // should not have their default handlers invoked. 264 // should not have their default handlers invoked.
262 bool isTrustedOrClick = 265 bool isTrustedOrClick =
263 !RuntimeEnabledFeatures::trustedEventsDefaultActionEnabled() || 266 !RuntimeEnabledFeatures::trustedEventsDefaultActionEnabled() ||
264 m_event->isTrusted() || isClick; 267 m_event->isTrusted() || isClick;
265 268
266 // For Android WebView (distinguished by wideViewportQuirkEnabled) 269 // For Android WebView (distinguished by wideViewportQuirkEnabled)
267 // enable untrusted events for mouse down on select elements because 270 // enable untrusted events for mouse down on select elements because
268 // fastclick.js seems to generate these. crbug.com/642698 271 // fastclick.js seems to generate these. crbug.com/642698
269 // TODO(dtapuska): Change this to a target SDK quirk crbug.com/643705 272 // TODO(dtapuska): Change this to a target SDK quirk crbug.com/643705
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // events to open select boxes. 307 // events to open select boxes.
305 if (!m_event->isTrusted() && m_event->isMouseEvent() && 308 if (!m_event->isTrusted() && m_event->isMouseEvent() &&
306 m_event->type() == EventTypeNames::mousedown && 309 m_event->type() == EventTypeNames::mousedown &&
307 isHTMLSelectElement(*m_node)) { 310 isHTMLSelectElement(*m_node)) {
308 UseCounter::count(m_node->document(), 311 UseCounter::count(m_node->document(),
309 UseCounter::UntrustedMouseDownEventDispatchedToSelect); 312 UseCounter::UntrustedMouseDownEventDispatchedToSelect);
310 } 313 }
311 } 314 }
312 315
313 } // namespace blink 316 } // namespace blink
OLDNEW
« 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