Title: [212321] trunk
Revision
212321
Author
[email protected]
Date
2017-02-14 13:11:54 -0800 (Tue, 14 Feb 2017)

Log Message

Fallback to legacy type only when event is trusted
https://bugs.webkit.org/show_bug.cgi?id=168301

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline web-platform-test now tha more checks are passing.

* web-platform-tests/dom/events/EventListener-invoke-legacy-expected.txt:

Source/WebCore:

Fallback to legacy type only when event is trusted as per a recent
DOM specification change:
- https://github.com/whatwg/dom/issues/404
- https://github.com/whatwg/dom/pull/406

No new tests, rebaselined existing test.

* dom/EventTarget.cpp:
(WebCore::legacyType):
(WebCore::EventTarget::fireEventListeners):

Modified Paths

Diff

Modified: trunk/LayoutTests/fast/events/wheelevent-in-scrolling-div.html (212320 => 212321)


--- trunk/LayoutTests/fast/events/wheelevent-in-scrolling-div.html	2017-02-14 21:08:46 UTC (rev 212320)
+++ trunk/LayoutTests/fast/events/wheelevent-in-scrolling-div.html	2017-02-14 21:11:54 UTC (rev 212321)
@@ -14,7 +14,7 @@
             {
                 var overflowElement = document.getElementById("overflow");
                 if (overflowElement) {
-                    overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
+                    overflowElement.addEventListener("wheel", mousewheelHandler, false);
 
                     var wheelEvent = document.createEvent("WheelEvent");
                     wheelEvent.initWebKitWheelEvent(-window.expectedScrollLeft, -window.expectedScrollTop, window, 0, 0, 0, 0, false, false, false, false);

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (212320 => 212321)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-14 21:08:46 UTC (rev 212320)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-14 21:11:54 UTC (rev 212321)
@@ -1,3 +1,14 @@
+2017-02-14  Chris Dumez  <[email protected]>
+
+        Fallback to legacy type only when event is trusted
+        https://bugs.webkit.org/show_bug.cgi?id=168301
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline web-platform-test now tha more checks are passing.
+
+        * web-platform-tests/dom/events/EventListener-invoke-legacy-expected.txt:
+
 2017-02-13  Alex Christensen  <[email protected]>
 
         URLs with an invalid IPv4 address should be invalid

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventListener-invoke-legacy-expected.txt (212320 => 212321)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventListener-invoke-legacy-expected.txt	2017-02-14 21:08:46 UTC (rev 212320)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventListener-invoke-legacy-expected.txt	2017-02-14 21:11:54 UTC (rev 212321)
@@ -1,10 +1,10 @@
 
 PASS Listener of transitionend 
-FAIL Legacy listener of transitionend assert_unreached: listener of webkitTransitionEnd should not be invoked again Reached unreachable code
+PASS Legacy listener of transitionend 
 PASS Listener of animationend 
-FAIL Legacy listener of animationend assert_unreached: listener of webkitAnimationEnd should not be invoked again Reached unreachable code
+PASS Legacy listener of animationend 
 PASS Listener of animationiteration 
-FAIL Legacy listener of animationiteration assert_unreached: listener of webkitAnimationIteration should not be invoked again Reached unreachable code
+PASS Legacy listener of animationiteration 
 PASS Listener of animationstart 
-FAIL Legacy listener of animationstart assert_unreached: listener of webkitAnimationStart should not be invoked again Reached unreachable code
+PASS Legacy listener of animationstart 
 

Modified: trunk/Source/WebCore/ChangeLog (212320 => 212321)


--- trunk/Source/WebCore/ChangeLog	2017-02-14 21:08:46 UTC (rev 212320)
+++ trunk/Source/WebCore/ChangeLog	2017-02-14 21:11:54 UTC (rev 212321)
@@ -1,3 +1,21 @@
+2017-02-14  Chris Dumez  <[email protected]>
+
+        Fallback to legacy type only when event is trusted
+        https://bugs.webkit.org/show_bug.cgi?id=168301
+
+        Reviewed by Ryosuke Niwa.
+
+        Fallback to legacy type only when event is trusted as per a recent
+        DOM specification change:
+        - https://github.com/whatwg/dom/issues/404
+        - https://github.com/whatwg/dom/pull/406
+
+        No new tests, rebaselined existing test.
+
+        * dom/EventTarget.cpp:
+        (WebCore::legacyType):
+        (WebCore::EventTarget::fireEventListeners):
+
 2017-02-13  Dean Jackson  <[email protected]>
 
         Rename preferLowPowerToHighPerformance to powerPreference

Modified: trunk/Source/WebCore/dom/EventTarget.cpp (212320 => 212321)


--- trunk/Source/WebCore/dom/EventTarget.cpp	2017-02-14 21:08:46 UTC (rev 212320)
+++ trunk/Source/WebCore/dom/EventTarget.cpp	2017-02-14 21:11:54 UTC (rev 212321)
@@ -179,6 +179,7 @@
     if (event.type() == eventNames().transitionendEvent)
         return eventNames().webkitTransitionEndEvent;
 
+    // FIXME: This legacy name is not part of the specification (https://dom.spec.whatwg.org/#dispatching-events).
     if (event.type() == eventNames().wheelEvent)
         return eventNames().mousewheelEvent;
 
@@ -201,6 +202,10 @@
         return !event.defaultPrevented();
     }
 
+    // Only fall back to legacy types for trusted events.
+    if (!event.isTrusted())
+        return !event.defaultPrevented();
+
     const AtomicString& legacyTypeName = legacyType(event);
     if (!legacyTypeName.isNull()) {
         if (auto* legacyListenersVector = data->eventListenerMap.find(legacyTypeName)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to