-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: check number of arguments in EventTarget
's function
#45668
lib: check number of arguments in EventTarget
's function
#45668
Conversation
I don't think it's necessary to be this strict (validating |
As you can see in code change(lib/readline.js), I think wrong usage(ex. 1 argument is passed to |
The readline change needs a test to verify the cleanup function is working correctly if there isn't already one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you check if there's a WPT test for this?
I disagree, I think it is necessary so our implementation is compliant with the WebIDL spec, and aligns with the other runtimes. |
lib/readline.js
Outdated
@@ -145,7 +145,7 @@ Interface.prototype.question = function question(query, options, cb) { | |||
}; | |||
options.signal.addEventListener('abort', onAbort, { once: true }); | |||
const cleanup = () => { | |||
options.signal.removeEventListener(onAbort); | |||
options.signal.removeEventListener('abort', onAbort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you send another PR for this fix so it can be backported more easily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created another PR(#45676) to resolve this issue. PTAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That shouldn’t be necessary, commits that land on main
are automatically back ported to current and active LTS release lines after the appropriate “maturation period”, backport PRs are necessary only if the commit doesn’t apply cleanly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for kind explanation. It's very helpful for me 👍
I couldn't find the same test in dom/event of WPT(https://github.com/web-platform-tests/wpt/tree/master/dom/events). BTW, chrome samples have similar tests. |
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments.
604b3c8
to
cc631b2
Compare
Co-authored-by: Antoine du Hamel <[email protected]>
Landed in c776324 |
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments. PR-URL: nodejs#45668 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments. PR-URL: #45668 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments. PR-URL: #45668 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments. PR-URL: #45668 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments. PR-URL: #45668 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments. PR-URL: #45668 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments. PR-URL: #45668 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
For now, addEventListener() only checks number of arguments. removeEventListener() and dispatchEvent() also need checking number of arguments. PR-URL: #45668 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
For now, addEventListener() only checks number of arguments.
removeEventListener() and dispatchEvent() also need checking number of arguments.