From 557d70331a61f3cffa61c4ba52026f4fd7cd9912 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 26 Jun 2017 23:39:21 +0800 Subject: [PATCH] Fallback to legacy type only when event is trusted According to the spec[1], |isTrusted| should be tested before fallback to the legacy event type. 4 failed tests will be passed after this change. [1] https://dom.spec.whatwg.org/#concept-event-listener-invoke Bug: 692000 Change-Id: I6f890f738d96b179e404f6db90f7ebe5041c351c Reviewed-on: https://chromium-review.googlesource.com/547448 Reviewed-by: Kent Tamura Commit-Queue: Kent Tamura Cr-Commit-Position: refs/heads/master@{#482482} --- .../events/EventListener-invoke-legacy-expected.txt | 11 ----------- third_party/WebKit/Source/core/events/EventTarget.cpp | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 third_party/WebKit/LayoutTests/external/wpt/dom/events/EventListener-invoke-legacy-expected.txt diff --git a/third_party/WebKit/LayoutTests/external/wpt/dom/events/EventListener-invoke-legacy-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/dom/events/EventListener-invoke-legacy-expected.txt deleted file mode 100644 index 7caefac7a65b07..00000000000000 --- a/third_party/WebKit/LayoutTests/external/wpt/dom/events/EventListener-invoke-legacy-expected.txt +++ /dev/null @@ -1,11 +0,0 @@ -This is a testharness.js-based test. -PASS Listener of transitionend -FAIL Legacy listener of transitionend assert_unreached: listener of webkitTransitionEnd should not be invoked again Reached unreachable code -PASS Listener of animationend -FAIL Legacy listener of animationend assert_unreached: listener of webkitAnimationEnd should not be invoked again Reached unreachable code -PASS Listener of animationiteration -FAIL Legacy listener of animationiteration assert_unreached: listener of webkitAnimationIteration should not be invoked again Reached unreachable code -PASS Listener of animationstart -FAIL Legacy listener of animationstart assert_unreached: listener of webkitAnimationStart should not be invoked again Reached unreachable code -Harness: the test ran to completion. - diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp index 54b08f221ce576..427eb3740af57b 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.cpp +++ b/third_party/WebKit/Source/core/events/EventTarget.cpp @@ -621,7 +621,7 @@ DispatchEventResult EventTarget::FireEventListeners(Event* event) { bool fired_event_listeners = false; if (listeners_vector) { fired_event_listeners = FireEventListeners(event, d, *listeners_vector); - } else if (legacy_listeners_vector) { + } else if (event->isTrusted() && legacy_listeners_vector) { AtomicString unprefixed_type_name = event->type(); event->SetType(legacy_type_name); fired_event_listeners =