File tree 4 files changed +20
-9
lines changed
4 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ const {
65
65
SymbolIterator,
66
66
SyntaxError,
67
67
TypeError,
68
+ TypedArray,
69
+ TypedArrayPrototype,
68
70
Uint16Array,
69
71
Uint32Array,
70
72
Uint8Array,
@@ -105,7 +107,7 @@ module.exports = function() {
105
107
// AsyncGeneratorFunction
106
108
ObjectGetPrototypeOf ( async function * ( ) { } ) ,
107
109
// TypedArray
108
- ObjectGetPrototypeOf ( Uint8Array ) ,
110
+ TypedArrayPrototype ,
109
111
110
112
// 19 Fundamental Objects
111
113
Object . prototype , // 19.1
@@ -189,7 +191,7 @@ module.exports = function() {
189
191
// AsyncGeneratorFunction
190
192
ObjectGetPrototypeOf ( async function * ( ) { } ) ,
191
193
// TypedArray
192
- ObjectGetPrototypeOf ( Uint8Array ) ,
194
+ TypedArray ,
193
195
194
196
// 18 The Global Object
195
197
eval ,
Original file line number Diff line number Diff line change @@ -171,5 +171,18 @@ primordials.SafeWeakSet = makeSafe(
171
171
copyPrototype ( original . prototype , primordials , `${ name } Prototype` ) ;
172
172
} ) ;
173
173
174
+ // Create copies of abstract intrinsic objects that are not directly exposed
175
+ // on the global object.
176
+ // Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
177
+ [
178
+ { name : 'TypedArray' , original : Reflect . getPrototypeOf ( Uint8Array ) } ,
179
+ ] . forEach ( ( { name, original } ) => {
180
+ primordials [ name ] = original ;
181
+ // The static %TypedArray% methods require a valid `this`, but can't be bound,
182
+ // as they need a subclass constructor as the receiver:
183
+ copyPrototype ( original , primordials , name ) ;
184
+ copyPrototype ( original . prototype , primordials , `${ name } Prototype` ) ;
185
+ } ) ;
186
+
174
187
Object . setPrototypeOf ( primordials , null ) ;
175
188
Object . freeze ( primordials ) ;
Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ const {
58
58
SymbolPrototypeValueOf,
59
59
SymbolIterator,
60
60
SymbolToStringTag,
61
+ TypedArrayPrototype,
61
62
Uint16Array,
62
63
Uint32Array,
63
64
Uint8Array,
64
- Uint8ArrayPrototype,
65
65
Uint8ClampedArray,
66
66
uncurryThis,
67
67
} = primordials ;
@@ -142,8 +142,7 @@ const setSizeGetter = uncurryThis(
142
142
const mapSizeGetter = uncurryThis (
143
143
ObjectGetOwnPropertyDescriptor ( MapPrototype , 'size' ) . get ) ;
144
144
const typedArraySizeGetter = uncurryThis (
145
- ObjectGetOwnPropertyDescriptor (
146
- ObjectGetPrototypeOf ( Uint8ArrayPrototype ) , 'length' ) . get ) ;
145
+ ObjectGetOwnPropertyDescriptor ( TypedArrayPrototype , 'length' ) . get ) ;
147
146
148
147
let hexSlice ;
149
148
Original file line number Diff line number Diff line change 3
3
const {
4
4
ArrayBufferIsView,
5
5
ObjectGetOwnPropertyDescriptor,
6
- ObjectGetPrototypeOf,
7
6
SymbolToStringTag,
8
- Uint8ArrayPrototype ,
7
+ TypedArrayPrototype ,
9
8
uncurryThis,
10
9
} = primordials ;
11
10
12
- const TypedArrayPrototype = ObjectGetPrototypeOf ( Uint8ArrayPrototype ) ;
13
-
14
11
const TypedArrayProto_toStringTag =
15
12
uncurryThis (
16
13
ObjectGetOwnPropertyDescriptor ( TypedArrayPrototype ,
You can’t perform that action at this time.
0 commit comments