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

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

Issue 1989463002: Deprecate invoking the default action for untrusted events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_dom_event_deprecation
Patch Set: Rebase Created 4 years, 7 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
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 665cf82318b789725a9bfbd2449d95a3130e6e23..af33e2aac8023d84d24fcb1d8944e759b0a6163a 100644
--- a/third_party/WebKit/Source/core/events/EventDispatcher.cpp
+++ b/third_party/WebKit/Source/core/events/EventDispatcher.cpp
@@ -32,6 +32,7 @@
#include "core/events/MouseEvent.h"
#include "core/events/ScopedEventQueue.h"
#include "core/events/WindowEventContext.h"
+#include "core/frame/Deprecation.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/UseCounter.h"
@@ -227,20 +228,20 @@ inline void EventDispatcher::dispatchEventPostProcess(EventDispatchHandlingState
m_node->willCallDefaultEventHandler(*m_event);
m_node->defaultEventHandler(m_event.get());
ASSERT(!m_event->defaultPrevented());
- if (m_event->defaultHandled())
- return;
// For bubbling events, call default event handlers on the same targets in the
// same order as the bubbling phase.
- if (m_event->bubbles()) {
+ if (!m_event->defaultHandled() && m_event->bubbles()) {
size_t size = m_event->eventPath().size();
for (size_t i = 1; i < size; ++i) {
m_event->eventPath()[i].node()->willCallDefaultEventHandler(*m_event);
m_event->eventPath()[i].node()->defaultEventHandler(m_event.get());
ASSERT(!m_event->defaultPrevented());
if (m_event->defaultHandled())
- return;
+ break;
}
}
+ if (m_event->defaultHandled() && !m_event->isTrusted() && !isClick)
+ Deprecation::countDeprecation(m_node->document(), UseCounter::UntrustedEventDefaultHandled);
}
}

Powered by Google App Engine
This is Rietveld 408576698