Skip to content

Commit

Permalink
Fallback to legacy type only when event is trusted
Browse files Browse the repository at this point in the history
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 <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#482482}
  • Loading branch information
nekolab authored and Commit Bot committed Jun 27, 2017
1 parent a8e8222 commit 557d703
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.

This file was deleted.

2 changes: 1 addition & 1 deletion third_party/WebKit/Source/core/events/EventTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 557d703

Please sign in to comment.