-
Notifications
You must be signed in to change notification settings - Fork 72
/
whitelist.js
1833 lines (1672 loc) · 50.9 KB
/
whitelist.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* @fileoverview Exports {@code whitelist}, a recursively defined
* JSON record enumerating all intrinsics and their properties
* according to ECMA specs.
*
* @author JF Paradis
*/
/* eslint max-lines: 0 */
/**
* constantProperties
* non-configurable, non-writable data properties of all global objects.
* Must be powerless.
* Maps from property name to the actual value
*/
export const constantProperties = {
// *** 18.1 Value Properties of the Global Object
Infinity,
NaN,
undefined,
};
/**
* universalPropertyNames
* Properties of all global objects.
* Must be powerless.
* Maps from property name to the intrinsic name in the whitelist.
*/
export const universalPropertyNames = {
// *** 18.2 Function Properties of the Global Object
isFinite: 'isFinite',
isNaN: 'isNaN',
parseFloat: 'parseFloat',
parseInt: 'parseInt',
decodeURI: 'decodeURI',
decodeURIComponent: 'decodeURIComponent',
encodeURI: 'encodeURI',
encodeURIComponent: 'encodeURIComponent',
// *** 18.3 Constructor Properties of the Global Object
Array: 'Array',
ArrayBuffer: 'ArrayBuffer',
BigInt: 'BigInt',
BigInt64Array: 'BigInt64Array',
BigUint64Array: 'BigUint64Array',
Boolean: 'Boolean',
DataView: 'DataView',
EvalError: 'EvalError',
Float32Array: 'Float32Array',
Float64Array: 'Float64Array',
Int8Array: 'Int8Array',
Int16Array: 'Int16Array',
Int32Array: 'Int32Array',
Map: 'Map',
Number: 'Number',
Object: 'Object',
Promise: 'Promise',
Proxy: 'Proxy',
RangeError: 'RangeError',
ReferenceError: 'ReferenceError',
Set: 'Set',
String: 'String',
Symbol: 'Symbol',
SyntaxError: 'SyntaxError',
TypeError: 'TypeError',
Uint8Array: 'Uint8Array',
Uint8ClampedArray: 'Uint8ClampedArray',
Uint16Array: 'Uint16Array',
Uint32Array: 'Uint32Array',
URIError: 'URIError',
WeakMap: 'WeakMap',
WeakSet: 'WeakSet',
// *** 18.4 Other Properties of the Global Object
JSON: 'JSON',
Reflect: 'Reflect',
// *** Annex B
escape: 'escape',
unescape: 'unescape',
// ESNext
lockdown: 'lockdown',
harden: 'harden',
HandledPromise: 'HandledPromise', // TODO: Until Promise.delegate (see below).
StaticModuleRecord: 'StaticModuleRecord',
};
/**
* initialGlobalPropertyNames
* Those found only on the initial global, i.e., the global of the
* start compartment, as well as any compartments created before lockdown.
* These may provide much of the power provided by the original.
* Maps from property name to the intrinsic name in the whitelist.
*/
export const initialGlobalPropertyNames = {
// *** 18.3 Constructor Properties of the Global Object
Date: '%InitialDate%',
Error: '%InitialError%',
RegExp: '%InitialRegExp%',
// *** 18.4 Other Properties of the Global Object
Math: '%InitialMath%',
// ESNext
// From Error-stack proposal
// Only on initial global. No corresponding
// powerless form for other globals.
getStackString: '%InitialGetStackString%',
};
/**
* sharedGlobalPropertyNames
* Those found only on the globals of new compartments created after lockdown,
* which must therefore be powerless.
* Maps from property name to the intrinsic name in the whitelist.
*/
export const sharedGlobalPropertyNames = {
// *** 18.3 Constructor Properties of the Global Object
Date: '%SharedDate%',
Error: '%SharedError%',
RegExp: '%SharedRegExp%',
// *** 18.4 Other Properties of the Global Object
Math: '%SharedMath%',
};
/**
* uniqueGlobalPropertyNames
* Those made separately for each global, including the initial global
* of the start compartment.
* Maps from property name to the intrinsic name in the whitelist
* (which is currently always the same).
*/
export const uniqueGlobalPropertyNames = {
// *** 18.1 Value Properties of the Global Object
globalThis: '%UniqueGlobalThis%',
// *** 18.2 Function Properties of the Global Object
eval: '%UniqueEval%',
// *** 18.3 Constructor Properties of the Global Object
Function: '%UniqueFunction%',
// *** 18.4 Other Properties of the Global Object
// ESNext
Compartment: '%UniqueCompartment%',
// According to current agreements, eventually the Realm constructor too.
// 'Realm',
};
// All the "subclasses" of Error. These are collectively represented in the
// EcmaScript spec by the meta variable NativeError.
export const NativeErrors = [
EvalError,
RangeError,
ReferenceError,
SyntaxError,
TypeError,
URIError,
];
/**
* <p>Each JSON record enumerates the disposition of the properties on
* some corresponding intrinsic object.
*
* <p>All records are made of key-value pairs where the key
* is the property to process, and the value is the associated
* dispositions a.k.a. the "permit". Those permits can be:
* <ul>
* <li>The boolean value "false", in which case this property is
* blacklisted and simply removed. Properties not mentioned
* are also considered blacklisted and are removed.
* <li>A string value equal to a primitive ("number", "string", etc),
* in which case the property is whitelisted if its value property
* is typeof the given type. For example, {@code "Infinity"} leads to
* "number" and property values that fail {@code typeof "number"}.
* are removed.
* <li>A string value equal to an intinsic name ("ObjectPrototype",
* "Array", etc), in which case the property whitelisted if its
* value property is equal to the value of the corresponfing
* intrinsics. For example, {@code Map.prototype} leads to
* "MapPrototype" and the property is removed if its value is
* not equal to %MapPrototype%
* <li>Another record, in which case this property is simply
* whitelisted and that next record represents the disposition of
* the object which is its value. For example, {@code "Object"}
* leads to another record explaining what properties {@code
* "Object"} may have and how each such property should be treated.
*
* <p>Notes:
* <li>"[[Proto]]" is used to refer to the "[[Prototype]]" internal
* slot, which says which object this object inherits from.
* <li>"--proto--" is used to refer to the "__proto__" property name,
* which is the name of an accessor property on Object.prototype.
* In practice, it is used to access the [[Proto]] internal slot,
* but is distinct from the internal slot itself. We use
* "--proto--" rather than "__proto__" below because "__proto__"
* in an object literal is special syntax rather than a normal
* property definition.
* <li>"ObjectPrototype" is the default "[[Proto]]" (when not specified).
* <li>Constants "fn" and "getter" are used to keep the structure DRY.
* <li>Symbol properties are listed using the "@@name" form.
*/
// 19.2.4 Function Instances
export const FunctionInstance = {
// Mentioned in "19.2.4.3 prototype"
'[[Proto]]': '%FunctionPrototype%',
// 19.2.4.1 length
length: 'number',
// 19.2.4.2 name
name: 'string',
// 19.2.4.3 prototype
// Do not specify "prototype" here, since only Function instances that can
// be used as a constructor have a prototype property. For constructors,
// since prototype properties are instance-specific, we define it there.
};
// 25.7.4 AsyncFunction Instances
const AsyncFunctionInstance = {
// This property is not mentioned in ECMA 262, but is present in V8 and
// necessary for lockdown to succeed.
'[[Proto]]': '%AsyncFunctionPrototype%',
};
// Aliases
const fn = FunctionInstance;
const asyncFn = AsyncFunctionInstance;
const getter = {
get: fn,
set: 'undefined',
};
// Possible but not encountered in the specs
// export const setter = {
// get: 'undefined',
// set: fn,
// };
const accessor = {
get: fn,
set: fn,
};
export function isAccessorPermit(permit) {
return permit === getter || permit === accessor;
}
// 19.5.6 NativeError Object Structure
function NativeError(prototype) {
return {
// 19.5.6.2 Properties of the NativeError Constructors
'[[Proto]]': '%SharedError%',
// 19.5.6.2.1 NativeError.prototype
prototype,
};
}
function NativeErrorPrototype(constructor) {
return {
// 19.5.6.3 Properties of the NativeError Prototype Objects
'[[Proto]]': '%ErrorPrototype%',
// 19.5.6.3.1 NativeError.prototype.constructor
constructor,
// 19.5.6.3.2 NativeError.prototype.message
message: 'string',
// 19.5.6.3.3 NativeError.prototype.name
name: 'string',
// Redundantly present only on v8. Safe to remove.
toString: false,
};
}
// 22.2.4 The TypedArray Constructors
function TypedArray(prototype) {
return {
// 22.2.5 Properties of the TypedArray Constructors
'[[Proto]]': '%TypedArray%',
// 22.2.5.1 TypedArray.BYTES_PER_ELEMENT
BYTES_PER_ELEMENT: 'number',
// 22.2.5.2 TypedArray.prototype
prototype,
};
}
function TypedArrayPrototype(constructor) {
return {
// 22.2.6 Properties of the TypedArray Prototype Objects
'[[Proto]]': '%TypedArrayPrototype%',
// 22.2.6.1 TypedArray.prototype.BYTES_PER_ELEMENT
BYTES_PER_ELEMENT: 'number',
// 22.2.6.2TypedArray.prototype.constructor
constructor,
};
}
// Without Math.random
const SharedMath = {
// 20.3.1.1 Math.E
E: 'number',
// 20.3.1.2 Math.LN10
LN10: 'number',
// 20.3.1.3 Math.LN2
LN2: 'number',
// 20.3.1.4 Math.LOG10E
LOG10E: 'number',
// 20.3.1.5 Math.LOG2E
LOG2E: 'number',
// 20.3.1.6 Math.PI
PI: 'number',
// 20.3.1.7 Math.SQRT1_2
SQRT1_2: 'number',
// 20.3.1.8 Math.SQRT2
SQRT2: 'number',
// 20.3.1.9 Math [ @@toStringTag ]
'@@toStringTag': 'string',
// 20.3.2.1 Math.abs
abs: fn,
// 20.3.2.2 Math.acos
acos: fn,
// 20.3.2.3 Math.acosh
acosh: fn,
// 20.3.2.4 Math.asin
asin: fn,
// 20.3.2.5 Math.asinh
asinh: fn,
// 20.3.2.6 Math.atan
atan: fn,
// 20.3.2.7 Math.atanh
atanh: fn,
// 20.3.2.8 Math.atan2
atan2: fn,
// 20.3.2.9 Math.cbrt
cbrt: fn,
// 20.3.2.10 Math.ceil
ceil: fn,
// 20.3.2.11 Math.clz32
clz32: fn,
// 20.3.2.12 Math.cos
cos: fn,
// 20.3.2.13 Math.cosh
cosh: fn,
// 20.3.2.14 Math.exp
exp: fn,
// 20.3.2.15 Math.expm1
expm1: fn,
// 20.3.2.16 Math.floor
floor: fn,
// 20.3.2.17 Math.fround
fround: fn,
// 20.3.2.18 Math.hypot
hypot: fn,
// 20.3.2.19 Math.imul
imul: fn,
// 20.3.2.20 Math.log
log: fn,
// 20.3.2.21 Math.log1p
log1p: fn,
// 20.3.2.22 Math.log10
log10: fn,
// 20.3.2.23 Math.log2
log2: fn,
// 20.3.2.24 Math.max
max: fn,
// 20.3.2.25 Math.min
min: fn,
// 20.3.2.26Math.pow
pow: fn,
// 20.3.2.28 Math.round
round: fn,
// 20.3.2.29 Math.sign
sign: fn,
// 20.3.2.30 Math.sin
sin: fn,
// 20.3.2.31 Math.sinh
sinh: fn,
// 20.3.2.32 Math.sqrt
sqrt: fn,
// 20.3.2.33 Math.tan
tan: fn,
// 20.3.2.34 Math.tanh
tanh: fn,
// 20.3.2.35 Math.trunc
trunc: fn,
// 20.3.2.35Math.trunc
};
export const whitelist = {
// ECMA https://tc39.es/ecma262
// The intrinsics object has no prototype to avoid conflicts.
'[[Proto]]': null,
// 9.2.4.1 %ThrowTypeError%
'%ThrowTypeError%': fn,
// *** 18 The Global Object
// *** 18.1 Value Properties of the Global Object
// 18.1.1 Infinity
Infinity: 'number',
// 18.1.2 NaN
NaN: 'number',
// 18.1.3 undefined
undefined: 'undefined',
// *** 18.2 Function Properties of the Global Object
// 18.2.1 eval
'%UniqueEval%': fn,
// 18.2.2 isFinite
isFinite: fn,
// 18.2.3 isNaN
isNaN: fn,
// 18.2.4 parseFloat
parseFloat: fn,
// 18.2.5 parseInt
parseInt: fn,
// 18.2.6.2 decodeURI
decodeURI: fn,
// 18.2.6.3 decodeURIComponent
decodeURIComponent: fn,
// 18.2.6.4 encodeURI
encodeURI: fn,
// 18.2.6.5 encodeURIComponent
encodeURIComponent: fn,
// *** 19 Fundamental Objects
Object: {
// 19.1.2 Properties of the Object Constructor
'[[Proto]]': '%FunctionPrototype%',
// 19.1.2.1 Object.assign
assign: fn,
// 19.1.2.2 Object.create
create: fn,
// 19.1.2.3 Object.defineProperties
defineProperties: fn,
// 19.1.2.4 Object.defineProperty
defineProperty: fn,
// 19.1.2.5 Object.entries
entries: fn,
// 19.1.2.6 Object.freeze
freeze: fn,
// 19.1.2.7 Object.fromEntries
fromEntries: fn,
// 19.1.2.8 Object.getOwnPropertyDescriptor
getOwnPropertyDescriptor: fn,
// 19.1.2.9 Object.getOwnPropertyDescriptors
getOwnPropertyDescriptors: fn,
// 19.1.2.10 Object.getOwnPropertyNames
getOwnPropertyNames: fn,
// 19.1.2.11 Object.getOwnPropertySymbols
getOwnPropertySymbols: fn,
// 19.1.2.12 Object.getPrototypeOf
getPrototypeOf: fn,
// 19.1.2.13 Object.is
is: fn,
// 19.1.2.14 Object.isExtensible
isExtensible: fn,
// 19.1.2.15 Object.isFrozen
isFrozen: fn,
// 19.1.2.16 Object.isSealed
isSealed: fn,
// 19.1.2.17 Object.keys
keys: fn,
// 19.1.2.18 Object.preventExtensions
preventExtensions: fn,
// 19.1.2.19 Object.prototype
prototype: '%ObjectPrototype%',
// 19.1.2.20 Object.seal
seal: fn,
// 19.1.2.21 Object.setPrototypeOf
setPrototypeOf: fn,
// 19.1.2.22 Object.values
values: fn,
},
'%ObjectPrototype%': {
// 19.1.3 Properties of the Object Prototype Object
'[[Proto]]': null,
// 19.1.3.1 Object.prototype.constructor
constructor: 'Object',
// 19.1.3.2 Object.prototype.hasOwnProperty
hasOwnProperty: fn,
// 19.1.3.3 Object.prototype.isPrototypeOf
isPrototypeOf: fn,
// 19.1.3.4 Object.prototype.propertyIsEnumerable
propertyIsEnumerable: fn,
// 19.1.3.5 Object.prototype.toLocaleString
toLocaleString: fn,
// 19.1.3.6 Object.prototype.toString
toString: fn,
// 19.1.3.7 Object.prototype.valueOf
valueOf: fn,
// B.2.2 Additional Properties of the Object.prototype Object
// B.2.2.1 Object.prototype.__proto__
'--proto--': accessor,
// B.2.2.2 Object.prototype.__defineGetter__
__defineGetter__: fn,
// B.2.2.3 Object.prototype.__defineSetter__
__defineSetter__: fn,
// B.2.2.4 Object.prototype.__lookupGetter__
__lookupGetter__: fn,
// B.2.2.5 Object.prototype.__lookupSetter__
__lookupSetter__: fn,
},
'%UniqueFunction%': {
// 19.2.2 Properties of the Function Constructor
'[[Proto]]': '%FunctionPrototype%',
// 19.2.2.2 Function.prototype
prototype: '%FunctionPrototype%',
},
'%InertFunction%': {
'[[Proto]]': '%FunctionPrototype%',
prototype: '%FunctionPrototype%',
},
'%FunctionPrototype%': {
// 19.2.3.1 Function.prototype.apply
apply: fn,
// 19.2.3.2 Function.prototype.bind
bind: fn,
// 19.2.3.3 Function.prototype.call
call: fn,
// 19.2.3.4 Function.prototype.constructor
constructor: '%InertFunction%', // TODO test
// 19.2.3.5 Function.prototype.toString
toString: fn,
// 19.2.3.6 Function.prototype [ @@hasInstance ]
'@@hasInstance': fn,
// non-std yet but proposed. To be removed if there
caller: false,
arguments: false,
},
Boolean: {
// 19.3.2 Properties of the Boolean Constructor
'[[Proto]]': '%FunctionPrototype%',
// 19.3.2.1 Boolean.prototype
prototype: '%BooleanPrototype%',
},
'%BooleanPrototype%': {
// 19.3.3.1 Boolean.prototype.constructor
constructor: 'Boolean',
// 19.3.3.2 Boolean.prototype.toString
toString: fn,
// 19.3.3.3 Boolean.prototype.valueOf
valueOf: fn,
},
Symbol: {
// 19.4.2 Properties of the Symbol Constructor
'[[Proto]]': '%FunctionPrototype%',
// 19.4.2.1 Symbol.asyncIterator
asyncIterator: 'symbol',
// 19.4.2.2 Symbol.for
for: fn,
// 19.4.2.3 Symbol.hasInstance
hasInstance: 'symbol',
// 19.4.2.4 Symbol.isConcatSpreadable
isConcatSpreadable: 'symbol',
// 19.4.2.5 Symbol.iterator
iterator: 'symbol',
// 19.4.2.6 Symbol.keyFor
keyFor: fn,
// 19.4.2.7 Symbol.match
match: 'symbol',
// 19.4.2.8 Symbol.matchAll
matchAll: 'symbol',
// 19.4.2.9 Symbol.prototype
prototype: '%SymbolPrototype%',
// 19.4.2.10 Symbol.replace
replace: 'symbol',
// 19.4.2.11 Symbol.search
search: 'symbol',
// 19.4.2.12 Symbol.species
species: 'symbol',
// 19.4.2.13 Symbol.split
split: 'symbol',
// 19.4.2.14 Symbol.toPrimitive
toPrimitive: 'symbol',
// 19.4.2.15 Symbol.toStringTag
toStringTag: 'symbol',
// 19.4.2.16 Symbol.unscopables
unscopables: 'symbol',
},
'%SymbolPrototype%': {
// 19.4.3 Properties of the Symbol Prototype Object
// 19.4.3.1 Symbol.prototype.constructor
constructor: 'Symbol',
// 19.4.3.2 get Symbol.prototype.description
description: getter,
// 19.4.3.3 Symbol.prototype.toString
toString: fn,
// 19.4.3.4 Symbol.prototype.valueOf
valueOf: fn,
// 19.4.3.5 Symbol.prototype [ @@toPrimitive ]
'@@toPrimitive': fn,
// 19.4.3.6 Symbol.prototype [ @@toStringTag ]
'@@toStringTag': 'string',
},
'%InitialError%': {
// 19.5.2 Properties of the Error Constructor
'[[Proto]]': '%FunctionPrototype%',
// 19.5.2.1 Error.prototype
prototype: '%ErrorPrototype%',
// Non standard, v8 only, used by tap
captureStackTrace: fn,
// Non standard, v8 only, used by tap, tamed to accessor
stackTraceLimit: accessor,
// Non standard, v8 only, used by several, tamed to accessor
prepareStackTrace: accessor,
},
'%SharedError%': {
// 19.5.2 Properties of the Error Constructor
'[[Proto]]': '%FunctionPrototype%',
// 19.5.2.1 Error.prototype
prototype: '%ErrorPrototype%',
// Non standard, v8 only, used by tap
captureStackTrace: fn,
// Non standard, v8 only, used by tap, tamed to accessor
stackTraceLimit: accessor,
// Non standard, v8 only, used by several, tamed to accessor
prepareStackTrace: accessor,
},
'%ErrorPrototype%': {
// 19.5.3.1 Error.prototype.constructor
constructor: '%SharedError%',
// 19.5.3.2 Error.prototype.message
message: 'string',
// 19.5.3.3 Error.prototype.name
name: 'string',
// 19.5.3.4 Error.prototype.toString
toString: fn,
// proposed de-facto, assumed TODO
// stack: accessor,
},
// 19.5.6.1.1 NativeError
EvalError: NativeError('%EvalErrorPrototype%'),
RangeError: NativeError('%RangeErrorPrototype%'),
ReferenceError: NativeError('%ReferenceErrorPrototype%'),
SyntaxError: NativeError('%SyntaxErrorPrototype%'),
TypeError: NativeError('%TypeErrorPrototype%'),
URIError: NativeError('%URIErrorPrototype%'),
'%EvalErrorPrototype%': NativeErrorPrototype('EvalError'),
'%RangeErrorPrototype%': NativeErrorPrototype('RangeError'),
'%ReferenceErrorPrototype%': NativeErrorPrototype('ReferenceError'),
'%SyntaxErrorPrototype%': NativeErrorPrototype('SyntaxError'),
'%TypeErrorPrototype%': NativeErrorPrototype('TypeError'),
'%URIErrorPrototype%': NativeErrorPrototype('URIError'),
// *** 20 Numbers and Dates
Number: {
// 20.1.2 Properties of the Number Constructor
'[[Proto]]': '%FunctionPrototype%',
// 20.1.2.1 Number.EPSILON
EPSILON: 'number',
// 20.1.2.2 Number.isFinite
isFinite: fn,
// 20.1.2.3 Number.isInteger
isInteger: fn,
// 20.1.2.4 Number.isNaN
isNaN: fn,
// 20.1.2.5 Number.isSafeInteger
isSafeInteger: fn,
// 20.1.2.6 Number.MAX_SAFE_INTEGER
MAX_SAFE_INTEGER: 'number',
// 20.1.2.7 Number.MAX_VALUE
MAX_VALUE: 'number',
// 20.1.2.8 Number.MIN_SAFE_INTEGER
MIN_SAFE_INTEGER: 'number',
// 20.1.2.9 Number.MIN_VALUE
MIN_VALUE: 'number',
// 20.1.2.10 Number.NaN
NaN: 'number',
// 20.1.2.11 Number.NEGATIVE_INFINITY
NEGATIVE_INFINITY: 'number',
// 20.1.2.12 Number.parseFloat
parseFloat: fn,
// 20.1.2.13 Number.parseInt
parseInt: fn,
// 20.1.2.14 Number.POSITIVE_INFINITY
POSITIVE_INFINITY: 'number',
// 20.1.2.15 Number.prototype
prototype: '%NumberPrototype%',
},
'%NumberPrototype%': {
// 20.1.3 Properties of the Number Prototype Object
// 20.1.3.1 Number.prototype.constructor
constructor: 'Number',
// 20.1.3.2 Number.prototype.toExponential
toExponential: fn,
// 20.1.3.3 Number.prototype.toFixed
toFixed: fn,
// 20.1.3.4 Number.prototype.toLocaleString
toLocaleString: fn,
// 20.1.3.5 Number.prototype.toPrecision
toPrecision: fn,
// 20.1.3.6 Number.prototype.toString
toString: fn,
// 20.1.3.7 Number.prototype.valueOf
valueOf: fn,
},
BigInt: {
// 20.2.2Properties of the BigInt Constructor
'[[Proto]]': '%FunctionPrototype%',
// 20.2.2.1 BigInt.asIntN
asIntN: fn,
// 20.2.2.2 BigInt.asUintN
asUintN: fn,
// 20.2.2.3 BigInt.prototype
prototype: '%BigIntPrototype%',
},
'%BigIntPrototype%': {
// 20.2.3.1 BigInt.prototype.constructor
constructor: 'BigInt',
// 20.2.3.2 BigInt.prototype.toLocaleString
toLocaleString: fn,
// 20.2.3.3 BigInt.prototype.toString
toString: fn,
// 20.2.3.4 BigInt.prototype.valueOf
valueOf: fn,
// 20.2.3.5 BigInt.prototype [ @@toStringTag ]
'@@toStringTag': 'string',
},
'%InitialMath%': {
...SharedMath,
// 20.3.2.27Math.random
random: fn,
},
'%SharedMath%': SharedMath,
'%InitialDate%': {
// 20.4.3 Properties of the Date Constructor
'[[Proto]]': '%FunctionPrototype%',
// 20.4.3.1 Date.now
now: fn,
// 20.4.3.2 Date.parse
parse: fn,
// 20.4.3.3 Date.prototype
prototype: '%DatePrototype%',
// 20.4.3.4 Date.UTC
UTC: fn,
},
'%SharedDate%': {
// 20.4.3 Properties of the Date Constructor
'[[Proto]]': '%FunctionPrototype%',
// 20.4.3.1 Date.now
now: fn,
// 20.4.3.2 Date.parse
parse: fn,
// 20.4.3.3 Date.prototype
prototype: '%DatePrototype%',
// 20.4.3.4 Date.UTC
UTC: fn,
},
'%DatePrototype%': {
// 20.4.4.1 Date.prototype.constructor
constructor: '%SharedDate%',
// 20.4.4.2 Date.prototype.getDate
getDate: fn,
// 20.4.4.3 Date.prototype.getDay
getDay: fn,
// 20.4.4.4 Date.prototype.getFullYear
getFullYear: fn,
// 20.4.4.5 Date.prototype.getHours
getHours: fn,
// 20.4.4.6 Date.prototype.getMilliseconds
getMilliseconds: fn,
// 20.4.4.7 Date.prototype.getMinutes
getMinutes: fn,
// 20.4.4.8 Date.prototype.getMonth
getMonth: fn,
// 20.4.4.9 Date.prototype.getSeconds
getSeconds: fn,
// 20.4.4.10 Date.prototype.getTime
getTime: fn,
// 20.4.4.11 Date.prototype.getTimezoneOffset
getTimezoneOffset: fn,
// 20.4.4.12 Date.prototype.getUTCDate
getUTCDate: fn,
// 20.4.4.13 Date.prototype.getUTCDay
getUTCDay: fn,
// 20.4.4.14 Date.prototype.getUTCFullYear
getUTCFullYear: fn,
// 20.4.4.15 Date.prototype.getUTCHours
getUTCHours: fn,
// 20.4.4.16 Date.prototype.getUTCMilliseconds
getUTCMilliseconds: fn,
// 20.4.4.17 Date.prototype.getUTCMinutes
getUTCMinutes: fn,
// 20.4.4.18 Date.prototype.getUTCMonth
getUTCMonth: fn,
// 20.4.4.19 Date.prototype.getUTCSeconds
getUTCSeconds: fn,
// 20.4.4.20 Date.prototype.setDate
setDate: fn,
// 20.4.4.21 Date.prototype.setFullYear
setFullYear: fn,
// 20.4.4.22 Date.prototype.setHours
setHours: fn,
// 20.4.4.23 Date.prototype.setMilliseconds
setMilliseconds: fn,
// 20.4.4.24 Date.prototype.setMinutes
setMinutes: fn,
// 20.4.4.25 Date.prototype.setMonth
setMonth: fn,
// 20.4.4.26 Date.prototype.setSeconds
setSeconds: fn,
// 20.4.4.27 Date.prototype.setTime
setTime: fn,
// 20.4.4.28 Date.prototype.setUTCDate
setUTCDate: fn,
// 20.4.4.29 Date.prototype.setUTCFullYear
setUTCFullYear: fn,
// 20.4.4.30 Date.prototype.setUTCHours
setUTCHours: fn,
// 20.4.4.31 Date.prototype.setUTCMilliseconds
setUTCMilliseconds: fn,
// 20.4.4.32 Date.prototype.setUTCMinutes
setUTCMinutes: fn,
// 20.4.4.33 Date.prototype.setUTCMonth
setUTCMonth: fn,
// 20.4.4.34 Date.prototype.setUTCSeconds
setUTCSeconds: fn,
// 20.4.4.35 Date.prototype.toDateString
toDateString: fn,
// 20.4.4.36 Date.prototype.toISOString
toISOString: fn,
// 20.4.4.37 Date.prototype.toJSON
toJSON: fn,
// 20.4.4.38 Date.prototype.toLocaleDateString
toLocaleDateString: fn,
// 20.4.4.39 Date.prototype.toLocaleString
toLocaleString: fn,
// 20.4.4.40 Date.prototype.toLocaleTimeString
toLocaleTimeString: fn,
// 20.4.4.41 Date.prototype.toString
toString: fn,
// 20.4.4.42 Date.prototype.toTimeString
toTimeString: fn,
// 20.4.4.43 Date.prototype.toUTCString
toUTCString: fn,
// 20.4.4.44 Date.prototype.valueOf
valueOf: fn,
// 20.4.4.45 Date.prototype [ @@toPrimitive ]
'@@toPrimitive': fn,
// B.2.4 Additional Properties of the Date.prototype Object
// B.2.4.1 Date.prototype.getYear
getYear: fn,
// B.2.4.2 Date.prototype.setYear
setYear: fn,
// B.2.4.3 Date.prototype.toGMTString
toGMTString: fn,
},
// 21 Text Processing
String: {
// 21.1.2 Properties of the String Constructor
'[[Proto]]': '%FunctionPrototype%',
// 21.1.2.1 String.fromCharCode
fromCharCode: fn,
// 21.1.2.2 String.fromCodePoint
fromCodePoint: fn,
// 21.1.2.3 String.prototype
prototype: '%StringPrototype%',
// 21.1.2.4 String.raw
raw: fn,
},
'%StringPrototype%': {
// 21.1.3 Properties of the String Prototype Object
length: 'number',
// 21.1.3.1 String.prototype.charAt
charAt: fn,
// 21.1.3.2 String.prototype.charCodeAt
charCodeAt: fn,
// 21.1.3.3 String.prototype.codePointAt
codePointAt: fn,
// 21.1.3.4 String.prototype.concat
concat: fn,
// 21.1.3.5 String.prototype.constructor
constructor: 'String',
// 21.1.3.6 String.prototype.endsWith
endsWith: fn,
// 21.1.3.7 String.prototype.includes
includes: fn,
// 21.1.3.8 String.prototype.indexOf
indexOf: fn,
// 21.1.3.9 String.prototype.lastIndexOf
lastIndexOf: fn,
// 21.1.3.10 String.prototype.localeCompare
localeCompare: fn,
// 21.1.3.11 String.prototype.match
match: fn,
// 21.1.3.12 String.prototype.matchAll
matchAll: fn,
// 21.1.3.13 String.prototype.normalize
normalize: fn,
// 21.1.3.14 String.prototype.padEnd
padEnd: fn,
// 21.1.3.15 String.prototype.padStart
padStart: fn,
// 21.1.3.16 String.prototype.repeat
repeat: fn,
// 21.1.3.17 String.prototype.replace
replace: fn,
// 21.1.3.18 String.prototype.search
search: fn,
// 21.1.3.19 String.prototype.slice
slice: fn,
// 21.1.3.20 String.prototype.split
split: fn,
// 21.1.3.21 String.prototype.startsWith
startsWith: fn,
// 21.1.3.22 String.prototype.substring
substring: fn,
// 21.1.3.23 String.prototype.toLocaleLowerCase
toLocaleLowerCase: fn,
// 21.1.3.24 String.prototype.toLocaleUpperCase
toLocaleUpperCase: fn,
// 21.1.3.25 String.prototype.toLowerCase
toLowerCase: fn,
// 21.1.3.26 String.prototype.
toString: fn,
// 21.1.3.27 String.prototype.toUpperCase
toUpperCase: fn,
// 21.1.3.28 String.prototype.trim
trim: fn,
// 21.1.3.29 String.prototype.trimEnd
trimEnd: fn,
// 21.1.3.30 String.prototype.trimStart
trimStart: fn,
// 21.1.3.31 String.prototype.valueOf
valueOf: fn,
// 21.1.3.32 String.prototype [ @@iterator ]
'@@iterator': fn,
// B.2.3 Additional Properties of the String.prototype Object
// B.2.3.1 String.prototype.substr
substr: fn,
// B.2.3.2 String.prototype.anchor
anchor: fn,
// B.2.3.3 String.prototype.big
big: fn,
// B.2.3.4 String.prototype.blink
blink: fn,
// B.2.3.5 String.prototype.bold
bold: fn,
// B.2.3.6 String.prototype.fixed