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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBEventDispatcher.cpp

Issue 1972053002: Add UseCounters for Event.cancelBubble behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/indexeddb/IDBEventDispatcher.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBEventDispatcher.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBEventDispatcher.cpp
index 76ca8bc0d5bf62d596ab8bca0f37e4db648dbf65..a57bddd93a153f245947c70f2d3292caa28b45a1 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBEventDispatcher.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBEventDispatcher.cpp
@@ -28,6 +28,7 @@
#include "modules/indexeddb/IDBEventDispatcher.h"
+#include "core/frame/UseCounter.h"
#include "modules/EventModules.h"
#include "modules/EventTargetModules.h"
@@ -49,15 +50,29 @@ DispatchEventResult IDBEventDispatcher::dispatch(Event* event, HeapVector<Member
event->setEventPhase(Event::AT_TARGET);
event->setCurrentTarget(eventTargets[0].get());
eventTargets[0]->fireEventListeners(event);
- if (event->propagationStopped() || !event->bubbles() || event->cancelBubble())
+ if (event->propagationStopped() || !event->bubbles())
goto doneDispatching;
+ if (event->bubbles() && event->cancelBubble()) {
+ for (size_t i = 1; i < size; ++i) { // Don't do the first element.
+ if (eventTargets[i]->hasEventListeners(event->type()))
+ UseCounter::count(eventTargets[i]->getExecutionContext(), UseCounter::EventCancelBubbleAffected);
+ }
+ goto doneDispatching;
+ }
event->setEventPhase(Event::BUBBLING_PHASE);
for (size_t i = 1; i < size; ++i) { // Don't do the first element.
event->setCurrentTarget(eventTargets[i].get());
eventTargets[i]->fireEventListeners(event);
- if (event->propagationStopped() || event->cancelBubble())
+ if (event->propagationStopped())
+ goto doneDispatching;
+ if (event->cancelBubble()) {
+ for (size_t j = i + 1; j < size; ++j) {
+ if (eventTargets[j]->hasEventListeners(event->type()))
+ UseCounter::count(eventTargets[j]->getExecutionContext(), UseCounter::EventCancelBubbleAffected);
+ }
goto doneDispatching;
+ }
}
doneDispatching:
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698