-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: save primordials during bootstrap and use it in builtins #25816
Conversation
This patches changes the `safe_globals` internal module into a script that gets run during bootstrap and saves JavaScript builtins (primordials) into an object that is available for all other builtin modules to access lexically later.
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.
can you add a test demonstrating that modifying Object.defineProperty or something doesn't break internal code?
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.
Adding them to the bootstrap seems fine, but we still cannot use methods via .
if we are wanting to have the original function.
@devsnek Do you have a good API to test this in mind? This test would depend on the implementation details of the API and if the API being tested is changed we would have to look for another one that uses these globals after user code execution starts. Or is there already any tests for the previous |
Landed in 39d9221 |
@joyeecheung This also needs to be backported to v11.x manually |
This patches changes the `safe_globals` internal module into a script that gets run during bootstrap and saves JavaScript builtins (primordials) into an object that is available for all other builtin modules to access lexically later. PR-URL: #25816 Refs: #18795 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
This patches changes the
safe_globals
internal module into ascript that gets run during bootstrap and saves JavaScript builtins
(primordials) into an object that is available for all other builtin
modules to access lexically later.
Refs: #18795
cc @hashseed @devsnek @bmeck
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes