ses 1.13.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -52
- package/dist/lockdown.cjs +1346 -948
- package/dist/lockdown.mjs +1346 -948
- package/dist/lockdown.umd.js +1346 -948
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses-hermes.cjs +1328 -804
- package/dist/ses.cjs +1346 -948
- package/dist/ses.mjs +1346 -948
- package/dist/ses.umd.js +1346 -948
- package/dist/ses.umd.min.js +1 -1
- package/dist/types.d.cts +115 -141
- package/package.json +19 -102
- package/src/assert-shim.js +2 -2
- package/src/cauterize-property.js +2 -2
- package/src/commons.js +111 -50
- package/src/compartment.js +25 -8
- package/src/enable-property-overrides.js +4 -4
- package/src/enablements.js +7 -8
- package/src/error/assert.js +126 -101
- package/src/error/note-log-args.js +5 -4
- package/src/error/stringify-utils.js +2 -2
- package/src/error/tame-v8-error-constructor.js +15 -12
- package/src/error/types.js +1 -1
- package/src/get-anonymous-intrinsics.js +0 -1
- package/src/global-object.js +3 -3
- package/src/intrinsics.js +8 -8
- package/src/lockdown.js +34 -12
- package/src/make-hardener.js +4 -4
- package/src/module-instance.js +22 -18
- package/src/module-link.js +4 -4
- package/src/module-load.js +48 -13
- package/src/permits-intrinsics.js +8 -8
- package/src/permits.js +5 -0
- package/src/reporting.js +48 -12
- package/src/scope-constants.js +19 -25
- package/src/tame-locale-methods.js +2 -2
- package/src/tame-regenerator-runtime.js +2 -2
- package/src/transforms.js +9 -7
- package/types.d.ts +115 -141
- package/src/error/README.md +0 -99
- package/src/make-lru-cachemap.js +0 -221
package/dist/ses-hermes.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ses@1.
|
|
1
|
+
// ses@1.15.0
|
|
2
2
|
(functors => options => {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
toStringTagSymbol: cell("toStringTagSymbol"),
|
|
100
100
|
iteratorSymbol: cell("iteratorSymbol"),
|
|
101
101
|
matchAllSymbol: cell("matchAllSymbol"),
|
|
102
|
+
replaceSymbol: cell("replaceSymbol"),
|
|
102
103
|
unscopablesSymbol: cell("unscopablesSymbol"),
|
|
103
104
|
symbolKeyFor: cell("symbolKeyFor"),
|
|
104
105
|
symbolFor: cell("symbolFor"),
|
|
@@ -130,7 +131,7 @@
|
|
|
130
131
|
iteratorPrototype: cell("iteratorPrototype"),
|
|
131
132
|
typedArrayPrototype: cell("typedArrayPrototype"),
|
|
132
133
|
uncurryThis: cell("uncurryThis"),
|
|
133
|
-
|
|
134
|
+
hasOwn: cell("hasOwn"),
|
|
134
135
|
arrayFilter: cell("arrayFilter"),
|
|
135
136
|
arrayForEach: cell("arrayForEach"),
|
|
136
137
|
arrayIncludes: cell("arrayIncludes"),
|
|
@@ -157,16 +158,14 @@
|
|
|
157
158
|
setForEach: cell("setForEach"),
|
|
158
159
|
setHas: cell("setHas"),
|
|
159
160
|
iterateSet: cell("iterateSet"),
|
|
160
|
-
regexpTest: cell("regexpTest"),
|
|
161
161
|
regexpExec: cell("regexpExec"),
|
|
162
|
+
regexpReplace: cell("regexpReplace"),
|
|
162
163
|
matchAllRegExp: cell("matchAllRegExp"),
|
|
164
|
+
sealRegexp: cell("sealRegexp"),
|
|
163
165
|
stringEndsWith: cell("stringEndsWith"),
|
|
164
166
|
stringIncludes: cell("stringIncludes"),
|
|
165
167
|
stringIndexOf: cell("stringIndexOf"),
|
|
166
168
|
stringMatch: cell("stringMatch"),
|
|
167
|
-
generatorNext: cell("generatorNext"),
|
|
168
|
-
generatorThrow: cell("generatorThrow"),
|
|
169
|
-
stringReplace: cell("stringReplace"),
|
|
170
169
|
stringSearch: cell("stringSearch"),
|
|
171
170
|
stringSlice: cell("stringSlice"),
|
|
172
171
|
stringSplit: cell("stringSplit"),
|
|
@@ -180,13 +179,14 @@
|
|
|
180
179
|
weaksetHas: cell("weaksetHas"),
|
|
181
180
|
functionToString: cell("functionToString"),
|
|
182
181
|
functionBind: cell("functionBind"),
|
|
182
|
+
generatorNext: cell("generatorNext"),
|
|
183
|
+
generatorThrow: cell("generatorThrow"),
|
|
183
184
|
promiseAll: cell("promiseAll"),
|
|
184
185
|
promiseCatch: cell("promiseCatch"),
|
|
185
186
|
promiseThen: cell("promiseThen"),
|
|
186
187
|
finalizationRegistryRegister: cell("finalizationRegistryRegister"),
|
|
187
188
|
finalizationRegistryUnregister: cell("finalizationRegistryUnregister"),
|
|
188
|
-
|
|
189
|
-
isObject: cell("isObject"),
|
|
189
|
+
isPrimitive: cell("isPrimitive"),
|
|
190
190
|
isError: cell("isError"),
|
|
191
191
|
identity: cell("identity"),
|
|
192
192
|
FERAL_EVAL: cell("FERAL_EVAL"),
|
|
@@ -209,6 +209,9 @@
|
|
|
209
209
|
{
|
|
210
210
|
isBufferImmutable: cell("isBufferImmutable"),
|
|
211
211
|
sliceBufferToImmutable: cell("sliceBufferToImmutable"),
|
|
212
|
+
optTransferBufferToImmutable: cell("optTransferBufferToImmutable"),
|
|
213
|
+
},
|
|
214
|
+
{
|
|
212
215
|
},
|
|
213
216
|
{
|
|
214
217
|
},
|
|
@@ -222,7 +225,10 @@
|
|
|
222
225
|
{
|
|
223
226
|
},
|
|
224
227
|
{
|
|
225
|
-
|
|
228
|
+
makeCacheMapKit: cell("makeCacheMapKit"),
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
makeCacheMapKit: cell("makeCacheMapKit"),
|
|
226
232
|
},
|
|
227
233
|
{
|
|
228
234
|
makeNoteLogArgsArrayKit: cell("makeNoteLogArgsArrayKit"),
|
|
@@ -235,10 +241,10 @@
|
|
|
235
241
|
makeError: cell("makeError"),
|
|
236
242
|
annotateError: cell("annotateError"),
|
|
237
243
|
loggedErrorHandler: cell("loggedErrorHandler"),
|
|
238
|
-
makeAssert: cell("makeAssert"),
|
|
239
244
|
assert: cell("assert"),
|
|
240
245
|
assertEqual: cell("assertEqual"),
|
|
241
246
|
sanitizeError: cell("sanitizeError"),
|
|
247
|
+
makeAssert: cell("makeAssert"),
|
|
242
248
|
},
|
|
243
249
|
{
|
|
244
250
|
isTypedArray: cell("isTypedArray"),
|
|
@@ -434,6 +440,8 @@
|
|
|
434
440
|
|
|
435
441
|
defineProperties(cells[3], getOwnPropertyDescriptors(cells[2]));
|
|
436
442
|
|
|
443
|
+
defineProperties(cells[11], {"makeCacheMapKit": { value: cells[10]["makeCacheMapKit"] } });
|
|
444
|
+
|
|
437
445
|
const namespaces = cells.map(cells => freeze(create(null, {
|
|
438
446
|
...cells,
|
|
439
447
|
// Make this appear like an ESM module namespace object.
|
|
@@ -519,6 +527,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
519
527
|
toStringTagSymbol: cells[0].toStringTagSymbol.set,
|
|
520
528
|
iteratorSymbol: cells[0].iteratorSymbol.set,
|
|
521
529
|
matchAllSymbol: cells[0].matchAllSymbol.set,
|
|
530
|
+
replaceSymbol: cells[0].replaceSymbol.set,
|
|
522
531
|
unscopablesSymbol: cells[0].unscopablesSymbol.set,
|
|
523
532
|
symbolKeyFor: cells[0].symbolKeyFor.set,
|
|
524
533
|
symbolFor: cells[0].symbolFor.set,
|
|
@@ -550,7 +559,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
550
559
|
iteratorPrototype: cells[0].iteratorPrototype.set,
|
|
551
560
|
typedArrayPrototype: cells[0].typedArrayPrototype.set,
|
|
552
561
|
uncurryThis: cells[0].uncurryThis.set,
|
|
553
|
-
|
|
562
|
+
hasOwn: cells[0].hasOwn.set,
|
|
554
563
|
arrayFilter: cells[0].arrayFilter.set,
|
|
555
564
|
arrayForEach: cells[0].arrayForEach.set,
|
|
556
565
|
arrayIncludes: cells[0].arrayIncludes.set,
|
|
@@ -577,16 +586,14 @@ function observeImports(map, importName, importIndex) {
|
|
|
577
586
|
setForEach: cells[0].setForEach.set,
|
|
578
587
|
setHas: cells[0].setHas.set,
|
|
579
588
|
iterateSet: cells[0].iterateSet.set,
|
|
580
|
-
regexpTest: cells[0].regexpTest.set,
|
|
581
589
|
regexpExec: cells[0].regexpExec.set,
|
|
590
|
+
regexpReplace: cells[0].regexpReplace.set,
|
|
582
591
|
matchAllRegExp: cells[0].matchAllRegExp.set,
|
|
592
|
+
sealRegexp: cells[0].sealRegexp.set,
|
|
583
593
|
stringEndsWith: cells[0].stringEndsWith.set,
|
|
584
594
|
stringIncludes: cells[0].stringIncludes.set,
|
|
585
595
|
stringIndexOf: cells[0].stringIndexOf.set,
|
|
586
596
|
stringMatch: cells[0].stringMatch.set,
|
|
587
|
-
generatorNext: cells[0].generatorNext.set,
|
|
588
|
-
generatorThrow: cells[0].generatorThrow.set,
|
|
589
|
-
stringReplace: cells[0].stringReplace.set,
|
|
590
597
|
stringSearch: cells[0].stringSearch.set,
|
|
591
598
|
stringSlice: cells[0].stringSlice.set,
|
|
592
599
|
stringSplit: cells[0].stringSplit.set,
|
|
@@ -600,13 +607,14 @@ function observeImports(map, importName, importIndex) {
|
|
|
600
607
|
weaksetHas: cells[0].weaksetHas.set,
|
|
601
608
|
functionToString: cells[0].functionToString.set,
|
|
602
609
|
functionBind: cells[0].functionBind.set,
|
|
610
|
+
generatorNext: cells[0].generatorNext.set,
|
|
611
|
+
generatorThrow: cells[0].generatorThrow.set,
|
|
603
612
|
promiseAll: cells[0].promiseAll.set,
|
|
604
613
|
promiseCatch: cells[0].promiseCatch.set,
|
|
605
614
|
promiseThen: cells[0].promiseThen.set,
|
|
606
615
|
finalizationRegistryRegister: cells[0].finalizationRegistryRegister.set,
|
|
607
616
|
finalizationRegistryUnregister: cells[0].finalizationRegistryUnregister.set,
|
|
608
|
-
|
|
609
|
-
isObject: cells[0].isObject.set,
|
|
617
|
+
isPrimitive: cells[0].isPrimitive.set,
|
|
610
618
|
isError: cells[0].isError.set,
|
|
611
619
|
identity: cells[0].identity.set,
|
|
612
620
|
FERAL_EVAL: cells[0].FERAL_EVAL.set,
|
|
@@ -663,13 +671,14 @@ function observeImports(map, importName, importIndex) {
|
|
|
663
671
|
onceVar: {
|
|
664
672
|
isBufferImmutable: cells[4].isBufferImmutable.set,
|
|
665
673
|
sliceBufferToImmutable: cells[4].sliceBufferToImmutable.set,
|
|
674
|
+
optTransferBufferToImmutable: cells[4].optTransferBufferToImmutable.set,
|
|
666
675
|
},
|
|
667
676
|
importMeta: {},
|
|
668
677
|
});
|
|
669
678
|
functors[5]({
|
|
670
679
|
imports(entries) {
|
|
671
680
|
const map = new Map(entries);
|
|
672
|
-
observeImports(map, "./
|
|
681
|
+
observeImports(map, "./immutable-arraybuffer-pony.js", 4);
|
|
673
682
|
},
|
|
674
683
|
liveVar: {
|
|
675
684
|
},
|
|
@@ -680,24 +689,25 @@ function observeImports(map, importName, importIndex) {
|
|
|
680
689
|
functors[6]({
|
|
681
690
|
imports(entries) {
|
|
682
691
|
const map = new Map(entries);
|
|
683
|
-
observeImports(map, "
|
|
692
|
+
observeImports(map, "./src/immutable-arraybuffer-shim.js", 5);
|
|
684
693
|
},
|
|
685
694
|
liveVar: {
|
|
686
695
|
},
|
|
687
696
|
onceVar: {
|
|
688
|
-
an: cells[6].an.set,
|
|
689
|
-
bestEffortStringify: cells[6].bestEffortStringify.set,
|
|
690
|
-
enJoin: cells[6].enJoin.set,
|
|
691
697
|
},
|
|
692
698
|
importMeta: {},
|
|
693
699
|
});
|
|
694
700
|
functors[7]({
|
|
695
701
|
imports(entries) {
|
|
696
702
|
const map = new Map(entries);
|
|
703
|
+
observeImports(map, "../commons.js", 0);
|
|
697
704
|
},
|
|
698
705
|
liveVar: {
|
|
699
706
|
},
|
|
700
707
|
onceVar: {
|
|
708
|
+
an: cells[7].an.set,
|
|
709
|
+
bestEffortStringify: cells[7].bestEffortStringify.set,
|
|
710
|
+
enJoin: cells[7].enJoin.set,
|
|
701
711
|
},
|
|
702
712
|
importMeta: {},
|
|
703
713
|
});
|
|
@@ -718,71 +728,66 @@ function observeImports(map, importName, importIndex) {
|
|
|
718
728
|
liveVar: {
|
|
719
729
|
},
|
|
720
730
|
onceVar: {
|
|
721
|
-
makeLRUCacheMap: cells[9].makeLRUCacheMap.set,
|
|
722
731
|
},
|
|
723
732
|
importMeta: {},
|
|
724
733
|
});
|
|
725
734
|
functors[10]({
|
|
726
735
|
imports(entries) {
|
|
727
736
|
const map = new Map(entries);
|
|
728
|
-
observeImports(map, "../make-lru-cachemap.js", 9);
|
|
729
737
|
},
|
|
730
738
|
liveVar: {
|
|
731
739
|
},
|
|
732
740
|
onceVar: {
|
|
733
|
-
|
|
741
|
+
makeCacheMapKit: cells[10].makeCacheMapKit.set,
|
|
734
742
|
},
|
|
735
743
|
importMeta: {},
|
|
736
744
|
});
|
|
737
745
|
functors[11]({
|
|
738
746
|
imports(entries) {
|
|
739
747
|
const map = new Map(entries);
|
|
740
|
-
observeImports(map, "
|
|
741
|
-
observeImports(map, "./stringify-utils.js", 6);
|
|
742
|
-
observeImports(map, "./types.js", 7);
|
|
743
|
-
observeImports(map, "./internal-types.js", 8);
|
|
744
|
-
observeImports(map, "./note-log-args.js", 10);
|
|
748
|
+
observeImports(map, "./src/cachemap.js", 10);
|
|
745
749
|
},
|
|
746
750
|
liveVar: {
|
|
747
751
|
},
|
|
748
752
|
onceVar: {
|
|
749
|
-
quote: cells[11].q.set,
|
|
750
|
-
bare: cells[11].b.set,
|
|
751
|
-
redactedDetails: cells[11].X.set,
|
|
752
|
-
unredactedDetails: cells[11].unredactedDetails.set,
|
|
753
|
-
makeError: cells[11].makeError.set,
|
|
754
|
-
note: cells[11].annotateError.set,
|
|
755
|
-
loggedErrorHandler: cells[11].loggedErrorHandler.set,
|
|
756
|
-
makeAssert: cells[11].makeAssert.set,
|
|
757
|
-
assert: cells[11].assert.set,
|
|
758
|
-
assertEqual: cells[11].assertEqual.set,
|
|
759
|
-
sanitizeError: cells[11].sanitizeError.set,
|
|
760
753
|
},
|
|
761
754
|
importMeta: {},
|
|
762
755
|
});
|
|
763
756
|
functors[12]({
|
|
764
757
|
imports(entries) {
|
|
765
758
|
const map = new Map(entries);
|
|
766
|
-
observeImports(map, "
|
|
767
|
-
observeImports(map, "./error/assert.js", 11);
|
|
759
|
+
observeImports(map, "@endo/cache-map", 11);
|
|
768
760
|
},
|
|
769
761
|
liveVar: {
|
|
770
762
|
},
|
|
771
763
|
onceVar: {
|
|
772
|
-
|
|
773
|
-
makeHardener: cells[12].makeHardener.set,
|
|
764
|
+
makeNoteLogArgsArrayKit: cells[12].makeNoteLogArgsArrayKit.set,
|
|
774
765
|
},
|
|
775
766
|
importMeta: {},
|
|
776
767
|
});
|
|
777
768
|
functors[13]({
|
|
778
769
|
imports(entries) {
|
|
779
770
|
const map = new Map(entries);
|
|
780
|
-
observeImports(map, "
|
|
771
|
+
observeImports(map, "../commons.js", 0);
|
|
772
|
+
observeImports(map, "./stringify-utils.js", 7);
|
|
773
|
+
observeImports(map, "./types.js", 8);
|
|
774
|
+
observeImports(map, "./internal-types.js", 9);
|
|
775
|
+
observeImports(map, "./note-log-args.js", 12);
|
|
781
776
|
},
|
|
782
777
|
liveVar: {
|
|
783
778
|
},
|
|
784
779
|
onceVar: {
|
|
785
|
-
|
|
780
|
+
quote: cells[13].q.set,
|
|
781
|
+
bare: cells[13].b.set,
|
|
782
|
+
redactedDetails: cells[13].X.set,
|
|
783
|
+
unredactedDetails: cells[13].unredactedDetails.set,
|
|
784
|
+
makeError: cells[13].makeError.set,
|
|
785
|
+
note: cells[13].annotateError.set,
|
|
786
|
+
loggedErrorHandler: cells[13].loggedErrorHandler.set,
|
|
787
|
+
assert: cells[13].assert.set,
|
|
788
|
+
assertEqual: cells[13].assertEqual.set,
|
|
789
|
+
sanitizeError: cells[13].sanitizeError.set,
|
|
790
|
+
makeAssert: cells[13].makeAssert.set,
|
|
786
791
|
},
|
|
787
792
|
importMeta: {},
|
|
788
793
|
});
|
|
@@ -790,68 +795,70 @@ function observeImports(map, importName, importIndex) {
|
|
|
790
795
|
imports(entries) {
|
|
791
796
|
const map = new Map(entries);
|
|
792
797
|
observeImports(map, "./commons.js", 0);
|
|
798
|
+
observeImports(map, "./error/assert.js", 13);
|
|
793
799
|
},
|
|
794
800
|
liveVar: {
|
|
795
801
|
},
|
|
796
802
|
onceVar: {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
universalPropertyNames: cells[14].universalPropertyNames.set,
|
|
800
|
-
initialGlobalPropertyNames: cells[14].initialGlobalPropertyNames.set,
|
|
801
|
-
sharedGlobalPropertyNames: cells[14].sharedGlobalPropertyNames.set,
|
|
802
|
-
uniqueGlobalPropertyNames: cells[14].uniqueGlobalPropertyNames.set,
|
|
803
|
-
FunctionInstance: cells[14].FunctionInstance.set,
|
|
804
|
-
AsyncFunctionInstance: cells[14].AsyncFunctionInstance.set,
|
|
805
|
-
isAccessorPermit: cells[14].isAccessorPermit.set,
|
|
806
|
-
permitted: cells[14].permitted.set,
|
|
803
|
+
isTypedArray: cells[14].isTypedArray.set,
|
|
804
|
+
makeHardener: cells[14].makeHardener.set,
|
|
807
805
|
},
|
|
808
806
|
importMeta: {},
|
|
809
807
|
});
|
|
810
808
|
functors[15]({
|
|
811
809
|
imports(entries) {
|
|
812
810
|
const map = new Map(entries);
|
|
813
|
-
observeImports(map, "./cauterize-property.js", 13);
|
|
814
811
|
observeImports(map, "./commons.js", 0);
|
|
815
|
-
observeImports(map, "./permits.js", 14);
|
|
816
812
|
},
|
|
817
813
|
liveVar: {
|
|
818
814
|
},
|
|
819
815
|
onceVar: {
|
|
820
|
-
|
|
821
|
-
getGlobalIntrinsics: cells[15].getGlobalIntrinsics.set,
|
|
816
|
+
cauterizeProperty: cells[15].cauterizeProperty.set,
|
|
822
817
|
},
|
|
823
818
|
importMeta: {},
|
|
824
819
|
});
|
|
825
820
|
functors[16]({
|
|
826
821
|
imports(entries) {
|
|
827
822
|
const map = new Map(entries);
|
|
828
|
-
observeImports(map, "./permits.js", 14);
|
|
829
823
|
observeImports(map, "./commons.js", 0);
|
|
830
|
-
observeImports(map, "./cauterize-property.js", 13);
|
|
831
824
|
},
|
|
832
825
|
liveVar: {
|
|
833
826
|
},
|
|
834
827
|
onceVar: {
|
|
835
|
-
|
|
828
|
+
NativeErrors: cells[16].NativeErrors.set,
|
|
829
|
+
constantProperties: cells[16].constantProperties.set,
|
|
830
|
+
universalPropertyNames: cells[16].universalPropertyNames.set,
|
|
831
|
+
initialGlobalPropertyNames: cells[16].initialGlobalPropertyNames.set,
|
|
832
|
+
sharedGlobalPropertyNames: cells[16].sharedGlobalPropertyNames.set,
|
|
833
|
+
uniqueGlobalPropertyNames: cells[16].uniqueGlobalPropertyNames.set,
|
|
834
|
+
FunctionInstance: cells[16].FunctionInstance.set,
|
|
835
|
+
AsyncFunctionInstance: cells[16].AsyncFunctionInstance.set,
|
|
836
|
+
isAccessorPermit: cells[16].isAccessorPermit.set,
|
|
837
|
+
permitted: cells[16].permitted.set,
|
|
836
838
|
},
|
|
837
839
|
importMeta: {},
|
|
838
840
|
});
|
|
839
841
|
functors[17]({
|
|
840
842
|
imports(entries) {
|
|
841
843
|
const map = new Map(entries);
|
|
844
|
+
observeImports(map, "./cauterize-property.js", 15);
|
|
842
845
|
observeImports(map, "./commons.js", 0);
|
|
846
|
+
observeImports(map, "./permits.js", 16);
|
|
843
847
|
},
|
|
844
848
|
liveVar: {
|
|
845
849
|
},
|
|
846
850
|
onceVar: {
|
|
847
|
-
|
|
851
|
+
makeIntrinsicsCollector: cells[17].makeIntrinsicsCollector.set,
|
|
852
|
+
getGlobalIntrinsics: cells[17].getGlobalIntrinsics.set,
|
|
848
853
|
},
|
|
849
854
|
importMeta: {},
|
|
850
855
|
});
|
|
851
856
|
functors[18]({
|
|
852
857
|
imports(entries) {
|
|
853
858
|
const map = new Map(entries);
|
|
859
|
+
observeImports(map, "./permits.js", 16);
|
|
854
860
|
observeImports(map, "./commons.js", 0);
|
|
861
|
+
observeImports(map, "./cauterize-property.js", 15);
|
|
855
862
|
},
|
|
856
863
|
liveVar: {
|
|
857
864
|
},
|
|
@@ -892,9 +899,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
892
899
|
liveVar: {
|
|
893
900
|
},
|
|
894
901
|
onceVar: {
|
|
895
|
-
|
|
896
|
-
moderateEnablements: cells[21].moderateEnablements.set,
|
|
897
|
-
severeEnablements: cells[21].severeEnablements.set,
|
|
902
|
+
default: cells[21].default.set,
|
|
898
903
|
},
|
|
899
904
|
importMeta: {},
|
|
900
905
|
});
|
|
@@ -902,7 +907,6 @@ function observeImports(map, importName, importIndex) {
|
|
|
902
907
|
imports(entries) {
|
|
903
908
|
const map = new Map(entries);
|
|
904
909
|
observeImports(map, "./commons.js", 0);
|
|
905
|
-
observeImports(map, "./enablements.js", 21);
|
|
906
910
|
},
|
|
907
911
|
liveVar: {
|
|
908
912
|
},
|
|
@@ -915,23 +919,26 @@ function observeImports(map, importName, importIndex) {
|
|
|
915
919
|
imports(entries) {
|
|
916
920
|
const map = new Map(entries);
|
|
917
921
|
observeImports(map, "./commons.js", 0);
|
|
918
|
-
observeImports(map, "./error/assert.js", 11);
|
|
919
922
|
},
|
|
920
923
|
liveVar: {
|
|
921
924
|
},
|
|
922
925
|
onceVar: {
|
|
923
|
-
|
|
926
|
+
minEnablements: cells[23].minEnablements.set,
|
|
927
|
+
moderateEnablements: cells[23].moderateEnablements.set,
|
|
928
|
+
severeEnablements: cells[23].severeEnablements.set,
|
|
924
929
|
},
|
|
925
930
|
importMeta: {},
|
|
926
931
|
});
|
|
927
932
|
functors[24]({
|
|
928
933
|
imports(entries) {
|
|
929
934
|
const map = new Map(entries);
|
|
935
|
+
observeImports(map, "./commons.js", 0);
|
|
936
|
+
observeImports(map, "./enablements.js", 23);
|
|
930
937
|
},
|
|
931
938
|
liveVar: {
|
|
932
939
|
},
|
|
933
940
|
onceVar: {
|
|
934
|
-
|
|
941
|
+
default: cells[24].default.set,
|
|
935
942
|
},
|
|
936
943
|
importMeta: {},
|
|
937
944
|
});
|
|
@@ -939,30 +946,23 @@ function observeImports(map, importName, importIndex) {
|
|
|
939
946
|
imports(entries) {
|
|
940
947
|
const map = new Map(entries);
|
|
941
948
|
observeImports(map, "./commons.js", 0);
|
|
942
|
-
observeImports(map, "./error/assert.js",
|
|
949
|
+
observeImports(map, "./error/assert.js", 13);
|
|
943
950
|
},
|
|
944
951
|
liveVar: {
|
|
945
952
|
},
|
|
946
953
|
onceVar: {
|
|
947
|
-
|
|
954
|
+
default: cells[25].default.set,
|
|
948
955
|
},
|
|
949
956
|
importMeta: {},
|
|
950
957
|
});
|
|
951
958
|
functors[26]({
|
|
952
959
|
imports(entries) {
|
|
953
960
|
const map = new Map(entries);
|
|
954
|
-
observeImports(map, "./commons.js", 0);
|
|
955
|
-
observeImports(map, "./make-eval-function.js", 24);
|
|
956
|
-
observeImports(map, "./make-function-constructor.js", 25);
|
|
957
|
-
observeImports(map, "./permits.js", 14);
|
|
958
961
|
},
|
|
959
962
|
liveVar: {
|
|
960
963
|
},
|
|
961
964
|
onceVar: {
|
|
962
|
-
|
|
963
|
-
setGlobalObjectConstantProperties: cells[26].setGlobalObjectConstantProperties.set,
|
|
964
|
-
setGlobalObjectMutableProperties: cells[26].setGlobalObjectMutableProperties.set,
|
|
965
|
-
setGlobalObjectEvaluators: cells[26].setGlobalObjectEvaluators.set,
|
|
965
|
+
makeEvalFunction: cells[26].makeEvalFunction.set,
|
|
966
966
|
},
|
|
967
967
|
importMeta: {},
|
|
968
968
|
});
|
|
@@ -970,14 +970,12 @@ function observeImports(map, importName, importIndex) {
|
|
|
970
970
|
imports(entries) {
|
|
971
971
|
const map = new Map(entries);
|
|
972
972
|
observeImports(map, "./commons.js", 0);
|
|
973
|
-
observeImports(map, "./error/assert.js",
|
|
973
|
+
observeImports(map, "./error/assert.js", 13);
|
|
974
974
|
},
|
|
975
975
|
liveVar: {
|
|
976
976
|
},
|
|
977
977
|
onceVar: {
|
|
978
|
-
|
|
979
|
-
strictScopeTerminatorHandler: cells[27].strictScopeTerminatorHandler.set,
|
|
980
|
-
strictScopeTerminator: cells[27].strictScopeTerminator.set,
|
|
978
|
+
makeFunctionConstructor: cells[27].makeFunctionConstructor.set,
|
|
981
979
|
},
|
|
982
980
|
importMeta: {},
|
|
983
981
|
});
|
|
@@ -985,12 +983,17 @@ function observeImports(map, importName, importIndex) {
|
|
|
985
983
|
imports(entries) {
|
|
986
984
|
const map = new Map(entries);
|
|
987
985
|
observeImports(map, "./commons.js", 0);
|
|
988
|
-
observeImports(map, "./
|
|
986
|
+
observeImports(map, "./make-eval-function.js", 26);
|
|
987
|
+
observeImports(map, "./make-function-constructor.js", 27);
|
|
988
|
+
observeImports(map, "./permits.js", 16);
|
|
989
989
|
},
|
|
990
990
|
liveVar: {
|
|
991
991
|
},
|
|
992
992
|
onceVar: {
|
|
993
|
-
|
|
993
|
+
setGlobalObjectSymbolUnscopables: cells[28].setGlobalObjectSymbolUnscopables.set,
|
|
994
|
+
setGlobalObjectConstantProperties: cells[28].setGlobalObjectConstantProperties.set,
|
|
995
|
+
setGlobalObjectMutableProperties: cells[28].setGlobalObjectMutableProperties.set,
|
|
996
|
+
setGlobalObjectEvaluators: cells[28].setGlobalObjectEvaluators.set,
|
|
994
997
|
},
|
|
995
998
|
importMeta: {},
|
|
996
999
|
});
|
|
@@ -998,12 +1001,14 @@ function observeImports(map, importName, importIndex) {
|
|
|
998
1001
|
imports(entries) {
|
|
999
1002
|
const map = new Map(entries);
|
|
1000
1003
|
observeImports(map, "./commons.js", 0);
|
|
1001
|
-
observeImports(map, "./error/assert.js",
|
|
1004
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1002
1005
|
},
|
|
1003
1006
|
liveVar: {
|
|
1004
1007
|
},
|
|
1005
1008
|
onceVar: {
|
|
1006
|
-
|
|
1009
|
+
alwaysThrowHandler: cells[29].alwaysThrowHandler.set,
|
|
1010
|
+
strictScopeTerminatorHandler: cells[29].strictScopeTerminatorHandler.set,
|
|
1011
|
+
strictScopeTerminator: cells[29].strictScopeTerminator.set,
|
|
1007
1012
|
},
|
|
1008
1013
|
importMeta: {},
|
|
1009
1014
|
});
|
|
@@ -1011,11 +1016,12 @@ function observeImports(map, importName, importIndex) {
|
|
|
1011
1016
|
imports(entries) {
|
|
1012
1017
|
const map = new Map(entries);
|
|
1013
1018
|
observeImports(map, "./commons.js", 0);
|
|
1019
|
+
observeImports(map, "./strict-scope-terminator.js", 29);
|
|
1014
1020
|
},
|
|
1015
1021
|
liveVar: {
|
|
1016
1022
|
},
|
|
1017
1023
|
onceVar: {
|
|
1018
|
-
|
|
1024
|
+
createSloppyGlobalsScopeTerminator: cells[30].createSloppyGlobalsScopeTerminator.set,
|
|
1019
1025
|
},
|
|
1020
1026
|
importMeta: {},
|
|
1021
1027
|
});
|
|
@@ -1023,19 +1029,12 @@ function observeImports(map, importName, importIndex) {
|
|
|
1023
1029
|
imports(entries) {
|
|
1024
1030
|
const map = new Map(entries);
|
|
1025
1031
|
observeImports(map, "./commons.js", 0);
|
|
1026
|
-
observeImports(map, "./
|
|
1032
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1027
1033
|
},
|
|
1028
1034
|
liveVar: {
|
|
1029
1035
|
},
|
|
1030
1036
|
onceVar: {
|
|
1031
|
-
|
|
1032
|
-
evadeHtmlCommentTest: cells[31].evadeHtmlCommentTest.set,
|
|
1033
|
-
rejectImportExpressions: cells[31].rejectImportExpressions.set,
|
|
1034
|
-
evadeImportExpressionTest: cells[31].evadeImportExpressionTest.set,
|
|
1035
|
-
rejectSomeDirectEvalExpressions: cells[31].rejectSomeDirectEvalExpressions.set,
|
|
1036
|
-
mandatoryTransforms: cells[31].mandatoryTransforms.set,
|
|
1037
|
-
applyTransforms: cells[31].applyTransforms.set,
|
|
1038
|
-
transforms: cells[31].transforms.set,
|
|
1037
|
+
makeEvalScopeKit: cells[31].makeEvalScopeKit.set,
|
|
1039
1038
|
},
|
|
1040
1039
|
importMeta: {},
|
|
1041
1040
|
});
|
|
@@ -1047,8 +1046,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
1047
1046
|
liveVar: {
|
|
1048
1047
|
},
|
|
1049
1048
|
onceVar: {
|
|
1050
|
-
|
|
1051
|
-
getScopeConstants: cells[32].getScopeConstants.set,
|
|
1049
|
+
getSourceURL: cells[32].getSourceURL.set,
|
|
1052
1050
|
},
|
|
1053
1051
|
importMeta: {},
|
|
1054
1052
|
});
|
|
@@ -1056,12 +1054,19 @@ function observeImports(map, importName, importIndex) {
|
|
|
1056
1054
|
imports(entries) {
|
|
1057
1055
|
const map = new Map(entries);
|
|
1058
1056
|
observeImports(map, "./commons.js", 0);
|
|
1059
|
-
observeImports(map, "./
|
|
1057
|
+
observeImports(map, "./get-source-url.js", 32);
|
|
1060
1058
|
},
|
|
1061
1059
|
liveVar: {
|
|
1062
1060
|
},
|
|
1063
1061
|
onceVar: {
|
|
1064
|
-
|
|
1062
|
+
rejectHtmlComments: cells[33].rejectHtmlComments.set,
|
|
1063
|
+
evadeHtmlCommentTest: cells[33].evadeHtmlCommentTest.set,
|
|
1064
|
+
rejectImportExpressions: cells[33].rejectImportExpressions.set,
|
|
1065
|
+
evadeImportExpressionTest: cells[33].evadeImportExpressionTest.set,
|
|
1066
|
+
rejectSomeDirectEvalExpressions: cells[33].rejectSomeDirectEvalExpressions.set,
|
|
1067
|
+
mandatoryTransforms: cells[33].mandatoryTransforms.set,
|
|
1068
|
+
applyTransforms: cells[33].applyTransforms.set,
|
|
1069
|
+
transforms: cells[33].transforms.set,
|
|
1065
1070
|
},
|
|
1066
1071
|
importMeta: {},
|
|
1067
1072
|
});
|
|
@@ -1069,17 +1074,12 @@ function observeImports(map, importName, importIndex) {
|
|
|
1069
1074
|
imports(entries) {
|
|
1070
1075
|
const map = new Map(entries);
|
|
1071
1076
|
observeImports(map, "./commons.js", 0);
|
|
1072
|
-
observeImports(map, "./strict-scope-terminator.js", 27);
|
|
1073
|
-
observeImports(map, "./sloppy-globals-scope-terminator.js", 28);
|
|
1074
|
-
observeImports(map, "./eval-scope.js", 29);
|
|
1075
|
-
observeImports(map, "./transforms.js", 31);
|
|
1076
|
-
observeImports(map, "./make-evaluate.js", 33);
|
|
1077
|
-
observeImports(map, "./error/assert.js", 11);
|
|
1078
1077
|
},
|
|
1079
1078
|
liveVar: {
|
|
1080
1079
|
},
|
|
1081
1080
|
onceVar: {
|
|
1082
|
-
|
|
1081
|
+
isValidIdentifierName: cells[34].isValidIdentifierName.set,
|
|
1082
|
+
getScopeConstants: cells[34].getScopeConstants.set,
|
|
1083
1083
|
},
|
|
1084
1084
|
importMeta: {},
|
|
1085
1085
|
});
|
|
@@ -1087,11 +1087,12 @@ function observeImports(map, importName, importIndex) {
|
|
|
1087
1087
|
imports(entries) {
|
|
1088
1088
|
const map = new Map(entries);
|
|
1089
1089
|
observeImports(map, "./commons.js", 0);
|
|
1090
|
+
observeImports(map, "./scope-constants.js", 34);
|
|
1090
1091
|
},
|
|
1091
1092
|
liveVar: {
|
|
1092
1093
|
},
|
|
1093
1094
|
onceVar: {
|
|
1094
|
-
|
|
1095
|
+
makeEvaluate: cells[35].makeEvaluate.set,
|
|
1095
1096
|
},
|
|
1096
1097
|
importMeta: {},
|
|
1097
1098
|
});
|
|
@@ -1099,11 +1100,17 @@ function observeImports(map, importName, importIndex) {
|
|
|
1099
1100
|
imports(entries) {
|
|
1100
1101
|
const map = new Map(entries);
|
|
1101
1102
|
observeImports(map, "./commons.js", 0);
|
|
1103
|
+
observeImports(map, "./strict-scope-terminator.js", 29);
|
|
1104
|
+
observeImports(map, "./sloppy-globals-scope-terminator.js", 30);
|
|
1105
|
+
observeImports(map, "./eval-scope.js", 31);
|
|
1106
|
+
observeImports(map, "./transforms.js", 33);
|
|
1107
|
+
observeImports(map, "./make-evaluate.js", 35);
|
|
1108
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1102
1109
|
},
|
|
1103
1110
|
liveVar: {
|
|
1104
1111
|
},
|
|
1105
1112
|
onceVar: {
|
|
1106
|
-
|
|
1113
|
+
makeSafeEvaluator: cells[36].makeSafeEvaluator.set,
|
|
1107
1114
|
},
|
|
1108
1115
|
importMeta: {},
|
|
1109
1116
|
});
|
|
@@ -1115,37 +1122,31 @@ function observeImports(map, importName, importIndex) {
|
|
|
1115
1122
|
liveVar: {
|
|
1116
1123
|
},
|
|
1117
1124
|
onceVar: {
|
|
1118
|
-
|
|
1125
|
+
tameFunctionToString: cells[37].tameFunctionToString.set,
|
|
1119
1126
|
},
|
|
1120
1127
|
importMeta: {},
|
|
1121
1128
|
});
|
|
1122
1129
|
functors[38]({
|
|
1123
1130
|
imports(entries) {
|
|
1124
1131
|
const map = new Map(entries);
|
|
1125
|
-
observeImports(map, "
|
|
1132
|
+
observeImports(map, "./commons.js", 0);
|
|
1126
1133
|
},
|
|
1127
1134
|
liveVar: {
|
|
1128
1135
|
},
|
|
1129
1136
|
onceVar: {
|
|
1130
|
-
|
|
1131
|
-
consoleOtherMethods: cells[38].consoleOtherMethods.set,
|
|
1132
|
-
makeLoggingConsoleKit: cells[38].makeLoggingConsoleKit.set,
|
|
1133
|
-
pumpLogToConsole: cells[38].pumpLogToConsole.set,
|
|
1134
|
-
makeCausalConsole: cells[38].makeCausalConsole.set,
|
|
1135
|
-
defineCausalConsoleFromLogger: cells[38].defineCausalConsoleFromLogger.set,
|
|
1136
|
-
filterConsole: cells[38].filterConsole.set,
|
|
1137
|
+
tameDomains: cells[38].tameDomains.set,
|
|
1137
1138
|
},
|
|
1138
1139
|
importMeta: {},
|
|
1139
1140
|
});
|
|
1140
1141
|
functors[39]({
|
|
1141
1142
|
imports(entries) {
|
|
1142
1143
|
const map = new Map(entries);
|
|
1143
|
-
observeImports(map, "
|
|
1144
|
+
observeImports(map, "./commons.js", 0);
|
|
1144
1145
|
},
|
|
1145
1146
|
liveVar: {
|
|
1146
1147
|
},
|
|
1147
1148
|
onceVar: {
|
|
1148
|
-
|
|
1149
|
+
tameModuleSource: cells[39].tameModuleSource.set,
|
|
1149
1150
|
},
|
|
1150
1151
|
importMeta: {},
|
|
1151
1152
|
});
|
|
@@ -1153,14 +1154,17 @@ function observeImports(map, importName, importIndex) {
|
|
|
1153
1154
|
imports(entries) {
|
|
1154
1155
|
const map = new Map(entries);
|
|
1155
1156
|
observeImports(map, "../commons.js", 0);
|
|
1156
|
-
observeImports(map, "./assert.js", 11);
|
|
1157
|
-
observeImports(map, "./console.js", 38);
|
|
1158
|
-
observeImports(map, "./unhandled-rejection.js", 39);
|
|
1159
1157
|
},
|
|
1160
1158
|
liveVar: {
|
|
1161
1159
|
},
|
|
1162
1160
|
onceVar: {
|
|
1163
|
-
|
|
1161
|
+
consoleLevelMethods: cells[40].consoleLevelMethods.set,
|
|
1162
|
+
consoleOtherMethods: cells[40].consoleOtherMethods.set,
|
|
1163
|
+
makeLoggingConsoleKit: cells[40].makeLoggingConsoleKit.set,
|
|
1164
|
+
pumpLogToConsole: cells[40].pumpLogToConsole.set,
|
|
1165
|
+
makeCausalConsole: cells[40].makeCausalConsole.set,
|
|
1166
|
+
defineCausalConsoleFromLogger: cells[40].defineCausalConsoleFromLogger.set,
|
|
1167
|
+
filterConsole: cells[40].filterConsole.set,
|
|
1164
1168
|
},
|
|
1165
1169
|
importMeta: {},
|
|
1166
1170
|
});
|
|
@@ -1172,9 +1176,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
1172
1176
|
liveVar: {
|
|
1173
1177
|
},
|
|
1174
1178
|
onceVar: {
|
|
1175
|
-
|
|
1176
|
-
shortenCallSiteString: cells[41].shortenCallSiteString.set,
|
|
1177
|
-
tameV8ErrorConstructor: cells[41].tameV8ErrorConstructor.set,
|
|
1179
|
+
makeRejectionHandlers: cells[41].makeRejectionHandlers.set,
|
|
1178
1180
|
},
|
|
1179
1181
|
importMeta: {},
|
|
1180
1182
|
});
|
|
@@ -1182,126 +1184,119 @@ function observeImports(map, importName, importIndex) {
|
|
|
1182
1184
|
imports(entries) {
|
|
1183
1185
|
const map = new Map(entries);
|
|
1184
1186
|
observeImports(map, "../commons.js", 0);
|
|
1185
|
-
observeImports(map, "
|
|
1186
|
-
observeImports(map, "./
|
|
1187
|
+
observeImports(map, "./assert.js", 13);
|
|
1188
|
+
observeImports(map, "./console.js", 40);
|
|
1189
|
+
observeImports(map, "./unhandled-rejection.js", 41);
|
|
1187
1190
|
},
|
|
1188
1191
|
liveVar: {
|
|
1189
1192
|
},
|
|
1190
1193
|
onceVar: {
|
|
1191
|
-
|
|
1194
|
+
tameConsole: cells[42].tameConsole.set,
|
|
1192
1195
|
},
|
|
1193
1196
|
importMeta: {},
|
|
1194
1197
|
});
|
|
1195
1198
|
functors[43]({
|
|
1196
1199
|
imports(entries) {
|
|
1197
1200
|
const map = new Map(entries);
|
|
1198
|
-
observeImports(map, "
|
|
1199
|
-
observeImports(map, "./commons.js", 0);
|
|
1200
|
-
observeImports(map, "./error/assert.js", 11);
|
|
1201
|
+
observeImports(map, "../commons.js", 0);
|
|
1201
1202
|
},
|
|
1202
1203
|
liveVar: {
|
|
1203
1204
|
},
|
|
1204
1205
|
onceVar: {
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1206
|
+
filterFileName: cells[43].filterFileName.set,
|
|
1207
|
+
shortenCallSiteString: cells[43].shortenCallSiteString.set,
|
|
1208
|
+
tameV8ErrorConstructor: cells[43].tameV8ErrorConstructor.set,
|
|
1208
1209
|
},
|
|
1209
1210
|
importMeta: {},
|
|
1210
1211
|
});
|
|
1211
1212
|
functors[44]({
|
|
1212
1213
|
imports(entries) {
|
|
1213
1214
|
const map = new Map(entries);
|
|
1214
|
-
observeImports(map, "
|
|
1215
|
-
observeImports(map, "
|
|
1216
|
-
observeImports(map, "./error
|
|
1215
|
+
observeImports(map, "../commons.js", 0);
|
|
1216
|
+
observeImports(map, "../permits.js", 16);
|
|
1217
|
+
observeImports(map, "./tame-v8-error-constructor.js", 43);
|
|
1217
1218
|
},
|
|
1218
1219
|
liveVar: {
|
|
1219
1220
|
},
|
|
1220
1221
|
onceVar: {
|
|
1221
|
-
|
|
1222
|
-
getDeferredExports: cells[44].getDeferredExports.set,
|
|
1222
|
+
default: cells[44].default.set,
|
|
1223
1223
|
},
|
|
1224
1224
|
importMeta: {},
|
|
1225
1225
|
});
|
|
1226
1226
|
functors[45]({
|
|
1227
1227
|
imports(entries) {
|
|
1228
1228
|
const map = new Map(entries);
|
|
1229
|
+
observeImports(map, "@endo/env-options", 3);
|
|
1229
1230
|
observeImports(map, "./commons.js", 0);
|
|
1230
|
-
observeImports(map, "./
|
|
1231
|
-
observeImports(map, "./make-safe-evaluator.js", 34);
|
|
1231
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1232
1232
|
},
|
|
1233
1233
|
liveVar: {
|
|
1234
1234
|
},
|
|
1235
1235
|
onceVar: {
|
|
1236
|
-
|
|
1237
|
-
|
|
1236
|
+
makeAlias: cells[45].makeAlias.set,
|
|
1237
|
+
load: cells[45].load.set,
|
|
1238
|
+
loadNow: cells[45].loadNow.set,
|
|
1238
1239
|
},
|
|
1239
1240
|
importMeta: {},
|
|
1240
1241
|
});
|
|
1241
1242
|
functors[46]({
|
|
1242
1243
|
imports(entries) {
|
|
1243
1244
|
const map = new Map(entries);
|
|
1244
|
-
observeImports(map, "./
|
|
1245
|
-
observeImports(map, "./module-proxy.js", 44);
|
|
1245
|
+
observeImports(map, "./module-load.js", 45);
|
|
1246
1246
|
observeImports(map, "./commons.js", 0);
|
|
1247
|
-
observeImports(map, "./
|
|
1247
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1248
1248
|
},
|
|
1249
1249
|
liveVar: {
|
|
1250
1250
|
},
|
|
1251
1251
|
onceVar: {
|
|
1252
|
-
|
|
1253
|
-
|
|
1252
|
+
deferExports: cells[46].deferExports.set,
|
|
1253
|
+
getDeferredExports: cells[46].getDeferredExports.set,
|
|
1254
1254
|
},
|
|
1255
1255
|
importMeta: {},
|
|
1256
1256
|
});
|
|
1257
1257
|
functors[47]({
|
|
1258
1258
|
imports(entries) {
|
|
1259
1259
|
const map = new Map(entries);
|
|
1260
|
-
observeImports(map, "./error/assert.js", 11);
|
|
1261
|
-
observeImports(map, "./module-instance.js", 46);
|
|
1262
1260
|
observeImports(map, "./commons.js", 0);
|
|
1261
|
+
observeImports(map, "./transforms.js", 33);
|
|
1262
|
+
observeImports(map, "./make-safe-evaluator.js", 36);
|
|
1263
1263
|
},
|
|
1264
1264
|
liveVar: {
|
|
1265
1265
|
},
|
|
1266
1266
|
onceVar: {
|
|
1267
|
-
|
|
1268
|
-
|
|
1267
|
+
provideCompartmentEvaluator: cells[47].provideCompartmentEvaluator.set,
|
|
1268
|
+
compartmentEvaluate: cells[47].compartmentEvaluate.set,
|
|
1269
1269
|
},
|
|
1270
1270
|
importMeta: {},
|
|
1271
1271
|
});
|
|
1272
1272
|
functors[48]({
|
|
1273
1273
|
imports(entries) {
|
|
1274
1274
|
const map = new Map(entries);
|
|
1275
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1276
|
+
observeImports(map, "./module-proxy.js", 46);
|
|
1275
1277
|
observeImports(map, "./commons.js", 0);
|
|
1276
|
-
observeImports(map, "./
|
|
1277
|
-
observeImports(map, "./error/assert.js", 11);
|
|
1278
|
-
observeImports(map, "./permits.js", 14);
|
|
1279
|
-
observeImports(map, "./module-load.js", 43);
|
|
1280
|
-
observeImports(map, "./module-link.js", 47);
|
|
1281
|
-
observeImports(map, "./module-proxy.js", 44);
|
|
1282
|
-
observeImports(map, "./compartment-evaluate.js", 45);
|
|
1283
|
-
observeImports(map, "./make-safe-evaluator.js", 34);
|
|
1278
|
+
observeImports(map, "./compartment-evaluate.js", 47);
|
|
1284
1279
|
},
|
|
1285
1280
|
liveVar: {
|
|
1286
1281
|
},
|
|
1287
1282
|
onceVar: {
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
compartmentOptions: cells[48].compartmentOptions.set,
|
|
1291
|
-
makeCompartmentConstructor: cells[48].makeCompartmentConstructor.set,
|
|
1283
|
+
makeVirtualModuleInstance: cells[48].makeVirtualModuleInstance.set,
|
|
1284
|
+
makeModuleInstance: cells[48].makeModuleInstance.set,
|
|
1292
1285
|
},
|
|
1293
1286
|
importMeta: {},
|
|
1294
1287
|
});
|
|
1295
1288
|
functors[49]({
|
|
1296
1289
|
imports(entries) {
|
|
1297
1290
|
const map = new Map(entries);
|
|
1291
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1292
|
+
observeImports(map, "./module-instance.js", 48);
|
|
1298
1293
|
observeImports(map, "./commons.js", 0);
|
|
1299
|
-
observeImports(map, "./compartment.js", 48);
|
|
1300
1294
|
},
|
|
1301
1295
|
liveVar: {
|
|
1302
1296
|
},
|
|
1303
1297
|
onceVar: {
|
|
1304
|
-
|
|
1298
|
+
link: cells[49].link.set,
|
|
1299
|
+
instantiate: cells[49].instantiate.set,
|
|
1305
1300
|
},
|
|
1306
1301
|
importMeta: {},
|
|
1307
1302
|
});
|
|
@@ -1309,11 +1304,22 @@ function observeImports(map, importName, importIndex) {
|
|
|
1309
1304
|
imports(entries) {
|
|
1310
1305
|
const map = new Map(entries);
|
|
1311
1306
|
observeImports(map, "./commons.js", 0);
|
|
1307
|
+
observeImports(map, "./global-object.js", 28);
|
|
1308
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1309
|
+
observeImports(map, "./permits.js", 16);
|
|
1310
|
+
observeImports(map, "./module-load.js", 45);
|
|
1311
|
+
observeImports(map, "./module-link.js", 49);
|
|
1312
|
+
observeImports(map, "./module-proxy.js", 46);
|
|
1313
|
+
observeImports(map, "./compartment-evaluate.js", 47);
|
|
1314
|
+
observeImports(map, "./make-safe-evaluator.js", 36);
|
|
1312
1315
|
},
|
|
1313
1316
|
liveVar: {
|
|
1314
1317
|
},
|
|
1315
1318
|
onceVar: {
|
|
1316
|
-
|
|
1319
|
+
InertCompartment: cells[50].InertCompartment.set,
|
|
1320
|
+
CompartmentPrototype: cells[50].CompartmentPrototype.set,
|
|
1321
|
+
compartmentOptions: cells[50].compartmentOptions.set,
|
|
1322
|
+
makeCompartmentConstructor: cells[50].makeCompartmentConstructor.set,
|
|
1317
1323
|
},
|
|
1318
1324
|
importMeta: {},
|
|
1319
1325
|
});
|
|
@@ -1321,11 +1327,12 @@ function observeImports(map, importName, importIndex) {
|
|
|
1321
1327
|
imports(entries) {
|
|
1322
1328
|
const map = new Map(entries);
|
|
1323
1329
|
observeImports(map, "./commons.js", 0);
|
|
1330
|
+
observeImports(map, "./compartment.js", 50);
|
|
1324
1331
|
},
|
|
1325
1332
|
liveVar: {
|
|
1326
1333
|
},
|
|
1327
1334
|
onceVar: {
|
|
1328
|
-
|
|
1335
|
+
getAnonymousIntrinsics: cells[51].getAnonymousIntrinsics.set,
|
|
1329
1336
|
},
|
|
1330
1337
|
importMeta: {},
|
|
1331
1338
|
});
|
|
@@ -1337,8 +1344,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
1337
1344
|
liveVar: {
|
|
1338
1345
|
},
|
|
1339
1346
|
onceVar: {
|
|
1340
|
-
|
|
1341
|
-
tameFauxDataProperties: cells[52].tameFauxDataProperties.set,
|
|
1347
|
+
tameHarden: cells[52].tameHarden.set,
|
|
1342
1348
|
},
|
|
1343
1349
|
importMeta: {},
|
|
1344
1350
|
});
|
|
@@ -1350,7 +1356,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
1350
1356
|
liveVar: {
|
|
1351
1357
|
},
|
|
1352
1358
|
onceVar: {
|
|
1353
|
-
|
|
1359
|
+
tameSymbolConstructor: cells[53].tameSymbolConstructor.set,
|
|
1354
1360
|
},
|
|
1355
1361
|
importMeta: {},
|
|
1356
1362
|
});
|
|
@@ -1362,7 +1368,8 @@ function observeImports(map, importName, importIndex) {
|
|
|
1362
1368
|
liveVar: {
|
|
1363
1369
|
},
|
|
1364
1370
|
onceVar: {
|
|
1365
|
-
|
|
1371
|
+
tameFauxDataProperty: cells[54].tameFauxDataProperty.set,
|
|
1372
|
+
tameFauxDataProperties: cells[54].tameFauxDataProperties.set,
|
|
1366
1373
|
},
|
|
1367
1374
|
importMeta: {},
|
|
1368
1375
|
});
|
|
@@ -1370,89 +1377,86 @@ function observeImports(map, importName, importIndex) {
|
|
|
1370
1377
|
imports(entries) {
|
|
1371
1378
|
const map = new Map(entries);
|
|
1372
1379
|
observeImports(map, "./commons.js", 0);
|
|
1373
|
-
observeImports(map, "./error/assert.js", 11);
|
|
1374
1380
|
},
|
|
1375
1381
|
liveVar: {
|
|
1376
1382
|
},
|
|
1377
1383
|
onceVar: {
|
|
1378
|
-
|
|
1379
|
-
reportInGroup: cells[55].reportInGroup.set,
|
|
1384
|
+
tameRegeneratorRuntime: cells[55].tameRegeneratorRuntime.set,
|
|
1380
1385
|
},
|
|
1381
1386
|
importMeta: {},
|
|
1382
1387
|
});
|
|
1383
1388
|
functors[56]({
|
|
1384
1389
|
imports(entries) {
|
|
1385
1390
|
const map = new Map(entries);
|
|
1386
|
-
observeImports(map, "@endo/env-options", 3);
|
|
1387
|
-
observeImports(map, "@endo/immutable-arraybuffer/shim-hermes.js", 5);
|
|
1388
1391
|
observeImports(map, "./commons.js", 0);
|
|
1389
|
-
observeImports(map, "./make-hardener.js", 12);
|
|
1390
|
-
observeImports(map, "./intrinsics.js", 15);
|
|
1391
|
-
observeImports(map, "./permits-intrinsics.js", 16);
|
|
1392
|
-
observeImports(map, "./tame-function-constructors.js", 17);
|
|
1393
|
-
observeImports(map, "./tame-date-constructor.js", 18);
|
|
1394
|
-
observeImports(map, "./tame-math-object.js", 19);
|
|
1395
|
-
observeImports(map, "./tame-regexp-constructor.js", 20);
|
|
1396
|
-
observeImports(map, "./enable-property-overrides.js", 22);
|
|
1397
|
-
observeImports(map, "./tame-locale-methods.js", 23);
|
|
1398
|
-
observeImports(map, "./global-object.js", 26);
|
|
1399
|
-
observeImports(map, "./make-safe-evaluator.js", 34);
|
|
1400
|
-
observeImports(map, "./permits.js", 14);
|
|
1401
|
-
observeImports(map, "./tame-function-tostring.js", 35);
|
|
1402
|
-
observeImports(map, "./tame-domains.js", 36);
|
|
1403
|
-
observeImports(map, "./tame-module-source.js", 37);
|
|
1404
|
-
observeImports(map, "./error/tame-console.js", 40);
|
|
1405
|
-
observeImports(map, "./error/tame-error-constructor.js", 42);
|
|
1406
|
-
observeImports(map, "./error/assert.js", 11);
|
|
1407
|
-
observeImports(map, "./get-anonymous-intrinsics.js", 49);
|
|
1408
|
-
observeImports(map, "./compartment.js", 48);
|
|
1409
|
-
observeImports(map, "./tame-harden.js", 50);
|
|
1410
|
-
observeImports(map, "./tame-symbol-constructor.js", 51);
|
|
1411
|
-
observeImports(map, "./tame-faux-data-properties.js", 52);
|
|
1412
|
-
observeImports(map, "./tame-regenerator-runtime.js", 53);
|
|
1413
|
-
observeImports(map, "./shim-arraybuffer-transfer.js", 54);
|
|
1414
|
-
observeImports(map, "./reporting.js", 55);
|
|
1415
1392
|
},
|
|
1416
1393
|
liveVar: {
|
|
1417
1394
|
},
|
|
1418
1395
|
onceVar: {
|
|
1419
|
-
|
|
1396
|
+
shimArrayBufferTransfer: cells[56].shimArrayBufferTransfer.set,
|
|
1420
1397
|
},
|
|
1421
1398
|
importMeta: {},
|
|
1422
1399
|
});
|
|
1423
1400
|
functors[57]({
|
|
1424
1401
|
imports(entries) {
|
|
1425
1402
|
const map = new Map(entries);
|
|
1426
|
-
observeImports(map, "./assert-sloppy-mode.js", 1);
|
|
1427
1403
|
observeImports(map, "./commons.js", 0);
|
|
1428
|
-
observeImports(map, "./
|
|
1404
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1429
1405
|
},
|
|
1430
1406
|
liveVar: {
|
|
1431
1407
|
},
|
|
1432
1408
|
onceVar: {
|
|
1409
|
+
chooseReporter: cells[57].chooseReporter.set,
|
|
1410
|
+
reportInGroup: cells[57].reportInGroup.set,
|
|
1433
1411
|
},
|
|
1434
1412
|
importMeta: {},
|
|
1435
1413
|
});
|
|
1436
1414
|
functors[58]({
|
|
1437
1415
|
imports(entries) {
|
|
1438
1416
|
const map = new Map(entries);
|
|
1417
|
+
observeImports(map, "@endo/env-options", 3);
|
|
1418
|
+
observeImports(map, "@endo/immutable-arraybuffer/shim.js", 6);
|
|
1439
1419
|
observeImports(map, "./commons.js", 0);
|
|
1440
|
-
observeImports(map, "./
|
|
1441
|
-
observeImports(map, "./
|
|
1442
|
-
observeImports(map, "./intrinsics.js",
|
|
1443
|
-
observeImports(map, "./
|
|
1420
|
+
observeImports(map, "./make-hardener.js", 14);
|
|
1421
|
+
observeImports(map, "./intrinsics.js", 17);
|
|
1422
|
+
observeImports(map, "./permits-intrinsics.js", 18);
|
|
1423
|
+
observeImports(map, "./tame-function-constructors.js", 19);
|
|
1424
|
+
observeImports(map, "./tame-date-constructor.js", 20);
|
|
1425
|
+
observeImports(map, "./tame-math-object.js", 21);
|
|
1426
|
+
observeImports(map, "./tame-regexp-constructor.js", 22);
|
|
1427
|
+
observeImports(map, "./enable-property-overrides.js", 24);
|
|
1428
|
+
observeImports(map, "./tame-locale-methods.js", 25);
|
|
1429
|
+
observeImports(map, "./global-object.js", 28);
|
|
1430
|
+
observeImports(map, "./make-safe-evaluator.js", 36);
|
|
1431
|
+
observeImports(map, "./permits.js", 16);
|
|
1432
|
+
observeImports(map, "./tame-function-tostring.js", 37);
|
|
1433
|
+
observeImports(map, "./tame-domains.js", 38);
|
|
1434
|
+
observeImports(map, "./tame-module-source.js", 39);
|
|
1435
|
+
observeImports(map, "./error/tame-console.js", 42);
|
|
1436
|
+
observeImports(map, "./error/tame-error-constructor.js", 44);
|
|
1437
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1438
|
+
observeImports(map, "./get-anonymous-intrinsics.js", 51);
|
|
1439
|
+
observeImports(map, "./compartment.js", 50);
|
|
1440
|
+
observeImports(map, "./tame-harden.js", 52);
|
|
1441
|
+
observeImports(map, "./tame-symbol-constructor.js", 53);
|
|
1442
|
+
observeImports(map, "./tame-faux-data-properties.js", 54);
|
|
1443
|
+
observeImports(map, "./tame-regenerator-runtime.js", 55);
|
|
1444
|
+
observeImports(map, "./shim-arraybuffer-transfer.js", 56);
|
|
1445
|
+
observeImports(map, "./reporting.js", 57);
|
|
1444
1446
|
},
|
|
1445
1447
|
liveVar: {
|
|
1446
1448
|
},
|
|
1447
1449
|
onceVar: {
|
|
1450
|
+
repairIntrinsics: cells[58].repairIntrinsics.set,
|
|
1448
1451
|
},
|
|
1449
1452
|
importMeta: {},
|
|
1450
1453
|
});
|
|
1451
1454
|
functors[59]({
|
|
1452
1455
|
imports(entries) {
|
|
1453
1456
|
const map = new Map(entries);
|
|
1457
|
+
observeImports(map, "./assert-sloppy-mode.js", 1);
|
|
1454
1458
|
observeImports(map, "./commons.js", 0);
|
|
1455
|
-
observeImports(map, "./
|
|
1459
|
+
observeImports(map, "./lockdown.js", 58);
|
|
1456
1460
|
},
|
|
1457
1461
|
liveVar: {
|
|
1458
1462
|
},
|
|
@@ -1464,8 +1468,10 @@ function observeImports(map, importName, importIndex) {
|
|
|
1464
1468
|
imports(entries) {
|
|
1465
1469
|
const map = new Map(entries);
|
|
1466
1470
|
observeImports(map, "./commons.js", 0);
|
|
1467
|
-
observeImports(map, "./
|
|
1468
|
-
observeImports(map, "./
|
|
1471
|
+
observeImports(map, "./compartment.js", 50);
|
|
1472
|
+
observeImports(map, "./tame-function-tostring.js", 37);
|
|
1473
|
+
observeImports(map, "./intrinsics.js", 17);
|
|
1474
|
+
observeImports(map, "./reporting.js", 57);
|
|
1469
1475
|
},
|
|
1470
1476
|
liveVar: {
|
|
1471
1477
|
},
|
|
@@ -1476,10 +1482,35 @@ function observeImports(map, importName, importIndex) {
|
|
|
1476
1482
|
functors[61]({
|
|
1477
1483
|
imports(entries) {
|
|
1478
1484
|
const map = new Map(entries);
|
|
1479
|
-
observeImports(map, "./
|
|
1480
|
-
observeImports(map, "./
|
|
1481
|
-
|
|
1482
|
-
|
|
1485
|
+
observeImports(map, "./commons.js", 0);
|
|
1486
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1487
|
+
},
|
|
1488
|
+
liveVar: {
|
|
1489
|
+
},
|
|
1490
|
+
onceVar: {
|
|
1491
|
+
},
|
|
1492
|
+
importMeta: {},
|
|
1493
|
+
});
|
|
1494
|
+
functors[62]({
|
|
1495
|
+
imports(entries) {
|
|
1496
|
+
const map = new Map(entries);
|
|
1497
|
+
observeImports(map, "./commons.js", 0);
|
|
1498
|
+
observeImports(map, "./error/console.js", 40);
|
|
1499
|
+
observeImports(map, "./error/assert.js", 13);
|
|
1500
|
+
},
|
|
1501
|
+
liveVar: {
|
|
1502
|
+
},
|
|
1503
|
+
onceVar: {
|
|
1504
|
+
},
|
|
1505
|
+
importMeta: {},
|
|
1506
|
+
});
|
|
1507
|
+
functors[63]({
|
|
1508
|
+
imports(entries) {
|
|
1509
|
+
const map = new Map(entries);
|
|
1510
|
+
observeImports(map, "./src/lockdown-shim.js", 59);
|
|
1511
|
+
observeImports(map, "./src/compartment-shim.js", 60);
|
|
1512
|
+
observeImports(map, "./src/assert-shim.js", 61);
|
|
1513
|
+
observeImports(map, "./src/console-shim.js", 62);
|
|
1483
1514
|
},
|
|
1484
1515
|
liveVar: {
|
|
1485
1516
|
},
|
|
@@ -1577,10 +1608,11 @@ const universalThis = globalThis;$h͏_once.universalThis(universalThis);
|
|
|
1577
1608
|
toStringTag: toStringTagSymbol,
|
|
1578
1609
|
iterator: iteratorSymbol,
|
|
1579
1610
|
matchAll: matchAllSymbol,
|
|
1611
|
+
replace: replaceSymbol,
|
|
1580
1612
|
unscopables: unscopablesSymbol,
|
|
1581
1613
|
keyFor: symbolKeyFor,
|
|
1582
1614
|
for: symbolFor,
|
|
1583
|
-
} = Symbol;$h͏_once.speciesSymbol(speciesSymbol);$h͏_once.toStringTagSymbol(toStringTagSymbol);$h͏_once.iteratorSymbol(iteratorSymbol);$h͏_once.matchAllSymbol(matchAllSymbol);$h͏_once.unscopablesSymbol(unscopablesSymbol);$h͏_once.symbolKeyFor(symbolKeyFor);$h͏_once.symbolFor(symbolFor);
|
|
1615
|
+
} = Symbol;$h͏_once.speciesSymbol(speciesSymbol);$h͏_once.toStringTagSymbol(toStringTagSymbol);$h͏_once.iteratorSymbol(iteratorSymbol);$h͏_once.matchAllSymbol(matchAllSymbol);$h͏_once.replaceSymbol(replaceSymbol);$h͏_once.unscopablesSymbol(unscopablesSymbol);$h͏_once.symbolKeyFor(symbolKeyFor);$h͏_once.symbolFor(symbolFor);
|
|
1584
1616
|
|
|
1585
1617
|
const { isInteger } = Number;$h͏_once.isInteger(isInteger);
|
|
1586
1618
|
|
|
@@ -1658,10 +1690,30 @@ const { bind } = functionPrototype;
|
|
|
1658
1690
|
* @type {<F extends (this: any, ...args: any[]) => any>(fn: F) => ((thisArg: ThisParameterType<F>, ...args: Parameters<F>) => ReturnType<F>)}
|
|
1659
1691
|
*/
|
|
1660
1692
|
const uncurryThis = bind.bind(bind.call); // eslint-disable-line @endo/no-polymorphic-call
|
|
1661
|
-
|
|
1662
|
-
|
|
1693
|
+
|
|
1694
|
+
// See https://github.com/endojs/endo/issues/2930
|
|
1695
|
+
$h͏_once.uncurryThis(uncurryThis);if(!('hasOwn'in Object)){
|
|
1696
|
+
const ObjectPrototypeHasOwnProperty = objectPrototype.hasOwnProperty;
|
|
1697
|
+
const hasOwnShim = (obj, key) => {
|
|
1698
|
+
if (obj === undefined || obj === null) {
|
|
1699
|
+
// We need to add this extra test because of differences in
|
|
1700
|
+
// the order in which `hasOwn` vs `hasOwnProperty` validates
|
|
1701
|
+
// arguments.
|
|
1702
|
+
throw TypeError('Cannot convert undefined or null to object');
|
|
1703
|
+
}
|
|
1704
|
+
return apply(ObjectPrototypeHasOwnProperty, obj, [key]);
|
|
1705
|
+
};
|
|
1706
|
+
defineProperty(Object, 'hasOwn', {
|
|
1707
|
+
value: hasOwnShim,
|
|
1708
|
+
writable: true,
|
|
1709
|
+
enumerable: false,
|
|
1710
|
+
configurable: true,
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
const { hasOwn } = Object;
|
|
1663
1715
|
//
|
|
1664
|
-
$h͏_once.
|
|
1716
|
+
$h͏_once.hasOwn(hasOwn);const arrayFilter=uncurryThis(arrayPrototype.filter);$h͏_once.arrayFilter(arrayFilter);
|
|
1665
1717
|
const arrayForEach = uncurryThis(arrayPrototype.forEach);$h͏_once.arrayForEach(arrayForEach);
|
|
1666
1718
|
const arrayIncludes = uncurryThis(arrayPrototype.includes);$h͏_once.arrayIncludes(arrayIncludes);
|
|
1667
1719
|
const arrayJoin = uncurryThis(arrayPrototype.join);
|
|
@@ -1700,32 +1752,53 @@ $h͏_once.iterateMap(iterateMap);const setAdd=uncurryThis(setPrototype.add);$h͏
|
|
|
1700
1752
|
const setHas = uncurryThis(setPrototype.has);$h͏_once.setHas(setHas);
|
|
1701
1753
|
const iterateSet = uncurryThis(setPrototype[iteratorSymbol]);
|
|
1702
1754
|
//
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
const stringIncludes = uncurryThis(stringPrototype.includes);$h͏_once.stringIncludes(stringIncludes);
|
|
1709
|
-
const stringIndexOf = uncurryThis(stringPrototype.indexOf);$h͏_once.stringIndexOf(stringIndexOf);
|
|
1710
|
-
const stringMatch = uncurryThis(stringPrototype.match);$h͏_once.stringMatch(stringMatch);
|
|
1711
|
-
const generatorNext = uncurryThis(generatorPrototype.next);$h͏_once.generatorNext(generatorNext);
|
|
1712
|
-
const generatorThrow = uncurryThis(generatorPrototype.throw);
|
|
1713
|
-
|
|
1755
|
+
/**
|
|
1756
|
+
* `regexpExec` is provided in exclusion of `regexpTest`, which would be
|
|
1757
|
+
* vulnerable to RegExp.prototype poisoning.
|
|
1758
|
+
*/$h͏_once.iterateSet(iterateSet);
|
|
1759
|
+
const regexpExec = uncurryThis(regexpPrototype.exec);
|
|
1714
1760
|
/**
|
|
1715
1761
|
* @type { &
|
|
1716
|
-
* ((thisArg:
|
|
1717
|
-
* ((thisArg:
|
|
1762
|
+
* ((thisArg: RegExp, string: string, replaceValue: string) => string) &
|
|
1763
|
+
* ((thisArg: RegExp, string: string, replacer: (substring: string, ...args: any[]) => string) => string)
|
|
1718
1764
|
* }
|
|
1719
|
-
*/$h͏_once.
|
|
1720
|
-
const
|
|
1721
|
-
uncurryThis(
|
|
1722
|
-
);$h͏_once.
|
|
1723
|
-
const
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1765
|
+
*/$h͏_once.regexpExec(regexpExec);
|
|
1766
|
+
const regexpReplace = /** @type {any} */ (
|
|
1767
|
+
uncurryThis(regexpPrototype[replaceSymbol])
|
|
1768
|
+
);$h͏_once.regexpReplace(regexpReplace);
|
|
1769
|
+
const matchAllRegExp = uncurryThis(regexpPrototype[matchAllSymbol]);$h͏_once.matchAllRegExp(matchAllRegExp);
|
|
1770
|
+
const { _regexpConstructor, ...regexpDescriptors } =
|
|
1771
|
+
getOwnPropertyDescriptors(regexpPrototype);
|
|
1772
|
+
arrayForEach(ownKeys(regexpDescriptors), key => {
|
|
1773
|
+
const desc = regexpDescriptors[/** @type {any} */ (key)];
|
|
1774
|
+
desc.configurable = false;
|
|
1775
|
+
if (desc.writable) desc.writable = false;
|
|
1776
|
+
});
|
|
1777
|
+
/**
|
|
1778
|
+
* Protect a RegExp instance against RegExp.prototype poisoning ("exec",
|
|
1779
|
+
* "flags", Symbol.replace, etc.).
|
|
1780
|
+
* @type {<T extends RegExp>(regexp: T) => T}
|
|
1781
|
+
*/
|
|
1782
|
+
const sealRegexp = regexp =>
|
|
1783
|
+
seal(defineProperties(regexp, regexpDescriptors));
|
|
1784
|
+
//
|
|
1785
|
+
$h͏_once.sealRegexp(sealRegexp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h͏_once.stringEndsWith(stringEndsWith);
|
|
1786
|
+
const stringIncludes = uncurryThis(stringPrototype.includes);$h͏_once.stringIncludes(stringIncludes);
|
|
1787
|
+
const stringIndexOf = uncurryThis(stringPrototype.indexOf);$h͏_once.stringIndexOf(stringIndexOf);
|
|
1788
|
+
const stringMatch = uncurryThis(stringPrototype.match);
|
|
1789
|
+
// `stringReplace` is intentionally omitted because it would be vulnerable to
|
|
1790
|
+
// RegExp.prototype poisoning; use `regexpReplace(re, str, replacer)` instead
|
|
1791
|
+
// (and `sealRegexp` on its regular expressions).
|
|
1792
|
+
$h͏_once.stringMatch(stringMatch);const stringSearch=uncurryThis(stringPrototype.search);$h͏_once.stringSearch(stringSearch);
|
|
1793
|
+
const stringSlice = uncurryThis(stringPrototype.slice);
|
|
1794
|
+
/**
|
|
1795
|
+
* `stringSplit` should only be used with a string separator; regular
|
|
1796
|
+
* expressions are vulnerable to RegExp.prototype poisoning.
|
|
1797
|
+
* @type {(thisArg: string, separator: string, limit?: number) => string[]}
|
|
1798
|
+
*/$h͏_once.stringSlice(stringSlice);
|
|
1799
|
+
const stringSplit = /** @type {any} */ (
|
|
1800
|
+
uncurryThis(stringPrototype.split)
|
|
1801
|
+
);$h͏_once.stringSplit(stringSplit);
|
|
1729
1802
|
const stringStartsWith = uncurryThis(stringPrototype.startsWith);$h͏_once.stringStartsWith(stringStartsWith);
|
|
1730
1803
|
const iterateString = uncurryThis(stringPrototype[iteratorSymbol]);
|
|
1731
1804
|
//
|
|
@@ -1741,7 +1814,10 @@ $h͏_once.weakmapSet(weakmapSet);const weaksetAdd=uncurryThis(weaksetPrototype.a
|
|
|
1741
1814
|
$h͏_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPrototype.toString);$h͏_once.functionToString(functionToString);
|
|
1742
1815
|
const functionBind = uncurryThis(bind);
|
|
1743
1816
|
//
|
|
1744
|
-
$h͏_once.functionBind(functionBind);const
|
|
1817
|
+
$h͏_once.functionBind(functionBind);const generatorNext=uncurryThis(generatorPrototype.next);$h͏_once.generatorNext(generatorNext);
|
|
1818
|
+
const generatorThrow = uncurryThis(generatorPrototype.throw);
|
|
1819
|
+
//
|
|
1820
|
+
$h͏_once.generatorThrow(generatorThrow);const{all}=Promise;
|
|
1745
1821
|
const promiseAll = promises => apply(all, Promise, [promises]);$h͏_once.promiseAll(promiseAll);
|
|
1746
1822
|
const promiseCatch = uncurryThis(promisePrototype.catch);
|
|
1747
1823
|
/** @type {<T, TResult1 = T, TResult2 = never>(thisArg: T, onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null) => Promise<TResult1 | TResult2>} */$h͏_once.promiseCatch(promiseCatch);
|
|
@@ -1756,32 +1832,20 @@ $h͏_once.promiseThen(promiseThen);const finalizationRegistryRegister=
|
|
|
1756
1832
|
uncurryThis(FinalizationRegistry.prototype.unregister);
|
|
1757
1833
|
|
|
1758
1834
|
/**
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1835
|
+
* TODO Consolidate with `isPrimitive` that's currently in `@endo/pass-style`.
|
|
1836
|
+
* Layering constraints make this tricky, which is why we haven't yet figured
|
|
1837
|
+
* out how to do this.
|
|
1761
1838
|
*
|
|
1762
|
-
* @
|
|
1839
|
+
* @type {(val: unknown) => val is (undefined
|
|
1840
|
+
* | null
|
|
1841
|
+
* | boolean
|
|
1842
|
+
* | number
|
|
1843
|
+
* | bigint
|
|
1844
|
+
* | string
|
|
1845
|
+
* | symbol)}
|
|
1763
1846
|
*/$h͏_once.finalizationRegistryUnregister(finalizationRegistryUnregister);
|
|
1764
|
-
const
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
/**
|
|
1768
|
-
* isObject tests whether a value is an object.
|
|
1769
|
-
* Today, this is equivalent to:
|
|
1770
|
-
*
|
|
1771
|
-
* const isObject = value => {
|
|
1772
|
-
* if (value === null) return false;
|
|
1773
|
-
* const type = typeof value;
|
|
1774
|
-
* return type === 'object' || type === 'function';
|
|
1775
|
-
* };
|
|
1776
|
-
*
|
|
1777
|
-
* But this is not safe in the face of possible evolution of the language, for
|
|
1778
|
-
* example new types or semantics of records and tuples.
|
|
1779
|
-
* We use this implementation despite the unnecessary allocation implied by
|
|
1780
|
-
* attempting to box a primitive.
|
|
1781
|
-
*
|
|
1782
|
-
* @param {any} value
|
|
1783
|
-
*/$h͏_once.getConstructorOf(getConstructorOf);
|
|
1784
|
-
const isObject = value => Object(value) === value;
|
|
1847
|
+
const isPrimitive = val =>
|
|
1848
|
+
!val || (typeof val !== 'object' && typeof val !== 'function');
|
|
1785
1849
|
|
|
1786
1850
|
/**
|
|
1787
1851
|
* isError tests whether an object inherits from the intrinsic
|
|
@@ -1793,7 +1857,7 @@ $h͏_once.promiseThen(promiseThen);const finalizationRegistryRegister=
|
|
|
1793
1857
|
* for such a trivial case outside commons.js, we provide a utility function.
|
|
1794
1858
|
*
|
|
1795
1859
|
* @param {any} value
|
|
1796
|
-
*/$h͏_once.
|
|
1860
|
+
*/$h͏_once.isPrimitive(isPrimitive);
|
|
1797
1861
|
const isError = value => value instanceof FERAL_ERROR;
|
|
1798
1862
|
|
|
1799
1863
|
/**
|
|
@@ -1819,13 +1883,40 @@ $h͏_once.FERAL_EVAL(FERAL_EVAL);const FERAL_FUNCTION=Function;$h͏_once.FERAL_F
|
|
|
1819
1883
|
};
|
|
1820
1884
|
|
|
1821
1885
|
// ////////////////// FERAL_STACK_GETTER FERAL_STACK_SETTER ////////////////////
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1886
|
+
|
|
1887
|
+
// The error repair mechanism is very similar to code in
|
|
1888
|
+
// pass-style/src/error.js and these implementations should be kept in sync.
|
|
1889
|
+
|
|
1890
|
+
/**
|
|
1891
|
+
* We gratuitiously construct a TypeError instance using syntax in order to
|
|
1892
|
+
* obviate the possibility that code that ran before SES (for which we are
|
|
1893
|
+
* irreducable vulnerable) may have replaced the global TypeError constructor.
|
|
1894
|
+
* We treat the nature of this error instance as the source of truth for the
|
|
1895
|
+
* nature of runtime constructed errors on the platform, particularly whether
|
|
1896
|
+
* such errors will have an own "stack" property with getters and setters.
|
|
1897
|
+
* At time of writing (2025) we know of no comparable mechanism for obtaining a
|
|
1898
|
+
* host-generated base Error instance, but we corroborate the nature of the
|
|
1899
|
+
* global Error constructor's instances and refuse to initialize SES in an
|
|
1900
|
+
* environment where the syntactic TypeError and global Error produce
|
|
1901
|
+
* inconsistent "stack" properties.
|
|
1902
|
+
* @returns {TypeError}
|
|
1903
|
+
*/$h͏_once.noEvalEvaluate(noEvalEvaluate);
|
|
1904
|
+
const makeTypeError = () => {
|
|
1905
|
+
try {
|
|
1906
|
+
// @ts-expect-error deliberate TypeError
|
|
1907
|
+
null.null;
|
|
1908
|
+
throw TypeError('obligatory'); // To convince the type flow inferrence.
|
|
1909
|
+
} catch (error) {
|
|
1910
|
+
return error;
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1913
|
+
|
|
1914
|
+
const errorStackDesc = getOwnPropertyDescriptor(Error('obligatory'), 'stack');
|
|
1915
|
+
const typeErrorStackDesc = getOwnPropertyDescriptor(makeTypeError(), 'stack');
|
|
1825
1916
|
|
|
1826
1917
|
let feralStackGetter;
|
|
1827
1918
|
let feralStackSetter;
|
|
1828
|
-
if (
|
|
1919
|
+
if (typeErrorStackDesc && typeErrorStackDesc.get) {
|
|
1829
1920
|
// We should only encounter this case on v8 because of its problematic
|
|
1830
1921
|
// error own stack accessor behavior.
|
|
1831
1922
|
// Note that FF/SpiderMonkey, Moddable/XS, and the error stack proposal
|
|
@@ -1836,16 +1927,17 @@ if (er1StackDesc && er2StackDesc && er1StackDesc.get) {
|
|
|
1836
1927
|
// accessor property, but within the same realm, all these accessor
|
|
1837
1928
|
// properties have the same getter and have the same setter.
|
|
1838
1929
|
// This is therefore the case that we repair.
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1930
|
+
errorStackDesc &&
|
|
1931
|
+
typeof typeErrorStackDesc.get === 'function' &&
|
|
1932
|
+
typeErrorStackDesc.get === errorStackDesc.get &&
|
|
1933
|
+
typeof typeErrorStackDesc.set === 'function' &&
|
|
1934
|
+
typeErrorStackDesc.set === errorStackDesc.set
|
|
1843
1935
|
) {
|
|
1844
1936
|
// Otherwise, we have own stack accessor properties that are outside
|
|
1845
1937
|
// our expectations, that therefore need to be understood better
|
|
1846
1938
|
// before we know how to repair them.
|
|
1847
|
-
feralStackGetter = freeze(
|
|
1848
|
-
feralStackSetter = freeze(
|
|
1939
|
+
feralStackGetter = freeze(typeErrorStackDesc.get);
|
|
1940
|
+
feralStackSetter = freeze(typeErrorStackDesc.set);
|
|
1849
1941
|
} else {
|
|
1850
1942
|
// See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_UNEXPECTED_ERROR_OWN_STACK_ACCESSOR.md
|
|
1851
1943
|
throw TypeError(
|
|
@@ -1942,6 +2034,10 @@ if (getThis()) {
|
|
|
1942
2034
|
// Prelude of cheap good - enough imitations of things we'd use or
|
|
1943
2035
|
// do differently if we could depend on ses
|
|
1944
2036
|
|
|
2037
|
+
// eslint-disable-next-line no-restricted-globals
|
|
2038
|
+
const localThis = globalThis;
|
|
2039
|
+
|
|
2040
|
+
const { Object, Reflect, Array, String, JSON, Error } = localThis;
|
|
1945
2041
|
const { freeze } = Object;
|
|
1946
2042
|
const { apply } = Reflect;
|
|
1947
2043
|
|
|
@@ -2076,35 +2172,53 @@ freeze(makeEnvironmentCaptor);
|
|
|
2076
2172
|
getEnvironmentOption,
|
|
2077
2173
|
getEnvironmentOptionsList,
|
|
2078
2174
|
environmentOptionsListHas,
|
|
2079
|
-
} = makeEnvironmentCaptor(
|
|
2175
|
+
} = makeEnvironmentCaptor(localThis, true);$h͏_once.getEnvironmentOption(getEnvironmentOption);$h͏_once.getEnvironmentOptionsList(getEnvironmentOptionsList);$h͏_once.environmentOptionsListHas(environmentOptionsListHas);
|
|
2080
2176
|
})()
|
|
2081
2177
|
,
|
|
2082
2178
|
// === 3. env-options ./index.js ===
|
|
2083
2179
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/env-options.js", []]]);
|
|
2084
2180
|
})()
|
|
2085
2181
|
,
|
|
2086
|
-
// === 4. immutable-arraybuffer ./src/
|
|
2087
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([])
|
|
2088
|
-
const { prototype: arrayBufferPrototype } = ArrayBuffer;
|
|
2182
|
+
// === 4. immutable-arraybuffer ./src/immutable-arraybuffer-pony.js ===
|
|
2183
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/* global globalThis */
|
|
2089
2184
|
|
|
2090
|
-
const {
|
|
2185
|
+
const {
|
|
2186
|
+
ArrayBuffer,
|
|
2187
|
+
Object,
|
|
2188
|
+
Reflect,
|
|
2189
|
+
Symbol,
|
|
2190
|
+
TypeError,
|
|
2191
|
+
Uint8Array,
|
|
2192
|
+
WeakMap,
|
|
2193
|
+
// Capture structuredClone before it can be scuttled.
|
|
2194
|
+
structuredClone: optStructuredClone
|
|
2195
|
+
// eslint-disable-next-line no-restricted-globals
|
|
2196
|
+
} = globalThis;
|
|
2091
2197
|
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
//
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2198
|
+
const { freeze, defineProperty, getPrototypeOf, getOwnPropertyDescriptor } =
|
|
2199
|
+
Object;
|
|
2200
|
+
const { apply, ownKeys } = Reflect;
|
|
2201
|
+
const { toStringTag } = Symbol;
|
|
2202
|
+
|
|
2203
|
+
const { prototype: arrayBufferPrototype } = ArrayBuffer;
|
|
2204
|
+
const { slice, transfer: optTransfer } = arrayBufferPrototype;
|
|
2205
|
+
// @ts-expect-error TS doesn't know it'll be there
|
|
2206
|
+
const { get: arrayBufferByteLength } = getOwnPropertyDescriptor(
|
|
2207
|
+
arrayBufferPrototype,
|
|
2208
|
+
'byteLength',
|
|
2209
|
+
);
|
|
2210
|
+
|
|
2211
|
+
const typedArrayPrototype = getPrototypeOf(Uint8Array.prototype);
|
|
2212
|
+
const { set: uint8ArraySet } = typedArrayPrototype;
|
|
2213
|
+
// @ts-expect-error TS doesn't know it'll be there
|
|
2214
|
+
const { get: uint8ArrayBuffer } = getOwnPropertyDescriptor(
|
|
2215
|
+
typedArrayPrototype,
|
|
2216
|
+
'buffer',
|
|
2217
|
+
);
|
|
2105
2218
|
|
|
2106
2219
|
/**
|
|
2107
|
-
*
|
|
2220
|
+
* Copy a range of values from a genuine ArrayBuffer exotic object into a new
|
|
2221
|
+
* ArrayBuffer.
|
|
2108
2222
|
*
|
|
2109
2223
|
* @param {ArrayBuffer} realBuffer
|
|
2110
2224
|
* @param {number} [start]
|
|
@@ -2115,11 +2229,56 @@ const arrayBufferSlice = (realBuffer, start = undefined, end = undefined) =>
|
|
|
2115
2229
|
apply(slice, realBuffer, [start, end]);
|
|
2116
2230
|
|
|
2117
2231
|
/**
|
|
2118
|
-
*
|
|
2232
|
+
* Move the contents of a genuine ArrayBuffer exotic object into a new fresh
|
|
2233
|
+
* ArrayBuffer and detach the original source.
|
|
2234
|
+
* We can only do this on platforms that support `structuredClone` or
|
|
2235
|
+
* `ArrayBuffer.prototype.transfer`.
|
|
2236
|
+
* On other platforms, we can still emulate
|
|
2237
|
+
* `ArrayBuffer.prototoype.sliceToImmutable`, but not
|
|
2238
|
+
* `ArrayBuffer.prototype.transferToImmutable`.
|
|
2239
|
+
* Currently, these known-deficient platforms are
|
|
2240
|
+
* - Hermes
|
|
2241
|
+
* - Node.js <= 16
|
|
2242
|
+
* - Apparently some versions of JavaScriptCore that are still of concern.
|
|
2243
|
+
*
|
|
2244
|
+
* @param {ArrayBuffer} arrayBuffer
|
|
2245
|
+
* @returns {ArrayBuffer}
|
|
2246
|
+
*/
|
|
2247
|
+
let optArrayBufferTransfer;
|
|
2248
|
+
|
|
2249
|
+
if (optTransfer) {
|
|
2250
|
+
optArrayBufferTransfer = arrayBuffer => apply(optTransfer, arrayBuffer, []);
|
|
2251
|
+
} else if (optStructuredClone) {
|
|
2252
|
+
optArrayBufferTransfer = arrayBuffer => {
|
|
2253
|
+
// Hopefully, a zero-length slice is cheap, but still enforces that
|
|
2254
|
+
// `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
|
|
2255
|
+
arrayBufferSlice(arrayBuffer, 0, 0);
|
|
2256
|
+
return optStructuredClone(arrayBuffer, {
|
|
2257
|
+
transfer: [arrayBuffer],
|
|
2258
|
+
});
|
|
2259
|
+
};
|
|
2260
|
+
} else {
|
|
2261
|
+
// Assignment is redundant, but remains for clarity.
|
|
2262
|
+
optArrayBufferTransfer = undefined;
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
/**
|
|
2266
|
+
* If we could use classes with private fields everywhere, this would have
|
|
2267
|
+
* been a `this.#buffer` private field on an `ImmutableArrayBufferInternal`
|
|
2268
|
+
* class. But we cannot do so on Hermes. So, instead, we
|
|
2269
|
+
* emulate the `this.#buffer` private field, including its use as a brand check.
|
|
2119
2270
|
* Maps from all and only emulated Immutable ArrayBuffers to real ArrayBuffers.
|
|
2271
|
+
*
|
|
2272
|
+
* @type {Pick<WeakMap<ArrayBuffer, ArrayBuffer>, 'get' | 'has' | 'set'>}
|
|
2120
2273
|
*/
|
|
2121
2274
|
const buffers = new WeakMap();
|
|
2275
|
+
// Avoid post-hoc prototype lookups.
|
|
2276
|
+
for (const methodName of ['get', 'has', 'set']) {
|
|
2277
|
+
defineProperty(buffers, methodName, { value: buffers[methodName] });
|
|
2278
|
+
}
|
|
2122
2279
|
const getBuffer = immuAB => {
|
|
2280
|
+
// Safe because this WeakMap owns its get method.
|
|
2281
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
2123
2282
|
const result = buffers.get(immuAB);
|
|
2124
2283
|
if (result) {
|
|
2125
2284
|
return result;
|
|
@@ -2131,7 +2290,7 @@ const getBuffer = immuAB => {
|
|
|
2131
2290
|
const ImmutableArrayBufferInternalPrototype = {
|
|
2132
2291
|
__proto__: arrayBufferPrototype,
|
|
2133
2292
|
get byteLength() {
|
|
2134
|
-
return getBuffer(this)
|
|
2293
|
+
return apply(arrayBufferByteLength, getBuffer(this), []);
|
|
2135
2294
|
},
|
|
2136
2295
|
get detached() {
|
|
2137
2296
|
getBuffer(this); // shim brand check
|
|
@@ -2139,7 +2298,7 @@ const ImmutableArrayBufferInternalPrototype = {
|
|
|
2139
2298
|
},
|
|
2140
2299
|
get maxByteLength() {
|
|
2141
2300
|
// Not underlying maxByteLength, which is irrelevant
|
|
2142
|
-
return getBuffer(this)
|
|
2301
|
+
return apply(arrayBufferByteLength, getBuffer(this), []);
|
|
2143
2302
|
},
|
|
2144
2303
|
get resizable() {
|
|
2145
2304
|
getBuffer(this); // shim brand check
|
|
@@ -2160,11 +2319,34 @@ const ImmutableArrayBufferInternalPrototype = {
|
|
|
2160
2319
|
getBuffer(this); // shim brand check
|
|
2161
2320
|
throw TypeError('Cannot resize an immutable ArrayBuffer');
|
|
2162
2321
|
},
|
|
2322
|
+
transfer(_newLength = undefined) {
|
|
2323
|
+
getBuffer(this); // shim brand check
|
|
2324
|
+
throw TypeError('Cannot detach an immutable ArrayBuffer');
|
|
2325
|
+
},
|
|
2326
|
+
transferToFixedLength(_newLength = undefined) {
|
|
2327
|
+
getBuffer(this); // shim brand check
|
|
2328
|
+
throw TypeError('Cannot detach an immutable ArrayBuffer');
|
|
2329
|
+
},
|
|
2330
|
+
transferToImmutable(_newLength = undefined) {
|
|
2331
|
+
getBuffer(this); // shim brand check
|
|
2332
|
+
throw TypeError('Cannot detach an immutable ArrayBuffer');
|
|
2333
|
+
},
|
|
2334
|
+
/**
|
|
2335
|
+
* See https://github.com/endojs/endo/tree/master/packages/immutable-arraybuffer#purposeful-violation
|
|
2336
|
+
*/
|
|
2337
|
+
[toStringTag]: 'ImmutableArrayBuffer',
|
|
2163
2338
|
};
|
|
2164
2339
|
|
|
2340
|
+
// Better fidelity emulation of a class prototype
|
|
2341
|
+
for (const key of ownKeys(ImmutableArrayBufferInternalPrototype)) {
|
|
2342
|
+
defineProperty(ImmutableArrayBufferInternalPrototype, key, {
|
|
2343
|
+
enumerable: false,
|
|
2344
|
+
});
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2165
2347
|
/**
|
|
2166
|
-
* Emulates the encapsulated `ImmutableArrayBufferInternal`
|
|
2167
|
-
*
|
|
2348
|
+
* Emulates what would have been the encapsulated `ImmutableArrayBufferInternal`
|
|
2349
|
+
* class constructor. This function takes the `realBuffer` which its
|
|
2168
2350
|
* result encapsulates. Security demands that this result has exclusive access
|
|
2169
2351
|
* to the `realBuffer` it is given, which its callers must ensure.
|
|
2170
2352
|
*
|
|
@@ -2172,14 +2354,25 @@ const ImmutableArrayBufferInternalPrototype = {
|
|
|
2172
2354
|
* @returns {ArrayBuffer}
|
|
2173
2355
|
*/
|
|
2174
2356
|
const makeImmutableArrayBufferInternal = realBuffer => {
|
|
2175
|
-
const result = {
|
|
2357
|
+
const result = /** @type {ArrayBuffer} */ (
|
|
2358
|
+
/** @type {unknown} */ ({
|
|
2359
|
+
__proto__: ImmutableArrayBufferInternalPrototype,
|
|
2360
|
+
})
|
|
2361
|
+
);
|
|
2362
|
+
// Safe because this WeakMap owns its set method.
|
|
2363
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
2176
2364
|
buffers.set(result, realBuffer);
|
|
2177
|
-
return
|
|
2365
|
+
return result;
|
|
2178
2366
|
};
|
|
2179
2367
|
// Since `makeImmutableArrayBufferInternal` MUST not escape,
|
|
2180
2368
|
// this `freeze` is just belt-and-suspenders.
|
|
2181
|
-
|
|
2369
|
+
freeze(makeImmutableArrayBufferInternal);
|
|
2182
2370
|
|
|
2371
|
+
/**
|
|
2372
|
+
* @param {ArrayBuffer} buffer
|
|
2373
|
+
* @returns {boolean}
|
|
2374
|
+
*/
|
|
2375
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
2183
2376
|
const isBufferImmutable = buffer => buffers.has(buffer);
|
|
2184
2377
|
|
|
2185
2378
|
/**
|
|
@@ -2194,6 +2387,8 @@ Object.freeze(makeImmutableArrayBufferInternal);
|
|
|
2194
2387
|
start = undefined,
|
|
2195
2388
|
end = undefined,
|
|
2196
2389
|
) => {
|
|
2390
|
+
// Safe because this WeakMap owns its get method.
|
|
2391
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
2197
2392
|
let realBuffer = buffers.get(buffer);
|
|
2198
2393
|
if (realBuffer === undefined) {
|
|
2199
2394
|
realBuffer = buffer;
|
|
@@ -2202,20 +2397,76 @@ Object.freeze(makeImmutableArrayBufferInternal);
|
|
|
2202
2397
|
arrayBufferSlice(realBuffer, start, end),
|
|
2203
2398
|
);
|
|
2204
2399
|
};$h͏_once.sliceBufferToImmutable(sliceBufferToImmutable);
|
|
2400
|
+
|
|
2401
|
+
let transferBufferToImmutable;
|
|
2402
|
+
if (optArrayBufferTransfer) {
|
|
2403
|
+
/**
|
|
2404
|
+
* Transfer the contents to a new Immutable ArrayBuffer
|
|
2405
|
+
*
|
|
2406
|
+
* @param {ArrayBuffer} buffer The original buffer.
|
|
2407
|
+
* @param {number} [newLength] The start index.
|
|
2408
|
+
* @returns {ArrayBuffer}
|
|
2409
|
+
*/
|
|
2410
|
+
transferBufferToImmutable = (buffer, newLength = undefined) => {
|
|
2411
|
+
if (newLength === undefined) {
|
|
2412
|
+
buffer = optArrayBufferTransfer(buffer);
|
|
2413
|
+
} else if (optTransfer) {
|
|
2414
|
+
buffer = apply(optTransfer, buffer, [newLength]);
|
|
2415
|
+
} else {
|
|
2416
|
+
buffer = optArrayBufferTransfer(buffer);
|
|
2417
|
+
const oldLength = buffer.byteLength;
|
|
2418
|
+
// eslint-disable-next-line @endo/restrict-comparison-operands
|
|
2419
|
+
if (newLength <= oldLength) {
|
|
2420
|
+
buffer = arrayBufferSlice(buffer, 0, newLength);
|
|
2421
|
+
} else {
|
|
2422
|
+
const oldTA = new Uint8Array(buffer);
|
|
2423
|
+
const newTA = new Uint8Array(newLength);
|
|
2424
|
+
apply(uint8ArraySet, newTA, [oldTA]);
|
|
2425
|
+
buffer = apply(uint8ArrayBuffer, newTA, []);
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
const result = makeImmutableArrayBufferInternal(buffer);
|
|
2429
|
+
return /** @type {ArrayBuffer} */ (/** @type {unknown} */ (result));
|
|
2430
|
+
};
|
|
2431
|
+
} else {
|
|
2432
|
+
transferBufferToImmutable = undefined;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
const optTransferBufferToImmutable = transferBufferToImmutable;$h͏_once.optTransferBufferToImmutable(optTransferBufferToImmutable);
|
|
2205
2436
|
})()
|
|
2206
2437
|
,
|
|
2207
|
-
// === 5. immutable-arraybuffer ./shim
|
|
2208
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let isBufferImmutable,sliceBufferToImmutable;$h͏_imports([["./
|
|
2438
|
+
// === 5. immutable-arraybuffer ./src/immutable-arraybuffer-shim.js ===
|
|
2439
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let isBufferImmutable,sliceBufferToImmutable,optXferBuf2Immu;$h͏_imports([["./immutable-arraybuffer-pony.js", [["isBufferImmutable",[$h͏_a => (isBufferImmutable = $h͏_a)]],["sliceBufferToImmutable",[$h͏_a => (sliceBufferToImmutable = $h͏_a)]],["optTransferBufferToImmutable",[$h͏_a => (optXferBuf2Immu = $h͏_a)]]]]]);
|
|
2440
|
+
|
|
2441
|
+
|
|
2209
2442
|
|
|
2210
2443
|
|
|
2211
2444
|
|
|
2212
2445
|
|
|
2213
|
-
|
|
2446
|
+
|
|
2447
|
+
const {
|
|
2448
|
+
ArrayBuffer,
|
|
2449
|
+
JSON,
|
|
2450
|
+
Object,
|
|
2451
|
+
Reflect
|
|
2452
|
+
// eslint-disable-next-line no-restricted-globals
|
|
2453
|
+
} = globalThis;
|
|
2454
|
+
|
|
2455
|
+
// Even though the imported one is not exported by the pony as a live binding,
|
|
2456
|
+
// TS doesn't know that,
|
|
2457
|
+
// so it cannot do its normal flow-based inference. By making and using a local
|
|
2458
|
+
// copy, no problem.
|
|
2459
|
+
const optTransferBufferToImmutable = optXferBuf2Immu;
|
|
2460
|
+
|
|
2461
|
+
const { getOwnPropertyDescriptors, defineProperties, defineProperty } = Object;
|
|
2462
|
+
const { ownKeys } = Reflect;
|
|
2214
2463
|
const { prototype: arrayBufferPrototype } = ArrayBuffer;
|
|
2464
|
+
const { stringify } = JSON;
|
|
2215
2465
|
|
|
2216
2466
|
const arrayBufferMethods = {
|
|
2217
2467
|
/**
|
|
2218
2468
|
* Creates an immutable slice of the given buffer.
|
|
2469
|
+
*
|
|
2219
2470
|
* @this {ArrayBuffer} buffer The original buffer.
|
|
2220
2471
|
* @param {number} [start] The start index.
|
|
2221
2472
|
* @param {number} [end] The end index.
|
|
@@ -2224,30 +2475,57 @@ const arrayBufferMethods = {
|
|
|
2224
2475
|
sliceToImmutable(start = undefined, end = undefined) {
|
|
2225
2476
|
return sliceBufferToImmutable(this, start, end);
|
|
2226
2477
|
},
|
|
2478
|
+
|
|
2479
|
+
/**
|
|
2480
|
+
* @this {ArrayBuffer}
|
|
2481
|
+
*/
|
|
2227
2482
|
get immutable() {
|
|
2228
2483
|
return isBufferImmutable(this);
|
|
2229
2484
|
},
|
|
2485
|
+
|
|
2486
|
+
...(optTransferBufferToImmutable
|
|
2487
|
+
? {
|
|
2488
|
+
/**
|
|
2489
|
+
* Transfer the contents to a new immutable ArrayBuffer
|
|
2490
|
+
*
|
|
2491
|
+
* @this {ArrayBuffer} buffer The original buffer.
|
|
2492
|
+
* @param {number} [newLength] The start index.
|
|
2493
|
+
* @returns {ArrayBuffer} The new immutable ArrayBuffer.
|
|
2494
|
+
*/
|
|
2495
|
+
transferToImmutable(newLength = undefined) {
|
|
2496
|
+
return optTransferBufferToImmutable(this, newLength);
|
|
2497
|
+
},
|
|
2498
|
+
}
|
|
2499
|
+
: {}),
|
|
2230
2500
|
};
|
|
2231
2501
|
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2502
|
+
// Better fidelity emulation of a class prototype
|
|
2503
|
+
for (const key of ownKeys(arrayBufferMethods)) {
|
|
2504
|
+
defineProperty(arrayBufferMethods, key, {
|
|
2505
|
+
enumerable: false,
|
|
2506
|
+
});
|
|
2236
2507
|
}
|
|
2237
2508
|
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2509
|
+
// Modern shim practice frowns on conditional installation, at least for
|
|
2510
|
+
// proposals prior to stage 3. This is so changes to the proposal since
|
|
2511
|
+
// an old shim was distributed don't need to worry about the proposal
|
|
2512
|
+
// breaking old code depending on the old shim. Thus, if we detect that
|
|
2513
|
+
// we're about to overwrite a prior installation, we simply issue this
|
|
2514
|
+
// warning and continue.
|
|
2515
|
+
//
|
|
2516
|
+
// TODO, if the primordials are frozen after the prior implementation, such as
|
|
2517
|
+
// by `lockdown`, then this precludes overwriting as expected. However, for
|
|
2518
|
+
// this case, the following warning text will be confusing.
|
|
2519
|
+
//
|
|
2520
|
+
// Allowing polymorphic calls because these occur during initialization.
|
|
2521
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
2522
|
+
const overwrites = ownKeys(arrayBufferMethods).filter(
|
|
2523
|
+
key => key in arrayBufferPrototype,
|
|
2524
|
+
);
|
|
2525
|
+
if (overwrites.length > 0) {
|
|
2526
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
2249
2527
|
console.warn(
|
|
2250
|
-
|
|
2528
|
+
`About to overwrite ArrayBuffer.prototype properties ${stringify(overwrites)}`,
|
|
2251
2529
|
);
|
|
2252
2530
|
}
|
|
2253
2531
|
|
|
@@ -2257,7 +2535,11 @@ defineProperties(
|
|
|
2257
2535
|
);
|
|
2258
2536
|
})()
|
|
2259
2537
|
,
|
|
2260
|
-
// === 6.
|
|
2538
|
+
// === 6. immutable-arraybuffer ./shim.js ===
|
|
2539
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/immutable-arraybuffer-shim.js", []]]);
|
|
2540
|
+
})()
|
|
2541
|
+
,
|
|
2542
|
+
// === 7. ses ./src/error/stringify-utils.js ===
|
|
2261
2543
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,isArray,arrayJoin,arraySlice,arraySort,arrayMap,keys,fromEntries,freeze,is,isError,setAdd,setHas,stringIncludes,stringStartsWith,stringifyJson,toStringTagSymbol;$h͏_imports([["../commons.js", [["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arraySlice",[$h͏_a => (arraySlice = $h͏_a)]],["arraySort",[$h͏_a => (arraySort = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["keys",[$h͏_a => (keys = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["setAdd",[$h͏_a => (setAdd = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]],["stringIncludes",[$h͏_a => (stringIncludes = $h͏_a)]],["stringStartsWith",[$h͏_a => (stringStartsWith = $h͏_a)]],["stringifyJson",[$h͏_a => (stringifyJson = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]]]]]);
|
|
2262
2544
|
|
|
2263
2545
|
|
|
@@ -2281,12 +2563,12 @@ defineProperties(
|
|
|
2281
2563
|
|
|
2282
2564
|
|
|
2283
2565
|
|
|
2284
|
-
/** @import {
|
|
2566
|
+
/** @import {Stringable} from '../../types.js' */
|
|
2285
2567
|
|
|
2286
2568
|
/**
|
|
2287
2569
|
* Joins English terms with commas and an optional conjunction.
|
|
2288
2570
|
*
|
|
2289
|
-
* @param {(string |
|
|
2571
|
+
* @param {(string | Stringable)[]} terms
|
|
2290
2572
|
* @param {"and" | "or"} conjunction
|
|
2291
2573
|
*/
|
|
2292
2574
|
const enJoin = (terms, conjunction) => {
|
|
@@ -2454,10 +2736,10 @@ const bestEffortStringify = (payload, spaces = undefined) => {
|
|
|
2454
2736
|
freeze(bestEffortStringify);
|
|
2455
2737
|
})()
|
|
2456
2738
|
,
|
|
2457
|
-
// ===
|
|
2739
|
+
// === 8. ses ./src/error/types.js ===
|
|
2458
2740
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
|
|
2459
2741
|
|
|
2460
|
-
/** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken,
|
|
2742
|
+
/** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken, Stringable} from '../../types.js' */
|
|
2461
2743
|
|
|
2462
2744
|
/**
|
|
2463
2745
|
* @typedef {object} VirtualConsole
|
|
@@ -2516,7 +2798,7 @@ freeze(bestEffortStringify);
|
|
|
2516
2798
|
*/
|
|
2517
2799
|
})()
|
|
2518
2800
|
,
|
|
2519
|
-
// ===
|
|
2801
|
+
// === 9. ses ./src/error/internal-types.js ===
|
|
2520
2802
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
|
|
2521
2803
|
|
|
2522
2804
|
/**
|
|
@@ -2617,10 +2899,15 @@ freeze(bestEffortStringify);
|
|
|
2617
2899
|
*/
|
|
2618
2900
|
})()
|
|
2619
2901
|
,
|
|
2620
|
-
// ===
|
|
2902
|
+
// === 10. cache-map ./src/cachemap.js ===
|
|
2621
2903
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
|
|
2904
|
+
/* global globalThis */
|
|
2622
2905
|
/* eslint-disable @endo/no-polymorphic-call */
|
|
2623
2906
|
|
|
2907
|
+
// eslint-disable-next-line no-restricted-globals
|
|
2908
|
+
const { Error, TypeError, WeakMap } = globalThis;
|
|
2909
|
+
// eslint-disable-next-line no-restricted-globals
|
|
2910
|
+
const { parse, stringify } = JSON;
|
|
2624
2911
|
// eslint-disable-next-line no-restricted-globals
|
|
2625
2912
|
const { isSafeInteger } = Number;
|
|
2626
2913
|
// eslint-disable-next-line no-restricted-globals
|
|
@@ -2628,227 +2915,323 @@ const { freeze } = Object;
|
|
|
2628
2915
|
// eslint-disable-next-line no-restricted-globals
|
|
2629
2916
|
const { toStringTag: toStringTagSymbol } = Symbol;
|
|
2630
2917
|
|
|
2918
|
+
// eslint-disable-next-line no-restricted-globals
|
|
2919
|
+
const UNKNOWN_KEY = Symbol('UNKNOWN_KEY');
|
|
2920
|
+
|
|
2631
2921
|
/**
|
|
2632
|
-
* @template
|
|
2633
|
-
* @typedef {object}
|
|
2634
|
-
*
|
|
2635
|
-
*
|
|
2636
|
-
* any abstraction that uses them.
|
|
2637
|
-
* @property {DoublyLinkedCell<Data>} next
|
|
2638
|
-
* @property {DoublyLinkedCell<Data>} prev
|
|
2639
|
-
* @property {Data} data
|
|
2922
|
+
* @template T
|
|
2923
|
+
* @typedef {T extends object ? { -readonly [K in keyof T]: T[K] } : never} WritableDeep
|
|
2924
|
+
* Intentionally limited to local needs; refer to
|
|
2925
|
+
* https://github.com/sindresorhus/type-fest if insufficient.
|
|
2640
2926
|
*/
|
|
2641
2927
|
|
|
2642
2928
|
/**
|
|
2643
|
-
*
|
|
2644
|
-
*
|
|
2645
|
-
*
|
|
2646
|
-
*
|
|
2647
|
-
* @template Data
|
|
2648
|
-
* @param {Data} data
|
|
2649
|
-
* @returns {DoublyLinkedCell<Data>}
|
|
2929
|
+
* @template T
|
|
2930
|
+
* @param {T} value
|
|
2931
|
+
* @param {<U,>(name: string, value: U) => U} [reviver]
|
|
2932
|
+
* @returns {WritableDeep<T>}
|
|
2650
2933
|
*/
|
|
2651
|
-
const
|
|
2652
|
-
|
|
2653
|
-
const
|
|
2654
|
-
|
|
2655
|
-
prev: undefined,
|
|
2656
|
-
data,
|
|
2657
|
-
};
|
|
2658
|
-
const selfCell = /** @type {DoublyLinkedCell<Data>} */ (incompleteCell);
|
|
2659
|
-
selfCell.next = selfCell;
|
|
2660
|
-
selfCell.prev = selfCell;
|
|
2661
|
-
// Not frozen!
|
|
2662
|
-
return selfCell;
|
|
2934
|
+
const deepCopyJsonable = (value, reviver) => {
|
|
2935
|
+
const encoded = stringify(value);
|
|
2936
|
+
const decoded = parse(encoded, reviver);
|
|
2937
|
+
return decoded;
|
|
2663
2938
|
};
|
|
2664
2939
|
|
|
2940
|
+
const freezingReviver = (_name, value) => freeze(value);
|
|
2941
|
+
|
|
2942
|
+
/** @type {<T,>(value: T) => T} */
|
|
2943
|
+
const deepCopyAndFreezeJsonable = value =>
|
|
2944
|
+
deepCopyJsonable(value, freezingReviver);
|
|
2945
|
+
|
|
2665
2946
|
/**
|
|
2666
|
-
*
|
|
2667
|
-
*
|
|
2668
|
-
*
|
|
2947
|
+
* A cache of bounded size, implementing the WeakMap interface but holding keys
|
|
2948
|
+
* strongly if created with a non-weak `makeMap` option of
|
|
2949
|
+
* {@link makeCacheMapKit}.
|
|
2669
2950
|
*
|
|
2670
|
-
* @template
|
|
2671
|
-
* @
|
|
2672
|
-
* @
|
|
2951
|
+
* @template K
|
|
2952
|
+
* @template V
|
|
2953
|
+
* @typedef {Pick<Map<K, V>, Exclude<keyof WeakMap<WeakKey, *>, 'set'>> & {set: (key: K, value: V) => WeakMapAPI<K, V>}} WeakMapAPI
|
|
2673
2954
|
*/
|
|
2674
|
-
const spliceAfter = (prev, selfCell) => {
|
|
2675
|
-
if (prev === selfCell) {
|
|
2676
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2677
|
-
throw TypeError('Cannot splice a cell into itself');
|
|
2678
|
-
}
|
|
2679
|
-
if (selfCell.next !== selfCell || selfCell.prev !== selfCell) {
|
|
2680
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2681
|
-
throw TypeError('Expected self-linked cell');
|
|
2682
|
-
}
|
|
2683
|
-
const cell = selfCell;
|
|
2684
|
-
// rename variable cause it isn't self-linked after this point.
|
|
2685
2955
|
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2956
|
+
/**
|
|
2957
|
+
* @template K
|
|
2958
|
+
* @template V
|
|
2959
|
+
* @typedef {WeakMapAPI<K, V> & ({clear?: undefined} | Pick<Map<K, V>, 'clear'>)} SingleEntryMap
|
|
2960
|
+
*/
|
|
2961
|
+
|
|
2962
|
+
/**
|
|
2963
|
+
* A cell of a doubly-linked ring (circular list) for a cache map.
|
|
2964
|
+
* Instances are not frozen, and so should be closely encapsulated.
|
|
2965
|
+
*
|
|
2966
|
+
* @template K
|
|
2967
|
+
* @template V
|
|
2968
|
+
* @typedef {object} CacheMapCell
|
|
2969
|
+
* @property {number} id for debugging
|
|
2970
|
+
* @property {CacheMapCell<K, V>} next
|
|
2971
|
+
* @property {CacheMapCell<K, V>} prev
|
|
2972
|
+
* @property {SingleEntryMap<K, V>} data
|
|
2973
|
+
*/
|
|
2974
|
+
|
|
2975
|
+
/**
|
|
2976
|
+
* @template K
|
|
2977
|
+
* @template V
|
|
2978
|
+
* @param {CacheMapCell<K, V>} prev
|
|
2979
|
+
* @param {number} id
|
|
2980
|
+
* @param {SingleEntryMap<K, V>} data
|
|
2981
|
+
* @returns {CacheMapCell<K, V>}
|
|
2982
|
+
*/
|
|
2983
|
+
const appendNewCell = (prev, id, data) => {
|
|
2984
|
+
const next = prev?.next;
|
|
2985
|
+
const cell = { id, next, prev, data };
|
|
2689
2986
|
prev.next = cell;
|
|
2690
2987
|
next.prev = cell;
|
|
2691
|
-
// Not frozen!
|
|
2692
2988
|
return cell;
|
|
2693
2989
|
};
|
|
2694
2990
|
|
|
2695
2991
|
/**
|
|
2696
|
-
* @template
|
|
2697
|
-
* @
|
|
2698
|
-
*
|
|
2992
|
+
* @template K
|
|
2993
|
+
* @template V
|
|
2994
|
+
* @param {CacheMapCell<K, V>} cell
|
|
2995
|
+
* @param {CacheMapCell<K, V>} prev
|
|
2996
|
+
* @param {CacheMapCell<K, V>} [next]
|
|
2699
2997
|
*/
|
|
2700
|
-
const
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2998
|
+
const moveCellAfter = (cell, prev, next = prev.next) => {
|
|
2999
|
+
if (cell === prev || cell === next) return; // already in position
|
|
3000
|
+
|
|
3001
|
+
// Splice out cell.
|
|
3002
|
+
const { prev: oldPrev, next: oldNext } = cell;
|
|
3003
|
+
oldPrev.next = oldNext;
|
|
3004
|
+
oldNext.prev = oldPrev;
|
|
3005
|
+
|
|
3006
|
+
// Splice in cell after prev.
|
|
3007
|
+
cell.prev = prev;
|
|
3008
|
+
cell.next = next;
|
|
3009
|
+
prev.next = cell;
|
|
3010
|
+
next.prev = cell;
|
|
2706
3011
|
};
|
|
2707
3012
|
|
|
2708
3013
|
/**
|
|
2709
|
-
*
|
|
2710
|
-
*
|
|
2711
|
-
* rather than a `WeakMapStore`-like interface. To work before `lockdown`,
|
|
2712
|
-
* the implementation must use `freeze` manually, but still exhaustively.
|
|
3014
|
+
* Clear out a cell to prepare it for future use. Its map is preserved when
|
|
3015
|
+
* possible, but must instead be replaced if the associated key is not known.
|
|
2713
3016
|
*
|
|
2714
|
-
*
|
|
2715
|
-
*
|
|
2716
|
-
*
|
|
2717
|
-
*
|
|
2718
|
-
*
|
|
2719
|
-
* itself will stay in memory.
|
|
2720
|
-
*
|
|
2721
|
-
* @template {{}} K
|
|
2722
|
-
* @template {unknown} V
|
|
2723
|
-
* @param {number} keysBudget
|
|
2724
|
-
* @returns {WeakMap<K,V>}
|
|
3017
|
+
* @template K
|
|
3018
|
+
* @template V
|
|
3019
|
+
* @param {CacheMapCell<K, V>} cell
|
|
3020
|
+
* @param {K | UNKNOWN_KEY} oldKey
|
|
3021
|
+
* @param {() => SingleEntryMap<K, V>} [makeMap] required when the key is unknown
|
|
2725
3022
|
*/
|
|
2726
|
-
|
|
2727
|
-
if (
|
|
2728
|
-
|
|
2729
|
-
|
|
3023
|
+
const resetCell = (cell, oldKey, makeMap) => {
|
|
3024
|
+
if (oldKey !== UNKNOWN_KEY) {
|
|
3025
|
+
cell.data.delete(oldKey);
|
|
3026
|
+
return;
|
|
2730
3027
|
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
3028
|
+
if (cell.data.clear) {
|
|
3029
|
+
cell.data.clear();
|
|
3030
|
+
return;
|
|
3031
|
+
}
|
|
3032
|
+
// WeakMap instances must be replaced when the key is unknown.
|
|
3033
|
+
if (!makeMap) {
|
|
3034
|
+
throw Error('internal: makeMap is required with UNKNOWN_KEY');
|
|
3035
|
+
}
|
|
3036
|
+
cell.data = makeMap();
|
|
3037
|
+
};
|
|
2739
3038
|
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
3039
|
+
const zeroMetrics = freeze({
|
|
3040
|
+
totalQueryCount: 0,
|
|
3041
|
+
totalHitCount: 0
|
|
3042
|
+
// TODO?
|
|
3043
|
+
// * method-specific counts
|
|
3044
|
+
// * liveTouchStats/evictedTouchStats { count, sum, mean, min, max }
|
|
3045
|
+
// * p50/p90/p95/p99 via Ben-Haim/Tom-Tov streaming histograms
|
|
3046
|
+
});
|
|
3047
|
+
/** @typedef {typeof zeroMetrics} CacheMapMetrics */
|
|
3048
|
+
|
|
3049
|
+
/**
|
|
3050
|
+
* @template {MapConstructor | WeakMapConstructor} [C=WeakMapConstructor]
|
|
3051
|
+
* @template {Parameters<InstanceType<C>['set']>[0]} [K=Parameters<InstanceType<C>['set']>[0]]
|
|
3052
|
+
* @template {unknown} [V=unknown]
|
|
3053
|
+
* @typedef {object} CacheMapKit
|
|
3054
|
+
* @property {WeakMapAPI<K, V>} cache
|
|
3055
|
+
* @property {() => CacheMapMetrics} getMetrics
|
|
3056
|
+
*/
|
|
3057
|
+
|
|
3058
|
+
/**
|
|
3059
|
+
* Create a bounded-size cache having WeakMap-compatible
|
|
3060
|
+
* `has`/`get`/`set`/`delete` methods, capable of supporting SES (specifically
|
|
3061
|
+
* `assert` error notes).
|
|
3062
|
+
* Key validity, comparison, and referential strength are controlled by the
|
|
3063
|
+
* `makeMap` option, which defaults to `WeakMap` but can be set to any producer
|
|
3064
|
+
* of objects with those methods (e.g., using `Map` allows for arbitrary keys
|
|
3065
|
+
* which will be strongly held).
|
|
3066
|
+
* Cache eviction policy is not currently configurable, but strives for a hit
|
|
3067
|
+
* ratio at least as good as
|
|
3068
|
+
* [LRU](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU) (e.g., it
|
|
3069
|
+
* might be
|
|
3070
|
+
* [CLOCK](https://en.wikipedia.org/wiki/Page_replacement_algorithm#Clock)
|
|
3071
|
+
* or [SIEVE](https://sievecache.com/)).
|
|
3072
|
+
*
|
|
3073
|
+
* @template {MapConstructor | WeakMapConstructor} [C=WeakMapConstructor]
|
|
3074
|
+
* @template {Parameters<InstanceType<C>['set']>[0]} [K=Parameters<InstanceType<C>['set']>[0]]
|
|
3075
|
+
* @template {unknown} [V=unknown]
|
|
3076
|
+
* @param {number} capacity
|
|
3077
|
+
* @param {object} [options]
|
|
3078
|
+
* @param {C | (() => SingleEntryMap<K, V>)} [options.makeMap]
|
|
3079
|
+
* @returns {CacheMapKit<C, K, V>}
|
|
3080
|
+
*/
|
|
3081
|
+
const makeCacheMapKit = (capacity, options = {}) => {
|
|
3082
|
+
if (!isSafeInteger(capacity) || capacity < 0) {
|
|
3083
|
+
throw TypeError(
|
|
3084
|
+
'capacity must be a non-negative safe integer number <= 2**53 - 1',
|
|
3085
|
+
);
|
|
3086
|
+
}
|
|
2751
3087
|
|
|
2752
3088
|
/**
|
|
2753
|
-
* @
|
|
3089
|
+
* @template V
|
|
3090
|
+
* @type {<V,>() => SingleEntryMap<K, V>}
|
|
2754
3091
|
*/
|
|
2755
|
-
const
|
|
2756
|
-
|
|
3092
|
+
const makeMap = (MaybeCtor => {
|
|
3093
|
+
try {
|
|
3094
|
+
// @ts-expect-error
|
|
3095
|
+
MaybeCtor();
|
|
3096
|
+
return /** @type {any} */ (MaybeCtor);
|
|
3097
|
+
} catch (err) {
|
|
3098
|
+
// @ts-expect-error
|
|
3099
|
+
const constructNewMap = () => new MaybeCtor();
|
|
3100
|
+
return constructNewMap;
|
|
3101
|
+
}
|
|
3102
|
+
})(options.makeMap ?? WeakMap);
|
|
3103
|
+
const tag =
|
|
3104
|
+
/** @type {any} */ (makeMap()).clear === undefined
|
|
3105
|
+
? 'WeakCacheMap'
|
|
3106
|
+
: 'CacheMap';
|
|
3107
|
+
|
|
3108
|
+
/** @type {WeakMapAPI<K, CacheMapCell<K, V>>} */
|
|
3109
|
+
const keyToCell = makeMap();
|
|
3110
|
+
// @ts-expect-error this sentinel head is special
|
|
3111
|
+
const head = /** @type {CacheMapCell<K, V>} */ ({
|
|
3112
|
+
id: 0,
|
|
3113
|
+
// next and prev are established below as self-referential.
|
|
3114
|
+
next: undefined,
|
|
3115
|
+
prev: undefined,
|
|
3116
|
+
data: {
|
|
3117
|
+
has: () => {
|
|
3118
|
+
throw Error('internal: sentinel head cell has no data');
|
|
3119
|
+
},
|
|
3120
|
+
},
|
|
3121
|
+
});
|
|
3122
|
+
head.next = head;
|
|
3123
|
+
head.prev = head;
|
|
3124
|
+
let cellCount = 0;
|
|
3125
|
+
|
|
3126
|
+
const metrics = deepCopyJsonable(zeroMetrics);
|
|
3127
|
+
const getMetrics = () => deepCopyAndFreezeJsonable(metrics);
|
|
2757
3128
|
|
|
2758
3129
|
/**
|
|
2759
|
-
*
|
|
3130
|
+
* Touching moves a cell to first position so LRU eviction can target the last
|
|
3131
|
+
* cell (`head.prev`).
|
|
3132
|
+
*
|
|
3133
|
+
* @type {(key: K) => (CacheMapCell<K, V> | undefined)}
|
|
2760
3134
|
*/
|
|
2761
|
-
|
|
2762
|
-
|
|
3135
|
+
const touchKey = key => {
|
|
3136
|
+
metrics.totalQueryCount += 1;
|
|
3137
|
+
const cell = keyToCell.get(key);
|
|
3138
|
+
if (!cell?.data.has(key)) return undefined;
|
|
3139
|
+
|
|
3140
|
+
metrics.totalHitCount += 1;
|
|
3141
|
+
moveCellAfter(cell, head);
|
|
3142
|
+
return cell;
|
|
3143
|
+
};
|
|
3144
|
+
|
|
3145
|
+
/** @type {WeakMapAPI<K, V>['has']} */
|
|
3146
|
+
const has = key => {
|
|
3147
|
+
const cell = touchKey(key);
|
|
3148
|
+
return cell !== undefined;
|
|
3149
|
+
};
|
|
3150
|
+
freeze(has);
|
|
3151
|
+
|
|
3152
|
+
/** @type {WeakMapAPI<K, V>['get']} */
|
|
2763
3153
|
const get = key => {
|
|
2764
|
-
const cell =
|
|
2765
|
-
return cell
|
|
3154
|
+
const cell = touchKey(key);
|
|
3155
|
+
return cell?.data.get(key);
|
|
2766
3156
|
};
|
|
2767
3157
|
freeze(get);
|
|
2768
3158
|
|
|
2769
|
-
/**
|
|
2770
|
-
* @param {K} key
|
|
2771
|
-
* @param {V} value
|
|
2772
|
-
*/
|
|
3159
|
+
/** @type {WeakMapAPI<K, V>['set']} */
|
|
2773
3160
|
const set = (key, value) => {
|
|
2774
|
-
|
|
3161
|
+
let cell = touchKey(key);
|
|
3162
|
+
if (cell) {
|
|
3163
|
+
cell.data.set(key, value);
|
|
2775
3164
|
// eslint-disable-next-line no-use-before-define
|
|
2776
|
-
return
|
|
3165
|
+
return implementation;
|
|
2777
3166
|
}
|
|
2778
3167
|
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
cell =
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
if (
|
|
2785
|
-
//
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
cell
|
|
2790
|
-
// Advertise the cell for this key.
|
|
2791
|
-
keyToCell.set(key, cell);
|
|
2792
|
-
while (size > keysBudget) {
|
|
2793
|
-
const condemned = head.prev;
|
|
2794
|
-
spliceOut(condemned); // Drop least recently used
|
|
2795
|
-
condemned.data = undefined;
|
|
2796
|
-
size -= 1;
|
|
2797
|
-
}
|
|
3168
|
+
if (cellCount < capacity) {
|
|
3169
|
+
// Add and use a new cell at first position.
|
|
3170
|
+
cell = appendNewCell(head, cellCount + 1, makeMap());
|
|
3171
|
+
cellCount += 1; // intentionally follows cell creation
|
|
3172
|
+
cell.data.set(key, value);
|
|
3173
|
+
} else if (capacity > 0) {
|
|
3174
|
+
// Reuse the current tail, moving it to first position.
|
|
3175
|
+
cell = head.prev;
|
|
3176
|
+
resetCell(/** @type {any} */ (cell), UNKNOWN_KEY, makeMap);
|
|
3177
|
+
cell.data.set(key, value);
|
|
3178
|
+
moveCellAfter(cell, head);
|
|
2798
3179
|
}
|
|
2799
3180
|
|
|
2800
|
-
//
|
|
2801
|
-
cell.
|
|
3181
|
+
// Don't establish this entry until prior steps succeed.
|
|
3182
|
+
if (cell) keyToCell.set(key, cell);
|
|
2802
3183
|
|
|
2803
3184
|
// eslint-disable-next-line no-use-before-define
|
|
2804
|
-
return
|
|
3185
|
+
return implementation;
|
|
2805
3186
|
};
|
|
2806
3187
|
freeze(set);
|
|
2807
3188
|
|
|
2808
3189
|
// "delete" is a keyword.
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
}
|
|
2823
|
-
|
|
2824
|
-
cell.data = undefined;
|
|
2825
|
-
size -= 1;
|
|
2826
|
-
return true;
|
|
3190
|
+
const { delete: deleteEntry } = {
|
|
3191
|
+
/** @type {WeakMapAPI<K, V>['delete']} */
|
|
3192
|
+
delete: key => {
|
|
3193
|
+
const cell = keyToCell.get(key);
|
|
3194
|
+
if (!cell?.data.has(key)) {
|
|
3195
|
+
keyToCell.delete(key);
|
|
3196
|
+
return false;
|
|
3197
|
+
}
|
|
3198
|
+
moveCellAfter(cell, head.prev);
|
|
3199
|
+
resetCell(cell, key);
|
|
3200
|
+
keyToCell.delete(key);
|
|
3201
|
+
return true;
|
|
3202
|
+
},
|
|
2827
3203
|
};
|
|
2828
|
-
freeze(
|
|
3204
|
+
freeze(deleteEntry);
|
|
2829
3205
|
|
|
2830
|
-
const
|
|
3206
|
+
const implementation = /** @type {WeakMapAPI<K, V>} */ ({
|
|
2831
3207
|
has,
|
|
2832
3208
|
get,
|
|
2833
3209
|
set,
|
|
2834
|
-
delete:
|
|
3210
|
+
delete: deleteEntry,
|
|
2835
3211
|
// eslint-disable-next-line jsdoc/check-types
|
|
2836
|
-
[/** @type {typeof Symbol.toStringTag} */ (toStringTagSymbol)]:
|
|
2837
|
-
'LRUCacheMap',
|
|
3212
|
+
[/** @type {typeof Symbol.toStringTag} */ (toStringTagSymbol)]: tag,
|
|
2838
3213
|
});
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
3214
|
+
freeze(implementation);
|
|
3215
|
+
|
|
3216
|
+
const kit = { cache: implementation, getMetrics };
|
|
3217
|
+
return freeze(kit);
|
|
3218
|
+
};$h͏_once.makeCacheMapKit(makeCacheMapKit);
|
|
3219
|
+
freeze(makeCacheMapKit);
|
|
3220
|
+
})()
|
|
3221
|
+
,
|
|
3222
|
+
// === 11. cache-map ./index.js ===
|
|
3223
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/cachemap.js", []]]);
|
|
2842
3224
|
})()
|
|
2843
3225
|
,
|
|
2844
|
-
// ===
|
|
2845
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let
|
|
3226
|
+
// === 12. ses ./src/error/note-log-args.js ===
|
|
3227
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let makeCacheMapKit;$h͏_imports([["@endo/cache-map", [["makeCacheMapKit",[$h͏_a => (makeCacheMapKit = $h͏_a)]]]]]);
|
|
2846
3228
|
|
|
2847
3229
|
|
|
2848
3230
|
|
|
2849
3231
|
|
|
2850
3232
|
|
|
2851
3233
|
/**
|
|
3234
|
+
* @import {CacheMapKit} from '@endo/cache-map';
|
|
2852
3235
|
* @import {LogArgs} from './internal-types.js';
|
|
2853
3236
|
*/
|
|
2854
3237
|
|
|
@@ -2873,16 +3256,16 @@ const defaultArgsPerErrorBudget = 100;
|
|
|
2873
3256
|
}
|
|
2874
3257
|
|
|
2875
3258
|
/**
|
|
2876
|
-
* @type {WeakMap<Error, LogArgs[]>}
|
|
2877
|
-
*
|
|
2878
3259
|
* Maps from an error to an array of log args, where each log args is
|
|
2879
3260
|
* remembered as an annotation on that error. This can be used, for example,
|
|
2880
3261
|
* to keep track of additional causes of the error. The elements of any
|
|
2881
3262
|
* log args may include errors which are associated with further annotations.
|
|
2882
3263
|
* An augmented console, like the causal console of `console.js`, could
|
|
2883
3264
|
* then retrieve the graph of such annotations.
|
|
3265
|
+
*
|
|
3266
|
+
* @type {CacheMapKit<WeakMapConstructor, Error, LogArgs[]>}
|
|
2884
3267
|
*/
|
|
2885
|
-
const noteLogArgsArrayMap =
|
|
3268
|
+
const { cache: noteLogArgsArrayMap } = makeCacheMapKit(errorsBudget);
|
|
2886
3269
|
|
|
2887
3270
|
/**
|
|
2888
3271
|
* @param {Error} error
|
|
@@ -2920,8 +3303,9 @@ const defaultArgsPerErrorBudget = 100;
|
|
|
2920
3303
|
freeze(makeNoteLogArgsArrayKit);
|
|
2921
3304
|
})()
|
|
2922
3305
|
,
|
|
2923
|
-
// ===
|
|
2924
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,
|
|
3306
|
+
// === 13. ses ./src/error/assert.js ===
|
|
3307
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,regexpExec,regexpReplace,sealRegexp,stringIndexOf,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,getOwnPropertyDescriptors,ownKeys,create,objectPrototype,hasOwn,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h͏_imports([["../commons.js", [["RangeError",[$h͏_a => (RangeError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringStartsWith",[$h͏_a => (stringStartsWith = $h͏_a)]],["weakmapDelete",[$h͏_a => (weakmapDelete = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["AggregateError",[$h͏_a => (AggregateError = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]],["./stringify-utils.js", [["an",[$h͏_a => (an = $h͏_a)]],["bestEffortStringify",[$h͏_a => (bestEffortStringify = $h͏_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit",[$h͏_a => (makeNoteLogArgsArrayKit = $h͏_a)]]]]]);
|
|
3308
|
+
|
|
2925
3309
|
|
|
2926
3310
|
|
|
2927
3311
|
|
|
@@ -2970,24 +3354,28 @@ freeze(makeNoteLogArgsArrayKit);
|
|
|
2970
3354
|
|
|
2971
3355
|
|
|
2972
3356
|
/**
|
|
2973
|
-
* @import {BaseAssert, Assert, AssertionFunctions, AssertionUtilities,
|
|
2974
|
-
* @import {LogArgs, NoteCallback, LoggedErrorHandler} from
|
|
3357
|
+
* @import {BaseAssert, Assert, AssertionFunctions, AssertionUtilities, DeprecatedAssertionUtilities, Stringable, DetailsToken, MakeAssert} from '../../types.js';
|
|
3358
|
+
* @import {LogArgs, NoteCallback, LoggedErrorHandler} from './internal-types.js';
|
|
2975
3359
|
*/
|
|
2976
3360
|
|
|
2977
|
-
// For
|
|
3361
|
+
// For internal debugging purposes, uncomment
|
|
2978
3362
|
// const internalDebugConsole = console;
|
|
2979
3363
|
|
|
2980
3364
|
// /////////////////////////////////////////////////////////////////////////////
|
|
2981
3365
|
|
|
2982
|
-
/**
|
|
3366
|
+
/**
|
|
3367
|
+
* Maps the result of a `quote` or `bare` call back to its input value.
|
|
3368
|
+
*
|
|
3369
|
+
* @type {WeakMap<Stringable, any>}
|
|
3370
|
+
*/
|
|
2983
3371
|
const declassifiers = new WeakMap();
|
|
2984
3372
|
|
|
2985
3373
|
/** @type {AssertionUtilities['quote']} */
|
|
2986
|
-
const quote = (
|
|
3374
|
+
const quote = (value, spaces = undefined) => {
|
|
2987
3375
|
const result = freeze({
|
|
2988
|
-
toString: freeze(() => bestEffortStringify(
|
|
3376
|
+
toString: freeze(() => bestEffortStringify(value, spaces)),
|
|
2989
3377
|
});
|
|
2990
|
-
weakmapSet(declassifiers, result,
|
|
3378
|
+
weakmapSet(declassifiers, result, value);
|
|
2991
3379
|
return result;
|
|
2992
3380
|
};$h͏_once.quote(quote);
|
|
2993
3381
|
freeze(quote);
|
|
@@ -2997,14 +3385,14 @@ const canBeBare = freeze(/^[\w:-]( ?[\w:-])*$/);
|
|
|
2997
3385
|
/**
|
|
2998
3386
|
* @type {AssertionUtilities['bare']}
|
|
2999
3387
|
*/
|
|
3000
|
-
const bare = (
|
|
3001
|
-
if (typeof
|
|
3002
|
-
return quote(
|
|
3388
|
+
const bare = (text, spaces = undefined) => {
|
|
3389
|
+
if (typeof text !== 'string' || !regexpExec(canBeBare, text)) {
|
|
3390
|
+
return quote(text, spaces);
|
|
3003
3391
|
}
|
|
3004
3392
|
const result = freeze({
|
|
3005
|
-
toString: freeze(() =>
|
|
3393
|
+
toString: freeze(() => text),
|
|
3006
3394
|
});
|
|
3007
|
-
weakmapSet(declassifiers, result,
|
|
3395
|
+
weakmapSet(declassifiers, result, text);
|
|
3008
3396
|
return result;
|
|
3009
3397
|
};$h͏_once.bare(bare);
|
|
3010
3398
|
freeze(bare);
|
|
@@ -3012,24 +3400,28 @@ freeze(bare);
|
|
|
3012
3400
|
// /////////////////////////////////////////////////////////////////////////////
|
|
3013
3401
|
|
|
3014
3402
|
/**
|
|
3015
|
-
* @typedef {
|
|
3403
|
+
* @typedef {{ template: TemplateStringsArray | string[], args: any[] }} DetailsParts
|
|
3016
3404
|
*
|
|
3017
|
-
*
|
|
3405
|
+
* The contents of a `details` template literal tag: literal strings (always at
|
|
3406
|
+
* least one) and arbitrary substitution values from in between them.
|
|
3018
3407
|
*
|
|
3019
|
-
*
|
|
3020
|
-
*
|
|
3408
|
+
* Unquoted substitution values are sensitive (and are redacted in error
|
|
3409
|
+
* `message` strings), so a DetailsPart must not leak outside of this file.
|
|
3021
3410
|
*/
|
|
3022
3411
|
|
|
3023
3412
|
/**
|
|
3024
|
-
*
|
|
3413
|
+
* Maps the result of a `details` tagged template literal back to a record of
|
|
3414
|
+
* that template literal's contents.
|
|
3025
3415
|
*
|
|
3026
|
-
*
|
|
3027
|
-
* to a record of the contents of that template literal expression.
|
|
3416
|
+
* @type {WeakMap<DetailsToken, DetailsParts>}
|
|
3028
3417
|
*/
|
|
3029
3418
|
const hiddenDetailsMap = new WeakMap();
|
|
3030
3419
|
|
|
3031
3420
|
/**
|
|
3032
|
-
*
|
|
3421
|
+
* Construct an error message string from `details` template literal contents,
|
|
3422
|
+
* replacing unquoted substitution values with redactions.
|
|
3423
|
+
*
|
|
3424
|
+
* @param {DetailsParts} hiddenDetails
|
|
3033
3425
|
* @returns {string}
|
|
3034
3426
|
*/
|
|
3035
3427
|
const getMessageString = ({ template, args }) => {
|
|
@@ -3050,16 +3442,14 @@ const getMessageString = ({ template, args }) => {
|
|
|
3050
3442
|
};
|
|
3051
3443
|
|
|
3052
3444
|
/**
|
|
3053
|
-
*
|
|
3054
|
-
* creating new
|
|
3055
|
-
*
|
|
3056
|
-
*
|
|
3057
|
-
* `
|
|
3058
|
-
* registered in `redactedDetails`, which should be exactly the detailsTokens.
|
|
3445
|
+
* Define `toString` behavior for DetailsToken. To minimize the overhead of
|
|
3446
|
+
* creating new instances, we do this with an inherited `this`-sensitive method,
|
|
3447
|
+
* even though we normally avoid such sensitivity. To protect the method from
|
|
3448
|
+
* inappropriate application, it verifies that `this` is registered in
|
|
3449
|
+
* `redactedDetails` before doing interesting work.
|
|
3059
3450
|
*
|
|
3060
|
-
* The
|
|
3061
|
-
* the same
|
|
3062
|
-
* string for a thrown assertion error.
|
|
3451
|
+
* The behavior must not reveal anything redacted, so we use `getMessageString`
|
|
3452
|
+
* to return the same value as the message for a thrown assertion-failure error.
|
|
3063
3453
|
*/
|
|
3064
3454
|
const DetailsTokenProto = freeze({
|
|
3065
3455
|
toString() {
|
|
@@ -3079,16 +3469,15 @@ freeze(DetailsTokenProto.toString);
|
|
|
3079
3469
|
* given to `lockdown`, then `unredactedDetails` is used instead.
|
|
3080
3470
|
*
|
|
3081
3471
|
* There are some unconditional uses of `redactedDetails` in this module. All
|
|
3082
|
-
* of them should be uses where the template literal has no redacted
|
|
3083
|
-
* substitution values. In those cases,
|
|
3472
|
+
* of them should be uses where the template literal has no redacted (unquoted)
|
|
3473
|
+
* substitution values. In those cases, `redactedDetails` is equivalent to
|
|
3474
|
+
* `unredactedDetails`.
|
|
3084
3475
|
*
|
|
3085
3476
|
* @type {AssertionUtilities['details']}
|
|
3086
3477
|
*/
|
|
3087
3478
|
const redactedDetails = (template, ...args) => {
|
|
3088
|
-
//
|
|
3089
|
-
//
|
|
3090
|
-
// possible. Hence we store what we've got with little processing, postponing
|
|
3091
|
-
// all the work to happen only if needed, for example, if an assertion fails.
|
|
3479
|
+
// In case the result of this call is never used, perform as little processing
|
|
3480
|
+
// as possible here to keep things fast.
|
|
3092
3481
|
const detailsToken = freeze({ __proto__: DetailsTokenProto });
|
|
3093
3482
|
weakmapSet(hiddenDetailsMap, detailsToken, { template, args });
|
|
3094
3483
|
return /** @type {DetailsToken} */ (/** @type {unknown} */ (detailsToken));
|
|
@@ -3118,8 +3507,15 @@ const unredactedDetails = (template, ...args) => {
|
|
|
3118
3507
|
freeze(unredactedDetails);
|
|
3119
3508
|
|
|
3120
3509
|
|
|
3510
|
+
const leadingSpacePattern = sealRegexp(/^ /);
|
|
3511
|
+
const trailingSpacePattern = sealRegexp(/ $/);
|
|
3512
|
+
|
|
3121
3513
|
/**
|
|
3122
|
-
*
|
|
3514
|
+
* Get arguments suitable for a console logger function (e.g., `console.error`)
|
|
3515
|
+
* from `details` template literal contents, unquoting quoted substitution
|
|
3516
|
+
* values.
|
|
3517
|
+
*
|
|
3518
|
+
* @param {DetailsParts} hiddenDetails
|
|
3123
3519
|
* @returns {LogArgs}
|
|
3124
3520
|
*/
|
|
3125
3521
|
const getLogArgs = ({ template, args }) => {
|
|
@@ -3129,14 +3525,22 @@ const getLogArgs = ({ template, args }) => {
|
|
|
3129
3525
|
if (weakmapHas(declassifiers, arg)) {
|
|
3130
3526
|
arg = weakmapGet(declassifiers, arg);
|
|
3131
3527
|
}
|
|
3132
|
-
// Remove
|
|
3133
|
-
//
|
|
3134
|
-
const
|
|
3135
|
-
|
|
3136
|
-
|
|
3528
|
+
// Remove substitution-adjacent spaces from template fixed-string parts
|
|
3529
|
+
// (since console logging inserts its own argument-separating spaces).
|
|
3530
|
+
const prevLiteralPart = regexpReplace(
|
|
3531
|
+
trailingSpacePattern,
|
|
3532
|
+
arrayPop(logArgs) || '',
|
|
3533
|
+
'',
|
|
3534
|
+
);
|
|
3535
|
+
if (prevLiteralPart !== '') {
|
|
3536
|
+
arrayPush(logArgs, prevLiteralPart);
|
|
3137
3537
|
}
|
|
3138
|
-
const
|
|
3139
|
-
|
|
3538
|
+
const nextLiteralPart = regexpReplace(
|
|
3539
|
+
leadingSpacePattern,
|
|
3540
|
+
template[i + 1],
|
|
3541
|
+
'',
|
|
3542
|
+
);
|
|
3543
|
+
arrayPush(logArgs, arg, nextLiteralPart);
|
|
3140
3544
|
}
|
|
3141
3545
|
if (logArgs[logArgs.length - 1] === '') {
|
|
3142
3546
|
arrayPop(logArgs);
|
|
@@ -3145,11 +3549,11 @@ const getLogArgs = ({ template, args }) => {
|
|
|
3145
3549
|
};
|
|
3146
3550
|
|
|
3147
3551
|
/**
|
|
3148
|
-
*
|
|
3552
|
+
* Maps from an error object to arguments suitable for a privileged console
|
|
3553
|
+
* logger function such as `console.error`, including values that may be
|
|
3554
|
+
* redacted in the error's `message`.
|
|
3149
3555
|
*
|
|
3150
|
-
*
|
|
3151
|
-
* alternative message for that error. When logging the error, these
|
|
3152
|
-
* log args should be preferred to `error.message`.
|
|
3556
|
+
* @type {WeakMap<Error, LogArgs>}
|
|
3153
3557
|
*/
|
|
3154
3558
|
const hiddenMessageLogArgs = new WeakMap();
|
|
3155
3559
|
|
|
@@ -3220,27 +3624,24 @@ const tagError = (err, optErrorName = err.name) => {
|
|
|
3220
3624
|
for (const name of restNames) {
|
|
3221
3625
|
delete error[name];
|
|
3222
3626
|
}
|
|
3223
|
-
const
|
|
3627
|
+
const dropped = create(objectPrototype, restDescs);
|
|
3628
|
+
const droppedDetails = redactedDetails`originally with properties ${quote(dropped)}`;
|
|
3224
3629
|
// eslint-disable-next-line no-use-before-define
|
|
3225
|
-
note(
|
|
3226
|
-
error,
|
|
3227
|
-
redactedDetails`originally with properties ${quote(droppedNote)}`,
|
|
3228
|
-
);
|
|
3630
|
+
note(error, droppedDetails);
|
|
3229
3631
|
}
|
|
3230
3632
|
for (const name of ownKeys(error)) {
|
|
3231
|
-
// @ts-expect-error
|
|
3633
|
+
// @ts-expect-error TypeScript is still confused by symbols as property keys
|
|
3232
3634
|
const desc = descs[name];
|
|
3233
|
-
if (desc &&
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
});
|
|
3635
|
+
if (desc && hasOwn(desc, 'get')) {
|
|
3636
|
+
const value = error[name]; // invokes the getter
|
|
3637
|
+
defineProperty(error, name, { value });
|
|
3237
3638
|
}
|
|
3238
3639
|
}
|
|
3239
3640
|
freeze(error);
|
|
3240
3641
|
};
|
|
3241
3642
|
|
|
3242
3643
|
/**
|
|
3243
|
-
* @type {AssertionUtilities['
|
|
3644
|
+
* @type {AssertionUtilities['makeError']}
|
|
3244
3645
|
*/$h͏_once.sanitizeError(sanitizeError);
|
|
3245
3646
|
const makeError = (
|
|
3246
3647
|
optDetails = redactedDetails`Assert failed`,
|
|
@@ -3252,9 +3653,9 @@ const makeError = (
|
|
|
3252
3653
|
sanitize = true,
|
|
3253
3654
|
} = {},
|
|
3254
3655
|
) => {
|
|
3656
|
+
// Promote string-valued `optDetails` into a minimal DetailsParts
|
|
3657
|
+
// consisting of that string as the sole literal part with no substitutions.
|
|
3255
3658
|
if (typeof optDetails === 'string') {
|
|
3256
|
-
// If it is a string, use it as the literal part of the template so
|
|
3257
|
-
// it doesn't get quoted.
|
|
3258
3659
|
optDetails = redactedDetails([optDetails]);
|
|
3259
3660
|
}
|
|
3260
3661
|
const hiddenDetails = weakmapGet(hiddenDetailsMap, optDetails);
|
|
@@ -3270,13 +3671,11 @@ const makeError = (
|
|
|
3270
3671
|
) {
|
|
3271
3672
|
error = AggregateError(errors || [], messageString, opts);
|
|
3272
3673
|
} else {
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3674
|
+
const ErrorCtor = /** @type {ErrorConstructor} */ (errConstructor);
|
|
3675
|
+
error = ErrorCtor(messageString, opts);
|
|
3676
|
+
// Since we need to tolerate `errors` on an AggregateError, we may as well
|
|
3677
|
+
// tolerate it on all errors.
|
|
3277
3678
|
if (errors !== undefined) {
|
|
3278
|
-
// Since we need to tolerate `errors` on an AggregateError, may as
|
|
3279
|
-
// well tolerate it on all errors.
|
|
3280
3679
|
defineProperty(error, 'errors', {
|
|
3281
3680
|
value: errors,
|
|
3282
3681
|
writable: true,
|
|
@@ -3299,11 +3698,10 @@ freeze(makeError);
|
|
|
3299
3698
|
|
|
3300
3699
|
// /////////////////////////////////////////////////////////////////////////////
|
|
3301
3700
|
|
|
3302
|
-
const { addLogArgs, takeLogArgsArray } =
|
|
3701
|
+
const { addLogArgs: addNoteLogArgs, takeLogArgsArray: takeAllNoteLogArgs } =
|
|
3702
|
+
makeNoteLogArgsArrayKit();
|
|
3303
3703
|
|
|
3304
3704
|
/**
|
|
3305
|
-
* @type {WeakMap<Error, NoteCallback[]>}
|
|
3306
|
-
*
|
|
3307
3705
|
* An augmented console will normally only take the hidden noteArgs array once,
|
|
3308
3706
|
* when it logs the error being annotated. Once that happens, further
|
|
3309
3707
|
* annotations of that error should go to the console immediately. We arrange
|
|
@@ -3312,14 +3710,16 @@ const { addLogArgs, takeLogArgsArray } = makeNoteLogArgsArrayKit();
|
|
|
3312
3710
|
* callback per error, but that depends on console behavior which we should not
|
|
3313
3711
|
* assume. We make this an array of callbacks so multiple registrations
|
|
3314
3712
|
* are independent.
|
|
3713
|
+
*
|
|
3714
|
+
* @type {WeakMap<Error, NoteCallback[]>}
|
|
3315
3715
|
*/
|
|
3316
|
-
const
|
|
3716
|
+
const hiddenNoteCallbacks = new WeakMap();
|
|
3317
3717
|
|
|
3318
3718
|
/** @type {AssertionUtilities['note']} */
|
|
3319
3719
|
const note = (error, detailsNote) => {
|
|
3720
|
+
// Promote string-valued `detailsNote` into a minimal DetailsParts consisting
|
|
3721
|
+
// of that string as the sole literal part with no substitutions.
|
|
3320
3722
|
if (typeof detailsNote === 'string') {
|
|
3321
|
-
// If it is a string, use it as the literal part of the template so
|
|
3322
|
-
// it doesn't get quoted.
|
|
3323
3723
|
detailsNote = redactedDetails([detailsNote]);
|
|
3324
3724
|
}
|
|
3325
3725
|
const hiddenDetails = weakmapGet(hiddenDetailsMap, detailsNote);
|
|
@@ -3327,13 +3727,13 @@ const note = (error, detailsNote) => {
|
|
|
3327
3727
|
throw TypeError(`unrecognized details ${quote(detailsNote)}`);
|
|
3328
3728
|
}
|
|
3329
3729
|
const logArgs = getLogArgs(hiddenDetails);
|
|
3330
|
-
const callbacks = weakmapGet(
|
|
3730
|
+
const callbacks = weakmapGet(hiddenNoteCallbacks, error);
|
|
3331
3731
|
if (callbacks !== undefined) {
|
|
3332
3732
|
for (const callback of callbacks) {
|
|
3333
3733
|
callback(error, logArgs);
|
|
3334
3734
|
}
|
|
3335
3735
|
} else {
|
|
3336
|
-
|
|
3736
|
+
addNoteLogArgs(error, logArgs);
|
|
3337
3737
|
}
|
|
3338
3738
|
};$h͏_once.note(note);
|
|
3339
3739
|
freeze(note);
|
|
@@ -3367,21 +3767,21 @@ const loggedErrorHandler = {
|
|
|
3367
3767
|
},
|
|
3368
3768
|
getMessageLogArgs: error => weakmapGet(hiddenMessageLogArgs, error),
|
|
3369
3769
|
takeMessageLogArgs: error => {
|
|
3370
|
-
const
|
|
3770
|
+
const logArgs = weakmapGet(hiddenMessageLogArgs, error);
|
|
3371
3771
|
weakmapDelete(hiddenMessageLogArgs, error);
|
|
3372
|
-
return
|
|
3772
|
+
return logArgs;
|
|
3373
3773
|
},
|
|
3374
3774
|
takeNoteLogArgsArray: (error, callback) => {
|
|
3375
|
-
const
|
|
3775
|
+
const logArgsArray = takeAllNoteLogArgs(error);
|
|
3376
3776
|
if (callback !== undefined) {
|
|
3377
|
-
const callbacks = weakmapGet(
|
|
3777
|
+
const callbacks = weakmapGet(hiddenNoteCallbacks, error);
|
|
3378
3778
|
if (callbacks) {
|
|
3379
3779
|
arrayPush(callbacks, callback);
|
|
3380
3780
|
} else {
|
|
3381
|
-
weakmapSet(
|
|
3781
|
+
weakmapSet(hiddenNoteCallbacks, error, [callback]);
|
|
3382
3782
|
}
|
|
3383
3783
|
}
|
|
3384
|
-
return
|
|
3784
|
+
return logArgsArray || [];
|
|
3385
3785
|
},
|
|
3386
3786
|
};$h͏_once.loggedErrorHandler(loggedErrorHandler);
|
|
3387
3787
|
freeze(loggedErrorHandler);
|
|
@@ -3392,7 +3792,7 @@ freeze(loggedErrorHandler);
|
|
|
3392
3792
|
/**
|
|
3393
3793
|
* @type {MakeAssert}
|
|
3394
3794
|
*/
|
|
3395
|
-
const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
3795
|
+
const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
3396
3796
|
const details = unredacted ? unredactedDetails : redactedDetails;
|
|
3397
3797
|
const assertFailedDetails = details`Check failed`;
|
|
3398
3798
|
|
|
@@ -3404,7 +3804,6 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
3404
3804
|
) => {
|
|
3405
3805
|
const reason = makeError(optDetails, errConstructor, options);
|
|
3406
3806
|
if (optRaise !== undefined) {
|
|
3407
|
-
// @ts-ignore returns `never` doesn't mean it isn't callable
|
|
3408
3807
|
optRaise(reason);
|
|
3409
3808
|
}
|
|
3410
3809
|
throw reason;
|
|
@@ -3414,18 +3813,16 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
3414
3813
|
/** @type {AssertionUtilities['Fail']} */
|
|
3415
3814
|
const Fail = (template, ...args) => fail(details(template, ...args));
|
|
3416
3815
|
|
|
3417
|
-
// Don't freeze or export `
|
|
3418
|
-
// TODO If I change this from a `function` function to an arrow
|
|
3419
|
-
// function, I seem to get type errors from TypeScript. Why?
|
|
3816
|
+
// Don't freeze or export `assert` until we add methods.
|
|
3420
3817
|
/** @type {BaseAssert} */
|
|
3421
|
-
|
|
3422
|
-
|
|
3818
|
+
const assert = (
|
|
3819
|
+
condition,
|
|
3423
3820
|
optDetails = undefined,
|
|
3424
3821
|
errConstructor = undefined,
|
|
3425
3822
|
options = undefined,
|
|
3426
|
-
) {
|
|
3427
|
-
|
|
3428
|
-
}
|
|
3823
|
+
) => {
|
|
3824
|
+
condition || fail(optDetails, errConstructor, options);
|
|
3825
|
+
};
|
|
3429
3826
|
|
|
3430
3827
|
/** @type {AssertionFunctions['equal']} */
|
|
3431
3828
|
const equal = (
|
|
@@ -3467,26 +3864,37 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
3467
3864
|
const assertString = (specimen, optDetails = undefined) =>
|
|
3468
3865
|
assertTypeof(specimen, 'string', optDetails);
|
|
3469
3866
|
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
const assert = assign(baseAssert, {
|
|
3473
|
-
error: makeError,
|
|
3474
|
-
fail,
|
|
3867
|
+
/** @type {Pick<AssertionFunctions, keyof AssertionFunctions>} */
|
|
3868
|
+
const assertionFunctions = {
|
|
3475
3869
|
equal,
|
|
3476
3870
|
typeof: assertTypeof,
|
|
3477
3871
|
string: assertString,
|
|
3872
|
+
fail,
|
|
3873
|
+
};
|
|
3874
|
+
|
|
3875
|
+
/** @type {AssertionUtilities} */
|
|
3876
|
+
const assertionUtilities = {
|
|
3877
|
+
makeError,
|
|
3478
3878
|
note,
|
|
3479
3879
|
details,
|
|
3480
3880
|
Fail,
|
|
3481
3881
|
quote,
|
|
3482
3882
|
bare,
|
|
3483
|
-
|
|
3883
|
+
};
|
|
3884
|
+
|
|
3885
|
+
/** @type {DeprecatedAssertionUtilities} */
|
|
3886
|
+
const deprecated = { error: makeError, makeAssert };
|
|
3887
|
+
|
|
3888
|
+
/** @type {Assert} */
|
|
3889
|
+
const finishedAssert = assign(assert, {
|
|
3890
|
+
...assertionFunctions,
|
|
3891
|
+
...assertionUtilities,
|
|
3892
|
+
...deprecated,
|
|
3484
3893
|
});
|
|
3485
|
-
return freeze(
|
|
3894
|
+
return freeze(finishedAssert);
|
|
3486
3895
|
};$h͏_once.makeAssert(makeAssert);
|
|
3487
3896
|
freeze(makeAssert);
|
|
3488
3897
|
|
|
3489
|
-
|
|
3490
3898
|
/** @type {Assert} */
|
|
3491
3899
|
const assert = makeAssert();$h͏_once.assert(assert);
|
|
3492
3900
|
|
|
@@ -3498,8 +3906,8 @@ const assert = makeAssert();$h͏_once.assert(assert);
|
|
|
3498
3906
|
const assertEqual = assert.equal;$h͏_once.assertEqual(assertEqual);
|
|
3499
3907
|
})()
|
|
3500
3908
|
,
|
|
3501
|
-
// ===
|
|
3502
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,TypeError,WeakSet,globalThis,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,
|
|
3909
|
+
// === 14. ses ./src/make-hardener.js ===
|
|
3910
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,TypeError,WeakSet,globalThis,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,isPrimitive,hasOwn,ownKeys,preventExtensions,setAdd,setForEach,setHas,toStringTagSymbol,typedArrayPrototype,weaksetAdd,weaksetHas,FERAL_STACK_GETTER,FERAL_STACK_SETTER,isError,assert;$h͏_imports([["./commons.js", [["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["isInteger",[$h͏_a => (isInteger = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["preventExtensions",[$h͏_a => (preventExtensions = $h͏_a)]],["setAdd",[$h͏_a => (setAdd = $h͏_a)]],["setForEach",[$h͏_a => (setForEach = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["typedArrayPrototype",[$h͏_a => (typedArrayPrototype = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["FERAL_STACK_GETTER",[$h͏_a => (FERAL_STACK_GETTER = $h͏_a)]],["FERAL_STACK_SETTER",[$h͏_a => (FERAL_STACK_SETTER = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
|
|
3503
3911
|
|
|
3504
3912
|
|
|
3505
3913
|
|
|
@@ -3652,7 +4060,7 @@ const freezeTypedArray = array => {
|
|
|
3652
4060
|
* @param {any} val
|
|
3653
4061
|
*/
|
|
3654
4062
|
function enqueue(val) {
|
|
3655
|
-
if (
|
|
4063
|
+
if (isPrimitive(val)) {
|
|
3656
4064
|
// ignore primitives
|
|
3657
4065
|
return;
|
|
3658
4066
|
}
|
|
@@ -3707,7 +4115,7 @@ const freezeTypedArray = array => {
|
|
|
3707
4115
|
// test could be confused. We use hasOwnProperty to be sure about
|
|
3708
4116
|
// whether 'value' is present or not, which tells us for sure that
|
|
3709
4117
|
// this is a data property.
|
|
3710
|
-
if (
|
|
4118
|
+
if (hasOwn(desc, 'value')) {
|
|
3711
4119
|
enqueue(desc.value);
|
|
3712
4120
|
} else {
|
|
3713
4121
|
enqueue(desc.get);
|
|
@@ -3776,8 +4184,8 @@ const freezeTypedArray = array => {
|
|
|
3776
4184
|
};$h͏_once.makeHardener(makeHardener);
|
|
3777
4185
|
})()
|
|
3778
4186
|
,
|
|
3779
|
-
// ===
|
|
3780
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let
|
|
4187
|
+
// === 15. ses ./src/cauterize-property.js ===
|
|
4188
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let hasOwn;$h͏_imports([["./commons.js", [["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]]]);
|
|
3781
4189
|
|
|
3782
4190
|
/**
|
|
3783
4191
|
* @import {Reporter} from './reporting-types.js'
|
|
@@ -3831,7 +4239,7 @@ const freezeTypedArray = array => {
|
|
|
3831
4239
|
try {
|
|
3832
4240
|
delete obj[prop];
|
|
3833
4241
|
} catch (err) {
|
|
3834
|
-
if (
|
|
4242
|
+
if (hasOwn(obj, prop)) {
|
|
3835
4243
|
if (typeof obj === 'function' && prop === 'prototype') {
|
|
3836
4244
|
obj.prototype = undefined;
|
|
3837
4245
|
if (obj.prototype === undefined) {
|
|
@@ -3848,7 +4256,7 @@ const freezeTypedArray = array => {
|
|
|
3848
4256
|
};$h͏_once.cauterizeProperty(cauterizeProperty);
|
|
3849
4257
|
})()
|
|
3850
4258
|
,
|
|
3851
|
-
// ===
|
|
4259
|
+
// === 16. ses ./src/permits.js ===
|
|
3852
4260
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayPush,arrayForEach;$h͏_imports([["./commons.js", [["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]]]]]);
|
|
3853
4261
|
|
|
3854
4262
|
|
|
@@ -4358,6 +4766,11 @@ const CommonMath = {
|
|
|
4358
4766
|
seal: fn,
|
|
4359
4767
|
setPrototypeOf: fn,
|
|
4360
4768
|
values: fn,
|
|
4769
|
+
'RegisteredSymbol(harden)': {
|
|
4770
|
+
...fn,
|
|
4771
|
+
// Installed with hardenTaming: 'unsafe'
|
|
4772
|
+
isFake: 'boolean',
|
|
4773
|
+
},
|
|
4361
4774
|
// https://github.com/tc39/proposal-accessible-object-hasownproperty
|
|
4362
4775
|
hasOwn: fn,
|
|
4363
4776
|
// https://github.com/tc39/proposal-array-grouping
|
|
@@ -5612,8 +6025,8 @@ const CommonMath = {
|
|
|
5612
6025
|
};$h͏_once.permitted(permitted);
|
|
5613
6026
|
})()
|
|
5614
6027
|
,
|
|
5615
|
-
// ===
|
|
5616
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let cauterizeProperty,TypeError,WeakSet,arrayFilter,create,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,
|
|
6028
|
+
// === 17. ses ./src/intrinsics.js ===
|
|
6029
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let cauterizeProperty,TypeError,WeakSet,arrayFilter,create,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isPrimitive,hasOwn,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,permitted;$h͏_imports([["./cauterize-property.js", [["cauterizeProperty",[$h͏_a => (cauterizeProperty = $h͏_a)]]]],["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["values",[$h͏_a => (values = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]]]],["./permits.js", [["constantProperties",[$h͏_a => (constantProperties = $h͏_a)]],["sharedGlobalPropertyNames",[$h͏_a => (sharedGlobalPropertyNames = $h͏_a)]],["universalPropertyNames",[$h͏_a => (universalPropertyNames = $h͏_a)]],["permitted",[$h͏_a => (permitted = $h͏_a)]]]]]);
|
|
5617
6030
|
|
|
5618
6031
|
|
|
5619
6032
|
|
|
@@ -5652,7 +6065,7 @@ const isFunction = obj => typeof obj === 'function';
|
|
|
5652
6065
|
// get masked as one overwrites the other. Accordingly, the thrown error
|
|
5653
6066
|
// complains of a "Conflicting definition".
|
|
5654
6067
|
function initProperty(obj, name, desc) {
|
|
5655
|
-
if (
|
|
6068
|
+
if (hasOwn(obj, name)) {
|
|
5656
6069
|
const preDesc = getOwnPropertyDescriptor(obj, name);
|
|
5657
6070
|
if (
|
|
5658
6071
|
!preDesc ||
|
|
@@ -5684,7 +6097,7 @@ function initProperties(obj, descs) {
|
|
|
5684
6097
|
function sampleGlobals(globalObject, newPropertyNames) {
|
|
5685
6098
|
const newIntrinsics = { __proto__: null };
|
|
5686
6099
|
for (const [globalName, intrinsicName] of entries(newPropertyNames)) {
|
|
5687
|
-
if (
|
|
6100
|
+
if (hasOwn(globalObject, globalName)) {
|
|
5688
6101
|
newIntrinsics[intrinsicName] = globalObject[globalName];
|
|
5689
6102
|
}
|
|
5690
6103
|
}
|
|
@@ -5709,11 +6122,11 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
5709
6122
|
// to the intrinsics.
|
|
5710
6123
|
const completePrototypes = () => {
|
|
5711
6124
|
for (const [name, intrinsic] of entries(intrinsics)) {
|
|
5712
|
-
if (
|
|
6125
|
+
if (isPrimitive(intrinsic)) {
|
|
5713
6126
|
// eslint-disable-next-line no-continue
|
|
5714
6127
|
continue;
|
|
5715
6128
|
}
|
|
5716
|
-
if (!
|
|
6129
|
+
if (!hasOwn(intrinsic, 'prototype')) {
|
|
5717
6130
|
// eslint-disable-next-line no-continue
|
|
5718
6131
|
continue;
|
|
5719
6132
|
}
|
|
@@ -5735,12 +6148,12 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
5735
6148
|
}
|
|
5736
6149
|
if (
|
|
5737
6150
|
typeof namePrototype !== 'string' ||
|
|
5738
|
-
!
|
|
6151
|
+
!hasOwn(permitted, namePrototype)
|
|
5739
6152
|
) {
|
|
5740
6153
|
throw TypeError(`Unrecognized ${name}.prototype permits entry`);
|
|
5741
6154
|
}
|
|
5742
6155
|
const intrinsicPrototype = intrinsic.prototype;
|
|
5743
|
-
if (
|
|
6156
|
+
if (hasOwn(intrinsics, namePrototype)) {
|
|
5744
6157
|
if (intrinsics[namePrototype] !== intrinsicPrototype) {
|
|
5745
6158
|
throw TypeError(`Conflicting bindings of ${namePrototype}`);
|
|
5746
6159
|
}
|
|
@@ -5807,8 +6220,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
5807
6220
|
};$h͏_once.getGlobalIntrinsics(getGlobalIntrinsics);
|
|
5808
6221
|
})()
|
|
5809
6222
|
,
|
|
5810
|
-
// ===
|
|
5811
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let permitted,FunctionInstance,isAccessorPermit,Map,String,Symbol,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,
|
|
6223
|
+
// === 18. ses ./src/permits-intrinsics.js ===
|
|
6224
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let permitted,FunctionInstance,isAccessorPermit,Map,String,Symbol,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isPrimitive,mapGet,hasOwn,ownKeys,symbolKeyFor,cauterizeProperty;$h͏_imports([["./permits.js", [["permitted",[$h͏_a => (permitted = $h͏_a)]],["FunctionInstance",[$h͏_a => (FunctionInstance = $h͏_a)]],["isAccessorPermit",[$h͏_a => (isAccessorPermit = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["Symbol",[$h͏_a => (Symbol = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["symbolKeyFor",[$h͏_a => (symbolKeyFor = $h͏_a)]]]],["./cauterize-property.js", [["cauterizeProperty",[$h͏_a => (cauterizeProperty = $h͏_a)]]]]]);
|
|
5812
6225
|
|
|
5813
6226
|
|
|
5814
6227
|
|
|
@@ -5941,8 +6354,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
5941
6354
|
* Validate the object's [[prototype]] against a permit.
|
|
5942
6355
|
*/
|
|
5943
6356
|
function visitPrototype(path, obj, protoName) {
|
|
5944
|
-
if (
|
|
5945
|
-
throw TypeError(`Object expected: ${path}, ${obj}, ${protoName}`);
|
|
6357
|
+
if (isPrimitive(obj)) {
|
|
6358
|
+
throw TypeError(`Object expected: ${path}, ${String(obj)}, ${protoName}`);
|
|
5946
6359
|
}
|
|
5947
6360
|
const proto = getPrototypeOf(obj);
|
|
5948
6361
|
|
|
@@ -5995,7 +6408,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
5995
6408
|
// Assert: the permit is the name of an intrinsic.
|
|
5996
6409
|
// Assert: the property value is equal to that intrinsic.
|
|
5997
6410
|
|
|
5998
|
-
if (
|
|
6411
|
+
if (hasOwn(intrinsics, permit)) {
|
|
5999
6412
|
if (value !== intrinsics[permit]) {
|
|
6000
6413
|
throw TypeError(`Does not match permit for ${path}`);
|
|
6001
6414
|
}
|
|
@@ -6035,7 +6448,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6035
6448
|
}
|
|
6036
6449
|
|
|
6037
6450
|
// Is this a value property?
|
|
6038
|
-
if (
|
|
6451
|
+
if (hasOwn(desc, 'value')) {
|
|
6039
6452
|
if (isAccessorPermit(permit)) {
|
|
6040
6453
|
throw TypeError(`Accessor expected at ${path}`);
|
|
6041
6454
|
}
|
|
@@ -6055,12 +6468,12 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6055
6468
|
*/
|
|
6056
6469
|
function getSubPermit(obj, permit, prop) {
|
|
6057
6470
|
const permitProp = prop === '__proto__' ? '--proto--' : prop;
|
|
6058
|
-
if (
|
|
6471
|
+
if (hasOwn(permit, permitProp)) {
|
|
6059
6472
|
return permit[permitProp];
|
|
6060
6473
|
}
|
|
6061
6474
|
|
|
6062
6475
|
if (typeof obj === 'function') {
|
|
6063
|
-
if (
|
|
6476
|
+
if (hasOwn(FunctionInstance, permitProp)) {
|
|
6064
6477
|
return FunctionInstance[permitProp];
|
|
6065
6478
|
}
|
|
6066
6479
|
}
|
|
@@ -6101,7 +6514,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6101
6514
|
}$h͏_once.default( removeUnpermittedIntrinsics);
|
|
6102
6515
|
})()
|
|
6103
6516
|
,
|
|
6104
|
-
// ===
|
|
6517
|
+
// === 19. ses ./src/tame-function-constructors.js ===
|
|
6105
6518
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,SyntaxError,TypeError,defineProperties,getPrototypeOf,setPrototypeOf,freeze,AsyncGeneratorFunctionInstance;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["setPrototypeOf",[$h͏_a => (setPrototypeOf = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["AsyncGeneratorFunctionInstance",[$h͏_a => (AsyncGeneratorFunctionInstance = $h͏_a)]]]]]);
|
|
6106
6519
|
|
|
6107
6520
|
|
|
@@ -6244,7 +6657,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6244
6657
|
}$h͏_once.default( tameFunctionConstructors);
|
|
6245
6658
|
})()
|
|
6246
6659
|
,
|
|
6247
|
-
// ===
|
|
6660
|
+
// === 20. ses ./src/tame-date-constructor.js ===
|
|
6248
6661
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Date,TypeError,apply,construct,defineProperties;$h͏_imports([["./commons.js", [["Date",[$h͏_a => (Date = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["construct",[$h͏_a => (construct = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]]]]]);
|
|
6249
6662
|
|
|
6250
6663
|
|
|
@@ -6374,7 +6787,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6374
6787
|
}$h͏_once.default( tameDateConstructor);
|
|
6375
6788
|
})()
|
|
6376
6789
|
,
|
|
6377
|
-
// ===
|
|
6790
|
+
// === 21. ses ./src/tame-math-object.js ===
|
|
6378
6791
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Math,TypeError,create,getOwnPropertyDescriptors,objectPrototype;$h͏_imports([["./commons.js", [["Math",[$h͏_a => (Math = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]]]]]);
|
|
6379
6792
|
|
|
6380
6793
|
|
|
@@ -6418,7 +6831,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6418
6831
|
}$h͏_once.default( tameMathObject);
|
|
6419
6832
|
})()
|
|
6420
6833
|
,
|
|
6421
|
-
// ===
|
|
6834
|
+
// === 22. ses ./src/tame-regexp-constructor.js ===
|
|
6422
6835
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,TypeError,construct,defineProperties,getOwnPropertyDescriptor,speciesSymbol;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["construct",[$h͏_a => (construct = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["speciesSymbol",[$h͏_a => (speciesSymbol = $h͏_a)]]]]]);
|
|
6423
6836
|
|
|
6424
6837
|
|
|
@@ -6486,7 +6899,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6486
6899
|
}$h͏_once.default( tameRegExpConstructor);
|
|
6487
6900
|
})()
|
|
6488
6901
|
,
|
|
6489
|
-
// ===
|
|
6902
|
+
// === 23. ses ./src/enablements.js ===
|
|
6490
6903
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let toStringTagSymbol,iteratorSymbol;$h͏_imports([["./commons.js", [["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["iteratorSymbol",[$h͏_a => (iteratorSymbol = $h͏_a)]]]]]);
|
|
6491
6904
|
|
|
6492
6905
|
/**
|
|
@@ -6567,6 +6980,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6567
6980
|
'%ErrorPrototype%': {
|
|
6568
6981
|
name: true // set by "precond", "ava", "node-fetch"
|
|
6569
6982
|
},
|
|
6983
|
+
|
|
6570
6984
|
'%IteratorPrototype%': {
|
|
6571
6985
|
toString: true,
|
|
6572
6986
|
// https://github.com/tc39/proposal-iterator-helpers
|
|
@@ -6580,6 +6994,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6580
6994
|
* Moderate enablements are usually good enough for legacy compat.
|
|
6581
6995
|
*/$h͏_once.minEnablements(minEnablements);
|
|
6582
6996
|
const moderateEnablements = {
|
|
6997
|
+
...minEnablements,
|
|
6998
|
+
|
|
6583
6999
|
'%ObjectPrototype%': {
|
|
6584
7000
|
toString: true,
|
|
6585
7001
|
valueOf: true,
|
|
@@ -6592,6 +7008,10 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6592
7008
|
[iteratorSymbol]: true // set by mobx generated code (old TS compiler?)
|
|
6593
7009
|
},
|
|
6594
7010
|
|
|
7011
|
+
'%IteratorPrototype%': {
|
|
7012
|
+
[iteratorSymbol]: true // is sometimes used in custom iterators and generators implementations eg. @rive-app/canvas
|
|
7013
|
+
},
|
|
7014
|
+
|
|
6595
7015
|
// Function.prototype has no 'prototype' property to enable.
|
|
6596
7016
|
// Function instances have their own 'name' and 'length' properties
|
|
6597
7017
|
// which are configurable and non-writable. Thus, they are already
|
|
@@ -6657,14 +7077,6 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6657
7077
|
name: true,
|
|
6658
7078
|
toString: true,
|
|
6659
7079
|
},
|
|
6660
|
-
|
|
6661
|
-
'%IteratorPrototype%': {
|
|
6662
|
-
toString: true,
|
|
6663
|
-
// https://github.com/tc39/proposal-iterator-helpers
|
|
6664
|
-
constructor: true,
|
|
6665
|
-
// https://github.com/tc39/proposal-iterator-helpers
|
|
6666
|
-
[toStringTagSymbol]: true,
|
|
6667
|
-
},
|
|
6668
7080
|
};
|
|
6669
7081
|
|
|
6670
7082
|
/**
|
|
@@ -6733,8 +7145,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6733
7145
|
};$h͏_once.severeEnablements(severeEnablements);
|
|
6734
7146
|
})()
|
|
6735
7147
|
,
|
|
6736
|
-
// ===
|
|
6737
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,TypeError,arrayForEach,defineProperty,getOwnPropertyDescriptor,getOwnPropertyDescriptors,
|
|
7148
|
+
// === 24. ses ./src/enable-property-overrides.js ===
|
|
7149
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,TypeError,arrayForEach,defineProperty,getOwnPropertyDescriptor,getOwnPropertyDescriptors,isPrimitive,hasOwn,ownKeys,setHas,minEnablements,moderateEnablements,severeEnablements;$h͏_imports([["./commons.js", [["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]]]],["./enablements.js", [["minEnablements",[$h͏_a => (minEnablements = $h͏_a)]],["moderateEnablements",[$h͏_a => (moderateEnablements = $h͏_a)]],["severeEnablements",[$h͏_a => (severeEnablements = $h͏_a)]]]]]);
|
|
6738
7150
|
|
|
6739
7151
|
|
|
6740
7152
|
|
|
@@ -6845,7 +7257,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6845
7257
|
)}' of '${path}'`,
|
|
6846
7258
|
);
|
|
6847
7259
|
}
|
|
6848
|
-
if (
|
|
7260
|
+
if (hasOwn(this, prop)) {
|
|
6849
7261
|
this[prop] = newValue;
|
|
6850
7262
|
} else {
|
|
6851
7263
|
if (isDebug) {
|
|
@@ -6915,7 +7327,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6915
7327
|
enableProperty(subPath, obj, prop);
|
|
6916
7328
|
} else if (subPlan === '*') {
|
|
6917
7329
|
enableAllProperties(subPath, desc.value);
|
|
6918
|
-
} else if (
|
|
7330
|
+
} else if (!isPrimitive(subPlan)) {
|
|
6919
7331
|
enableProperties(subPath, desc.value, subPlan);
|
|
6920
7332
|
} else {
|
|
6921
7333
|
throw TypeError(`Unexpected override enablement plan ${subPath}`);
|
|
@@ -6947,8 +7359,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6947
7359
|
}$h͏_once.default( enablePropertyOverrides);
|
|
6948
7360
|
})()
|
|
6949
7361
|
,
|
|
6950
|
-
// ===
|
|
6951
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Number,String,TypeError,defineProperty,getOwnPropertyNames,
|
|
7362
|
+
// === 25. ses ./src/tame-locale-methods.js ===
|
|
7363
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Number,String,TypeError,defineProperty,getOwnPropertyNames,isPrimitive,regexpExec,assert;$h͏_imports([["./commons.js", [["Number",[$h͏_a => (Number = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
|
|
6952
7364
|
|
|
6953
7365
|
|
|
6954
7366
|
|
|
@@ -7004,7 +7416,7 @@ const numberToString = tamedMethods.toString;
|
|
|
7004
7416
|
|
|
7005
7417
|
for (const intrinsicName of getOwnPropertyNames(intrinsics)) {
|
|
7006
7418
|
const intrinsic = intrinsics[intrinsicName];
|
|
7007
|
-
if (
|
|
7419
|
+
if (!isPrimitive(intrinsic)) {
|
|
7008
7420
|
for (const methodName of getOwnPropertyNames(intrinsic)) {
|
|
7009
7421
|
const match = regexpExec(localePattern, methodName);
|
|
7010
7422
|
if (match) {
|
|
@@ -7028,7 +7440,7 @@ const numberToString = tamedMethods.toString;
|
|
|
7028
7440
|
}$h͏_once.default( tameLocaleMethods);
|
|
7029
7441
|
})()
|
|
7030
7442
|
,
|
|
7031
|
-
// ===
|
|
7443
|
+
// === 26. ses ./src/make-eval-function.js ===
|
|
7032
7444
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/**
|
|
7033
7445
|
* makeEvalFunction()
|
|
7034
7446
|
* A safe version of the native eval function which relies on
|
|
@@ -7059,7 +7471,7 @@ const numberToString = tamedMethods.toString;
|
|
|
7059
7471
|
};$h͏_once.makeEvalFunction(makeEvalFunction);
|
|
7060
7472
|
})()
|
|
7061
7473
|
,
|
|
7062
|
-
// ===
|
|
7474
|
+
// === 27. ses ./src/make-function-constructor.js ===
|
|
7063
7475
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,arrayJoin,arrayPop,defineProperties,getPrototypeOf,assert;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
|
|
7064
7476
|
|
|
7065
7477
|
|
|
@@ -7141,8 +7553,8 @@ const { Fail } = assert;
|
|
|
7141
7553
|
};$h͏_once.makeFunctionConstructor(makeFunctionConstructor);
|
|
7142
7554
|
})()
|
|
7143
7555
|
,
|
|
7144
|
-
// ===
|
|
7145
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,assign,create,defineProperty,entries,freeze,
|
|
7556
|
+
// === 28. ses ./src/global-object.js ===
|
|
7557
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,assign,create,defineProperty,entries,freeze,hasOwn,unscopablesSymbol,makeEvalFunction,makeFunctionConstructor,constantProperties,universalPropertyNames;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["unscopablesSymbol",[$h͏_a => (unscopablesSymbol = $h͏_a)]]]],["./make-eval-function.js", [["makeEvalFunction",[$h͏_a => (makeEvalFunction = $h͏_a)]]]],["./make-function-constructor.js", [["makeFunctionConstructor",[$h͏_a => (makeFunctionConstructor = $h͏_a)]]]],["./permits.js", [["constantProperties",[$h͏_a => (constantProperties = $h͏_a)]],["universalPropertyNames",[$h͏_a => (universalPropertyNames = $h͏_a)]]]]]);
|
|
7146
7558
|
|
|
7147
7559
|
|
|
7148
7560
|
|
|
@@ -7231,7 +7643,7 @@ const { Fail } = assert;
|
|
|
7231
7643
|
},
|
|
7232
7644
|
) => {
|
|
7233
7645
|
for (const [name, intrinsicName] of entries(universalPropertyNames)) {
|
|
7234
|
-
if (
|
|
7646
|
+
if (hasOwn(intrinsics, intrinsicName)) {
|
|
7235
7647
|
defineProperty(globalObject, name, {
|
|
7236
7648
|
value: intrinsics[intrinsicName],
|
|
7237
7649
|
writable: true,
|
|
@@ -7242,7 +7654,7 @@ const { Fail } = assert;
|
|
|
7242
7654
|
}
|
|
7243
7655
|
|
|
7244
7656
|
for (const [name, intrinsicName] of entries(newGlobalPropertyNames)) {
|
|
7245
|
-
if (
|
|
7657
|
+
if (hasOwn(intrinsics, intrinsicName)) {
|
|
7246
7658
|
defineProperty(globalObject, name, {
|
|
7247
7659
|
value: intrinsics[intrinsicName],
|
|
7248
7660
|
writable: true,
|
|
@@ -7319,7 +7731,7 @@ const { Fail } = assert;
|
|
|
7319
7731
|
};$h͏_once.setGlobalObjectEvaluators(setGlobalObjectEvaluators);
|
|
7320
7732
|
})()
|
|
7321
7733
|
,
|
|
7322
|
-
// ===
|
|
7734
|
+
// === 29. ses ./src/strict-scope-terminator.js ===
|
|
7323
7735
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Proxy,String,TypeError,ReferenceError,create,freeze,getOwnPropertyDescriptors,assert;$h͏_imports([["./commons.js", [["Proxy",[$h͏_a => (Proxy = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["ReferenceError",[$h͏_a => (ReferenceError = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
|
|
7324
7736
|
|
|
7325
7737
|
|
|
@@ -7421,7 +7833,7 @@ const scopeProxyHandlerProperties = {
|
|
|
7421
7833
|
);$h͏_once.strictScopeTerminator(strictScopeTerminator);
|
|
7422
7834
|
})()
|
|
7423
7835
|
,
|
|
7424
|
-
// ===
|
|
7836
|
+
// === 30. ses ./src/sloppy-globals-scope-terminator.js ===
|
|
7425
7837
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Proxy,create,freeze,getOwnPropertyDescriptors,reflectSet,strictScopeTerminatorHandler,alwaysThrowHandler;$h͏_imports([["./commons.js", [["Proxy",[$h͏_a => (Proxy = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["reflectSet",[$h͏_a => (reflectSet = $h͏_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminatorHandler",[$h͏_a => (strictScopeTerminatorHandler = $h͏_a)]],["alwaysThrowHandler",[$h͏_a => (alwaysThrowHandler = $h͏_a)]]]]]);
|
|
7426
7838
|
|
|
7427
7839
|
|
|
@@ -7485,7 +7897,7 @@ const objTarget = freeze({ __proto__: null });
|
|
|
7485
7897
|
freeze(createSloppyGlobalsScopeTerminator);
|
|
7486
7898
|
})()
|
|
7487
7899
|
,
|
|
7488
|
-
// ===
|
|
7900
|
+
// === 31. ses ./src/eval-scope.js ===
|
|
7489
7901
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_EVAL,create,defineProperties,freeze,assert;$h͏_imports([["./commons.js", [["FERAL_EVAL",[$h͏_a => (FERAL_EVAL = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
|
|
7490
7902
|
|
|
7491
7903
|
|
|
@@ -7577,7 +7989,7 @@ const { Fail } = assert;
|
|
|
7577
7989
|
};$h͏_once.makeEvalScopeKit(makeEvalScopeKit);
|
|
7578
7990
|
})()
|
|
7579
7991
|
,
|
|
7580
|
-
// ===
|
|
7992
|
+
// === 32. ses ./src/get-source-url.js ===
|
|
7581
7993
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,regexpExec,stringSlice;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]]]]]);
|
|
7582
7994
|
|
|
7583
7995
|
// Captures a key and value of the form #key=value or @key=value
|
|
@@ -7630,8 +8042,9 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
|
|
|
7630
8042
|
};$h͏_once.getSourceURL(getSourceURL);
|
|
7631
8043
|
})()
|
|
7632
8044
|
,
|
|
7633
|
-
// ===
|
|
7634
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,
|
|
8045
|
+
// === 33. ses ./src/transforms.js ===
|
|
8046
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,regexpReplace,sealRegexp,stringSearch,stringSlice,stringSplit,freeze,getSourceURL;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringSearch",[$h͏_a => (stringSearch = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]],["./get-source-url.js", [["getSourceURL",[$h͏_a => (getSourceURL = $h͏_a)]]]]]);
|
|
8047
|
+
|
|
7635
8048
|
|
|
7636
8049
|
|
|
7637
8050
|
|
|
@@ -7668,7 +8081,9 @@ function getLineNumber(src, pattern) {
|
|
|
7668
8081
|
|
|
7669
8082
|
// /////////////////////////////////////////////////////////////////////////////
|
|
7670
8083
|
|
|
7671
|
-
const htmlCommentPattern =
|
|
8084
|
+
const htmlCommentPattern = sealRegexp(
|
|
8085
|
+
new FERAL_REG_EXP(`(?:${'<'}!--|--${'>'})`, 'g'),
|
|
8086
|
+
);
|
|
7672
8087
|
|
|
7673
8088
|
/**
|
|
7674
8089
|
* Conservatively reject the source text if it may contain text that some
|
|
@@ -7733,14 +8148,13 @@ const htmlCommentPattern = new FERAL_REG_EXP(`(?:${'<'}!--|--${'>'})`, 'g');
|
|
|
7733
8148
|
*/$h͏_once.rejectHtmlComments(rejectHtmlComments);
|
|
7734
8149
|
const evadeHtmlCommentTest = src => {
|
|
7735
8150
|
const replaceFn = match => (match[0] === '<' ? '< ! --' : '-- >');
|
|
7736
|
-
return
|
|
8151
|
+
return regexpReplace(htmlCommentPattern, src, replaceFn);
|
|
7737
8152
|
};
|
|
7738
8153
|
|
|
7739
8154
|
// /////////////////////////////////////////////////////////////////////////////
|
|
7740
8155
|
$h͏_once.evadeHtmlCommentTest(evadeHtmlCommentTest);
|
|
7741
|
-
const importPattern =
|
|
7742
|
-
'(^|[^.]|\\.\\.\\.)\\bimport(\\s*(?:\\(|/[/*]))',
|
|
7743
|
-
'g',
|
|
8156
|
+
const importPattern = sealRegexp(
|
|
8157
|
+
new FERAL_REG_EXP('(^|[^.]|\\.\\.\\.)\\bimport(\\s*(?:\\(|/[/*]))', 'g'),
|
|
7744
8158
|
);
|
|
7745
8159
|
|
|
7746
8160
|
/**
|
|
@@ -7803,7 +8217,7 @@ const importPattern = new FERAL_REG_EXP(
|
|
|
7803
8217
|
*/$h͏_once.rejectImportExpressions(rejectImportExpressions);
|
|
7804
8218
|
const evadeImportExpressionTest = src => {
|
|
7805
8219
|
const replaceFn = (_, p1, p2) => `${p1}__import__${p2}`;
|
|
7806
|
-
return
|
|
8220
|
+
return regexpReplace(importPattern, src, replaceFn);
|
|
7807
8221
|
};
|
|
7808
8222
|
|
|
7809
8223
|
// /////////////////////////////////////////////////////////////////////////////
|
|
@@ -7900,8 +8314,10 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
|
|
|
7900
8314
|
});$h͏_once.transforms(transforms);
|
|
7901
8315
|
})()
|
|
7902
8316
|
,
|
|
7903
|
-
// ===
|
|
7904
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,
|
|
8317
|
+
// === 34. ses ./src/scope-constants.js ===
|
|
8318
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,hasOwn,regexpExec,Set,setHas;$h͏_imports([["./commons.js", [["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]]]]]);
|
|
8319
|
+
|
|
8320
|
+
|
|
7905
8321
|
|
|
7906
8322
|
|
|
7907
8323
|
|
|
@@ -7911,11 +8327,12 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
|
|
|
7911
8327
|
|
|
7912
8328
|
|
|
7913
8329
|
/**
|
|
7914
|
-
*
|
|
7915
|
-
* In JavaScript you cannot use
|
|
7916
|
-
*
|
|
8330
|
+
* reservedNames
|
|
8331
|
+
* In JavaScript you cannot use reserved words as variable names (except for
|
|
8332
|
+
* "eval", which is specially reserved to prevent shadowing).
|
|
8333
|
+
* https://tc39.es/ecma262/multipage/ecmascript-language-lexical-grammar.html#sec-identifier-names
|
|
7917
8334
|
*/
|
|
7918
|
-
const
|
|
8335
|
+
const reservedNames = new Set([
|
|
7919
8336
|
// 11.6.2.1 Keywords
|
|
7920
8337
|
'await',
|
|
7921
8338
|
'break',
|
|
@@ -7976,7 +8393,10 @@ const keywords = [
|
|
|
7976
8393
|
|
|
7977
8394
|
'this',
|
|
7978
8395
|
'arguments',
|
|
7979
|
-
|
|
8396
|
+
|
|
8397
|
+
// Reserved by us
|
|
8398
|
+
'eval',
|
|
8399
|
+
]);
|
|
7980
8400
|
|
|
7981
8401
|
/**
|
|
7982
8402
|
* identifierPattern
|
|
@@ -7992,24 +8412,12 @@ const identifierPattern = /^[a-zA-Z_$][\w$]*$/;
|
|
|
7992
8412
|
|
|
7993
8413
|
/**
|
|
7994
8414
|
* isValidIdentifierName()
|
|
7995
|
-
*
|
|
7996
|
-
* property names which can be variable names, including the names
|
|
7997
|
-
* of inherited properties. It excludes symbols and names which are
|
|
7998
|
-
* keywords. We drop symbols safely. Currently, this shim refuses
|
|
7999
|
-
* service if any of the names are keywords or keyword-like. This is
|
|
8000
|
-
* safe and only prevent performance optimization.
|
|
8415
|
+
* Is a value allowed as an arbitrary identifier name?
|
|
8001
8416
|
*
|
|
8002
8417
|
* @param {string} name
|
|
8003
8418
|
*/
|
|
8004
|
-
const isValidIdentifierName = name =>
|
|
8005
|
-
|
|
8006
|
-
// /../.test() to guard against the case where RegExp has been poisoned.
|
|
8007
|
-
return (
|
|
8008
|
-
name !== 'eval' &&
|
|
8009
|
-
!arrayIncludes(keywords, name) &&
|
|
8010
|
-
regexpTest(identifierPattern, name)
|
|
8011
|
-
);
|
|
8012
|
-
};
|
|
8419
|
+
const isValidIdentifierName = name =>
|
|
8420
|
+
!setHas(reservedNames, name) && !!regexpExec(identifierPattern, name);
|
|
8013
8421
|
|
|
8014
8422
|
/*
|
|
8015
8423
|
* isImmutableDataProperty
|
|
@@ -8034,18 +8442,18 @@ function isImmutableDataProperty(obj, name) {
|
|
|
8034
8442
|
// can't have accessors and value properties at the same time, therefore
|
|
8035
8443
|
// this check is sufficient. Using explicit own property deal with the
|
|
8036
8444
|
// case where Object.prototype has been poisoned.
|
|
8037
|
-
|
|
8445
|
+
hasOwn(desc, 'value')
|
|
8038
8446
|
);
|
|
8039
8447
|
}
|
|
8040
8448
|
|
|
8041
8449
|
/**
|
|
8042
8450
|
* getScopeConstants()
|
|
8043
|
-
* What variable names might
|
|
8451
|
+
* What variable names might be brought into scope? These include all
|
|
8044
8452
|
* property names which can be variable names, including the names
|
|
8045
8453
|
* of inherited properties. It excludes symbols and names which are
|
|
8046
8454
|
* keywords. We drop symbols safely. Currently, this shim refuses
|
|
8047
8455
|
* service if any of the names are keywords or keyword-like. This is
|
|
8048
|
-
* safe and only
|
|
8456
|
+
* safe and only affects performance optimization.
|
|
8049
8457
|
*
|
|
8050
8458
|
* @param {object} globalObject
|
|
8051
8459
|
* @param {object} moduleLexicals
|
|
@@ -8083,7 +8491,7 @@ function isImmutableDataProperty(obj, name) {
|
|
|
8083
8491
|
};$h͏_once.getScopeConstants(getScopeConstants);
|
|
8084
8492
|
})()
|
|
8085
8493
|
,
|
|
8086
|
-
// ===
|
|
8494
|
+
// === 35. ses ./src/make-evaluate.js ===
|
|
8087
8495
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,arrayJoin,apply,getScopeConstants;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]]]],["./scope-constants.js", [["getScopeConstants",[$h͏_a => (getScopeConstants = $h͏_a)]]]]]);
|
|
8088
8496
|
|
|
8089
8497
|
|
|
@@ -8196,7 +8604,7 @@ function buildOptimizer(constants, name) {
|
|
|
8196
8604
|
};$h͏_once.makeEvaluate(makeEvaluate);
|
|
8197
8605
|
})()
|
|
8198
8606
|
,
|
|
8199
|
-
// ===
|
|
8607
|
+
// === 36. ses ./src/make-safe-evaluator.js ===
|
|
8200
8608
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let apply,arrayFlatMap,freeze,identity,strictScopeTerminator,createSloppyGlobalsScopeTerminator,makeEvalScopeKit,applyTransforms,mandatoryTransforms,makeEvaluate,assert;$h͏_imports([["./commons.js", [["apply",[$h͏_a => (apply = $h͏_a)]],["arrayFlatMap",[$h͏_a => (arrayFlatMap = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["identity",[$h͏_a => (identity = $h͏_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminator",[$h͏_a => (strictScopeTerminator = $h͏_a)]]]],["./sloppy-globals-scope-terminator.js", [["createSloppyGlobalsScopeTerminator",[$h͏_a => (createSloppyGlobalsScopeTerminator = $h͏_a)]]]],["./eval-scope.js", [["makeEvalScopeKit",[$h͏_a => (makeEvalScopeKit = $h͏_a)]]]],["./transforms.js", [["applyTransforms",[$h͏_a => (applyTransforms = $h͏_a)]],["mandatoryTransforms",[$h͏_a => (mandatoryTransforms = $h͏_a)]]]],["./make-evaluate.js", [["makeEvaluate",[$h͏_a => (makeEvaluate = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
|
|
8201
8609
|
|
|
8202
8610
|
|
|
@@ -8311,7 +8719,7 @@ const { Fail } = assert;
|
|
|
8311
8719
|
};$h͏_once.makeSafeEvaluator(makeSafeEvaluator);
|
|
8312
8720
|
})()
|
|
8313
8721
|
,
|
|
8314
|
-
// ===
|
|
8722
|
+
// === 37. ses ./src/tame-function-tostring.js ===
|
|
8315
8723
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakSet,defineProperty,freeze,functionPrototype,functionToString,stringEndsWith,weaksetAdd,weaksetHas;$h͏_imports([["./commons.js", [["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["functionPrototype",[$h͏_a => (functionPrototype = $h͏_a)]],["functionToString",[$h͏_a => (functionToString = $h͏_a)]],["stringEndsWith",[$h͏_a => (stringEndsWith = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]]]]]);
|
|
8316
8724
|
|
|
8317
8725
|
|
|
@@ -8364,7 +8772,7 @@ let markVirtualizedNativeFunction;
|
|
|
8364
8772
|
};$h͏_once.tameFunctionToString(tameFunctionToString);
|
|
8365
8773
|
})()
|
|
8366
8774
|
,
|
|
8367
|
-
// ===
|
|
8775
|
+
// === 38. ses ./src/tame-domains.js ===
|
|
8368
8776
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,globalThis,getOwnPropertyDescriptor,defineProperty;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]]]]]);Object.defineProperty(tameDomains,'name',{value:"tameDomains"});$h͏_once.tameDomains(tameDomains);
|
|
8369
8777
|
|
|
8370
8778
|
|
|
@@ -8408,7 +8816,7 @@ let markVirtualizedNativeFunction;
|
|
|
8408
8816
|
}
|
|
8409
8817
|
})()
|
|
8410
8818
|
,
|
|
8411
|
-
// ===
|
|
8819
|
+
// === 39. ses ./src/tame-module-source.js ===
|
|
8412
8820
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let functionPrototype,getPrototypeOf,globalThis,objectPrototype,setPrototypeOf;$h͏_imports([["./commons.js", [["functionPrototype",[$h͏_a => (functionPrototype = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]],["setPrototypeOf",[$h͏_a => (setPrototypeOf = $h͏_a)]]]]]);
|
|
8413
8821
|
|
|
8414
8822
|
|
|
@@ -8462,7 +8870,7 @@ let markVirtualizedNativeFunction;
|
|
|
8462
8870
|
};$h͏_once.tameModuleSource(tameModuleSource);
|
|
8463
8871
|
})()
|
|
8464
8872
|
,
|
|
8465
|
-
// ===
|
|
8873
|
+
// === 40. ses ./src/error/console.js ===
|
|
8466
8874
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakSet,arrayFilter,arrayFlatMap,arrayMap,arrayPop,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,stringIncludes,stringSplit,weaksetAdd,weaksetHas;$h͏_imports([["../commons.js", [["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayFlatMap",[$h͏_a => (arrayFlatMap = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["stringEndsWith",[$h͏_a => (stringEndsWith = $h͏_a)]],["stringIncludes",[$h͏_a => (stringIncludes = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]]]]]);
|
|
8467
8875
|
|
|
8468
8876
|
|
|
@@ -9006,7 +9414,7 @@ freeze(defineCausalConsoleFromLogger);
|
|
|
9006
9414
|
freeze(filterConsole);
|
|
9007
9415
|
})()
|
|
9008
9416
|
,
|
|
9009
|
-
// ===
|
|
9417
|
+
// === 41. ses ./src/error/unhandled-rejection.js ===
|
|
9010
9418
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FinalizationRegistry,Map,mapGet,mapDelete,WeakMap,mapSet,finalizationRegistryRegister,weakmapSet,weakmapGet,mapEntries,mapHas;$h͏_imports([["../commons.js", [["FinalizationRegistry",[$h͏_a => (FinalizationRegistry = $h͏_a)]],["Map",[$h͏_a => (Map = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapDelete",[$h͏_a => (mapDelete = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["finalizationRegistryRegister",[$h͏_a => (finalizationRegistryRegister = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["mapEntries",[$h͏_a => (mapEntries = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]]]]]);
|
|
9011
9419
|
|
|
9012
9420
|
|
|
@@ -9131,7 +9539,7 @@ freeze(filterConsole);
|
|
|
9131
9539
|
};$h͏_once.makeRejectionHandlers(makeRejectionHandlers);
|
|
9132
9540
|
})()
|
|
9133
9541
|
,
|
|
9134
|
-
// ===
|
|
9542
|
+
// === 42. ses ./src/error/tame-console.js ===
|
|
9135
9543
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,apply,defineProperty,freeze,globalThis,defaultHandler,makeCausalConsole,makeRejectionHandlers;$h͏_imports([["../commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./assert.js", [["loggedErrorHandler",[$h͏_a => (defaultHandler = $h͏_a)]]]],["./console.js", [["makeCausalConsole",[$h͏_a => (makeCausalConsole = $h͏_a)]]]],["./unhandled-rejection.js", [["makeRejectionHandlers",[$h͏_a => (makeRejectionHandlers = $h͏_a)]]]]]);
|
|
9136
9544
|
|
|
9137
9545
|
|
|
@@ -9331,9 +9739,8 @@ const wrapLogger = (logger, thisArg) =>
|
|
|
9331
9739
|
};$h͏_once.tameConsole(tameConsole);
|
|
9332
9740
|
})()
|
|
9333
9741
|
,
|
|
9334
|
-
// ===
|
|
9335
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,
|
|
9336
|
-
|
|
9742
|
+
// === 43. ses ./src/error/tame-v8-error-constructor.js ===
|
|
9743
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,TypeError;$h͏_imports([["../commons.js", [["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arraySlice",[$h͏_a => (arraySlice = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["reflectSet",[$h͏_a => (reflectSet = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]]]]]);
|
|
9337
9744
|
|
|
9338
9745
|
|
|
9339
9746
|
|
|
@@ -9436,12 +9843,12 @@ const FILENAME_CENSORS = [
|
|
|
9436
9843
|
// Exported only so it can be unit tested.
|
|
9437
9844
|
// TODO Move so that it applies not just to v8.
|
|
9438
9845
|
const filterFileName = fileName => {
|
|
9439
|
-
if (
|
|
9440
|
-
//
|
|
9441
|
-
return
|
|
9846
|
+
if (fileName === null) {
|
|
9847
|
+
// Seems to suppress builtins like `Array.every (<anonymous>)`
|
|
9848
|
+
return false;
|
|
9442
9849
|
}
|
|
9443
9850
|
for (const filter of FILENAME_CENSORS) {
|
|
9444
|
-
if (
|
|
9851
|
+
if (regexpExec(filter, fileName)) {
|
|
9445
9852
|
return false;
|
|
9446
9853
|
}
|
|
9447
9854
|
}
|
|
@@ -9452,9 +9859,9 @@ const FILENAME_CENSORS = [
|
|
|
9452
9859
|
// likely url-path prefix, ending in a `/.../` should get dropped.
|
|
9453
9860
|
// Anything to the left of the likely path text is kept.
|
|
9454
9861
|
// Everything to the right of `/.../` is kept. Thus
|
|
9455
|
-
// `'Object.bar (/vat-v1/.../
|
|
9862
|
+
// `'Object.bar (/vat-v1/.../errors/test/deep-send.test.js:13:21)'`
|
|
9456
9863
|
// simplifies to
|
|
9457
|
-
// `'Object.bar (
|
|
9864
|
+
// `'Object.bar (errors/test/deep-send.test.js:13:21)'`.
|
|
9458
9865
|
//
|
|
9459
9866
|
// See thread starting at
|
|
9460
9867
|
// https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
|
|
@@ -9464,9 +9871,9 @@ $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSIS_PATTERN1=/^((?:
|
|
|
9464
9871
|
// likely url-path prefix consisting of `.../` should get dropped.
|
|
9465
9872
|
// Anything to the left of the likely path text is kept.
|
|
9466
9873
|
// Everything to the right of `.../` is kept. Thus
|
|
9467
|
-
// `'Object.bar (.../
|
|
9874
|
+
// `'Object.bar (.../errors/test/deep-send.test.js:13:21)'`
|
|
9468
9875
|
// simplifies to
|
|
9469
|
-
// `'Object.bar (
|
|
9876
|
+
// `'Object.bar (errors/test/deep-send.test.js:13:21)'`.
|
|
9470
9877
|
//
|
|
9471
9878
|
// See thread starting at
|
|
9472
9879
|
// https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
|
|
@@ -9477,9 +9884,9 @@ const CALLSITE_ELLIPSIS_PATTERN2 = /^((?:.*[( ])?)\.\.\.\/(.+)$/;
|
|
|
9477
9884
|
// dropped.
|
|
9478
9885
|
// Anything to the left of the likely path prefix text is kept. `package/` and
|
|
9479
9886
|
// everything to its right is kept. Thus
|
|
9480
|
-
// `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/
|
|
9887
|
+
// `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/errors/test/deep-send.test.js:13:21)'`
|
|
9481
9888
|
// simplifies to
|
|
9482
|
-
// `'Object.bar (packages/
|
|
9889
|
+
// `'Object.bar (packages/errors/test/deep-send.test.js:13:21)'`.
|
|
9483
9890
|
// Note that `/packages/` is a convention for monorepos encouraged by
|
|
9484
9891
|
// lerna.
|
|
9485
9892
|
const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
|
|
@@ -9489,7 +9896,7 @@ const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
|
|
|
9489
9896
|
// dropped.
|
|
9490
9897
|
// Anything to the left of the likely path prefix text is kept. Everything to
|
|
9491
9898
|
// the right of `file://` is kept. Thus
|
|
9492
|
-
// `'Object.bar (file:///Users/markmiller/src/ongithub/endojs/endo/packages/
|
|
9899
|
+
// `'Object.bar (file:///Users/markmiller/src/ongithub/endojs/endo/packages/errors/test/deep-send.test.js:13:21)'` is unchanged but
|
|
9493
9900
|
// `'Object.bar (file://test/deep-send.test.js:13:21)'`
|
|
9494
9901
|
|
|
9495
9902
|
// simplifies to
|
|
@@ -9555,6 +9962,10 @@ const CALLSITE_PATTERNS = [
|
|
|
9555
9962
|
// const callSiteFilter = _callSite => true;
|
|
9556
9963
|
const callSiteFilter = callSite => {
|
|
9557
9964
|
if (omitFrames) {
|
|
9965
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
9966
|
+
if (callSite.getFunctionName()?.startsWith('__HIDE_')) {
|
|
9967
|
+
return false;
|
|
9968
|
+
}
|
|
9558
9969
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
9559
9970
|
return filterFileName(callSite.getFileName());
|
|
9560
9971
|
}
|
|
@@ -9720,7 +10131,7 @@ const CALLSITE_PATTERNS = [
|
|
|
9720
10131
|
};$h͏_once.tameV8ErrorConstructor(tameV8ErrorConstructor);
|
|
9721
10132
|
})()
|
|
9722
10133
|
,
|
|
9723
|
-
// ===
|
|
10134
|
+
// === 44. ses ./src/error/tame-error-constructor.js ===
|
|
9724
10135
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_ERROR,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,defineProperty,getOwnPropertyDescriptors,NativeErrors,tameV8ErrorConstructor;$h͏_imports([["../commons.js", [["FERAL_ERROR",[$h͏_a => (FERAL_ERROR = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["construct",[$h͏_a => (construct = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["setPrototypeOf",[$h͏_a => (setPrototypeOf = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]]]],["../permits.js", [["NativeErrors",[$h͏_a => (NativeErrors = $h͏_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor",[$h͏_a => (tameV8ErrorConstructor = $h͏_a)]]]]]);
|
|
9725
10136
|
|
|
9726
10137
|
|
|
@@ -10007,8 +10418,8 @@ let initialGetStackString = tamedMethods.getStackString;
|
|
|
10007
10418
|
}$h͏_once.default( tameErrorConstructor);
|
|
10008
10419
|
})()
|
|
10009
10420
|
,
|
|
10010
|
-
// ===
|
|
10011
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,Map,Set,TypeError,arrayJoin,arrayMap,arrayPush,arraySome,create,freeze,generatorNext,generatorThrow,getOwnPropertyNames,isArray,
|
|
10421
|
+
// === 45. ses ./src/module-load.js ===
|
|
10422
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,Map,Set,TypeError,arrayJoin,arrayMap,arrayPush,arraySome,create,freeze,generatorNext,generatorThrow,getOwnPropertyNames,isArray,isPrimitive,mapGet,mapHas,mapSet,promiseThen,setAdd,values,weakmapGet,weakmapHas,makeError,annotateError,q,b,X;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["arraySome",[$h͏_a => (arraySome = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["generatorNext",[$h͏_a => (generatorNext = $h͏_a)]],["generatorThrow",[$h͏_a => (generatorThrow = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["promiseThen",[$h͏_a => (promiseThen = $h͏_a)]],["setAdd",[$h͏_a => (setAdd = $h͏_a)]],["values",[$h͏_a => (values = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]]]],["./error/assert.js", [["makeError",[$h͏_a => (makeError = $h͏_a)]],["annotateError",[$h͏_a => (annotateError = $h͏_a)]],["q",[$h͏_a => (q = $h͏_a)]],["b",[$h͏_a => (b = $h͏_a)]],["X",[$h͏_a => (X = $h͏_a)]]]]]);
|
|
10012
10423
|
|
|
10013
10424
|
|
|
10014
10425
|
|
|
@@ -10196,7 +10607,7 @@ function* loadWithoutErrorAnnotation(
|
|
|
10196
10607
|
)} in parent compartment, use {source} module descriptor`,
|
|
10197
10608
|
TypeError,
|
|
10198
10609
|
);
|
|
10199
|
-
} else if (
|
|
10610
|
+
} else if (!isPrimitive(moduleDescriptor)) {
|
|
10200
10611
|
// In this shim (and not in XS, and not in the standard we imagine), we
|
|
10201
10612
|
// allow a module namespace object to stand in for a module descriptor that
|
|
10202
10613
|
// describes its original {compartment, specifier} so that it can be used
|
|
@@ -10219,7 +10630,7 @@ function* loadWithoutErrorAnnotation(
|
|
|
10219
10630
|
namespace: aliasSpecifier,
|
|
10220
10631
|
} = moduleDescriptor;
|
|
10221
10632
|
if (
|
|
10222
|
-
|
|
10633
|
+
isPrimitive(aliasCompartment) ||
|
|
10223
10634
|
!weakmapHas(compartmentPrivateFields, aliasCompartment)
|
|
10224
10635
|
) {
|
|
10225
10636
|
throw makeError(
|
|
@@ -10243,7 +10654,7 @@ function* loadWithoutErrorAnnotation(
|
|
|
10243
10654
|
|
|
10244
10655
|
// All remaining objects must either be a module namespace, or be
|
|
10245
10656
|
// promoted into a module namespace with a virtual module source.
|
|
10246
|
-
if (
|
|
10657
|
+
if (!isPrimitive(moduleDescriptor.namespace)) {
|
|
10247
10658
|
const { namespace } = moduleDescriptor;
|
|
10248
10659
|
// Brand-check SES shim module exports namespaces:
|
|
10249
10660
|
aliasDescriptor = weakmapGet(moduleAliases, namespace);
|
|
@@ -10416,7 +10827,7 @@ function* loadWithoutErrorAnnotation(
|
|
|
10416
10827
|
moduleDescriptor.specifier !== undefined
|
|
10417
10828
|
) {
|
|
10418
10829
|
if (
|
|
10419
|
-
|
|
10830
|
+
isPrimitive(moduleDescriptor.compartment) ||
|
|
10420
10831
|
!weakmapHas(compartmentPrivateFields, moduleDescriptor.compartment) ||
|
|
10421
10832
|
typeof moduleDescriptor.specifier !== 'string'
|
|
10422
10833
|
) {
|
|
@@ -10517,7 +10928,12 @@ const memoizedLoadWithErrorAnnotation = (
|
|
|
10517
10928
|
return moduleLoading;
|
|
10518
10929
|
};
|
|
10519
10930
|
|
|
10520
|
-
|
|
10931
|
+
/**
|
|
10932
|
+
* If `aggregateErrors` is `false`, the `errors` property of the fulfilled object
|
|
10933
|
+
* will always be empty.
|
|
10934
|
+
* @param {{errors?: Error[], noAggregateErrors?: boolean}} [options]
|
|
10935
|
+
*/
|
|
10936
|
+
const asyncJobQueue = ({ errors = [], noAggregateErrors = false } = {}) => {
|
|
10521
10937
|
/** @type {Set<Promise<undefined>>} */
|
|
10522
10938
|
const pendingJobs = new Set();
|
|
10523
10939
|
|
|
@@ -10533,7 +10949,11 @@ const asyncJobQueue = (errors = []) => {
|
|
|
10533
10949
|
setAdd(
|
|
10534
10950
|
pendingJobs,
|
|
10535
10951
|
promiseThen(func(...args), noop, error => {
|
|
10536
|
-
|
|
10952
|
+
if (noAggregateErrors) {
|
|
10953
|
+
throw error;
|
|
10954
|
+
} else {
|
|
10955
|
+
arrayPush(errors, error);
|
|
10956
|
+
}
|
|
10537
10957
|
}),
|
|
10538
10958
|
);
|
|
10539
10959
|
};
|
|
@@ -10550,7 +10970,12 @@ const asyncJobQueue = (errors = []) => {
|
|
|
10550
10970
|
return { enqueueJob, drainQueue, errors };
|
|
10551
10971
|
};
|
|
10552
10972
|
|
|
10553
|
-
|
|
10973
|
+
/**
|
|
10974
|
+
* If `aggregateErrors` is `false`, the `errors` property of the returned object
|
|
10975
|
+
* will always be empty.
|
|
10976
|
+
* @param {{errors?: Error[], noAggregateErrors?: boolean}} [options]
|
|
10977
|
+
*/
|
|
10978
|
+
const syncJobQueue = ({ errors = [], noAggregateErrors = false } = {}) => {
|
|
10554
10979
|
let current = [];
|
|
10555
10980
|
let next = [];
|
|
10556
10981
|
|
|
@@ -10574,7 +10999,11 @@ const syncJobQueue = (errors = []) => {
|
|
|
10574
10999
|
try {
|
|
10575
11000
|
func(...args);
|
|
10576
11001
|
} catch (error) {
|
|
10577
|
-
|
|
11002
|
+
if (noAggregateErrors) {
|
|
11003
|
+
throw error;
|
|
11004
|
+
} else {
|
|
11005
|
+
arrayPush(errors, error);
|
|
11006
|
+
}
|
|
10578
11007
|
}
|
|
10579
11008
|
}
|
|
10580
11009
|
current = next;
|
|
@@ -10607,18 +11036,24 @@ const throwAggregateError = ({ errors, errorPrefix }) => {
|
|
|
10607
11036
|
const preferSync = (_asyncImpl, syncImpl) => syncImpl;
|
|
10608
11037
|
const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
|
|
10609
11038
|
|
|
10610
|
-
|
|
11039
|
+
/**
|
|
10611
11040
|
* `load` asynchronously gathers the module records for a module and its
|
|
10612
11041
|
* transitive dependencies.
|
|
10613
11042
|
* The module records refer to each other by a reference to the dependency's
|
|
10614
11043
|
* compartment and the specifier of the module within its own compartment.
|
|
10615
11044
|
* This graph is then ready to be synchronously linked and executed.
|
|
11045
|
+
* @param {WeakMap<Compartment, any>} compartmentPrivateFields
|
|
11046
|
+
* @param {WeakMap<object, object>} moduleAliases
|
|
11047
|
+
* @param {Compartment} compartment
|
|
11048
|
+
* @param {string} moduleSpecifier - The module specifier to load.
|
|
11049
|
+
* @param {{ noAggregateErrors?: boolean}} options
|
|
10616
11050
|
*/
|
|
10617
11051
|
const load =async function(
|
|
10618
11052
|
compartmentPrivateFields,
|
|
10619
11053
|
moduleAliases,
|
|
10620
11054
|
compartment,
|
|
10621
|
-
moduleSpecifier
|
|
11055
|
+
moduleSpecifier,
|
|
11056
|
+
{ noAggregateErrors = false } = {})
|
|
10622
11057
|
{
|
|
10623
11058
|
const { name: compartmentName } = weakmapGet(
|
|
10624
11059
|
compartmentPrivateFields,
|
|
@@ -10628,7 +11063,9 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
|
|
|
10628
11063
|
/** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
|
|
10629
11064
|
const moduleLoads = new Map();
|
|
10630
11065
|
|
|
10631
|
-
const { enqueueJob, drainQueue, errors } = asyncJobQueue(
|
|
11066
|
+
const { enqueueJob, drainQueue, errors } = asyncJobQueue({
|
|
11067
|
+
noAggregateErrors,
|
|
11068
|
+
});
|
|
10632
11069
|
|
|
10633
11070
|
enqueueJob(memoizedLoadWithErrorAnnotation, [
|
|
10634
11071
|
compartmentPrivateFields,
|
|
@@ -10650,18 +11087,25 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
|
|
|
10650
11087
|
});
|
|
10651
11088
|
};
|
|
10652
11089
|
|
|
10653
|
-
|
|
11090
|
+
/**
|
|
10654
11091
|
* `loadNow` synchronously gathers the module records for a specified module
|
|
10655
11092
|
* and its transitive dependencies.
|
|
10656
11093
|
* The module records refer to each other by a reference to the dependency's
|
|
10657
11094
|
* compartment and the specifier of the module within its own compartment.
|
|
10658
11095
|
* This graph is then ready to be synchronously linked and executed.
|
|
11096
|
+
* @param {WeakMap<Compartment, any>} compartmentPrivateFields
|
|
11097
|
+
* @param {WeakMap<object, object>} moduleAliases
|
|
11098
|
+
* @param {Compartment} compartment
|
|
11099
|
+
* @param {string} moduleSpecifier - The module specifier to load.
|
|
11100
|
+
* @param {{ noAggregateErrors?: boolean}} options
|
|
10659
11101
|
*/$h͏_once.load(load);
|
|
11102
|
+
|
|
10660
11103
|
const loadNow = (
|
|
10661
11104
|
compartmentPrivateFields,
|
|
10662
11105
|
moduleAliases,
|
|
10663
11106
|
compartment,
|
|
10664
11107
|
moduleSpecifier,
|
|
11108
|
+
{ noAggregateErrors = false } = {},
|
|
10665
11109
|
) => {
|
|
10666
11110
|
const { name: compartmentName } = weakmapGet(
|
|
10667
11111
|
compartmentPrivateFields,
|
|
@@ -10671,7 +11115,9 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
|
|
|
10671
11115
|
/** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
|
|
10672
11116
|
const moduleLoads = new Map();
|
|
10673
11117
|
|
|
10674
|
-
const { enqueueJob, drainQueue, errors } = syncJobQueue(
|
|
11118
|
+
const { enqueueJob, drainQueue, errors } = syncJobQueue({
|
|
11119
|
+
noAggregateErrors,
|
|
11120
|
+
});
|
|
10675
11121
|
|
|
10676
11122
|
enqueueJob(memoizedLoadWithErrorAnnotation, [
|
|
10677
11123
|
compartmentPrivateFields,
|
|
@@ -10694,7 +11140,7 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
|
|
|
10694
11140
|
};$h͏_once.loadNow(loadNow);
|
|
10695
11141
|
})()
|
|
10696
11142
|
,
|
|
10697
|
-
// ===
|
|
11143
|
+
// === 46. ses ./src/module-proxy.js ===
|
|
10698
11144
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let makeAlias,Proxy,TypeError,create,freeze,mapGet,mapHas,mapSet,ownKeys,reflectGet,reflectGetOwnPropertyDescriptor,reflectHas,reflectIsExtensible,reflectPreventExtensions,toStringTagSymbol,weakmapSet,assert;$h͏_imports([["./module-load.js", [["makeAlias",[$h͏_a => (makeAlias = $h͏_a)]]]],["./commons.js", [["Proxy",[$h͏_a => (Proxy = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["reflectGet",[$h͏_a => (reflectGet = $h͏_a)]],["reflectGetOwnPropertyDescriptor",[$h͏_a => (reflectGetOwnPropertyDescriptor = $h͏_a)]],["reflectHas",[$h͏_a => (reflectHas = $h͏_a)]],["reflectIsExtensible",[$h͏_a => (reflectIsExtensible = $h͏_a)]],["reflectPreventExtensions",[$h͏_a => (reflectPreventExtensions = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
|
|
10699
11145
|
|
|
10700
11146
|
|
|
@@ -10897,7 +11343,7 @@ const { quote: q } = assert;
|
|
|
10897
11343
|
};$h͏_once.getDeferredExports(getDeferredExports);
|
|
10898
11344
|
})()
|
|
10899
11345
|
,
|
|
10900
|
-
// ===
|
|
11346
|
+
// === 47. ses ./src/compartment-evaluate.js ===
|
|
10901
11347
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,arrayPush,create,getOwnPropertyDescriptors,evadeHtmlCommentTest,evadeImportExpressionTest,rejectSomeDirectEvalExpressions,makeSafeEvaluator;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]]]],["./transforms.js", [["evadeHtmlCommentTest",[$h͏_a => (evadeHtmlCommentTest = $h͏_a)]],["evadeImportExpressionTest",[$h͏_a => (evadeImportExpressionTest = $h͏_a)]],["rejectSomeDirectEvalExpressions",[$h͏_a => (rejectSomeDirectEvalExpressions = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]]]);
|
|
10902
11348
|
|
|
10903
11349
|
|
|
@@ -10993,7 +11439,7 @@ const { quote: q } = assert;
|
|
|
10993
11439
|
};$h͏_once.compartmentEvaluate(compartmentEvaluate);
|
|
10994
11440
|
})()
|
|
10995
11441
|
,
|
|
10996
|
-
// ===
|
|
11442
|
+
// === 48. ses ./src/module-instance.js ===
|
|
10997
11443
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,reflectHas,assign,compartmentEvaluate;$h͏_imports([["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]],["./module-proxy.js", [["getDeferredExports",[$h͏_a => (getDeferredExports = $h͏_a)]]]],["./commons.js", [["ReferenceError",[$h͏_a => (ReferenceError = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["arraySome",[$h͏_a => (arraySome = $h͏_a)]],["arraySort",[$h͏_a => (arraySort = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["keys",[$h͏_a => (keys = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["reflectHas",[$h͏_a => (reflectHas = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate",[$h͏_a => (compartmentEvaluate = $h͏_a)]]]]]);
|
|
10998
11444
|
|
|
10999
11445
|
|
|
@@ -11350,6 +11796,25 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
|
|
|
11350
11796
|
};
|
|
11351
11797
|
notifiers['*'] = notifyStar;
|
|
11352
11798
|
|
|
11799
|
+
const wireUpExportNotifier = (exportName, notify) => {
|
|
11800
|
+
if (!notifiers[exportName] && notify !== false) {
|
|
11801
|
+
notifiers[exportName] = notify;
|
|
11802
|
+
|
|
11803
|
+
// exported live binding state
|
|
11804
|
+
let value;
|
|
11805
|
+
const update = newValue => (value = newValue);
|
|
11806
|
+
notify(update);
|
|
11807
|
+
exportsProps[exportName] = {
|
|
11808
|
+
get() {
|
|
11809
|
+
return value;
|
|
11810
|
+
},
|
|
11811
|
+
set: undefined,
|
|
11812
|
+
enumerable: true,
|
|
11813
|
+
configurable: false,
|
|
11814
|
+
};
|
|
11815
|
+
}
|
|
11816
|
+
};
|
|
11817
|
+
|
|
11353
11818
|
// Per the calling convention for the moduleFunctor generated from
|
|
11354
11819
|
// an ESM, the `imports` function gets called once up front
|
|
11355
11820
|
// to populate or arrange the population of imports and reexports.
|
|
@@ -11403,30 +11868,15 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
|
|
|
11403
11868
|
}
|
|
11404
11869
|
}
|
|
11405
11870
|
if (reexportMap[specifier]) {
|
|
11406
|
-
//
|
|
11871
|
+
// Set up reexport notifiers instantly so they are available in cycles.
|
|
11407
11872
|
for (const [localName, exportedName] of reexportMap[specifier]) {
|
|
11408
|
-
|
|
11873
|
+
wireUpExportNotifier(exportedName, importNotifiers[localName]);
|
|
11409
11874
|
}
|
|
11410
11875
|
}
|
|
11411
11876
|
}
|
|
11412
11877
|
|
|
11413
11878
|
for (const [exportName, notify] of entries(candidateAll)) {
|
|
11414
|
-
|
|
11415
|
-
notifiers[exportName] = notify;
|
|
11416
|
-
|
|
11417
|
-
// exported live binding state
|
|
11418
|
-
let value;
|
|
11419
|
-
const update = newValue => (value = newValue);
|
|
11420
|
-
notify(update);
|
|
11421
|
-
exportsProps[exportName] = {
|
|
11422
|
-
get() {
|
|
11423
|
-
return value;
|
|
11424
|
-
},
|
|
11425
|
-
set: undefined,
|
|
11426
|
-
enumerable: true,
|
|
11427
|
-
configurable: false,
|
|
11428
|
-
};
|
|
11429
|
-
}
|
|
11879
|
+
wireUpExportNotifier(exportName, notify);
|
|
11430
11880
|
}
|
|
11431
11881
|
|
|
11432
11882
|
// Sort the module exports namespace as per spec.
|
|
@@ -11493,8 +11943,8 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
|
|
|
11493
11943
|
};$h͏_once.makeModuleInstance(makeModuleInstance);
|
|
11494
11944
|
})()
|
|
11495
11945
|
,
|
|
11496
|
-
// ===
|
|
11497
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let assert,makeModuleInstance,makeVirtualModuleInstance,Map,ReferenceError,TypeError,entries,isArray,
|
|
11946
|
+
// === 49. ses ./src/module-link.js ===
|
|
11947
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let assert,makeModuleInstance,makeVirtualModuleInstance,Map,ReferenceError,TypeError,entries,isArray,isPrimitive,mapGet,mapHas,mapSet,weakmapGet;$h͏_imports([["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]],["./module-instance.js", [["makeModuleInstance",[$h͏_a => (makeModuleInstance = $h͏_a)]],["makeVirtualModuleInstance",[$h͏_a => (makeVirtualModuleInstance = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["ReferenceError",[$h͏_a => (ReferenceError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]]]]]);
|
|
11498
11948
|
|
|
11499
11949
|
|
|
11500
11950
|
|
|
@@ -11555,11 +12005,11 @@ function mayBePrecompiledModuleSource(moduleSource) {
|
|
|
11555
12005
|
|
|
11556
12006
|
function validatePrecompiledModuleSource(moduleSource, moduleSpecifier) {
|
|
11557
12007
|
const { __fixedExportMap__, __liveExportMap__ } = moduleSource;
|
|
11558
|
-
|
|
12008
|
+
!isPrimitive(__fixedExportMap__) ||
|
|
11559
12009
|
Fail`Property '__fixedExportMap__' of a precompiled module source must be an object, got ${q(
|
|
11560
12010
|
__fixedExportMap__,
|
|
11561
12011
|
)}, for module ${q(moduleSpecifier)}`;
|
|
11562
|
-
|
|
12012
|
+
!isPrimitive(__liveExportMap__) ||
|
|
11563
12013
|
Fail`Property '__liveExportMap__' of a precompiled module source must be an object, got ${q(
|
|
11564
12014
|
__liveExportMap__,
|
|
11565
12015
|
)}, for module ${q(moduleSpecifier)}`;
|
|
@@ -11578,7 +12028,7 @@ function validateVirtualModuleSource(moduleSource, moduleSpecifier) {
|
|
|
11578
12028
|
}
|
|
11579
12029
|
|
|
11580
12030
|
function validateModuleSource(moduleSource, moduleSpecifier) {
|
|
11581
|
-
|
|
12031
|
+
!isPrimitive(moduleSource) ||
|
|
11582
12032
|
Fail`Invalid module source: must be of type object, got ${q(
|
|
11583
12033
|
moduleSource,
|
|
11584
12034
|
)}, for module ${q(moduleSpecifier)}`;
|
|
@@ -11655,7 +12105,7 @@ function validateModuleSource(moduleSource, moduleSpecifier) {
|
|
|
11655
12105
|
};$h͏_once.instantiate(instantiate);
|
|
11656
12106
|
})()
|
|
11657
12107
|
,
|
|
11658
|
-
// ===
|
|
12108
|
+
// === 50. ses ./src/compartment.js ===
|
|
11659
12109
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Map,TypeError,WeakMap,arrayFlatMap,assign,defineProperties,identity,promiseThen,toStringTagSymbol,weakmapGet,weakmapSet,setGlobalObjectSymbolUnscopables,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,assert,assertEqual,q,sharedGlobalPropertyNames,load,loadNow,link,getDeferredExports,compartmentEvaluate,makeSafeEvaluator;$h͏_imports([["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["arrayFlatMap",[$h͏_a => (arrayFlatMap = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["identity",[$h͏_a => (identity = $h͏_a)]],["promiseThen",[$h͏_a => (promiseThen = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]]]],["./global-object.js", [["setGlobalObjectSymbolUnscopables",[$h͏_a => (setGlobalObjectSymbolUnscopables = $h͏_a)]],["setGlobalObjectConstantProperties",[$h͏_a => (setGlobalObjectConstantProperties = $h͏_a)]],["setGlobalObjectMutableProperties",[$h͏_a => (setGlobalObjectMutableProperties = $h͏_a)]],["setGlobalObjectEvaluators",[$h͏_a => (setGlobalObjectEvaluators = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]],["assertEqual",[$h͏_a => (assertEqual = $h͏_a)]],["q",[$h͏_a => (q = $h͏_a)]]]],["./permits.js", [["sharedGlobalPropertyNames",[$h͏_a => (sharedGlobalPropertyNames = $h͏_a)]]]],["./module-load.js", [["load",[$h͏_a => (load = $h͏_a)]],["loadNow",[$h͏_a => (loadNow = $h͏_a)]]]],["./module-link.js", [["link",[$h͏_a => (link = $h͏_a)]]]],["./module-proxy.js", [["getDeferredExports",[$h͏_a => (getDeferredExports = $h͏_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate",[$h͏_a => (compartmentEvaluate = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]]]);
|
|
11660
12110
|
|
|
11661
12111
|
|
|
@@ -11762,6 +12212,7 @@ const moduleAliases = new WeakMap();
|
|
|
11762
12212
|
* @property {Compartment} [parentCompartment]
|
|
11763
12213
|
* @property {boolean} noNamespaceBox
|
|
11764
12214
|
* @property {(fullSpecifier: string) => Promise<ModuleExportsNamespace>} compartmentImport
|
|
12215
|
+
* @property {boolean} [noAggregateLoadErrors]
|
|
11765
12216
|
*/
|
|
11766
12217
|
|
|
11767
12218
|
/**
|
|
@@ -11831,16 +12282,17 @@ const compartmentImportNow = (compartment, specifier) => {
|
|
|
11831
12282
|
},
|
|
11832
12283
|
|
|
11833
12284
|
async import(specifier) {
|
|
11834
|
-
const { noNamespaceBox } =
|
|
11835
|
-
weakmapGet(privateFields, this)
|
|
11836
|
-
);
|
|
12285
|
+
const { noNamespaceBox, noAggregateLoadErrors } =
|
|
12286
|
+
/** @type {CompartmentFields} */ (weakmapGet(privateFields, this));
|
|
11837
12287
|
|
|
11838
12288
|
if (typeof specifier !== 'string') {
|
|
11839
12289
|
throw TypeError('first argument of import() must be a string');
|
|
11840
12290
|
}
|
|
11841
12291
|
|
|
11842
12292
|
return promiseThen(
|
|
11843
|
-
load(privateFields, moduleAliases, this, specifier
|
|
12293
|
+
load(privateFields, moduleAliases, this, specifier, {
|
|
12294
|
+
noAggregateErrors: noAggregateLoadErrors,
|
|
12295
|
+
}),
|
|
11844
12296
|
() => {
|
|
11845
12297
|
// The namespace box is a contentious design and likely to be a breaking
|
|
11846
12298
|
// change in an appropriately numbered future version.
|
|
@@ -11863,16 +12315,27 @@ const compartmentImportNow = (compartment, specifier) => {
|
|
|
11863
12315
|
throw TypeError('first argument of load() must be a string');
|
|
11864
12316
|
}
|
|
11865
12317
|
|
|
11866
|
-
|
|
12318
|
+
const { noAggregateLoadErrors } = /** @type {CompartmentFields} */ (
|
|
12319
|
+
weakmapGet(privateFields, this)
|
|
12320
|
+
);
|
|
12321
|
+
|
|
12322
|
+
return load(privateFields, moduleAliases, this, specifier, {
|
|
12323
|
+
noAggregateErrors: noAggregateLoadErrors,
|
|
12324
|
+
});
|
|
11867
12325
|
},
|
|
11868
12326
|
|
|
11869
12327
|
importNow(specifier) {
|
|
11870
12328
|
if (typeof specifier !== 'string') {
|
|
11871
12329
|
throw TypeError('first argument of importNow() must be a string');
|
|
11872
12330
|
}
|
|
12331
|
+
const { noAggregateLoadErrors } = /** @type {CompartmentFields} */ (
|
|
12332
|
+
weakmapGet(privateFields, this)
|
|
12333
|
+
);
|
|
11873
12334
|
|
|
11874
|
-
loadNow(privateFields, moduleAliases, this, specifier
|
|
11875
|
-
|
|
12335
|
+
loadNow(privateFields, moduleAliases, this, specifier, {
|
|
12336
|
+
noAggregateErrors: noAggregateLoadErrors,
|
|
12337
|
+
});
|
|
12338
|
+
return compartmentImportNow(/** @type {Compartment} */ (this), specifier);
|
|
11876
12339
|
},
|
|
11877
12340
|
};
|
|
11878
12341
|
|
|
@@ -12003,6 +12466,7 @@ defineProperties(InertCompartment, {
|
|
|
12003
12466
|
moduleMapHook,
|
|
12004
12467
|
importMetaHook,
|
|
12005
12468
|
__noNamespaceBox__: noNamespaceBox = false,
|
|
12469
|
+
noAggregateLoadErrors = false,
|
|
12006
12470
|
} = compartmentOptions(...args);
|
|
12007
12471
|
const globalTransforms = arrayFlatMap(
|
|
12008
12472
|
[transforms, __shimTransforms__],
|
|
@@ -12080,7 +12544,9 @@ defineProperties(InertCompartment, {
|
|
|
12080
12544
|
`Compartment does not support dynamic import: no configured resolveHook for compartment ${q(name)}`,
|
|
12081
12545
|
);
|
|
12082
12546
|
}
|
|
12083
|
-
await load(privateFields, moduleAliases, compartment, fullSpecifier
|
|
12547
|
+
await load(privateFields, moduleAliases, compartment, fullSpecifier, {
|
|
12548
|
+
noAggregateErrors: noAggregateLoadErrors,
|
|
12549
|
+
});
|
|
12084
12550
|
const { execute, exportsProxy } = link(
|
|
12085
12551
|
privateFields,
|
|
12086
12552
|
moduleAliases,
|
|
@@ -12109,6 +12575,7 @@ defineProperties(InertCompartment, {
|
|
|
12109
12575
|
parentCompartment,
|
|
12110
12576
|
noNamespaceBox,
|
|
12111
12577
|
compartmentImport,
|
|
12578
|
+
noAggregateLoadErrors,
|
|
12112
12579
|
});
|
|
12113
12580
|
}
|
|
12114
12581
|
|
|
@@ -12118,7 +12585,7 @@ defineProperties(InertCompartment, {
|
|
|
12118
12585
|
};$h͏_once.makeCompartmentConstructor(makeCompartmentConstructor);
|
|
12119
12586
|
})()
|
|
12120
12587
|
,
|
|
12121
|
-
// ===
|
|
12588
|
+
// === 51. ses ./src/get-anonymous-intrinsics.js ===
|
|
12122
12589
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,Float32Array,Map,Set,String,getOwnPropertyDescriptor,getPrototypeOf,iterateArray,iterateMap,iterateSet,iterateString,matchAllRegExp,matchAllSymbol,regexpPrototype,globalThis,assign,AsyncGeneratorFunctionInstance,ArrayBuffer,InertCompartment;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["Float32Array",[$h͏_a => (Float32Array = $h͏_a)]],["Map",[$h͏_a => (Map = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["iterateArray",[$h͏_a => (iterateArray = $h͏_a)]],["iterateMap",[$h͏_a => (iterateMap = $h͏_a)]],["iterateSet",[$h͏_a => (iterateSet = $h͏_a)]],["iterateString",[$h͏_a => (iterateString = $h͏_a)]],["matchAllRegExp",[$h͏_a => (matchAllRegExp = $h͏_a)]],["matchAllSymbol",[$h͏_a => (matchAllSymbol = $h͏_a)]],["regexpPrototype",[$h͏_a => (regexpPrototype = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["AsyncGeneratorFunctionInstance",[$h͏_a => (AsyncGeneratorFunctionInstance = $h͏_a)]],["ArrayBuffer",[$h͏_a => (ArrayBuffer = $h͏_a)]]]],["./compartment.js", [["InertCompartment",[$h͏_a => (InertCompartment = $h͏_a)]]]]]);
|
|
12123
12590
|
|
|
12124
12591
|
|
|
@@ -12289,7 +12756,6 @@ function makeArguments() {
|
|
|
12289
12756
|
}
|
|
12290
12757
|
|
|
12291
12758
|
const ab = new ArrayBuffer(0);
|
|
12292
|
-
// @ts-expect-error TODO How do I add sliceToImmutable to ArrayBuffer type?
|
|
12293
12759
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
12294
12760
|
const iab = ab.sliceToImmutable();
|
|
12295
12761
|
const iabProto = getPrototypeOf(iab);
|
|
@@ -12302,7 +12768,7 @@ function makeArguments() {
|
|
|
12302
12768
|
};$h͏_once.getAnonymousIntrinsics(getAnonymousIntrinsics);
|
|
12303
12769
|
})()
|
|
12304
12770
|
,
|
|
12305
|
-
// ===
|
|
12771
|
+
// === 52. ses ./src/tame-harden.js ===
|
|
12306
12772
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let freeze;$h͏_imports([["./commons.js", [["freeze",[$h͏_a => (freeze = $h͏_a)]]]]]);
|
|
12307
12773
|
|
|
12308
12774
|
|
|
@@ -12334,7 +12800,7 @@ function makeArguments() {
|
|
|
12334
12800
|
freeze(tameHarden);
|
|
12335
12801
|
})()
|
|
12336
12802
|
,
|
|
12337
|
-
// ===
|
|
12803
|
+
// === 53. ses ./src/tame-symbol-constructor.js ===
|
|
12338
12804
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Symbol,entries,fromEntries,getOwnPropertyDescriptors,defineProperties,arrayMap,functionBind;$h͏_imports([["./commons.js", [["Symbol",[$h͏_a => (Symbol = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["functionBind",[$h͏_a => (functionBind = $h͏_a)]]]]]);
|
|
12339
12805
|
|
|
12340
12806
|
|
|
@@ -12401,7 +12867,7 @@ freeze(tameHarden);
|
|
|
12401
12867
|
};$h͏_once.tameSymbolConstructor(tameSymbolConstructor);
|
|
12402
12868
|
})()
|
|
12403
12869
|
,
|
|
12404
|
-
// ===
|
|
12870
|
+
// === 54. ses ./src/tame-faux-data-properties.js ===
|
|
12405
12871
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getOwnPropertyDescriptor,apply,defineProperty,toStringTagSymbol;$h͏_imports([["./commons.js", [["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]]]]]);
|
|
12406
12872
|
|
|
12407
12873
|
|
|
@@ -12614,8 +13080,8 @@ const throws = thunk => {
|
|
|
12614
13080
|
};$h͏_once.tameFauxDataProperties(tameFauxDataProperties);
|
|
12615
13081
|
})()
|
|
12616
13082
|
,
|
|
12617
|
-
// ===
|
|
12618
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let defineProperty,iteratorPrototype,iteratorSymbol,
|
|
13083
|
+
// === 55. ses ./src/tame-regenerator-runtime.js ===
|
|
13084
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let defineProperty,iteratorPrototype,iteratorSymbol,hasOwn;$h͏_imports([["./commons.js", [["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["iteratorPrototype",[$h͏_a => (iteratorPrototype = $h͏_a)]],["iteratorSymbol",[$h͏_a => (iteratorSymbol = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]]]);
|
|
12619
13085
|
|
|
12620
13086
|
|
|
12621
13087
|
|
|
@@ -12632,7 +13098,7 @@ const throws = thunk => {
|
|
|
12632
13098
|
set(value) {
|
|
12633
13099
|
// ignore the assignment on IteratorPrototype
|
|
12634
13100
|
if (this === iteratorPrototype) return;
|
|
12635
|
-
if (
|
|
13101
|
+
if (hasOwn(this, iteratorSymbol)) {
|
|
12636
13102
|
this[iteratorSymbol] = value;
|
|
12637
13103
|
}
|
|
12638
13104
|
defineProperty(this, iteratorSymbol, {
|
|
@@ -12646,7 +13112,7 @@ const throws = thunk => {
|
|
|
12646
13112
|
};$h͏_once.tameRegeneratorRuntime(tameRegeneratorRuntime);
|
|
12647
13113
|
})()
|
|
12648
13114
|
,
|
|
12649
|
-
// ===
|
|
13115
|
+
// === 56. ses ./src/shim-arraybuffer-transfer.js ===
|
|
12650
13116
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let ArrayBuffer,arrayBufferPrototype,arrayBufferSlice,arrayBufferGetByteLength,Uint8Array,typedArraySet,globalThis,TypeError,defineProperty;$h͏_imports([["./commons.js", [["ArrayBuffer",[$h͏_a => (ArrayBuffer = $h͏_a)]],["arrayBufferPrototype",[$h͏_a => (arrayBufferPrototype = $h͏_a)]],["arrayBufferSlice",[$h͏_a => (arrayBufferSlice = $h͏_a)]],["arrayBufferGetByteLength",[$h͏_a => (arrayBufferGetByteLength = $h͏_a)]],["Uint8Array",[$h͏_a => (Uint8Array = $h͏_a)]],["typedArraySet",[$h͏_a => (typedArraySet = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]]]]]);
|
|
12651
13117
|
|
|
12652
13118
|
|
|
@@ -12734,17 +13200,49 @@ const throws = thunk => {
|
|
|
12734
13200
|
};$h͏_once.shimArrayBufferTransfer(shimArrayBufferTransfer);
|
|
12735
13201
|
})()
|
|
12736
13202
|
,
|
|
12737
|
-
// ===
|
|
12738
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let
|
|
13203
|
+
// === 57. ses ./src/reporting.js ===
|
|
13204
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,assert;$h͏_imports([["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
|
|
12739
13205
|
|
|
12740
13206
|
|
|
12741
13207
|
/**
|
|
12742
13208
|
* @import {Reporter, GroupReporter} from './reporting-types.js'
|
|
12743
13209
|
*/
|
|
12744
13210
|
|
|
13211
|
+
/* eslint-disable @endo/no-polymorphic-call */
|
|
13212
|
+
/**
|
|
13213
|
+
* To address https://github.com/endojs/endo/issues/2908,
|
|
13214
|
+
* the `consoleReporter` uses the current `console` rather
|
|
13215
|
+
* than the original one.
|
|
13216
|
+
*
|
|
13217
|
+
* @type {GroupReporter}
|
|
13218
|
+
*/
|
|
13219
|
+
const consoleReporter = {
|
|
13220
|
+
warn(...args) {
|
|
13221
|
+
globalThis.console.warn(...args);
|
|
13222
|
+
},
|
|
13223
|
+
error(...args) {
|
|
13224
|
+
globalThis.console.error(...args);
|
|
13225
|
+
},
|
|
13226
|
+
...(globalThis.console?.groupCollapsed
|
|
13227
|
+
? {
|
|
13228
|
+
groupCollapsed(...args) {
|
|
13229
|
+
globalThis.console.groupCollapsed(...args);
|
|
13230
|
+
},
|
|
13231
|
+
}
|
|
13232
|
+
: undefined),
|
|
13233
|
+
...(globalThis.console?.groupEnd
|
|
13234
|
+
? {
|
|
13235
|
+
groupEnd() {
|
|
13236
|
+
globalThis.console.groupEnd();
|
|
13237
|
+
},
|
|
13238
|
+
}
|
|
13239
|
+
: undefined),
|
|
13240
|
+
};
|
|
13241
|
+
/* eslint-enable @endo/no-polymorphic-call */
|
|
13242
|
+
|
|
12745
13243
|
/**
|
|
12746
13244
|
* Creates a suitable reporter for internal errors and warnings out of the
|
|
12747
|
-
* Node.js console.error to ensure all messages to
|
|
13245
|
+
* Node.js console.error to ensure all messages go to stderr, including the
|
|
12748
13246
|
* group label.
|
|
12749
13247
|
* Accounts for the extra space introduced by console.error as a delimiter
|
|
12750
13248
|
* between the indent and subsequent arguments.
|
|
@@ -12788,18 +13286,22 @@ const mute = () => {};
|
|
|
12788
13286
|
if (reporting === 'none') {
|
|
12789
13287
|
return makeReportPrinter(mute);
|
|
12790
13288
|
}
|
|
12791
|
-
if (
|
|
12792
|
-
reporting === 'console' ||
|
|
12793
|
-
globalThis.window === globalThis ||
|
|
12794
|
-
globalThis.importScripts !== undefined
|
|
12795
|
-
) {
|
|
12796
|
-
return console;
|
|
12797
|
-
}
|
|
12798
13289
|
if (globalThis.console !== undefined) {
|
|
13290
|
+
if (
|
|
13291
|
+
reporting === 'console' || // asks for console explicitly
|
|
13292
|
+
globalThis.window === globalThis || // likely on browser
|
|
13293
|
+
globalThis.importScripts !== undefined // likely on worker
|
|
13294
|
+
) {
|
|
13295
|
+
// reporter just delegates directly to the current console
|
|
13296
|
+
return consoleReporter;
|
|
13297
|
+
}
|
|
13298
|
+
assert(reporting === 'platform');
|
|
12799
13299
|
// On Node.js, we send all feedback to stderr, regardless of purported level.
|
|
12800
|
-
|
|
12801
|
-
|
|
12802
|
-
|
|
13300
|
+
// This uses `consoleReporter.error` instead of `console.error` because we
|
|
13301
|
+
// want the constructed reporter to use the `console.error` of the current
|
|
13302
|
+
// `console`, not the `console` that was installed when the reporter
|
|
13303
|
+
// was created.
|
|
13304
|
+
return makeReportPrinter(consoleReporter.error);
|
|
12803
13305
|
}
|
|
12804
13306
|
if (globalThis.print !== undefined) {
|
|
12805
13307
|
return makeReportPrinter(globalThis.print);
|
|
@@ -12842,8 +13344,9 @@ const mute = () => {};
|
|
|
12842
13344
|
};$h͏_once.reportInGroup(reportInGroup);
|
|
12843
13345
|
})()
|
|
12844
13346
|
,
|
|
12845
|
-
// ===
|
|
12846
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,noEvalEvaluate,getOwnPropertyNames,getPrototypeOf,makeHardener,makeIntrinsicsCollector,removeUnpermittedIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameModuleSource,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor,tameFauxDataProperties,tameRegeneratorRuntime,shimArrayBufferTransfer,reportInGroup,chooseReporter;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["@endo/immutable-arraybuffer/shim
|
|
13347
|
+
// === 58. ses ./src/lockdown.js ===
|
|
13348
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,symbolFor,noEvalEvaluate,getOwnPropertyNames,getPrototypeOf,makeHardener,makeIntrinsicsCollector,removeUnpermittedIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameModuleSource,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor,tameFauxDataProperties,tameRegeneratorRuntime,shimArrayBufferTransfer,reportInGroup,chooseReporter;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["@endo/immutable-arraybuffer/shim.js", []],["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["FERAL_EVAL",[$h͏_a => (FERAL_EVAL = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["symbolFor",[$h͏_a => (symbolFor = $h͏_a)]],["noEvalEvaluate",[$h͏_a => (noEvalEvaluate = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]]]],["./make-hardener.js", [["makeHardener",[$h͏_a => (makeHardener = $h͏_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector",[$h͏_a => (makeIntrinsicsCollector = $h͏_a)]]]],["./permits-intrinsics.js", [["default",[$h͏_a => (removeUnpermittedIntrinsics = $h͏_a)]]]],["./tame-function-constructors.js", [["default",[$h͏_a => (tameFunctionConstructors = $h͏_a)]]]],["./tame-date-constructor.js", [["default",[$h͏_a => (tameDateConstructor = $h͏_a)]]]],["./tame-math-object.js", [["default",[$h͏_a => (tameMathObject = $h͏_a)]]]],["./tame-regexp-constructor.js", [["default",[$h͏_a => (tameRegExpConstructor = $h͏_a)]]]],["./enable-property-overrides.js", [["default",[$h͏_a => (enablePropertyOverrides = $h͏_a)]]]],["./tame-locale-methods.js", [["default",[$h͏_a => (tameLocaleMethods = $h͏_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties",[$h͏_a => (setGlobalObjectConstantProperties = $h͏_a)]],["setGlobalObjectMutableProperties",[$h͏_a => (setGlobalObjectMutableProperties = $h͏_a)]],["setGlobalObjectEvaluators",[$h͏_a => (setGlobalObjectEvaluators = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]],["./permits.js", [["initialGlobalPropertyNames",[$h͏_a => (initialGlobalPropertyNames = $h͏_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString",[$h͏_a => (tameFunctionToString = $h͏_a)]]]],["./tame-domains.js", [["tameDomains",[$h͏_a => (tameDomains = $h͏_a)]]]],["./tame-module-source.js", [["tameModuleSource",[$h͏_a => (tameModuleSource = $h͏_a)]]]],["./error/tame-console.js", [["tameConsole",[$h͏_a => (tameConsole = $h͏_a)]]]],["./error/tame-error-constructor.js", [["default",[$h͏_a => (tameErrorConstructor = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]],["makeAssert",[$h͏_a => (makeAssert = $h͏_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics",[$h͏_a => (getAnonymousIntrinsics = $h͏_a)]]]],["./compartment.js", [["makeCompartmentConstructor",[$h͏_a => (makeCompartmentConstructor = $h͏_a)]]]],["./tame-harden.js", [["tameHarden",[$h͏_a => (tameHarden = $h͏_a)]]]],["./tame-symbol-constructor.js", [["tameSymbolConstructor",[$h͏_a => (tameSymbolConstructor = $h͏_a)]]]],["./tame-faux-data-properties.js", [["tameFauxDataProperties",[$h͏_a => (tameFauxDataProperties = $h͏_a)]]]],["./tame-regenerator-runtime.js", [["tameRegeneratorRuntime",[$h͏_a => (tameRegeneratorRuntime = $h͏_a)]]]],["./shim-arraybuffer-transfer.js", [["shimArrayBufferTransfer",[$h͏_a => (shimArrayBufferTransfer = $h͏_a)]]]],["./reporting.js", [["reportInGroup",[$h͏_a => (reportInGroup = $h͏_a)]],["chooseReporter",[$h͏_a => (chooseReporter = $h͏_a)]]]]]);
|
|
13349
|
+
|
|
12847
13350
|
|
|
12848
13351
|
|
|
12849
13352
|
|
|
@@ -13208,6 +13711,30 @@ const probeHostEvaluators = () => {
|
|
|
13208
13711
|
|
|
13209
13712
|
const intrinsics = finalIntrinsics();
|
|
13210
13713
|
|
|
13714
|
+
// Install Object[@harden] or abort.
|
|
13715
|
+
const symbolForHarden = symbolFor('harden');
|
|
13716
|
+
const priorHarden = intrinsics.Object[symbolForHarden];
|
|
13717
|
+
if (priorHarden) {
|
|
13718
|
+
// By convention, if a module like @endo/harden gets used before lockdown,
|
|
13719
|
+
// it will install itself as a non-configurable, non-writable property over
|
|
13720
|
+
// Object[@harden] so that versions of SES predating the introduction of
|
|
13721
|
+
// Object[@harden] will fail to lockdown because they cannot remove an
|
|
13722
|
+
// unknown intrinsic.
|
|
13723
|
+
// All newer versions explicitly check for Object[@harden] (here).
|
|
13724
|
+
// The @endo/harden implementation additionally captures a stack trace
|
|
13725
|
+
// where harden was first used to assist developers in tracking down the
|
|
13726
|
+
// hardened module that was initialized before lockdown.
|
|
13727
|
+
if (priorHarden.lockdownError) {
|
|
13728
|
+
throw priorHarden.lockdownError;
|
|
13729
|
+
}
|
|
13730
|
+
// And in the event a library installs Object[@harden] without leaving a
|
|
13731
|
+
// hint, we fall back to a generic lockdown error.
|
|
13732
|
+
throw new TypeError(
|
|
13733
|
+
'Cannot lockdown (repairIntrinsics) if a prior harden implementation has been used and installed. Check for libraries using @endo/harden before lockdown.',
|
|
13734
|
+
);
|
|
13735
|
+
}
|
|
13736
|
+
intrinsics.Object[symbolForHarden] = tamedHarden;
|
|
13737
|
+
|
|
13211
13738
|
const hostIntrinsics = { __proto__: null };
|
|
13212
13739
|
|
|
13213
13740
|
// The Node.js Buffer is a derived class of Uint8Array, and as such is often
|
|
@@ -13249,19 +13776,16 @@ const probeHostEvaluators = () => {
|
|
|
13249
13776
|
);
|
|
13250
13777
|
}
|
|
13251
13778
|
|
|
13779
|
+
// The default `assert` installed by `assert-shim.js` does not redact errors,
|
|
13780
|
+
// leaving `lockdown` or `repairIntrinsics` with the obligation to replace it
|
|
13781
|
+
// with a redacting version, unless the caller opts-out with errorTaming set
|
|
13782
|
+
// to `unsafe` or `unsafe-debug`.
|
|
13783
|
+
// The inverse was true through version 1.13.0, except the configuration
|
|
13784
|
+
// was disregarded and the redacting `assert` left in place if lexical
|
|
13785
|
+
// `assert` differed from `globalThis.assert`.
|
|
13252
13786
|
// @ts-ignore assert is absent on globalThis type def.
|
|
13253
|
-
if (
|
|
13254
|
-
|
|
13255
|
-
globalThis.assert === assert
|
|
13256
|
-
) {
|
|
13257
|
-
// If errorTaming is 'unsafe' or 'unsafe-debug' we replace the
|
|
13258
|
-
// global assert with
|
|
13259
|
-
// one whose `details` template literal tag does not redact
|
|
13260
|
-
// unmarked substitution values. IOW, it blabs information that
|
|
13261
|
-
// was supposed to be secret from callers, as an aid to debugging
|
|
13262
|
-
// at a further cost in safety.
|
|
13263
|
-
// @ts-ignore assert is absent on globalThis type def.
|
|
13264
|
-
globalThis.assert = makeAssert(undefined, true);
|
|
13787
|
+
if (errorTaming !== 'unsafe' && errorTaming !== 'unsafe-debug') {
|
|
13788
|
+
globalThis.assert = makeAssert();
|
|
13265
13789
|
}
|
|
13266
13790
|
|
|
13267
13791
|
// Replace *Locale* methods with their non-locale equivalents
|
|
@@ -13403,7 +13927,7 @@ const probeHostEvaluators = () => {
|
|
|
13403
13927
|
};$h͏_once.repairIntrinsics(repairIntrinsics);
|
|
13404
13928
|
})()
|
|
13405
13929
|
,
|
|
13406
|
-
// ===
|
|
13930
|
+
// === 59. ses ./src/lockdown-shim.js ===
|
|
13407
13931
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,repairIntrinsics;$h͏_imports([["./assert-sloppy-mode.js", []],["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./lockdown.js", [["repairIntrinsics",[$h͏_a => (repairIntrinsics = $h͏_a)]]]]]);
|
|
13408
13932
|
|
|
13409
13933
|
|
|
@@ -13443,7 +13967,7 @@ globalThis.repairIntrinsics = options => {
|
|
|
13443
13967
|
};
|
|
13444
13968
|
})()
|
|
13445
13969
|
,
|
|
13446
|
-
// ===
|
|
13970
|
+
// === 60. ses ./src/compartment-shim.js ===
|
|
13447
13971
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,makeCompartmentConstructor,tameFunctionToString,getGlobalIntrinsics,chooseReporter;$h͏_imports([["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./compartment.js", [["makeCompartmentConstructor",[$h͏_a => (makeCompartmentConstructor = $h͏_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString",[$h͏_a => (tameFunctionToString = $h͏_a)]]]],["./intrinsics.js", [["getGlobalIntrinsics",[$h͏_a => (getGlobalIntrinsics = $h͏_a)]]]],["./reporting.js", [["chooseReporter",[$h͏_a => (chooseReporter = $h͏_a)]]]]]);
|
|
13448
13972
|
|
|
13449
13973
|
|
|
@@ -13468,14 +13992,14 @@ globalThis.Compartment = makeCompartmentConstructor(
|
|
|
13468
13992
|
);
|
|
13469
13993
|
})()
|
|
13470
13994
|
,
|
|
13471
|
-
// ===
|
|
13472
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,
|
|
13995
|
+
// === 61. ses ./src/assert-shim.js ===
|
|
13996
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,makeAssert;$h͏_imports([["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["makeAssert",[$h͏_a => (makeAssert = $h͏_a)]]]]]);
|
|
13473
13997
|
|
|
13474
13998
|
|
|
13475
|
-
globalThis.assert =
|
|
13999
|
+
globalThis.assert = makeAssert(undefined, true);
|
|
13476
14000
|
})()
|
|
13477
14001
|
,
|
|
13478
|
-
// ===
|
|
14002
|
+
// === 62. ses ./src/console-shim.js ===
|
|
13479
14003
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let symbolFor,globalThis,defineCausalConsoleFromLogger,loggedErrorHandler;$h͏_imports([["./commons.js", [["symbolFor",[$h͏_a => (symbolFor = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/console.js", [["defineCausalConsoleFromLogger",[$h͏_a => (defineCausalConsoleFromLogger = $h͏_a)]]]],["./error/assert.js", [["loggedErrorHandler",[$h͏_a => (loggedErrorHandler = $h͏_a)]]]]]);
|
|
13480
14004
|
|
|
13481
14005
|
|
|
@@ -13528,7 +14052,7 @@ globalThis[MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA] =
|
|
|
13528
14052
|
makeCausalConsoleFromLoggerForSesAva;
|
|
13529
14053
|
})()
|
|
13530
14054
|
,
|
|
13531
|
-
// ===
|
|
14055
|
+
// === 63. ses ./index.js ===
|
|
13532
14056
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/lockdown-shim.js", []],["./src/compartment-shim.js", []],["./src/assert-shim.js", []],["./src/console-shim.js", []]]);
|
|
13533
14057
|
})()
|
|
13534
14058
|
,
|