-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: fix WebIDL object
and dictionary type conversion
#37047
lib: fix WebIDL object
and dictionary type conversion
#37047
Conversation
lib/internal/event_target.js
Outdated
@@ -86,7 +86,9 @@ class Event { | |||
if (arguments.length === 0) | |||
throw new ERR_MISSING_ARGS('type'); | |||
if (options !== null) | |||
validateObject(options, 'options'); | |||
validateObject(options, 'options', { |
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.
For performance reasons, It's likely better to introduce a separate validator function for this.
So, should we run a benchmark CI for this, and which one? |
I think the benchmark/events/eventtarget.js is one you are looking for? |
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/928/ (queued) |
Benchmark results are OK:
|
lib/internal/event_target.js
Outdated
if (options !== null) | ||
validateObject(options, 'options'); | ||
validateObject(options, 'options', { | ||
allowArray: true, allowFunction: true, |
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.
Shouldn't you pass nullable: true
instead of having a if (options !== null)
?
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.
Right, this became possible when #35806 made options
default to null
.
9ee498a
to
b6eb2bd
Compare
4762372
to
b6eb2bd
Compare
The PR labels should probably include the events label or the eventtarget label. |
Landed in beee538 |
b6eb2bd
to
beee538
Compare
PR-URL: #37047 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #37047 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #37047 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #37047 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #37047 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Rich Trott <[email protected]>
The WebIDL
object
,record<K, V>
, and Dictionary type conversion algorithm implicitly allows Arrays and Functions:This is also necessary to prevent #37028 from being a breaking change.