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 @@ -175,5 +175,18 @@ primordials.SafePromise = makeSafe(
175
175
copyPrototype ( original . prototype , primordials , `${ name } Prototype` ) ;
176
176
} ) ;
177
177
178
+ // Create copies of abstract intrinsic objects that are not directly exposed
179
+ // on the global object.
180
+ // Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
181
+ [
182
+ { name : 'TypedArray' , original : Reflect . getPrototypeOf ( Uint8Array ) } ,
183
+ ] . forEach ( ( { name, original } ) => {
184
+ primordials [ name ] = original ;
185
+ // The static %TypedArray% methods require a valid `this`, but can't be bound,
186
+ // as they need a subclass constructor as the receiver:
187
+ copyPrototype ( original , primordials , name ) ;
188
+ copyPrototype ( original . prototype , primordials , `${ name } Prototype` ) ;
189
+ } ) ;
190
+
178
191
Object . setPrototypeOf ( primordials , null ) ;
179
192
Object . freeze ( primordials ) ;
Original file line number Diff line number Diff line change @@ -57,10 +57,10 @@ const {
57
57
SymbolPrototypeValueOf,
58
58
SymbolIterator,
59
59
SymbolToStringTag,
60
+ TypedArrayPrototype,
60
61
Uint16Array,
61
62
Uint32Array,
62
63
Uint8Array,
63
- Uint8ArrayPrototype,
64
64
Uint8ClampedArray,
65
65
uncurryThis,
66
66
} = primordials ;
@@ -141,8 +141,7 @@ const setSizeGetter = uncurryThis(
141
141
const mapSizeGetter = uncurryThis (
142
142
ObjectGetOwnPropertyDescriptor ( MapPrototype , 'size' ) . get ) ;
143
143
const typedArraySizeGetter = uncurryThis (
144
- ObjectGetOwnPropertyDescriptor (
145
- ObjectGetPrototypeOf ( Uint8ArrayPrototype ) , 'length' ) . get ) ;
144
+ ObjectGetOwnPropertyDescriptor ( TypedArrayPrototype , 'length' ) . get ) ;
146
145
147
146
let hexSlice ;
148
147
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