-
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: add %TypedArray% abstract constructor to primordials #36016
Conversation
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.
Thanks a lot for doing this! I like it way more than my hack in the other PR. Two comments:
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.
With Antoine's comments addressed :]
06d4cde
to
4c11653
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nit: you can also replace two instances in --- a/lib/internal/freeze_intrinsics.js
+++ b/lib/internal/freeze_intrinsics.js
@@ -65,6 +65,7 @@ const {
SymbolIterator,
SyntaxError,
TypeError,
+ TypedArrayPrototype,
Uint16Array,
Uint32Array,
Uint8Array,
@@ -105,7 +106,7 @@ module.exports = function() {
// AsyncGeneratorFunction
ObjectGetPrototypeOf(async function* () {}),
// TypedArray
- ObjectGetPrototypeOf(Uint8Array),
+ TypedArrayPrototype,
// 19 Fundamental Objects
Object.prototype, // 19.1
@@ -189,7 +190,7 @@ module.exports = function() {
// AsyncGeneratorFunction
ObjectGetPrototypeOf(async function* () {}),
// TypedArray
- ObjectGetPrototypeOf(Uint8Array),
+ TypedArrayPrototype,
// 18 The Global Object
eval,
|
4c11653
to
15592ff
Compare
const original = global[name]; | ||
primordials[name] = original; | ||
copyPropsRenamed(original, primordials, name); |
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 is needed because of #35448 (comment).
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 open a separate PR for this?
freeze_intrinsics.js
is executed before any user code, I don't think it's worth adding it to the primordials
object: there's no security reason to do so, IMHO we should fix frozen_intrinsics.js
code instead.
15592ff
to
6d64af7
Compare
const original = global[name]; | ||
primordials[name] = original; | ||
copyPropsRenamed(original, primordials, name); |
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 open a separate PR for this?
freeze_intrinsics.js
is executed before any user code, I don't think it's worth adding it to the primordials
object: there's no security reason to do so, IMHO we should fix frozen_intrinsics.js
code instead.
aca2ee7
to
8fee9b7
Compare
Refs: nodejs#35448 Refs: nodejs#36003 Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object Co-authored-by: Antoine du Hamel <[email protected]>
Landed in aa1eb1f...c925e24 |
Refs: #35448 Refs: #36003 Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object Co-authored-by: Antoine du Hamel <[email protected]> PR-URL: #36016 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Shingo Inoue <[email protected]>
Refs: #35448 Refs: #36003 Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object Co-authored-by: Antoine du Hamel <[email protected]> PR-URL: #36016 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Shingo Inoue <[email protected]>
Refs: #35448 Refs: #36003 Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object Co-authored-by: Antoine du Hamel <[email protected]> PR-URL: #36016 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Shingo Inoue <[email protected]>
Refs: #35448 Refs: #36003 Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object Co-authored-by: Antoine du Hamel <[email protected]> PR-URL: #36016 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Shingo Inoue <[email protected]>
Refs: #35448
Refs: #36003
Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesSupersedes and closes #32127
review?(@aduh95, @targos)