Title: [250385] trunk
Revision
250385
Author
[email protected]
Date
2019-09-26 10:43:24 -0700 (Thu, 26 Sep 2019)

Log Message

Non-callable "handleEvent" property is silently ignored
https://bugs.webkit.org/show_bug.cgi?id=200066

Patch by Alexey Shvayka <[email protected]> on 2019-09-26
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt:
* web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt:
* web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt:
* web-platform-tests/dom/events/EventListener-handleEvent-expected.txt:

Source/WebCore:

Tests: imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html
       imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception.html
       imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception.html
       imported/w3c/web-platform-tests/dom/events/EventListener-handleEvent.html

* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent): Report TypeError if "handleEvent" is not callable.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (250384 => 250385)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-09-26 15:44:33 UTC (rev 250384)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-09-26 17:43:24 UTC (rev 250385)
@@ -1,3 +1,15 @@
+2019-09-26  Alexey Shvayka  <[email protected]>
+
+        Non-callable "handleEvent" property is silently ignored
+        https://bugs.webkit.org/show_bug.cgi?id=200066
+
+        Reviewed by Darin Adler.
+
+        * web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt:
+        * web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt:
+        * web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt:
+        * web-platform-tests/dom/events/EventListener-handleEvent-expected.txt:
+
 2019-09-25  Alexey Shvayka  <[email protected]>
 
         Re-sync web-platform-tests/IndexedDB from upstream

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt (250384 => 250385)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt	2019-09-26 15:44:33 UTC (rev 250384)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception-expected.txt	2019-09-26 17:43:24 UTC (rev 250385)
@@ -3,7 +3,7 @@
 PASS Exception in error event handler on request, with preventDefault 
 PASS Exception in error event listener on request 
 PASS Exception in error event listener ("handleEvent" lookup) on request 
-FAIL Exception in error event listener (non-callable "handleEvent") on request assert_equals: expected "AbortError" but got "ConstraintError"
+PASS Exception in error event listener (non-callable "handleEvent") on request 
 PASS Exception in second error event listener on request 
 PASS Exception in first error event listener on request, transaction active in second 
 PASS Exception in error event handler on transaction 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt (250384 => 250385)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt	2019-09-26 15:44:33 UTC (rev 250384)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception-expected.txt	2019-09-26 17:43:24 UTC (rev 250385)
@@ -2,7 +2,7 @@
 PASS Exception in success event handler on request 
 PASS Exception in success event listener on request 
 PASS Exception in success event listener ("handleEvent" lookup) on request 
-FAIL Exception in success event listener (non-callable "handleEvent") on request assert_unreached: transaction should abort Reached unreachable code
+PASS Exception in success event listener (non-callable "handleEvent") on request 
 PASS Exception in second success event listener on request 
 PASS Exception in first success event listener, tx active in second 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt (250384 => 250385)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt	2019-09-26 15:44:33 UTC (rev 250384)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception-expected.txt	2019-09-26 17:43:24 UTC (rev 250385)
@@ -1,6 +1,7 @@
 CONSOLE MESSAGE: line 31: Error
 CONSOLE MESSAGE: line 37: Error
 CONSOLE MESSAGE: line 44: Error
+CONSOLE MESSAGE: TypeError: 'handleEvent' property of event listener should be callable
 CONSOLE MESSAGE: line 62: Error
 CONSOLE MESSAGE: line 70: Error
 
@@ -7,7 +8,7 @@
 PASS Exception in upgradeneeded handler 
 PASS Exception in upgradeneeded listener 
 PASS Exception in upgradeneeded "handleEvent" lookup 
-FAIL Exception in upgradeneeded due to non-callable "handleEvent" assert_unreached: open should fail Reached unreachable code
+PASS Exception in upgradeneeded due to non-callable "handleEvent" 
 PASS Exception in second upgradeneeded listener 
 PASS Exception in first upgradeneeded listener, tx active in second 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventListener-handleEvent-expected.txt (250384 => 250385)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventListener-handleEvent-expected.txt	2019-09-26 15:44:33 UTC (rev 250384)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/EventListener-handleEvent-expected.txt	2019-09-26 17:43:24 UTC (rev 250385)
@@ -1,9 +1,11 @@
 CONSOLE MESSAGE: line 46: [object Object]
+CONSOLE MESSAGE: line 101: TypeError: 'handleEvent' property of event listener should be callable
+CONSOLE MESSAGE: line 122: TypeError: 'handleEvent' property of event listener should be callable
 
 PASS calls `handleEvent` method of `EventListener` 
 PASS rethrows errors when getting `handleEvent` 
 PASS performs `Get` every time event is dispatched 
 PASS doesn't call `handleEvent` method on callable `EventListener` 
-FAIL throws if `handleEvent` is falsy and not callable assert_true: expected true got false
-FAIL throws if `handleEvent` is thruthy and not callable assert_true: expected true got false
+PASS throws if `handleEvent` is falsy and not callable 
+PASS throws if `handleEvent` is thruthy and not callable 
 

Modified: trunk/Source/WebCore/ChangeLog (250384 => 250385)


--- trunk/Source/WebCore/ChangeLog	2019-09-26 15:44:33 UTC (rev 250384)
+++ trunk/Source/WebCore/ChangeLog	2019-09-26 17:43:24 UTC (rev 250385)
@@ -1,3 +1,18 @@
+2019-09-26  Alexey Shvayka  <[email protected]>
+
+        Non-callable "handleEvent" property is silently ignored
+        https://bugs.webkit.org/show_bug.cgi?id=200066
+
+        Reviewed by Darin Adler.
+
+        Tests: imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html
+               imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception.html
+               imported/w3c/web-platform-tests/IndexedDB/fire-upgradeneeded-event-exception.html
+               imported/w3c/web-platform-tests/dom/events/EventListener-handleEvent.html
+
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSEventListener::handleEvent): Report TypeError if "handleEvent" is not callable.
+
 2019-09-26  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Decouple Display::Run and Display::Box initializations.

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (250384 => 250385)


--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2019-09-26 15:44:33 UTC (rev 250384)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2019-09-26 17:43:24 UTC (rev 250385)
@@ -148,11 +148,13 @@
             return;
         }
         callType = getCallData(vm, handleEventFunction, callData);
+        if (callType == CallType::None) {
+            event.target()->uncaughtExceptionInEventHandler();
+            reportException(exec, createTypeError(exec, "'handleEvent' property of event listener should be callable"_s));
+            return;
+        }
     }
 
-    if (callType == CallType::None)
-        return;
-
     Ref<JSEventListener> protectedThis(*this);
 
     MarkedArgumentBuffer args;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to