RESOLVED FIXED 200066
Non-callable "handleEvent" property is silently ignored
https://bugs.webkit.org/show_bug.cgi?id=200066
Summary Non-callable "handleEvent" property is silently ignored
Alexey Shvayka
Reported 2019-07-23 17:29:18 PDT
Test case: let et = document.createElement("div") et.addEventListener("foo", {handleEvent: "str"}) et.dispatchEvent(new Event("foo")) // => true Actual: No errors reported in DevTools or `window.onerror` Expected: TypeError should be reported WPT: https://github.com/web-platform-tests/wpt/pull/15105 WebIDL: https://heycam.github.io/webidl/#call-a-user-objects-operation (step 10.4) Firefox 68 reports TypeError, Chrome 75 doesn't.
Attachments
Patch (49.81 KB, patch)
2019-07-23 17:43 PDT, Alexey Shvayka
ews-watchlist: commit-queue-
Archive of layout-test-results from ews105 for mac-highsierra-wk2 (3.40 MB, application/zip)
2019-07-23 19:02 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews100 for mac-highsierra (3.35 MB, application/zip)
2019-07-23 19:04 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews116 for mac-highsierra (3.11 MB, application/zip)
2019-07-23 20:55 PDT, EWS Watchlist
no flags
Patch (49.80 KB, patch)
2019-07-24 02:30 PDT, Alexey Shvayka
no flags
Patch (52.79 KB, patch)
2019-07-24 16:31 PDT, Alexey Shvayka
no flags
Patch (51.00 KB, patch)
2019-07-25 10:16 PDT, Alexey Shvayka
no flags
Patch (3.33 KB, patch)
2019-08-14 11:04 PDT, Alexey Shvayka
no flags
Patch (7.05 KB, patch)
2019-09-26 09:35 PDT, Alexey Shvayka
no flags
Patch (9.00 KB, patch)
2019-12-04 11:19 PST, Alexey Shvayka
no flags
Patch (12.07 KB, patch)
2019-12-04 12:49 PST, Alexey Shvayka
no flags
Alexey Shvayka
Comment 1 2019-07-23 17:43:54 PDT
EWS Watchlist
Comment 2 2019-07-23 19:02:40 PDT
Comment on attachment 374743 [details] Patch Attachment 374743 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/12798284 New failing tests: imported/w3c/web-platform-tests/dom/events/event-global-extra.window.html
EWS Watchlist
Comment 3 2019-07-23 19:02:42 PDT
Created attachment 374751 [details] Archive of layout-test-results from ews105 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 4 2019-07-23 19:04:23 PDT
Comment on attachment 374743 [details] Patch Attachment 374743 [details] did not pass mac-ews (mac): Output: https://webkit-queues.webkit.org/results/12798301 New failing tests: imported/w3c/web-platform-tests/dom/events/event-global-extra.window.html
EWS Watchlist
Comment 5 2019-07-23 19:04:25 PDT
Created attachment 374752 [details] Archive of layout-test-results from ews100 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-highsierra Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 6 2019-07-23 20:55:32 PDT
Comment on attachment 374743 [details] Patch Attachment 374743 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/12798762 New failing tests: imported/w3c/web-platform-tests/dom/events/event-global-extra.window.html
EWS Watchlist
Comment 7 2019-07-23 20:55:34 PDT
Created attachment 374759 [details] Archive of layout-test-results from ews116 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-highsierra Platform: Mac OS X 10.13.6
Alexey Shvayka
Comment 8 2019-07-24 02:30:09 PDT
Created attachment 374768 [details] Patch Fix unrelated test failure.
Alexey Shvayka
Comment 9 2019-07-24 16:31:18 PDT
Created attachment 374829 [details] Patch Remove outdated expectations that caused iOS tests failure.
Alexey Shvayka
Comment 10 2019-07-25 10:16:26 PDT
Created attachment 374896 [details] Patch Bring back iOS expectations and adjust them.
Darin Adler
Comment 11 2019-08-07 17:21:04 PDT
Comment on attachment 374896 [details] Patch Thanks for contributing this fix. It’s not ideal to have a single patch with many test changes, along with a bug fix and the new expectations that show the bug is fixed. Instead, we should first re-sync the tests in a first patch, and then make sure that this second patch has the behavior change and the test result changes that go with it only.
Ryosuke Niwa
Comment 12 2019-08-14 01:35:12 PDT
Comment on attachment 374896 [details] Patch Please update the patch now that the tests have been landed. Thanks!
Alexey Shvayka
Comment 13 2019-08-14 11:04:07 PDT
Created attachment 376283 [details] Patch Rebase patch.
Darin Adler
Comment 14 2019-08-14 11:21:25 PDT
Comment on attachment 376283 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=376283&action=review Thanks for fixing this! > Source/WebCore/bindings/js/JSEventListener.cpp:152 > + event.target()->uncaughtExceptionInEventHandler(); I can’t find anything in that tests that checks this. I assume this is needed here for the same reason it’s needed above, but how can we test that it’s working properly?
Alexey Shvayka
Comment 15 2019-08-14 13:12:33 PDT
(In reply to Darin Adler from comment #14) > Comment on attachment 376283 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=376283&action=review > > Thanks for fixing this! Thank you for reviewing my patches! > > > Source/WebCore/bindings/js/JSEventListener.cpp:152 > > + event.target()->uncaughtExceptionInEventHandler(); > > I can’t find anything in that tests that checks this. I assume this is > needed here for the same reason it’s needed above, but how can we test that > it’s working properly? Nice catch, we don't have test coverage for this. It implements legacyOutputDidListenersThrowFlag (please see https://dom.spec.whatwg.org/#dispatching-events and https://w3c.github.io/IndexedDB) via IDBRequest::uncaughtExceptionInEventHandler. I will make a PR to web-platform-tests, submit another patch to re-sync, and update this one to pass new tests.
Alexey Shvayka
Comment 16 2019-09-26 09:35:02 PDT
Created attachment 379647 [details] Patch Pass newly imported IndexedDB tests.
Darin Adler
Comment 17 2019-09-26 10:00:26 PDT
Comment on attachment 379647 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379647&action=review > Source/WebCore/bindings/js/JSEventListener.cpp:153 > + reportException(exec, createTypeError(exec, "'handleEvent' property of event listener should be callable"_s)); Not sure if we really need to create an exception object just to do the logging, but seems fine for now at least.
Alexey Shvayka
Comment 18 2019-09-26 10:20:39 PDT
(In reply to Darin Adler from comment #17) > Not sure if we really need to create an exception object just to do the > logging, but seems fine for now at least. Please note that it is observable in `window.onerror`: https://github.com/web-platform-tests/wpt/blob/master/dom/events/EventListener-handleEvent.html#L102.
WebKit Commit Bot
Comment 19 2019-09-26 10:43:30 PDT
Comment on attachment 379647 [details] Patch Clearing flags on attachment: 379647 Committed r250385: <https://trac.webkit.org/changeset/250385>
WebKit Commit Bot
Comment 20 2019-09-26 10:43:32 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 21 2019-09-26 10:44:25 PDT
Truitt Savell
Comment 22 2019-09-26 12:30:57 PDT
Looks like the changes in https://trac.webkit.org/changeset/250385/webkit broke: imported/w3c/web-platform-tests/svg/animations/syncbase-remove-add-while-running.html History: https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=imported%2Fw3c%2Fweb-platform-tests%2Fsvg%2Fanimations%2Fsyncbase-remove-add-while-running.html Diff: --- /Volumes/Data/slave/mojave-release-tests-wk2/build/layout-test-results/imported/w3c/web-platform-tests/svg/animations/syncbase-remove-add-while-running-expected.txt +++ /Volumes/Data/slave/mojave-release-tests-wk2/build/layout-test-results/imported/w3c/web-platform-tests/svg/animations/syncbase-remove-add-while-running-actual.txt @@ -1,3 +1,6 @@ +CONSOLE MESSAGE: TypeError: 'handleEvent' property of event listener should be callable + +Harness Error (FAIL), message = Script error. FAIL Remove/Add syncbase while animation is running assert_equals: Sync base triggered expected 100 but got 0 This issue was identified by EWS, so we will need to roll this change back.
Truitt Savell
Comment 23 2019-09-26 13:05:29 PDT
Reverted r250385 for reason: Broke imported/w3c/web-platform-tests/svg/animations/syncbase-remove-add-while-running.html on all platforms. Which was caught by EWS Committed r250395: <https://trac.webkit.org/changeset/250395>
Alexey Shvayka
Comment 24 2019-12-03 14:18:06 PST
web-platform-tests/svg/animations/syncbase-remove-add-while-running.html failed because a) it had incorrect test harness usage (fixed in https://github.com/web-platform-tests/wpt/commit/786fc058fd83cbf002be3a35100ab2a3b1f98d58#diff-30a693f22699fe784f08efb22d0743ee) and b) WebKit gets "handleEvent" property from event handlers (on* attributes) and throws if it is non-callable. https://bugs.webkit.org/show_bug.cgi?id=204814 syncs web-platform-tests so I can update this patch with a fix and new tests passes.
Alexey Shvayka
Comment 25 2019-12-04 11:19:55 PST
Created attachment 384829 [details] Patch Add m_isAttribute check.
Alexey Shvayka
Comment 26 2019-12-04 12:49:56 PST
Created attachment 384836 [details] Patch Adjust 3 more tests.
Ryosuke Niwa
Comment 27 2019-12-04 13:40:20 PST
Comment on attachment 384836 [details] Patch Seems reasonable.
WebKit Commit Bot
Comment 28 2019-12-04 14:24:31 PST
Comment on attachment 384836 [details] Patch Clearing flags on attachment: 384836 Committed r253123: <https://trac.webkit.org/changeset/253123>
WebKit Commit Bot
Comment 29 2019-12-04 14:24:33 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.