Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3dcdab3

Browse filesBrowse files
deokjinkimRafaelGSS
authored andcommitted
events: check signal before listener
In WPT Events, TypeError is expected if both listener and signal are null. But checking listener doesn't throw TypeError. So check signal before listener because checking signal throws TypeError if signal is null. PR-URL: #46054 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 parent 8684dae commit 3dcdab3
Copy full SHA for 3dcdab3

File tree

Expand file treeCollapse file tree

2 files changed

+2
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-9
lines changed
Open diff view settings
Collapse file

‎lib/internal/event_target.js‎

Copy file name to clipboardExpand all lines: lib/internal/event_target.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ class EventTarget {
561561
weak,
562562
} = validateEventListenerOptions(options);
563563

564+
validateAbortSignal(signal, 'options.signal');
565+
564566
if (!validateEventListener(listener)) {
565567
// The DOM silently allows passing undefined as a second argument
566568
// No error code for this since it is a Warning
@@ -575,8 +577,6 @@ class EventTarget {
575577
}
576578
type = String(type);
577579

578-
validateAbortSignal(signal, 'options.signal');
579-
580580
if (signal) {
581581
if (signal.aborted) {
582582
return;
Collapse file

‎test/wpt/status/dom/events.json‎

Copy file name to clipboardExpand all lines: test/wpt/status/dom/events.json
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
]
99
}
1010
},
11-
"AddEventListenerOptions-signal.any.js": {
12-
"fail": {
13-
"expected": [
14-
"Passing null as the signal should throw (listener is also null)"
15-
]
16-
}
17-
},
1811
"Event-constructors.any.js": {
1912
"fail": {
2013
"expected": [

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.