lib: fix WebIDL object and dictionary type conversion#37047
lib: fix WebIDL object and dictionary type conversion#37047Trott merged 0 commit intonodejs:masterfrom
object and dictionary type conversion#37047Conversation
lib/internal/event_target.js
Outdated
| throw new ERR_MISSING_ARGS('type'); | ||
| if (options !== null) | ||
| validateObject(options, 'options'); | ||
| validateObject(options, 'options', { |
There was a problem hiding this comment.
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.
Shouldn't you pass nullable: true instead of having a if (options !== null)?
There was a problem hiding this comment.
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 <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #37047 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #37047 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #37047 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #37047 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
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.