GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: check number of arguments in `EventTarget`'s function by deokjinkim · Pull Request #45668 · nodejs/node

Conversation

@deokjinkim

@deokjinkim deokjinkim commented Nov 29, 2022

Copy link
Copy Markdown
Contributor

For now, addEventListener() only checks number of arguments.
removeEventListener() and dispatchEvent() also need checking number of arguments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. labels Nov 29, 2022
@mscdex

mscdex commented Nov 29, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I don't think it's necessary to be this strict (validating arguments.length). These functions already validate the argument values themselves.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@deokjinkim

deokjinkim commented Nov 29, 2022

Copy link
Copy Markdown
Contributor Author

I don't think it's necessary to be this strict. These functions already validate the argument values themselves.

As you can see in code change(lib/readline.js), I think wrong usage(ex. 1 argument is passed to removeEventListener) is allowed for removeEventListener for now. wdyt?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mscdex

mscdex commented Nov 29, 2022

Copy link
Copy Markdown
Contributor

The readline change needs a test to verify the cleanup function is working correctly if there isn't already one.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 reviewed Nov 29, 2022
View reviewed changes

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/parallel/test-eventtarget.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Nov 29, 2022

Copy link
Copy Markdown
Contributor

I don't think it's necessary to be this strict (validating arguments.length). These functions already validate the argument values themselves.

I disagree, I think it is necessary so our implementation is compliant with the WebIDL spec, and aligns with the other runtimes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 reviewed Nov 29, 2022
View reviewed changes
Comment thread lib/readline.js Outdated

@aduh95 aduh95 Nov 29, 2022

Copy link
Copy Markdown
Contributor

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@deokjinkim deokjinkim Nov 29, 2022

Copy link
Copy Markdown
Contributor Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95 reacted with heart emoji
All reactions
  • ❤️ 1 reaction

@deokjinkim deokjinkim Dec 5, 2022

Copy link
Copy Markdown
Contributor Author

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.

@aduh95 Can I create PR for backport of #45676? If yes, is v18.x-staging branch proper?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@aduh95 aduh95 Dec 5, 2022

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@deokjinkim deokjinkim Dec 5, 2022

Copy link
Copy Markdown
Contributor Author

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 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@deokjinkim

deokjinkim commented Nov 29, 2022

Copy link
Copy Markdown
Contributor Author

LGTM. Can you check if there's a WPT test for this?

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.
ref1. https://googlechrome.github.io/samples/event-listeners-mandatory-arguments/
ref2. https://github.com/GoogleChrome/samples/blob/gh-pages/event-listeners-mandatory-arguments/demo.js

aduh95 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

deokjinkim added 2 commits December 2, 2022 00:15
@deokjinkim
lib: check number of arguments in EventTarget's function
6860e13
For now, addEventListener() only checks number of arguments.
removeEventListener() and dispatchEvent() also need checking
number of arguments.
@deokjinkim
remove validating error message in test case
cc631b2
@deokjinkim
deokjinkim force-pushed the 221129_check_number_parameter_eventtarget branch from 604b3c8 to cc631b2 Compare December 1, 2022 15:37
aduh95
aduh95 approved these changes Dec 1, 2022
View reviewed changes
Comment thread test/parallel/test-eventtarget.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/parallel/test-eventtarget.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/parallel/test-eventtarget.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/parallel/test-eventtarget.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/parallel/test-eventtarget.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

deokjinkim and others added 2 commits December 2, 2022 08:04
@deokjinkim @aduh95
Update test/parallel/test-eventtarget.js
a53c721
Co-authored-by: Antoine du Hamel <[email protected]>
@aduh95
Apply suggestions from code review
6cdded5
@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. commit-queue-squash PRs the Commit Queue should land as one squashed commit. eventtarget Issues and PRs related to the EventTarget implementation. and removed readline Issues and PRs related to the built-in readline module. labels Dec 1, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Dec 1, 2022
@nodejs-github-bot

nodejs-github-bot commented Dec 1, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/48271/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Dec 2, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/48276/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

daeyeon
daeyeon approved these changes Dec 9, 2022
View reviewed changes
@daeyeon daeyeon added the commit-queue PRs queued for automated landing through the Commit Queue. label Dec 9, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Dec 9, 2022
@nodejs-github-bot
nodejs-github-bot merged commit c776324 into nodejs:main Dec 9, 2022
@nodejs-github-bot

nodejs-github-bot commented Dec 9, 2022

Copy link
Copy Markdown
Collaborator

Landed in c776324

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos pushed a commit that referenced this pull request Dec 12, 2022
@deokjinkim @targos
lib: check number of arguments in EventTarget's function
c8a52e7
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]>
@targos targos mentioned this pull request Dec 12, 2022
v19.3.0 release proposal #45831
Merged
targos pushed a commit that referenced this pull request Dec 13, 2022
@deokjinkim @targos
lib: check number of arguments in EventTarget's function
e874508
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]>
@danielleadams danielleadams mentioned this pull request Dec 30, 2022
v18.13.0 release proposal #46025
Merged
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@deokjinkim @danielleadams
lib: check number of arguments in EventTarget's function
9125fac
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]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@deokjinkim @danielleadams
lib: check number of arguments in EventTarget's function
1284789
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]>
danielleadams pushed a commit that referenced this pull request Jan 5, 2023
@deokjinkim @danielleadams
lib: check number of arguments in EventTarget's function
130106d
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aduh95 aduh95 aduh95 approved these changes
@daeyeon daeyeon daeyeon approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-squash PRs the Commit Queue should land as one squashed commit. eventtarget Issues and PRs related to the EventTarget implementation. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@deokjinkim @mscdex @aduh95 @nodejs-github-bot @daeyeon
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.