-
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: enforce use of Array from primordials #30635
Conversation
ReflectConstruct(original, args, new.target) : | ||
ReflectApply(original, this, args); | ||
} | ||
}[name], 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.
This change is necessary, for two reasons:
- Some of the arrays we create are returned to the user
- Without it I'd also have to change calls to array methods
Also, It's probably better not to wrap the primordial functions for performance reasons, especially when we migrate String() and Number() calls in the future.
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.
hmm, wait, but why is Object.setPrototypeOf(..., null)
removed here?
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.
Because if we stop wrapping the functions, it becomes useless, as there is nothing left to set the prototype of (we can't do that directly on the original functions).
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 see. To me making the Array namespace less mutable takes precedence over keeping these functions away from prototype poisoning, so LGTM.
b904161
to
5f67c62
Compare
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.
Rubber Stamp LGTM
ReflectConstruct(original, args, new.target) : | ||
ReflectApply(original, this, args); | ||
} | ||
}[name], 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.
I see. To me making the Array namespace less mutable takes precedence over keeping these functions away from prototype poisoning, so LGTM.
5f67c62
to
cf1f94b
Compare
PR-URL: #30635 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
Landed in 141a6e3 |
PR-URL: #30635 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
PR-URL: #30635 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
PR-URL: #30635 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes