Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Issue 329053002: Throw TypeError when addEventListener or removeEventListener are called without enough arguments (Closed)

Created:
6 years, 6 months ago by Nils Barth (inactive)
Modified:
6 years, 6 months ago
CC:
blink-reviews, arv+blink, Inactive, watchdog-blink-watchlist_google.com
Visibility:
Public.

Description

Throw TypeError when addEventListener or removeEventListener are called without enough arguments ** Changes web-facing behavior ** This removes legacy behavior, per request of Tab: it fixes some current compatibility problems which *are* causing pain, but potentially breaks some old content. Current behavior (not throwing a TypeError) was for compatibility in 2012, though unspecified cause: WebKit bug specifically special-casing this in JavaScriptCore bindings is: [JSC] Regression: addEventListener() and removeEventListener() raise an exception on missing args https://bugs.webkit.org/show_bug.cgi?id=85928 WebKit/Safari also has legacy behavior (matches current Blink/Chrome): "For compatibility with legacy content, the EventListener calls are generated without GenerateArgumentsCountCheck." http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm#L2823 However, IE and Firefox *do* throw (correctly), and this discrepancy is causing compatibility problems: removeEventListener with only one passed parameter... http://lists.w3.org/Archives/Public/public-script-coord/2014AprJun/0166.html Thus this CL aligns with spec, updating tests and removing legacy tests. R=haraken BUG=353484 TEST=fast/dom/event-target-arguments.html Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=176746

Patch Set 1 #

Patch Set 2 : Update test, doc/FIXME updates #

Patch Set 3 : Rebased off [DeprecateAs] CL #

Patch Set 4 : Rebased #

Patch Set 5 : Rebase off master #

Patch Set 6 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+63 lines, -172 lines) Patch
D LayoutTests/fast/dom/Window/window-legacy-event-listener.html View 1 chunk +0 lines, -17 lines 0 comments Download
D LayoutTests/fast/dom/Window/window-legacy-event-listener-expected.txt View 3 4 1 chunk +0 lines, -13 lines 0 comments Download
D LayoutTests/fast/dom/XMLHttpRequest-legacy-event-listener.html View 1 chunk +0 lines, -17 lines 0 comments Download
D LayoutTests/fast/dom/XMLHttpRequest-legacy-event-listener-expected.txt View 3 4 1 chunk +0 lines, -13 lines 0 comments Download
M LayoutTests/fast/dom/event-target-arguments.html View 1 2 3 4 1 chunk +10 lines, -30 lines 0 comments Download
M LayoutTests/fast/dom/event-target-arguments-expected.txt View 1 2 3 4 1 chunk +10 lines, -10 lines 0 comments Download
D LayoutTests/fast/dom/node-legacy-event-listener.html View 1 chunk +0 lines, -17 lines 0 comments Download
D LayoutTests/fast/dom/node-legacy-event-listener-expected.txt View 3 4 1 chunk +0 lines, -13 lines 0 comments Download
M LayoutTests/fast/js/function-length.html View 1 1 chunk +1 line, -3 lines 0 comments Download
M LayoutTests/fast/js/function-length-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/scripts/v8_interface.py View 1 2 3 4 5 2 chunks +5 lines, -4 lines 0 comments Download
M Source/bindings/scripts/v8_methods.py View 1 2 3 4 5 5 chunks +9 lines, -7 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M Source/bindings/templates/interface.cpp View 1 2 3 4 5 3 chunks +3 lines, -3 lines 0 comments Download
M Source/bindings/templates/methods.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/tests/idls/TestObject.idl View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/tests/results/V8TestObject.cpp View 1 2 3 4 5 3 chunks +6 lines, -7 lines 0 comments Download
M Source/core/events/EventTarget.h View 1 2 3 4 1 chunk +2 lines, -7 lines 0 comments Download
M Source/core/events/EventTarget.idl View 1 2 3 4 1 chunk +12 lines, -6 lines 0 comments Download

Messages

Total messages: 27 (0 generated)
Nils Barth (inactive)
Removing legacy cruft (our favorite interface, EventListener), per request of Tab.
6 years, 6 months ago (2014-06-11 05:49:25 UTC) #1
Nils Barth (inactive)
Tab, one other question for you: I've left a FIXME for what to do if ...
6 years, 6 months ago (2014-06-11 05:53:08 UTC) #2
haraken
LGTM, given the spec and the behavior of IE and Firefox. I'd like to have ...
6 years, 6 months ago (2014-06-11 06:49:25 UTC) #3
TabAtkins
On 2014/06/11 06:49:25, haraken wrote: > LGTM, given the spec and the behavior of IE ...
6 years, 6 months ago (2014-06-11 22:09:32 UTC) #4
TabAtkins
On 2014/06/11 05:53:08, Nils Barth wrote: > Tab, one other question for you: > > ...
6 years, 6 months ago (2014-06-11 22:14:58 UTC) #5
Nils Barth (inactive)
On 2014/06/11 22:14:58, TabAtkins wrote: > I think it's a good idea to align with ...
6 years, 6 months ago (2014-06-12 04:10:27 UTC) #6
Tab Atkins
On 2014/06/12 04:10:27, Nils Barth wrote: > On 2014/06/11 22:14:58, TabAtkins wrote: > > I ...
6 years, 6 months ago (2014-06-12 18:28:56 UTC) #7
Nils Barth (inactive)
On 2014/06/12 18:28:56, Tab Atkins wrote: > I was suggesting measuring usage of passing "undefined" ...
6 years, 6 months ago (2014-06-23 09:55:40 UTC) #8
Nils Barth (inactive)
Apologies for delay (been busy); rebased and committing.
6 years, 6 months ago (2014-06-23 10:10:14 UTC) #9
Nils Barth (inactive)
The CQ bit was checked by nbarth@chromium.org
6 years, 6 months ago (2014-06-23 10:10:46 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nbarth@chromium.org/329053002/80001
6 years, 6 months ago (2014-06-23 10:11:27 UTC) #11
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_blink_compile_dbg on tryserver.blink ...
6 years, 6 months ago (2014-06-23 11:15:14 UTC) #12
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-23 11:16:25 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: mac_blink_compile_dbg on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/mac_blink_compile_dbg/builds/9923) mac_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/mac_blink_rel/builds/12376) mac_gpu ...
6 years, 6 months ago (2014-06-23 11:16:26 UTC) #14
Nils Barth (inactive)
The CQ bit was checked by nbarth@chromium.org
6 years, 6 months ago (2014-06-23 11:25:31 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nbarth@chromium.org/329053002/100001
6 years, 6 months ago (2014-06-23 11:26:43 UTC) #16
commit-bot: I haz the power
Change committed as 176746
6 years, 6 months ago (2014-06-23 12:31:20 UTC) #17
f(malita)
On 2014/06/23 12:31:20, I haz the power (commit-bot) wrote: > Change committed as 176746 This ...
6 years, 6 months ago (2014-06-23 14:59:56 UTC) #18
f(malita)
On 2014/06/23 14:59:56, Florin Malita wrote: > On 2014/06/23 12:31:20, I haz the power (commit-bot) ...
6 years, 6 months ago (2014-06-23 17:07:37 UTC) #19
tkent
> ** Changes web-facing behavior ** Please involve API owners for such changes. I'm very ...
6 years, 6 months ago (2014-06-23 23:58:36 UTC) #20
tkent
On 2014/06/23 23:58:36, tkent wrote: > > ** Changes web-facing behavior ** > > Please ...
6 years, 6 months ago (2014-06-24 00:01:52 UTC) #21
Stephen White
On 2014/06/24 00:01:52, tkent wrote: > On 2014/06/23 23:58:36, tkent wrote: > > > ** ...
6 years, 6 months ago (2014-06-24 00:19:35 UTC) #22
Stephen White
On 2014/06/24 00:19:35, Stephen White wrote: > On 2014/06/24 00:01:52, tkent wrote: > > On ...
6 years, 6 months ago (2014-06-24 01:11:16 UTC) #23
haraken
On 2014/06/24 01:11:16, Stephen White wrote: > On 2014/06/24 00:19:35, Stephen White wrote: > > ...
6 years, 6 months ago (2014-06-24 01:23:33 UTC) #24
Nils Barth (inactive)
A revert of this CL has been created in https://codereview.chromium.org/331323012/ by nbarth@chromium.org. The reason for ...
6 years, 6 months ago (2014-06-24 01:49:08 UTC) #25
Nils Barth (inactive)
Hi Kent, Sorry about that; I had assumed this was an ok change, but you're ...
6 years, 6 months ago (2014-06-24 04:42:17 UTC) #26
Nils Barth (inactive)
6 years, 6 months ago (2014-06-24 07:12:34 UTC) #27
Message was sent while issue was closed.
To summarize:
* Reverted.
* Will deprecate instead, in https://codereview.chromium.org/329223004/
* This revealed 2 bugs, both now fixed:
- Missing removeEventListener arg in:
chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js
https://codereview.chromium.org/347393005/

- Incorrect use of removeEventListener in Chrome OS Gallery.app:
https://code.google.com/p/chromium/issues/detail?id=388071
https://codereview.chromium.org/354543002

FWIW, the two failures were both due to the same error:
in removeEventListener,
omitting the first argument (|DOMString type|),
so the call silently failed, not removing the EL.

I suspect that this is a common failure type,
since failing to *add* an EL is probably pretty visible,
but failing to *remove* one probably causes subtler bugs.

Powered by Google App Engine
This is Rietveld 408576698