-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: make primordials Promise static methods safe #38843
Conversation
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1035/ Results
|
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.
I am against changing further code to use primordials as outlined here #30697 (comment).
Note that this change removes the |
I'm generally uncomfortable about reimplementing standard methods to avoid the fact that they call user-mutable things. |
Superseded by #43728. |
Promise static methods that iterate over the provided argument (
%Promise.all%
,%Promise.any%
, ...) look up thethen
property over each promise to support promise subclassing. This PR is introducingSafePromiseAll
,SafePromiseAny
, etc. that take a array, safely iterate over it, and wrap each promise in aSafePromise
whose prototype is accessible from userland.