@metamask/snaps-execution-environments 10.2.1 → 10.2.2

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.
@@ -1,6 +1,6 @@
1
1
  /*! SES sources included by LavaMoat. Do not optimize or minify. */
2
2
  ;
3
- // ses@1.12.0
3
+ // ses@1.14.0
4
4
  (functors => options => {
5
5
  'use strict';
6
6
 
@@ -97,6 +97,7 @@
97
97
  setPrototypeOf: cell("setPrototypeOf"),
98
98
  values: cell("values"),
99
99
  fromEntries: cell("fromEntries"),
100
+ hasOwn: cell("hasOwn"),
100
101
  speciesSymbol: cell("speciesSymbol"),
101
102
  toStringTagSymbol: cell("toStringTagSymbol"),
102
103
  iteratorSymbol: cell("iteratorSymbol"),
@@ -188,7 +189,7 @@
188
189
  finalizationRegistryRegister: cell("finalizationRegistryRegister"),
189
190
  finalizationRegistryUnregister: cell("finalizationRegistryUnregister"),
190
191
  getConstructorOf: cell("getConstructorOf"),
191
- isObject: cell("isObject"),
192
+ isPrimitive: cell("isPrimitive"),
192
193
  isError: cell("isError"),
193
194
  identity: cell("identity"),
194
195
  FERAL_EVAL: cell("FERAL_EVAL"),
@@ -208,6 +209,15 @@
208
209
  },
209
210
  {
210
211
  },
212
+ {
213
+ isBufferImmutable: cell("isBufferImmutable"),
214
+ sliceBufferToImmutable: cell("sliceBufferToImmutable"),
215
+ optTransferBufferToImmutable: cell("optTransferBufferToImmutable"),
216
+ },
217
+ {
218
+ },
219
+ {
220
+ },
211
221
  {
212
222
  an: cell("an"),
213
223
  bestEffortStringify: cell("bestEffortStringify"),
@@ -218,7 +228,10 @@
218
228
  {
219
229
  },
220
230
  {
221
- makeLRUCacheMap: cell("makeLRUCacheMap"),
231
+ makeCacheMapKit: cell("makeCacheMapKit"),
232
+ },
233
+ {
234
+ makeCacheMapKit: cell("makeCacheMapKit"),
222
235
  },
223
236
  {
224
237
  makeNoteLogArgsArrayKit: cell("makeNoteLogArgsArrayKit"),
@@ -430,6 +443,8 @@
430
443
 
431
444
  defineProperties(cells[3], getOwnPropertyDescriptors(cells[2]));
432
445
 
446
+ defineProperties(cells[11], {"makeCacheMapKit": { value: cells[10]["makeCacheMapKit"] } });
447
+
433
448
  const namespaces = cells.map(cells => freeze(create(null, {
434
449
  ...cells,
435
450
  // Make this appear like an ESM module namespace object.
@@ -511,6 +526,7 @@ function observeImports(map, importName, importIndex) {
511
526
  setPrototypeOf: cells[0].setPrototypeOf.set,
512
527
  values: cells[0].values.set,
513
528
  fromEntries: cells[0].fromEntries.set,
529
+ hasOwn: cells[0].hasOwn.set,
514
530
  speciesSymbol: cells[0].speciesSymbol.set,
515
531
  toStringTagSymbol: cells[0].toStringTagSymbol.set,
516
532
  iteratorSymbol: cells[0].iteratorSymbol.set,
@@ -602,7 +618,7 @@ function observeImports(map, importName, importIndex) {
602
618
  finalizationRegistryRegister: cells[0].finalizationRegistryRegister.set,
603
619
  finalizationRegistryUnregister: cells[0].finalizationRegistryUnregister.set,
604
620
  getConstructorOf: cells[0].getConstructorOf.set,
605
- isObject: cells[0].isObject.set,
621
+ isPrimitive: cells[0].isPrimitive.set,
606
622
  isError: cells[0].isError.set,
607
623
  identity: cells[0].identity.set,
608
624
  FERAL_EVAL: cells[0].FERAL_EVAL.set,
@@ -653,20 +669,20 @@ function observeImports(map, importName, importIndex) {
653
669
  functors[4]({
654
670
  imports(entries) {
655
671
  const map = new Map(entries);
656
- observeImports(map, "../commons.js", 0);
657
672
  },
658
673
  liveVar: {
659
674
  },
660
675
  onceVar: {
661
- an: cells[4].an.set,
662
- bestEffortStringify: cells[4].bestEffortStringify.set,
663
- enJoin: cells[4].enJoin.set,
676
+ isBufferImmutable: cells[4].isBufferImmutable.set,
677
+ sliceBufferToImmutable: cells[4].sliceBufferToImmutable.set,
678
+ optTransferBufferToImmutable: cells[4].optTransferBufferToImmutable.set,
664
679
  },
665
680
  importMeta: {},
666
681
  });
667
682
  functors[5]({
668
683
  imports(entries) {
669
684
  const map = new Map(entries);
685
+ observeImports(map, "./immutable-arraybuffer-pony.js", 4);
670
686
  },
671
687
  liveVar: {
672
688
  },
@@ -677,6 +693,7 @@ function observeImports(map, importName, importIndex) {
677
693
  functors[6]({
678
694
  imports(entries) {
679
695
  const map = new Map(entries);
696
+ observeImports(map, "./src/immutable-arraybuffer-shim.js", 5);
680
697
  },
681
698
  liveVar: {
682
699
  },
@@ -687,125 +704,108 @@ function observeImports(map, importName, importIndex) {
687
704
  functors[7]({
688
705
  imports(entries) {
689
706
  const map = new Map(entries);
707
+ observeImports(map, "../commons.js", 0);
690
708
  },
691
709
  liveVar: {
692
710
  },
693
711
  onceVar: {
694
- makeLRUCacheMap: cells[7].makeLRUCacheMap.set,
712
+ an: cells[7].an.set,
713
+ bestEffortStringify: cells[7].bestEffortStringify.set,
714
+ enJoin: cells[7].enJoin.set,
695
715
  },
696
716
  importMeta: {},
697
717
  });
698
718
  functors[8]({
699
719
  imports(entries) {
700
720
  const map = new Map(entries);
701
- observeImports(map, "../make-lru-cachemap.js", 7);
702
721
  },
703
722
  liveVar: {
704
723
  },
705
724
  onceVar: {
706
- makeNoteLogArgsArrayKit: cells[8].makeNoteLogArgsArrayKit.set,
707
725
  },
708
726
  importMeta: {},
709
727
  });
710
728
  functors[9]({
711
729
  imports(entries) {
712
730
  const map = new Map(entries);
713
- observeImports(map, "../commons.js", 0);
714
- observeImports(map, "./stringify-utils.js", 4);
715
- observeImports(map, "./types.js", 5);
716
- observeImports(map, "./internal-types.js", 6);
717
- observeImports(map, "./note-log-args.js", 8);
718
731
  },
719
732
  liveVar: {
720
733
  },
721
734
  onceVar: {
722
- quote: cells[9].q.set,
723
- bare: cells[9].b.set,
724
- redactedDetails: cells[9].X.set,
725
- unredactedDetails: cells[9].unredactedDetails.set,
726
- makeError: cells[9].makeError.set,
727
- note: cells[9].annotateError.set,
728
- loggedErrorHandler: cells[9].loggedErrorHandler.set,
729
- makeAssert: cells[9].makeAssert.set,
730
- assert: cells[9].assert.set,
731
- assertEqual: cells[9].assertEqual.set,
732
- sanitizeError: cells[9].sanitizeError.set,
733
735
  },
734
736
  importMeta: {},
735
737
  });
736
738
  functors[10]({
737
739
  imports(entries) {
738
740
  const map = new Map(entries);
739
- observeImports(map, "./commons.js", 0);
740
- observeImports(map, "./error/assert.js", 9);
741
741
  },
742
742
  liveVar: {
743
743
  },
744
744
  onceVar: {
745
- isTypedArray: cells[10].isTypedArray.set,
746
- makeHardener: cells[10].makeHardener.set,
745
+ makeCacheMapKit: cells[10].makeCacheMapKit.set,
747
746
  },
748
747
  importMeta: {},
749
748
  });
750
749
  functors[11]({
751
750
  imports(entries) {
752
751
  const map = new Map(entries);
753
- observeImports(map, "./commons.js", 0);
752
+ observeImports(map, "./src/cachemap.js", 10);
754
753
  },
755
754
  liveVar: {
756
755
  },
757
756
  onceVar: {
758
- cauterizeProperty: cells[11].cauterizeProperty.set,
759
757
  },
760
758
  importMeta: {},
761
759
  });
762
760
  functors[12]({
763
761
  imports(entries) {
764
762
  const map = new Map(entries);
765
- observeImports(map, "./commons.js", 0);
763
+ observeImports(map, "@endo/cache-map", 11);
766
764
  },
767
765
  liveVar: {
768
766
  },
769
767
  onceVar: {
770
- NativeErrors: cells[12].NativeErrors.set,
771
- constantProperties: cells[12].constantProperties.set,
772
- universalPropertyNames: cells[12].universalPropertyNames.set,
773
- initialGlobalPropertyNames: cells[12].initialGlobalPropertyNames.set,
774
- sharedGlobalPropertyNames: cells[12].sharedGlobalPropertyNames.set,
775
- uniqueGlobalPropertyNames: cells[12].uniqueGlobalPropertyNames.set,
776
- FunctionInstance: cells[12].FunctionInstance.set,
777
- AsyncFunctionInstance: cells[12].AsyncFunctionInstance.set,
778
- isAccessorPermit: cells[12].isAccessorPermit.set,
779
- permitted: cells[12].permitted.set,
768
+ makeNoteLogArgsArrayKit: cells[12].makeNoteLogArgsArrayKit.set,
780
769
  },
781
770
  importMeta: {},
782
771
  });
783
772
  functors[13]({
784
773
  imports(entries) {
785
774
  const map = new Map(entries);
786
- observeImports(map, "./cauterize-property.js", 11);
787
- observeImports(map, "./commons.js", 0);
788
- observeImports(map, "./permits.js", 12);
775
+ observeImports(map, "../commons.js", 0);
776
+ observeImports(map, "./stringify-utils.js", 7);
777
+ observeImports(map, "./types.js", 8);
778
+ observeImports(map, "./internal-types.js", 9);
779
+ observeImports(map, "./note-log-args.js", 12);
789
780
  },
790
781
  liveVar: {
791
782
  },
792
783
  onceVar: {
793
- makeIntrinsicsCollector: cells[13].makeIntrinsicsCollector.set,
794
- getGlobalIntrinsics: cells[13].getGlobalIntrinsics.set,
784
+ quote: cells[13].q.set,
785
+ bare: cells[13].b.set,
786
+ redactedDetails: cells[13].X.set,
787
+ unredactedDetails: cells[13].unredactedDetails.set,
788
+ makeError: cells[13].makeError.set,
789
+ note: cells[13].annotateError.set,
790
+ loggedErrorHandler: cells[13].loggedErrorHandler.set,
791
+ makeAssert: cells[13].makeAssert.set,
792
+ assert: cells[13].assert.set,
793
+ assertEqual: cells[13].assertEqual.set,
794
+ sanitizeError: cells[13].sanitizeError.set,
795
795
  },
796
796
  importMeta: {},
797
797
  });
798
798
  functors[14]({
799
799
  imports(entries) {
800
800
  const map = new Map(entries);
801
- observeImports(map, "./permits.js", 12);
802
801
  observeImports(map, "./commons.js", 0);
803
- observeImports(map, "./cauterize-property.js", 11);
802
+ observeImports(map, "./error/assert.js", 13);
804
803
  },
805
804
  liveVar: {
806
805
  },
807
806
  onceVar: {
808
- default: cells[14].default.set,
807
+ isTypedArray: cells[14].isTypedArray.set,
808
+ makeHardener: cells[14].makeHardener.set,
809
809
  },
810
810
  importMeta: {},
811
811
  });
@@ -817,7 +817,7 @@ function observeImports(map, importName, importIndex) {
817
817
  liveVar: {
818
818
  },
819
819
  onceVar: {
820
- default: cells[15].default.set,
820
+ cauterizeProperty: cells[15].cauterizeProperty.set,
821
821
  },
822
822
  importMeta: {},
823
823
  });
@@ -829,26 +829,40 @@ function observeImports(map, importName, importIndex) {
829
829
  liveVar: {
830
830
  },
831
831
  onceVar: {
832
- default: cells[16].default.set,
832
+ NativeErrors: cells[16].NativeErrors.set,
833
+ constantProperties: cells[16].constantProperties.set,
834
+ universalPropertyNames: cells[16].universalPropertyNames.set,
835
+ initialGlobalPropertyNames: cells[16].initialGlobalPropertyNames.set,
836
+ sharedGlobalPropertyNames: cells[16].sharedGlobalPropertyNames.set,
837
+ uniqueGlobalPropertyNames: cells[16].uniqueGlobalPropertyNames.set,
838
+ FunctionInstance: cells[16].FunctionInstance.set,
839
+ AsyncFunctionInstance: cells[16].AsyncFunctionInstance.set,
840
+ isAccessorPermit: cells[16].isAccessorPermit.set,
841
+ permitted: cells[16].permitted.set,
833
842
  },
834
843
  importMeta: {},
835
844
  });
836
845
  functors[17]({
837
846
  imports(entries) {
838
847
  const map = new Map(entries);
848
+ observeImports(map, "./cauterize-property.js", 15);
839
849
  observeImports(map, "./commons.js", 0);
850
+ observeImports(map, "./permits.js", 16);
840
851
  },
841
852
  liveVar: {
842
853
  },
843
854
  onceVar: {
844
- default: cells[17].default.set,
855
+ makeIntrinsicsCollector: cells[17].makeIntrinsicsCollector.set,
856
+ getGlobalIntrinsics: cells[17].getGlobalIntrinsics.set,
845
857
  },
846
858
  importMeta: {},
847
859
  });
848
860
  functors[18]({
849
861
  imports(entries) {
850
862
  const map = new Map(entries);
863
+ observeImports(map, "./permits.js", 16);
851
864
  observeImports(map, "./commons.js", 0);
865
+ observeImports(map, "./cauterize-property.js", 15);
852
866
  },
853
867
  liveVar: {
854
868
  },
@@ -865,9 +879,7 @@ function observeImports(map, importName, importIndex) {
865
879
  liveVar: {
866
880
  },
867
881
  onceVar: {
868
- minEnablements: cells[19].minEnablements.set,
869
- moderateEnablements: cells[19].moderateEnablements.set,
870
- severeEnablements: cells[19].severeEnablements.set,
882
+ default: cells[19].default.set,
871
883
  },
872
884
  importMeta: {},
873
885
  });
@@ -875,7 +887,6 @@ function observeImports(map, importName, importIndex) {
875
887
  imports(entries) {
876
888
  const map = new Map(entries);
877
889
  observeImports(map, "./commons.js", 0);
878
- observeImports(map, "./enablements.js", 19);
879
890
  },
880
891
  liveVar: {
881
892
  },
@@ -888,7 +899,6 @@ function observeImports(map, importName, importIndex) {
888
899
  imports(entries) {
889
900
  const map = new Map(entries);
890
901
  observeImports(map, "./commons.js", 0);
891
- observeImports(map, "./error/assert.js", 9);
892
902
  },
893
903
  liveVar: {
894
904
  },
@@ -900,11 +910,12 @@ function observeImports(map, importName, importIndex) {
900
910
  functors[22]({
901
911
  imports(entries) {
902
912
  const map = new Map(entries);
913
+ observeImports(map, "./commons.js", 0);
903
914
  },
904
915
  liveVar: {
905
916
  },
906
917
  onceVar: {
907
- makeEvalFunction: cells[22].makeEvalFunction.set,
918
+ default: cells[22].default.set,
908
919
  },
909
920
  importMeta: {},
910
921
  });
@@ -912,12 +923,13 @@ function observeImports(map, importName, importIndex) {
912
923
  imports(entries) {
913
924
  const map = new Map(entries);
914
925
  observeImports(map, "./commons.js", 0);
915
- observeImports(map, "./error/assert.js", 9);
916
926
  },
917
927
  liveVar: {
918
928
  },
919
929
  onceVar: {
920
- makeFunctionConstructor: cells[23].makeFunctionConstructor.set,
930
+ minEnablements: cells[23].minEnablements.set,
931
+ moderateEnablements: cells[23].moderateEnablements.set,
932
+ severeEnablements: cells[23].severeEnablements.set,
921
933
  },
922
934
  importMeta: {},
923
935
  });
@@ -925,17 +937,12 @@ function observeImports(map, importName, importIndex) {
925
937
  imports(entries) {
926
938
  const map = new Map(entries);
927
939
  observeImports(map, "./commons.js", 0);
928
- observeImports(map, "./make-eval-function.js", 22);
929
- observeImports(map, "./make-function-constructor.js", 23);
930
- observeImports(map, "./permits.js", 12);
940
+ observeImports(map, "./enablements.js", 23);
931
941
  },
932
942
  liveVar: {
933
943
  },
934
944
  onceVar: {
935
- setGlobalObjectSymbolUnscopables: cells[24].setGlobalObjectSymbolUnscopables.set,
936
- setGlobalObjectConstantProperties: cells[24].setGlobalObjectConstantProperties.set,
937
- setGlobalObjectMutableProperties: cells[24].setGlobalObjectMutableProperties.set,
938
- setGlobalObjectEvaluators: cells[24].setGlobalObjectEvaluators.set,
945
+ default: cells[24].default.set,
939
946
  },
940
947
  importMeta: {},
941
948
  });
@@ -943,27 +950,23 @@ function observeImports(map, importName, importIndex) {
943
950
  imports(entries) {
944
951
  const map = new Map(entries);
945
952
  observeImports(map, "./commons.js", 0);
946
- observeImports(map, "./error/assert.js", 9);
953
+ observeImports(map, "./error/assert.js", 13);
947
954
  },
948
955
  liveVar: {
949
956
  },
950
957
  onceVar: {
951
- alwaysThrowHandler: cells[25].alwaysThrowHandler.set,
952
- strictScopeTerminatorHandler: cells[25].strictScopeTerminatorHandler.set,
953
- strictScopeTerminator: cells[25].strictScopeTerminator.set,
958
+ default: cells[25].default.set,
954
959
  },
955
960
  importMeta: {},
956
961
  });
957
962
  functors[26]({
958
963
  imports(entries) {
959
964
  const map = new Map(entries);
960
- observeImports(map, "./commons.js", 0);
961
- observeImports(map, "./strict-scope-terminator.js", 25);
962
965
  },
963
966
  liveVar: {
964
967
  },
965
968
  onceVar: {
966
- createSloppyGlobalsScopeTerminator: cells[26].createSloppyGlobalsScopeTerminator.set,
969
+ makeEvalFunction: cells[26].makeEvalFunction.set,
967
970
  },
968
971
  importMeta: {},
969
972
  });
@@ -971,12 +974,12 @@ function observeImports(map, importName, importIndex) {
971
974
  imports(entries) {
972
975
  const map = new Map(entries);
973
976
  observeImports(map, "./commons.js", 0);
974
- observeImports(map, "./error/assert.js", 9);
977
+ observeImports(map, "./error/assert.js", 13);
975
978
  },
976
979
  liveVar: {
977
980
  },
978
981
  onceVar: {
979
- makeEvalScopeKit: cells[27].makeEvalScopeKit.set,
982
+ makeFunctionConstructor: cells[27].makeFunctionConstructor.set,
980
983
  },
981
984
  importMeta: {},
982
985
  });
@@ -984,11 +987,17 @@ function observeImports(map, importName, importIndex) {
984
987
  imports(entries) {
985
988
  const map = new Map(entries);
986
989
  observeImports(map, "./commons.js", 0);
990
+ observeImports(map, "./make-eval-function.js", 26);
991
+ observeImports(map, "./make-function-constructor.js", 27);
992
+ observeImports(map, "./permits.js", 16);
987
993
  },
988
994
  liveVar: {
989
995
  },
990
996
  onceVar: {
991
- getSourceURL: cells[28].getSourceURL.set,
997
+ setGlobalObjectSymbolUnscopables: cells[28].setGlobalObjectSymbolUnscopables.set,
998
+ setGlobalObjectConstantProperties: cells[28].setGlobalObjectConstantProperties.set,
999
+ setGlobalObjectMutableProperties: cells[28].setGlobalObjectMutableProperties.set,
1000
+ setGlobalObjectEvaluators: cells[28].setGlobalObjectEvaluators.set,
992
1001
  },
993
1002
  importMeta: {},
994
1003
  });
@@ -996,19 +1005,14 @@ function observeImports(map, importName, importIndex) {
996
1005
  imports(entries) {
997
1006
  const map = new Map(entries);
998
1007
  observeImports(map, "./commons.js", 0);
999
- observeImports(map, "./get-source-url.js", 28);
1008
+ observeImports(map, "./error/assert.js", 13);
1000
1009
  },
1001
1010
  liveVar: {
1002
1011
  },
1003
1012
  onceVar: {
1004
- rejectHtmlComments: cells[29].rejectHtmlComments.set,
1005
- evadeHtmlCommentTest: cells[29].evadeHtmlCommentTest.set,
1006
- rejectImportExpressions: cells[29].rejectImportExpressions.set,
1007
- evadeImportExpressionTest: cells[29].evadeImportExpressionTest.set,
1008
- rejectSomeDirectEvalExpressions: cells[29].rejectSomeDirectEvalExpressions.set,
1009
- mandatoryTransforms: cells[29].mandatoryTransforms.set,
1010
- applyTransforms: cells[29].applyTransforms.set,
1011
- transforms: cells[29].transforms.set,
1013
+ alwaysThrowHandler: cells[29].alwaysThrowHandler.set,
1014
+ strictScopeTerminatorHandler: cells[29].strictScopeTerminatorHandler.set,
1015
+ strictScopeTerminator: cells[29].strictScopeTerminator.set,
1012
1016
  },
1013
1017
  importMeta: {},
1014
1018
  });
@@ -1016,12 +1020,12 @@ function observeImports(map, importName, importIndex) {
1016
1020
  imports(entries) {
1017
1021
  const map = new Map(entries);
1018
1022
  observeImports(map, "./commons.js", 0);
1023
+ observeImports(map, "./strict-scope-terminator.js", 29);
1019
1024
  },
1020
1025
  liveVar: {
1021
1026
  },
1022
1027
  onceVar: {
1023
- isValidIdentifierName: cells[30].isValidIdentifierName.set,
1024
- getScopeConstants: cells[30].getScopeConstants.set,
1028
+ createSloppyGlobalsScopeTerminator: cells[30].createSloppyGlobalsScopeTerminator.set,
1025
1029
  },
1026
1030
  importMeta: {},
1027
1031
  });
@@ -1029,12 +1033,12 @@ function observeImports(map, importName, importIndex) {
1029
1033
  imports(entries) {
1030
1034
  const map = new Map(entries);
1031
1035
  observeImports(map, "./commons.js", 0);
1032
- observeImports(map, "./scope-constants.js", 30);
1036
+ observeImports(map, "./error/assert.js", 13);
1033
1037
  },
1034
1038
  liveVar: {
1035
1039
  },
1036
1040
  onceVar: {
1037
- makeEvaluate: cells[31].makeEvaluate.set,
1041
+ makeEvalScopeKit: cells[31].makeEvalScopeKit.set,
1038
1042
  },
1039
1043
  importMeta: {},
1040
1044
  });
@@ -1042,17 +1046,11 @@ function observeImports(map, importName, importIndex) {
1042
1046
  imports(entries) {
1043
1047
  const map = new Map(entries);
1044
1048
  observeImports(map, "./commons.js", 0);
1045
- observeImports(map, "./strict-scope-terminator.js", 25);
1046
- observeImports(map, "./sloppy-globals-scope-terminator.js", 26);
1047
- observeImports(map, "./eval-scope.js", 27);
1048
- observeImports(map, "./transforms.js", 29);
1049
- observeImports(map, "./make-evaluate.js", 31);
1050
- observeImports(map, "./error/assert.js", 9);
1051
1049
  },
1052
1050
  liveVar: {
1053
1051
  },
1054
1052
  onceVar: {
1055
- makeSafeEvaluator: cells[32].makeSafeEvaluator.set,
1053
+ getSourceURL: cells[32].getSourceURL.set,
1056
1054
  },
1057
1055
  importMeta: {},
1058
1056
  });
@@ -1060,11 +1058,19 @@ function observeImports(map, importName, importIndex) {
1060
1058
  imports(entries) {
1061
1059
  const map = new Map(entries);
1062
1060
  observeImports(map, "./commons.js", 0);
1061
+ observeImports(map, "./get-source-url.js", 32);
1063
1062
  },
1064
1063
  liveVar: {
1065
1064
  },
1066
1065
  onceVar: {
1067
- tameFunctionToString: cells[33].tameFunctionToString.set,
1066
+ rejectHtmlComments: cells[33].rejectHtmlComments.set,
1067
+ evadeHtmlCommentTest: cells[33].evadeHtmlCommentTest.set,
1068
+ rejectImportExpressions: cells[33].rejectImportExpressions.set,
1069
+ evadeImportExpressionTest: cells[33].evadeImportExpressionTest.set,
1070
+ rejectSomeDirectEvalExpressions: cells[33].rejectSomeDirectEvalExpressions.set,
1071
+ mandatoryTransforms: cells[33].mandatoryTransforms.set,
1072
+ applyTransforms: cells[33].applyTransforms.set,
1073
+ transforms: cells[33].transforms.set,
1068
1074
  },
1069
1075
  importMeta: {},
1070
1076
  });
@@ -1076,7 +1082,8 @@ function observeImports(map, importName, importIndex) {
1076
1082
  liveVar: {
1077
1083
  },
1078
1084
  onceVar: {
1079
- tameDomains: cells[34].tameDomains.set,
1085
+ isValidIdentifierName: cells[34].isValidIdentifierName.set,
1086
+ getScopeConstants: cells[34].getScopeConstants.set,
1080
1087
  },
1081
1088
  importMeta: {},
1082
1089
  });
@@ -1084,70 +1091,66 @@ function observeImports(map, importName, importIndex) {
1084
1091
  imports(entries) {
1085
1092
  const map = new Map(entries);
1086
1093
  observeImports(map, "./commons.js", 0);
1094
+ observeImports(map, "./scope-constants.js", 34);
1087
1095
  },
1088
1096
  liveVar: {
1089
1097
  },
1090
1098
  onceVar: {
1091
- tameModuleSource: cells[35].tameModuleSource.set,
1099
+ makeEvaluate: cells[35].makeEvaluate.set,
1092
1100
  },
1093
1101
  importMeta: {},
1094
1102
  });
1095
1103
  functors[36]({
1096
1104
  imports(entries) {
1097
1105
  const map = new Map(entries);
1098
- observeImports(map, "../commons.js", 0);
1106
+ observeImports(map, "./commons.js", 0);
1107
+ observeImports(map, "./strict-scope-terminator.js", 29);
1108
+ observeImports(map, "./sloppy-globals-scope-terminator.js", 30);
1109
+ observeImports(map, "./eval-scope.js", 31);
1110
+ observeImports(map, "./transforms.js", 33);
1111
+ observeImports(map, "./make-evaluate.js", 35);
1112
+ observeImports(map, "./error/assert.js", 13);
1099
1113
  },
1100
1114
  liveVar: {
1101
1115
  },
1102
1116
  onceVar: {
1103
- consoleLevelMethods: cells[36].consoleLevelMethods.set,
1104
- consoleOtherMethods: cells[36].consoleOtherMethods.set,
1105
- makeLoggingConsoleKit: cells[36].makeLoggingConsoleKit.set,
1106
- pumpLogToConsole: cells[36].pumpLogToConsole.set,
1107
- makeCausalConsole: cells[36].makeCausalConsole.set,
1108
- defineCausalConsoleFromLogger: cells[36].defineCausalConsoleFromLogger.set,
1109
- filterConsole: cells[36].filterConsole.set,
1117
+ makeSafeEvaluator: cells[36].makeSafeEvaluator.set,
1110
1118
  },
1111
1119
  importMeta: {},
1112
1120
  });
1113
1121
  functors[37]({
1114
1122
  imports(entries) {
1115
1123
  const map = new Map(entries);
1116
- observeImports(map, "../commons.js", 0);
1124
+ observeImports(map, "./commons.js", 0);
1117
1125
  },
1118
1126
  liveVar: {
1119
1127
  },
1120
1128
  onceVar: {
1121
- makeRejectionHandlers: cells[37].makeRejectionHandlers.set,
1129
+ tameFunctionToString: cells[37].tameFunctionToString.set,
1122
1130
  },
1123
1131
  importMeta: {},
1124
1132
  });
1125
1133
  functors[38]({
1126
1134
  imports(entries) {
1127
1135
  const map = new Map(entries);
1128
- observeImports(map, "../commons.js", 0);
1129
- observeImports(map, "./assert.js", 9);
1130
- observeImports(map, "./console.js", 36);
1131
- observeImports(map, "./unhandled-rejection.js", 37);
1136
+ observeImports(map, "./commons.js", 0);
1132
1137
  },
1133
1138
  liveVar: {
1134
1139
  },
1135
1140
  onceVar: {
1136
- tameConsole: cells[38].tameConsole.set,
1141
+ tameDomains: cells[38].tameDomains.set,
1137
1142
  },
1138
1143
  importMeta: {},
1139
1144
  });
1140
1145
  functors[39]({
1141
1146
  imports(entries) {
1142
1147
  const map = new Map(entries);
1143
- observeImports(map, "../commons.js", 0);
1148
+ observeImports(map, "./commons.js", 0);
1144
1149
  },
1145
1150
  liveVar: {
1146
1151
  },
1147
1152
  onceVar: {
1148
- filterFileName: cells[39].filterFileName.set,
1149
- shortenCallSiteString: cells[39].shortenCallSiteString.set,
1150
- tameV8ErrorConstructor: cells[39].tameV8ErrorConstructor.set,
1153
+ tameModuleSource: cells[39].tameModuleSource.set,
1151
1154
  },
1152
1155
  importMeta: {},
1153
1156
  });
@@ -1155,113 +1158,103 @@ function observeImports(map, importName, importIndex) {
1155
1158
  imports(entries) {
1156
1159
  const map = new Map(entries);
1157
1160
  observeImports(map, "../commons.js", 0);
1158
- observeImports(map, "../permits.js", 12);
1159
- observeImports(map, "./tame-v8-error-constructor.js", 39);
1160
1161
  },
1161
1162
  liveVar: {
1162
1163
  },
1163
1164
  onceVar: {
1164
- default: cells[40].default.set,
1165
+ consoleLevelMethods: cells[40].consoleLevelMethods.set,
1166
+ consoleOtherMethods: cells[40].consoleOtherMethods.set,
1167
+ makeLoggingConsoleKit: cells[40].makeLoggingConsoleKit.set,
1168
+ pumpLogToConsole: cells[40].pumpLogToConsole.set,
1169
+ makeCausalConsole: cells[40].makeCausalConsole.set,
1170
+ defineCausalConsoleFromLogger: cells[40].defineCausalConsoleFromLogger.set,
1171
+ filterConsole: cells[40].filterConsole.set,
1165
1172
  },
1166
1173
  importMeta: {},
1167
1174
  });
1168
1175
  functors[41]({
1169
1176
  imports(entries) {
1170
1177
  const map = new Map(entries);
1171
- observeImports(map, "@endo/env-options", 3);
1172
- observeImports(map, "./commons.js", 0);
1173
- observeImports(map, "./error/assert.js", 9);
1178
+ observeImports(map, "../commons.js", 0);
1174
1179
  },
1175
1180
  liveVar: {
1176
1181
  },
1177
1182
  onceVar: {
1178
- makeAlias: cells[41].makeAlias.set,
1179
- load: cells[41].load.set,
1180
- loadNow: cells[41].loadNow.set,
1183
+ makeRejectionHandlers: cells[41].makeRejectionHandlers.set,
1181
1184
  },
1182
1185
  importMeta: {},
1183
1186
  });
1184
1187
  functors[42]({
1185
1188
  imports(entries) {
1186
1189
  const map = new Map(entries);
1187
- observeImports(map, "./module-load.js", 41);
1188
- observeImports(map, "./commons.js", 0);
1189
- observeImports(map, "./error/assert.js", 9);
1190
+ observeImports(map, "../commons.js", 0);
1191
+ observeImports(map, "./assert.js", 13);
1192
+ observeImports(map, "./console.js", 40);
1193
+ observeImports(map, "./unhandled-rejection.js", 41);
1190
1194
  },
1191
1195
  liveVar: {
1192
1196
  },
1193
1197
  onceVar: {
1194
- deferExports: cells[42].deferExports.set,
1195
- getDeferredExports: cells[42].getDeferredExports.set,
1198
+ tameConsole: cells[42].tameConsole.set,
1196
1199
  },
1197
1200
  importMeta: {},
1198
1201
  });
1199
1202
  functors[43]({
1200
1203
  imports(entries) {
1201
1204
  const map = new Map(entries);
1202
- observeImports(map, "./commons.js", 0);
1203
- observeImports(map, "./transforms.js", 29);
1204
- observeImports(map, "./make-safe-evaluator.js", 32);
1205
+ observeImports(map, "../commons.js", 0);
1205
1206
  },
1206
1207
  liveVar: {
1207
1208
  },
1208
1209
  onceVar: {
1209
- provideCompartmentEvaluator: cells[43].provideCompartmentEvaluator.set,
1210
- compartmentEvaluate: cells[43].compartmentEvaluate.set,
1210
+ filterFileName: cells[43].filterFileName.set,
1211
+ shortenCallSiteString: cells[43].shortenCallSiteString.set,
1212
+ tameV8ErrorConstructor: cells[43].tameV8ErrorConstructor.set,
1211
1213
  },
1212
1214
  importMeta: {},
1213
1215
  });
1214
1216
  functors[44]({
1215
1217
  imports(entries) {
1216
1218
  const map = new Map(entries);
1217
- observeImports(map, "./error/assert.js", 9);
1218
- observeImports(map, "./module-proxy.js", 42);
1219
- observeImports(map, "./commons.js", 0);
1220
- observeImports(map, "./compartment-evaluate.js", 43);
1219
+ observeImports(map, "../commons.js", 0);
1220
+ observeImports(map, "../permits.js", 16);
1221
+ observeImports(map, "./tame-v8-error-constructor.js", 43);
1221
1222
  },
1222
1223
  liveVar: {
1223
1224
  },
1224
1225
  onceVar: {
1225
- makeVirtualModuleInstance: cells[44].makeVirtualModuleInstance.set,
1226
- makeModuleInstance: cells[44].makeModuleInstance.set,
1226
+ default: cells[44].default.set,
1227
1227
  },
1228
1228
  importMeta: {},
1229
1229
  });
1230
1230
  functors[45]({
1231
1231
  imports(entries) {
1232
1232
  const map = new Map(entries);
1233
- observeImports(map, "./error/assert.js", 9);
1234
- observeImports(map, "./module-instance.js", 44);
1233
+ observeImports(map, "@endo/env-options", 3);
1235
1234
  observeImports(map, "./commons.js", 0);
1235
+ observeImports(map, "./error/assert.js", 13);
1236
1236
  },
1237
1237
  liveVar: {
1238
1238
  },
1239
1239
  onceVar: {
1240
- link: cells[45].link.set,
1241
- instantiate: cells[45].instantiate.set,
1240
+ makeAlias: cells[45].makeAlias.set,
1241
+ load: cells[45].load.set,
1242
+ loadNow: cells[45].loadNow.set,
1242
1243
  },
1243
1244
  importMeta: {},
1244
1245
  });
1245
1246
  functors[46]({
1246
1247
  imports(entries) {
1247
1248
  const map = new Map(entries);
1249
+ observeImports(map, "./module-load.js", 45);
1248
1250
  observeImports(map, "./commons.js", 0);
1249
- observeImports(map, "./global-object.js", 24);
1250
- observeImports(map, "./error/assert.js", 9);
1251
- observeImports(map, "./permits.js", 12);
1252
- observeImports(map, "./module-load.js", 41);
1253
- observeImports(map, "./module-link.js", 45);
1254
- observeImports(map, "./module-proxy.js", 42);
1255
- observeImports(map, "./compartment-evaluate.js", 43);
1256
- observeImports(map, "./make-safe-evaluator.js", 32);
1251
+ observeImports(map, "./error/assert.js", 13);
1257
1252
  },
1258
1253
  liveVar: {
1259
1254
  },
1260
1255
  onceVar: {
1261
- InertCompartment: cells[46].InertCompartment.set,
1262
- CompartmentPrototype: cells[46].CompartmentPrototype.set,
1263
- compartmentOptions: cells[46].compartmentOptions.set,
1264
- makeCompartmentConstructor: cells[46].makeCompartmentConstructor.set,
1256
+ deferExports: cells[46].deferExports.set,
1257
+ getDeferredExports: cells[46].getDeferredExports.set,
1265
1258
  },
1266
1259
  importMeta: {},
1267
1260
  });
@@ -1269,36 +1262,45 @@ function observeImports(map, importName, importIndex) {
1269
1262
  imports(entries) {
1270
1263
  const map = new Map(entries);
1271
1264
  observeImports(map, "./commons.js", 0);
1272
- observeImports(map, "./compartment.js", 46);
1265
+ observeImports(map, "./transforms.js", 33);
1266
+ observeImports(map, "./make-safe-evaluator.js", 36);
1273
1267
  },
1274
1268
  liveVar: {
1275
1269
  },
1276
1270
  onceVar: {
1277
- getAnonymousIntrinsics: cells[47].getAnonymousIntrinsics.set,
1271
+ provideCompartmentEvaluator: cells[47].provideCompartmentEvaluator.set,
1272
+ compartmentEvaluate: cells[47].compartmentEvaluate.set,
1278
1273
  },
1279
1274
  importMeta: {},
1280
1275
  });
1281
1276
  functors[48]({
1282
1277
  imports(entries) {
1283
1278
  const map = new Map(entries);
1279
+ observeImports(map, "./error/assert.js", 13);
1280
+ observeImports(map, "./module-proxy.js", 46);
1284
1281
  observeImports(map, "./commons.js", 0);
1282
+ observeImports(map, "./compartment-evaluate.js", 47);
1285
1283
  },
1286
1284
  liveVar: {
1287
1285
  },
1288
1286
  onceVar: {
1289
- tameHarden: cells[48].tameHarden.set,
1287
+ makeVirtualModuleInstance: cells[48].makeVirtualModuleInstance.set,
1288
+ makeModuleInstance: cells[48].makeModuleInstance.set,
1290
1289
  },
1291
1290
  importMeta: {},
1292
1291
  });
1293
1292
  functors[49]({
1294
1293
  imports(entries) {
1295
1294
  const map = new Map(entries);
1295
+ observeImports(map, "./error/assert.js", 13);
1296
+ observeImports(map, "./module-instance.js", 48);
1296
1297
  observeImports(map, "./commons.js", 0);
1297
1298
  },
1298
1299
  liveVar: {
1299
1300
  },
1300
1301
  onceVar: {
1301
- tameSymbolConstructor: cells[49].tameSymbolConstructor.set,
1302
+ link: cells[49].link.set,
1303
+ instantiate: cells[49].instantiate.set,
1302
1304
  },
1303
1305
  importMeta: {},
1304
1306
  });
@@ -1306,12 +1308,22 @@ function observeImports(map, importName, importIndex) {
1306
1308
  imports(entries) {
1307
1309
  const map = new Map(entries);
1308
1310
  observeImports(map, "./commons.js", 0);
1311
+ observeImports(map, "./global-object.js", 28);
1312
+ observeImports(map, "./error/assert.js", 13);
1313
+ observeImports(map, "./permits.js", 16);
1314
+ observeImports(map, "./module-load.js", 45);
1315
+ observeImports(map, "./module-link.js", 49);
1316
+ observeImports(map, "./module-proxy.js", 46);
1317
+ observeImports(map, "./compartment-evaluate.js", 47);
1318
+ observeImports(map, "./make-safe-evaluator.js", 36);
1309
1319
  },
1310
1320
  liveVar: {
1311
1321
  },
1312
1322
  onceVar: {
1313
- tameFauxDataProperty: cells[50].tameFauxDataProperty.set,
1314
- tameFauxDataProperties: cells[50].tameFauxDataProperties.set,
1323
+ InertCompartment: cells[50].InertCompartment.set,
1324
+ CompartmentPrototype: cells[50].CompartmentPrototype.set,
1325
+ compartmentOptions: cells[50].compartmentOptions.set,
1326
+ makeCompartmentConstructor: cells[50].makeCompartmentConstructor.set,
1315
1327
  },
1316
1328
  importMeta: {},
1317
1329
  });
@@ -1319,11 +1331,12 @@ function observeImports(map, importName, importIndex) {
1319
1331
  imports(entries) {
1320
1332
  const map = new Map(entries);
1321
1333
  observeImports(map, "./commons.js", 0);
1334
+ observeImports(map, "./compartment.js", 50);
1322
1335
  },
1323
1336
  liveVar: {
1324
1337
  },
1325
1338
  onceVar: {
1326
- tameRegeneratorRuntime: cells[51].tameRegeneratorRuntime.set,
1339
+ getAnonymousIntrinsics: cells[51].getAnonymousIntrinsics.set,
1327
1340
  },
1328
1341
  importMeta: {},
1329
1342
  });
@@ -1335,7 +1348,7 @@ function observeImports(map, importName, importIndex) {
1335
1348
  liveVar: {
1336
1349
  },
1337
1350
  onceVar: {
1338
- shimArrayBufferTransfer: cells[52].shimArrayBufferTransfer.set,
1351
+ tameHarden: cells[52].tameHarden.set,
1339
1352
  },
1340
1353
  importMeta: {},
1341
1354
  });
@@ -1343,65 +1356,36 @@ function observeImports(map, importName, importIndex) {
1343
1356
  imports(entries) {
1344
1357
  const map = new Map(entries);
1345
1358
  observeImports(map, "./commons.js", 0);
1346
- observeImports(map, "./error/assert.js", 9);
1347
1359
  },
1348
1360
  liveVar: {
1349
1361
  },
1350
1362
  onceVar: {
1351
- chooseReporter: cells[53].chooseReporter.set,
1352
- reportInGroup: cells[53].reportInGroup.set,
1363
+ tameSymbolConstructor: cells[53].tameSymbolConstructor.set,
1353
1364
  },
1354
1365
  importMeta: {},
1355
1366
  });
1356
1367
  functors[54]({
1357
1368
  imports(entries) {
1358
1369
  const map = new Map(entries);
1359
- observeImports(map, "@endo/env-options", 3);
1360
1370
  observeImports(map, "./commons.js", 0);
1361
- observeImports(map, "./make-hardener.js", 10);
1362
- observeImports(map, "./intrinsics.js", 13);
1363
- observeImports(map, "./permits-intrinsics.js", 14);
1364
- observeImports(map, "./tame-function-constructors.js", 15);
1365
- observeImports(map, "./tame-date-constructor.js", 16);
1366
- observeImports(map, "./tame-math-object.js", 17);
1367
- observeImports(map, "./tame-regexp-constructor.js", 18);
1368
- observeImports(map, "./enable-property-overrides.js", 20);
1369
- observeImports(map, "./tame-locale-methods.js", 21);
1370
- observeImports(map, "./global-object.js", 24);
1371
- observeImports(map, "./make-safe-evaluator.js", 32);
1372
- observeImports(map, "./permits.js", 12);
1373
- observeImports(map, "./tame-function-tostring.js", 33);
1374
- observeImports(map, "./tame-domains.js", 34);
1375
- observeImports(map, "./tame-module-source.js", 35);
1376
- observeImports(map, "./error/tame-console.js", 38);
1377
- observeImports(map, "./error/tame-error-constructor.js", 40);
1378
- observeImports(map, "./error/assert.js", 9);
1379
- observeImports(map, "./get-anonymous-intrinsics.js", 47);
1380
- observeImports(map, "./compartment.js", 46);
1381
- observeImports(map, "./tame-harden.js", 48);
1382
- observeImports(map, "./tame-symbol-constructor.js", 49);
1383
- observeImports(map, "./tame-faux-data-properties.js", 50);
1384
- observeImports(map, "./tame-regenerator-runtime.js", 51);
1385
- observeImports(map, "./shim-arraybuffer-transfer.js", 52);
1386
- observeImports(map, "./reporting.js", 53);
1387
1371
  },
1388
1372
  liveVar: {
1389
1373
  },
1390
1374
  onceVar: {
1391
- repairIntrinsics: cells[54].repairIntrinsics.set,
1375
+ tameFauxDataProperty: cells[54].tameFauxDataProperty.set,
1376
+ tameFauxDataProperties: cells[54].tameFauxDataProperties.set,
1392
1377
  },
1393
1378
  importMeta: {},
1394
1379
  });
1395
1380
  functors[55]({
1396
1381
  imports(entries) {
1397
1382
  const map = new Map(entries);
1398
- observeImports(map, "./assert-sloppy-mode.js", 1);
1399
1383
  observeImports(map, "./commons.js", 0);
1400
- observeImports(map, "./lockdown.js", 54);
1401
1384
  },
1402
1385
  liveVar: {
1403
1386
  },
1404
1387
  onceVar: {
1388
+ tameRegeneratorRuntime: cells[55].tameRegeneratorRuntime.set,
1405
1389
  },
1406
1390
  importMeta: {},
1407
1391
  });
@@ -1409,14 +1393,11 @@ function observeImports(map, importName, importIndex) {
1409
1393
  imports(entries) {
1410
1394
  const map = new Map(entries);
1411
1395
  observeImports(map, "./commons.js", 0);
1412
- observeImports(map, "./compartment.js", 46);
1413
- observeImports(map, "./tame-function-tostring.js", 33);
1414
- observeImports(map, "./intrinsics.js", 13);
1415
- observeImports(map, "./reporting.js", 53);
1416
1396
  },
1417
1397
  liveVar: {
1418
1398
  },
1419
1399
  onceVar: {
1400
+ shimArrayBufferTransfer: cells[56].shimArrayBufferTransfer.set,
1420
1401
  },
1421
1402
  importMeta: {},
1422
1403
  });
@@ -1424,34 +1405,116 @@ function observeImports(map, importName, importIndex) {
1424
1405
  imports(entries) {
1425
1406
  const map = new Map(entries);
1426
1407
  observeImports(map, "./commons.js", 0);
1427
- observeImports(map, "./error/assert.js", 9);
1408
+ observeImports(map, "./error/assert.js", 13);
1428
1409
  },
1429
1410
  liveVar: {
1430
1411
  },
1431
1412
  onceVar: {
1413
+ chooseReporter: cells[57].chooseReporter.set,
1414
+ reportInGroup: cells[57].reportInGroup.set,
1432
1415
  },
1433
1416
  importMeta: {},
1434
1417
  });
1435
1418
  functors[58]({
1436
1419
  imports(entries) {
1437
1420
  const map = new Map(entries);
1421
+ observeImports(map, "@endo/env-options", 3);
1422
+ observeImports(map, "@endo/immutable-arraybuffer/shim.js", 6);
1438
1423
  observeImports(map, "./commons.js", 0);
1439
- observeImports(map, "./error/console.js", 36);
1440
- observeImports(map, "./error/assert.js", 9);
1424
+ observeImports(map, "./make-hardener.js", 14);
1425
+ observeImports(map, "./intrinsics.js", 17);
1426
+ observeImports(map, "./permits-intrinsics.js", 18);
1427
+ observeImports(map, "./tame-function-constructors.js", 19);
1428
+ observeImports(map, "./tame-date-constructor.js", 20);
1429
+ observeImports(map, "./tame-math-object.js", 21);
1430
+ observeImports(map, "./tame-regexp-constructor.js", 22);
1431
+ observeImports(map, "./enable-property-overrides.js", 24);
1432
+ observeImports(map, "./tame-locale-methods.js", 25);
1433
+ observeImports(map, "./global-object.js", 28);
1434
+ observeImports(map, "./make-safe-evaluator.js", 36);
1435
+ observeImports(map, "./permits.js", 16);
1436
+ observeImports(map, "./tame-function-tostring.js", 37);
1437
+ observeImports(map, "./tame-domains.js", 38);
1438
+ observeImports(map, "./tame-module-source.js", 39);
1439
+ observeImports(map, "./error/tame-console.js", 42);
1440
+ observeImports(map, "./error/tame-error-constructor.js", 44);
1441
+ observeImports(map, "./error/assert.js", 13);
1442
+ observeImports(map, "./get-anonymous-intrinsics.js", 51);
1443
+ observeImports(map, "./compartment.js", 50);
1444
+ observeImports(map, "./tame-harden.js", 52);
1445
+ observeImports(map, "./tame-symbol-constructor.js", 53);
1446
+ observeImports(map, "./tame-faux-data-properties.js", 54);
1447
+ observeImports(map, "./tame-regenerator-runtime.js", 55);
1448
+ observeImports(map, "./shim-arraybuffer-transfer.js", 56);
1449
+ observeImports(map, "./reporting.js", 57);
1441
1450
  },
1442
1451
  liveVar: {
1443
1452
  },
1444
1453
  onceVar: {
1454
+ repairIntrinsics: cells[58].repairIntrinsics.set,
1445
1455
  },
1446
1456
  importMeta: {},
1447
1457
  });
1448
1458
  functors[59]({
1449
1459
  imports(entries) {
1450
1460
  const map = new Map(entries);
1451
- observeImports(map, "./src/lockdown-shim.js", 55);
1452
- observeImports(map, "./src/compartment-shim.js", 56);
1453
- observeImports(map, "./src/assert-shim.js", 57);
1454
- observeImports(map, "./src/console-shim.js", 58);
1461
+ observeImports(map, "./assert-sloppy-mode.js", 1);
1462
+ observeImports(map, "./commons.js", 0);
1463
+ observeImports(map, "./lockdown.js", 58);
1464
+ },
1465
+ liveVar: {
1466
+ },
1467
+ onceVar: {
1468
+ },
1469
+ importMeta: {},
1470
+ });
1471
+ functors[60]({
1472
+ imports(entries) {
1473
+ const map = new Map(entries);
1474
+ observeImports(map, "./commons.js", 0);
1475
+ observeImports(map, "./compartment.js", 50);
1476
+ observeImports(map, "./tame-function-tostring.js", 37);
1477
+ observeImports(map, "./intrinsics.js", 17);
1478
+ observeImports(map, "./reporting.js", 57);
1479
+ },
1480
+ liveVar: {
1481
+ },
1482
+ onceVar: {
1483
+ },
1484
+ importMeta: {},
1485
+ });
1486
+ functors[61]({
1487
+ imports(entries) {
1488
+ const map = new Map(entries);
1489
+ observeImports(map, "./commons.js", 0);
1490
+ observeImports(map, "./error/assert.js", 13);
1491
+ },
1492
+ liveVar: {
1493
+ },
1494
+ onceVar: {
1495
+ },
1496
+ importMeta: {},
1497
+ });
1498
+ functors[62]({
1499
+ imports(entries) {
1500
+ const map = new Map(entries);
1501
+ observeImports(map, "./commons.js", 0);
1502
+ observeImports(map, "./error/console.js", 40);
1503
+ observeImports(map, "./error/assert.js", 13);
1504
+ },
1505
+ liveVar: {
1506
+ },
1507
+ onceVar: {
1508
+ },
1509
+ importMeta: {},
1510
+ });
1511
+ functors[63]({
1512
+ imports(entries) {
1513
+ const map = new Map(entries);
1514
+ observeImports(map, "./src/lockdown-shim.js", 59);
1515
+ observeImports(map, "./src/compartment-shim.js", 60);
1516
+ observeImports(map, "./src/assert-shim.js", 61);
1517
+ observeImports(map, "./src/console-shim.js", 62);
1455
1518
  },
1456
1519
  liveVar: {
1457
1520
  },
@@ -1464,7 +1527,7 @@ function observeImports(map, importName, importIndex) {
1464
1527
  })([
1465
1528
  // === 0. ses ./src/commons.js ===
1466
1529
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/**
1467
- * @module Captures native intrinsics during initialization, so vetted shims
1530
+ * Captures native intrinsics during initialization, so vetted shims
1468
1531
  * (running between initialization of SES and calling lockdown) are free to
1469
1532
  * modify the environment without compromising the integrity of SES. For
1470
1533
  * example, a vetted shim can modify Object.assign because we capture and
@@ -1474,6 +1537,8 @@ function observeImports(map, importName, importIndex) {
1474
1537
  * This pattern of use is enforced by eslint rules no-restricted-globals and
1475
1538
  * no-polymorphic-call.
1476
1539
  * We maintain the list of restricted globals in ../package.json.
1540
+ *
1541
+ * @module
1477
1542
  */
1478
1543
 
1479
1544
  /* global globalThis */
@@ -1540,7 +1605,8 @@ const universalThis = globalThis;$h͏_once.universalThis(universalThis);
1540
1605
  setPrototypeOf,
1541
1606
  values,
1542
1607
  fromEntries,
1543
- } = Object;$h͏_once.assign(assign);$h͏_once.create(create);$h͏_once.defineProperties(defineProperties);$h͏_once.entries(entries);$h͏_once.freeze(freeze);$h͏_once.getOwnPropertyDescriptor(getOwnPropertyDescriptor);$h͏_once.getOwnPropertyDescriptors(getOwnPropertyDescriptors);$h͏_once.getOwnPropertyNames(getOwnPropertyNames);$h͏_once.getPrototypeOf(getPrototypeOf);$h͏_once.is(is);$h͏_once.isFrozen(isFrozen);$h͏_once.isSealed(isSealed);$h͏_once.isExtensible(isExtensible);$h͏_once.keys(keys);$h͏_once.objectPrototype(objectPrototype);$h͏_once.seal(seal);$h͏_once.preventExtensions(preventExtensions);$h͏_once.setPrototypeOf(setPrototypeOf);$h͏_once.values(values);$h͏_once.fromEntries(fromEntries);
1608
+ hasOwn,
1609
+ } = Object;$h͏_once.assign(assign);$h͏_once.create(create);$h͏_once.defineProperties(defineProperties);$h͏_once.entries(entries);$h͏_once.freeze(freeze);$h͏_once.getOwnPropertyDescriptor(getOwnPropertyDescriptor);$h͏_once.getOwnPropertyDescriptors(getOwnPropertyDescriptors);$h͏_once.getOwnPropertyNames(getOwnPropertyNames);$h͏_once.getPrototypeOf(getPrototypeOf);$h͏_once.is(is);$h͏_once.isFrozen(isFrozen);$h͏_once.isSealed(isSealed);$h͏_once.isExtensible(isExtensible);$h͏_once.keys(keys);$h͏_once.objectPrototype(objectPrototype);$h͏_once.seal(seal);$h͏_once.preventExtensions(preventExtensions);$h͏_once.setPrototypeOf(setPrototypeOf);$h͏_once.values(values);$h͏_once.fromEntries(fromEntries);$h͏_once.hasOwn(hasOwn);
1544
1610
 
1545
1611
  const {
1546
1612
  species: speciesSymbol,
@@ -1628,8 +1694,11 @@ const { bind } = functionPrototype;
1628
1694
  * @type {<F extends (this: any, ...args: any[]) => any>(fn: F) => ((thisArg: ThisParameterType<F>, ...args: Parameters<F>) => ReturnType<F>)}
1629
1695
  */
1630
1696
  const uncurryThis = bind.bind(bind.call); // eslint-disable-line @endo/no-polymorphic-call
1631
- $h͏_once.uncurryThis(uncurryThis);
1632
- const objectHasOwnProperty = uncurryThis(objectPrototype.hasOwnProperty);
1697
+
1698
+ /**
1699
+ * @deprecated Use `hasOwn` instead
1700
+ */$h͏_once.uncurryThis(uncurryThis);
1701
+ const objectHasOwnProperty = hasOwn;
1633
1702
  //
1634
1703
  $h͏_once.objectHasOwnProperty(objectHasOwnProperty);const arrayFilter=uncurryThis(arrayPrototype.filter);$h͏_once.arrayFilter(arrayFilter);
1635
1704
  const arrayForEach = uncurryThis(arrayPrototype.forEach);$h͏_once.arrayForEach(arrayForEach);
@@ -1735,23 +1804,20 @@ $h͏_once.promiseThen(promiseThen);const finalizationRegistryRegister=
1735
1804
  reflectGet(getPrototypeOf(fn), 'constructor');
1736
1805
 
1737
1806
  /**
1738
- * isObject tests whether a value is an object.
1739
- * Today, this is equivalent to:
1807
+ * TODO Consolidate with `isPrimitive` that's currently in `@endo/pass-style`.
1808
+ * Layering constraints make this tricky, which is why we haven't yet figured
1809
+ * out how to do this.
1740
1810
  *
1741
- * const isObject = value => {
1742
- * if (value === null) return false;
1743
- * const type = typeof value;
1744
- * return type === 'object' || type === 'function';
1745
- * };
1746
- *
1747
- * But this is not safe in the face of possible evolution of the language, for
1748
- * example new types or semantics of records and tuples.
1749
- * We use this implementation despite the unnecessary allocation implied by
1750
- * attempting to box a primitive.
1751
- *
1752
- * @param {any} value
1811
+ * @type {(val: unknown) => val is (undefined
1812
+ * | null
1813
+ * | boolean
1814
+ * | number
1815
+ * | bigint
1816
+ * | string
1817
+ * | symbol)}
1753
1818
  */$h͏_once.getConstructorOf(getConstructorOf);
1754
- const isObject = value => Object(value) === value;
1819
+ const isPrimitive = val =>
1820
+ !val || (typeof val !== 'object' && typeof val !== 'function');
1755
1821
 
1756
1822
  /**
1757
1823
  * isError tests whether an object inherits from the intrinsic
@@ -1763,7 +1829,7 @@ $h͏_once.promiseThen(promiseThen);const finalizationRegistryRegister=
1763
1829
  * for such a trivial case outside commons.js, we provide a utility function.
1764
1830
  *
1765
1831
  * @param {any} value
1766
- */$h͏_once.isObject(isObject);
1832
+ */$h͏_once.isPrimitive(isPrimitive);
1767
1833
  const isError = value => value instanceof FERAL_ERROR;
1768
1834
 
1769
1835
  /**
@@ -1912,6 +1978,10 @@ if (getThis()) {
1912
1978
  // Prelude of cheap good - enough imitations of things we'd use or
1913
1979
  // do differently if we could depend on ses
1914
1980
 
1981
+ // eslint-disable-next-line no-restricted-globals
1982
+ const localThis = globalThis;
1983
+
1984
+ const { Object, Reflect, Array, String, JSON, Error } = localThis;
1915
1985
  const { freeze } = Object;
1916
1986
  const { apply } = Reflect;
1917
1987
 
@@ -1948,6 +2018,7 @@ const Fail = (literals, ...args) => {
1948
2018
  * names used.
1949
2019
  */
1950
2020
  const makeEnvironmentCaptor = (aGlobal, dropNames = false) => {
2021
+ /** @type {string[]} */
1951
2022
  const capturedEnvironmentOptionNames = [];
1952
2023
 
1953
2024
  /**
@@ -2004,8 +2075,9 @@ const Fail = (literals, ...args) => {
2004
2075
  freeze(getEnvironmentOption);
2005
2076
 
2006
2077
  /**
2078
+ * @template {string} [T=string]
2007
2079
  * @param {string} optionName
2008
- * @returns {string[]}
2080
+ * @returns {T[]}
2009
2081
  */
2010
2082
  const getEnvironmentOptionsList = optionName => {
2011
2083
  const option = getEnvironmentOption(optionName, '');
@@ -2013,6 +2085,12 @@ const Fail = (literals, ...args) => {
2013
2085
  };
2014
2086
  freeze(getEnvironmentOptionsList);
2015
2087
 
2088
+ /**
2089
+ * @template {string} [T=string]
2090
+ * @param {string} optionName
2091
+ * @param {T} element
2092
+ * @returns {boolean}
2093
+ */
2016
2094
  const environmentOptionsListHas = (optionName, element) =>
2017
2095
  arrayIncludes(getEnvironmentOptionsList(optionName), element);
2018
2096
 
@@ -2038,14 +2116,374 @@ freeze(makeEnvironmentCaptor);
2038
2116
  getEnvironmentOption,
2039
2117
  getEnvironmentOptionsList,
2040
2118
  environmentOptionsListHas,
2041
- } = makeEnvironmentCaptor(globalThis, true);$h͏_once.getEnvironmentOption(getEnvironmentOption);$h͏_once.getEnvironmentOptionsList(getEnvironmentOptionsList);$h͏_once.environmentOptionsListHas(environmentOptionsListHas);
2119
+ } = makeEnvironmentCaptor(localThis, true);$h͏_once.getEnvironmentOption(getEnvironmentOption);$h͏_once.getEnvironmentOptionsList(getEnvironmentOptionsList);$h͏_once.environmentOptionsListHas(environmentOptionsListHas);
2042
2120
  })()
2043
2121
  ,
2044
2122
  // === 3. env-options ./index.js ===
2045
2123
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/env-options.js", []]]);
2046
2124
  })()
2047
2125
  ,
2048
- // === 4. ses ./src/error/stringify-utils.js ===
2126
+ // === 4. immutable-arraybuffer ./src/immutable-arraybuffer-pony.js ===
2127
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/* global globalThis */
2128
+
2129
+ const {
2130
+ ArrayBuffer,
2131
+ Object,
2132
+ Reflect,
2133
+ Symbol,
2134
+ TypeError,
2135
+ Uint8Array,
2136
+ WeakMap,
2137
+ // Capture structuredClone before it can be scuttled.
2138
+ structuredClone: optStructuredClone
2139
+ // eslint-disable-next-line no-restricted-globals
2140
+ } = globalThis;
2141
+
2142
+ const { freeze, defineProperty, getPrototypeOf, getOwnPropertyDescriptor } =
2143
+ Object;
2144
+ const { apply, ownKeys } = Reflect;
2145
+ const { toStringTag } = Symbol;
2146
+
2147
+ const { prototype: arrayBufferPrototype } = ArrayBuffer;
2148
+ const { slice, transfer: optTransfer } = arrayBufferPrototype;
2149
+ // @ts-expect-error TS doesn't know it'll be there
2150
+ const { get: arrayBufferByteLength } = getOwnPropertyDescriptor(
2151
+ arrayBufferPrototype,
2152
+ 'byteLength',
2153
+ );
2154
+
2155
+ const typedArrayPrototype = getPrototypeOf(Uint8Array.prototype);
2156
+ const { set: uint8ArraySet } = typedArrayPrototype;
2157
+ // @ts-expect-error TS doesn't know it'll be there
2158
+ const { get: uint8ArrayBuffer } = getOwnPropertyDescriptor(
2159
+ typedArrayPrototype,
2160
+ 'buffer',
2161
+ );
2162
+
2163
+ /**
2164
+ * Copy a range of values from a genuine ArrayBuffer exotic object into a new
2165
+ * ArrayBuffer.
2166
+ *
2167
+ * @param {ArrayBuffer} realBuffer
2168
+ * @param {number} [start]
2169
+ * @param {number} [end]
2170
+ * @returns {ArrayBuffer}
2171
+ */
2172
+ const arrayBufferSlice = (realBuffer, start = undefined, end = undefined) =>
2173
+ apply(slice, realBuffer, [start, end]);
2174
+
2175
+ /**
2176
+ * Move the contents of a genuine ArrayBuffer exotic object into a new fresh
2177
+ * ArrayBuffer and detach the original source.
2178
+ * We can only do this on platforms that support `structuredClone` or
2179
+ * `ArrayBuffer.prototype.transfer`.
2180
+ * On other platforms, we can still emulate
2181
+ * `ArrayBuffer.prototoype.sliceToImmutable`, but not
2182
+ * `ArrayBuffer.prototype.transferToImmutable`.
2183
+ * Currently, these known-deficient platforms are
2184
+ * - Hermes
2185
+ * - Node.js <= 16
2186
+ * - Apparently some versions of JavaScriptCore that are still of concern.
2187
+ *
2188
+ * @param {ArrayBuffer} arrayBuffer
2189
+ * @returns {ArrayBuffer}
2190
+ */
2191
+ let optArrayBufferTransfer;
2192
+
2193
+ if (optTransfer) {
2194
+ optArrayBufferTransfer = arrayBuffer => apply(optTransfer, arrayBuffer, []);
2195
+ } else if (optStructuredClone) {
2196
+ optArrayBufferTransfer = arrayBuffer => {
2197
+ // Hopefully, a zero-length slice is cheap, but still enforces that
2198
+ // `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2199
+ arrayBufferSlice(arrayBuffer, 0, 0);
2200
+ return optStructuredClone(arrayBuffer, {
2201
+ transfer: [arrayBuffer],
2202
+ });
2203
+ };
2204
+ } else {
2205
+ // Assignment is redundant, but remains for clarity.
2206
+ optArrayBufferTransfer = undefined;
2207
+ }
2208
+
2209
+ /**
2210
+ * If we could use classes with private fields everywhere, this would have
2211
+ * been a `this.#buffer` private field on an `ImmutableArrayBufferInternal`
2212
+ * class. But we cannot do so on Hermes. So, instead, we
2213
+ * emulate the `this.#buffer` private field, including its use as a brand check.
2214
+ * Maps from all and only emulated Immutable ArrayBuffers to real ArrayBuffers.
2215
+ *
2216
+ * @type {Pick<WeakMap<ArrayBuffer, ArrayBuffer>, 'get' | 'has' | 'set'>}
2217
+ */
2218
+ const buffers = new WeakMap();
2219
+ // Avoid post-hoc prototype lookups.
2220
+ for (const methodName of ['get', 'has', 'set']) {
2221
+ defineProperty(buffers, methodName, { value: buffers[methodName] });
2222
+ }
2223
+ const getBuffer = immuAB => {
2224
+ // Safe because this WeakMap owns its get method.
2225
+ // eslint-disable-next-line @endo/no-polymorphic-call
2226
+ const result = buffers.get(immuAB);
2227
+ if (result) {
2228
+ return result;
2229
+ }
2230
+ throw TypeError('Not an emulated Immutable ArrayBuffer');
2231
+ };
2232
+
2233
+ // Omits `constructor` so `Array.prototype.constructor` is inherited.
2234
+ const ImmutableArrayBufferInternalPrototype = {
2235
+ __proto__: arrayBufferPrototype,
2236
+ get byteLength() {
2237
+ return apply(arrayBufferByteLength, getBuffer(this), []);
2238
+ },
2239
+ get detached() {
2240
+ getBuffer(this); // shim brand check
2241
+ return false;
2242
+ },
2243
+ get maxByteLength() {
2244
+ // Not underlying maxByteLength, which is irrelevant
2245
+ return apply(arrayBufferByteLength, getBuffer(this), []);
2246
+ },
2247
+ get resizable() {
2248
+ getBuffer(this); // shim brand check
2249
+ return false;
2250
+ },
2251
+ get immutable() {
2252
+ getBuffer(this); // shim brand check
2253
+ return true;
2254
+ },
2255
+ slice(start = undefined, end = undefined) {
2256
+ return arrayBufferSlice(getBuffer(this), start, end);
2257
+ },
2258
+ sliceToImmutable(start = undefined, end = undefined) {
2259
+ // eslint-disable-next-line no-use-before-define
2260
+ return sliceBufferToImmutable(getBuffer(this), start, end);
2261
+ },
2262
+ resize(_newByteLength = undefined) {
2263
+ getBuffer(this); // shim brand check
2264
+ throw TypeError('Cannot resize an immutable ArrayBuffer');
2265
+ },
2266
+ transfer(_newLength = undefined) {
2267
+ getBuffer(this); // shim brand check
2268
+ throw TypeError('Cannot detach an immutable ArrayBuffer');
2269
+ },
2270
+ transferToFixedLength(_newLength = undefined) {
2271
+ getBuffer(this); // shim brand check
2272
+ throw TypeError('Cannot detach an immutable ArrayBuffer');
2273
+ },
2274
+ transferToImmutable(_newLength = undefined) {
2275
+ getBuffer(this); // shim brand check
2276
+ throw TypeError('Cannot detach an immutable ArrayBuffer');
2277
+ },
2278
+ /**
2279
+ * See https://github.com/endojs/endo/tree/master/packages/immutable-arraybuffer#purposeful-violation
2280
+ */
2281
+ [toStringTag]: 'ImmutableArrayBuffer',
2282
+ };
2283
+
2284
+ // Better fidelity emulation of a class prototype
2285
+ for (const key of ownKeys(ImmutableArrayBufferInternalPrototype)) {
2286
+ defineProperty(ImmutableArrayBufferInternalPrototype, key, {
2287
+ enumerable: false,
2288
+ });
2289
+ }
2290
+
2291
+ /**
2292
+ * Emulates what would have been the encapsulated `ImmutableArrayBufferInternal`
2293
+ * class constructor. This function takes the `realBuffer` which its
2294
+ * result encapsulates. Security demands that this result has exclusive access
2295
+ * to the `realBuffer` it is given, which its callers must ensure.
2296
+ *
2297
+ * @param {ArrayBuffer} realBuffer
2298
+ * @returns {ArrayBuffer}
2299
+ */
2300
+ const makeImmutableArrayBufferInternal = realBuffer => {
2301
+ const result = /** @type {ArrayBuffer} */ (
2302
+ /** @type {unknown} */ ({
2303
+ __proto__: ImmutableArrayBufferInternalPrototype,
2304
+ })
2305
+ );
2306
+ // Safe because this WeakMap owns its set method.
2307
+ // eslint-disable-next-line @endo/no-polymorphic-call
2308
+ buffers.set(result, realBuffer);
2309
+ return result;
2310
+ };
2311
+ // Since `makeImmutableArrayBufferInternal` MUST not escape,
2312
+ // this `freeze` is just belt-and-suspenders.
2313
+ freeze(makeImmutableArrayBufferInternal);
2314
+
2315
+ /**
2316
+ * @param {ArrayBuffer} buffer
2317
+ * @returns {boolean}
2318
+ */
2319
+ // eslint-disable-next-line @endo/no-polymorphic-call
2320
+ const isBufferImmutable = buffer => buffers.has(buffer);
2321
+
2322
+ /**
2323
+ * Creates an immutable slice of the given buffer.
2324
+ * @param {ArrayBuffer} buffer The original buffer.
2325
+ * @param {number} [start] The start index.
2326
+ * @param {number} [end] The end index.
2327
+ * @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
2328
+ */$h͏_once.isBufferImmutable(isBufferImmutable);
2329
+ const sliceBufferToImmutable = (
2330
+ buffer,
2331
+ start = undefined,
2332
+ end = undefined,
2333
+ ) => {
2334
+ // Safe because this WeakMap owns its get method.
2335
+ // eslint-disable-next-line @endo/no-polymorphic-call
2336
+ let realBuffer = buffers.get(buffer);
2337
+ if (realBuffer === undefined) {
2338
+ realBuffer = buffer;
2339
+ }
2340
+ return makeImmutableArrayBufferInternal(
2341
+ arrayBufferSlice(realBuffer, start, end),
2342
+ );
2343
+ };$h͏_once.sliceBufferToImmutable(sliceBufferToImmutable);
2344
+
2345
+ let transferBufferToImmutable;
2346
+ if (optArrayBufferTransfer) {
2347
+ /**
2348
+ * Transfer the contents to a new Immutable ArrayBuffer
2349
+ *
2350
+ * @param {ArrayBuffer} buffer The original buffer.
2351
+ * @param {number} [newLength] The start index.
2352
+ * @returns {ArrayBuffer}
2353
+ */
2354
+ transferBufferToImmutable = (buffer, newLength = undefined) => {
2355
+ if (newLength === undefined) {
2356
+ buffer = optArrayBufferTransfer(buffer);
2357
+ } else if (optTransfer) {
2358
+ buffer = apply(optTransfer, buffer, [newLength]);
2359
+ } else {
2360
+ buffer = optArrayBufferTransfer(buffer);
2361
+ const oldLength = buffer.byteLength;
2362
+ // eslint-disable-next-line @endo/restrict-comparison-operands
2363
+ if (newLength <= oldLength) {
2364
+ buffer = arrayBufferSlice(buffer, 0, newLength);
2365
+ } else {
2366
+ const oldTA = new Uint8Array(buffer);
2367
+ const newTA = new Uint8Array(newLength);
2368
+ apply(uint8ArraySet, newTA, [oldTA]);
2369
+ buffer = apply(uint8ArrayBuffer, newTA, []);
2370
+ }
2371
+ }
2372
+ const result = makeImmutableArrayBufferInternal(buffer);
2373
+ return /** @type {ArrayBuffer} */ (/** @type {unknown} */ (result));
2374
+ };
2375
+ } else {
2376
+ transferBufferToImmutable = undefined;
2377
+ }
2378
+
2379
+ const optTransferBufferToImmutable = transferBufferToImmutable;$h͏_once.optTransferBufferToImmutable(optTransferBufferToImmutable);
2380
+ })()
2381
+ ,
2382
+ // === 5. immutable-arraybuffer ./src/immutable-arraybuffer-shim.js ===
2383
+ ({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)]]]]]);
2384
+
2385
+
2386
+
2387
+
2388
+
2389
+
2390
+
2391
+ const {
2392
+ ArrayBuffer,
2393
+ JSON,
2394
+ Object,
2395
+ Reflect
2396
+ // eslint-disable-next-line no-restricted-globals
2397
+ } = globalThis;
2398
+
2399
+ // Even though the imported one is not exported by the pony as a live binding,
2400
+ // TS doesn't know that,
2401
+ // so it cannot do its normal flow-based inference. By making and using a local
2402
+ // copy, no problem.
2403
+ const optTransferBufferToImmutable = optXferBuf2Immu;
2404
+
2405
+ const { getOwnPropertyDescriptors, defineProperties, defineProperty } = Object;
2406
+ const { ownKeys } = Reflect;
2407
+ const { prototype: arrayBufferPrototype } = ArrayBuffer;
2408
+ const { stringify } = JSON;
2409
+
2410
+ const arrayBufferMethods = {
2411
+ /**
2412
+ * Creates an immutable slice of the given buffer.
2413
+ *
2414
+ * @this {ArrayBuffer} buffer The original buffer.
2415
+ * @param {number} [start] The start index.
2416
+ * @param {number} [end] The end index.
2417
+ * @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
2418
+ */
2419
+ sliceToImmutable(start = undefined, end = undefined) {
2420
+ return sliceBufferToImmutable(this, start, end);
2421
+ },
2422
+
2423
+ /**
2424
+ * @this {ArrayBuffer}
2425
+ */
2426
+ get immutable() {
2427
+ return isBufferImmutable(this);
2428
+ },
2429
+
2430
+ ...(optTransferBufferToImmutable
2431
+ ? {
2432
+ /**
2433
+ * Transfer the contents to a new Immutable ArrayBuffer
2434
+ *
2435
+ * @this {ArrayBuffer} buffer The original buffer.
2436
+ * @param {number} [newLength] The start index.
2437
+ * @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
2438
+ */
2439
+ transferToImmutable(newLength = undefined) {
2440
+ return optTransferBufferToImmutable(this, newLength);
2441
+ },
2442
+ }
2443
+ : {}),
2444
+ };
2445
+
2446
+ // Better fidelity emulation of a class prototype
2447
+ for (const key of ownKeys(arrayBufferMethods)) {
2448
+ defineProperty(arrayBufferMethods, key, {
2449
+ enumerable: false,
2450
+ });
2451
+ }
2452
+
2453
+ // Modern shim practice frowns on conditional installation, at least for
2454
+ // proposals prior to stage 3. This is so changes to the proposal since
2455
+ // an old shim was distributed don't need to worry about the proposal
2456
+ // breaking old code depending on the old shim. Thus, if we detect that
2457
+ // we're about to overwrite a prior installation, we simply issue this
2458
+ // warning and continue.
2459
+ //
2460
+ // TODO, if the primordials are frozen after the prior implementation, such as
2461
+ // by `lockdown`, then this precludes overwriting as expected. However, for
2462
+ // this case, the following warning text will be confusing.
2463
+ //
2464
+ // Allowing polymorphic calls because these occur during initialization.
2465
+ // eslint-disable-next-line @endo/no-polymorphic-call
2466
+ const overwrites = ownKeys(arrayBufferMethods).filter(
2467
+ key => key in arrayBufferPrototype,
2468
+ );
2469
+ if (overwrites.length > 0) {
2470
+ // eslint-disable-next-line @endo/no-polymorphic-call
2471
+ console.warn(
2472
+ `About to overwrite ArrayBuffer.prototype properties ${stringify(overwrites)}`,
2473
+ );
2474
+ }
2475
+
2476
+ defineProperties(
2477
+ arrayBufferPrototype,
2478
+ getOwnPropertyDescriptors(arrayBufferMethods),
2479
+ );
2480
+ })()
2481
+ ,
2482
+ // === 6. immutable-arraybuffer ./shim.js ===
2483
+ ({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", []]]);
2484
+ })()
2485
+ ,
2486
+ // === 7. ses ./src/error/stringify-utils.js ===
2049
2487
  ({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)]]]]]);
2050
2488
 
2051
2489
 
@@ -2242,7 +2680,7 @@ const bestEffortStringify = (payload, spaces = undefined) => {
2242
2680
  freeze(bestEffortStringify);
2243
2681
  })()
2244
2682
  ,
2245
- // === 5. ses ./src/error/types.js ===
2683
+ // === 8. ses ./src/error/types.js ===
2246
2684
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2247
2685
 
2248
2686
  /** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken, StringablePayload} from '../../types.js' */
@@ -2304,7 +2742,7 @@ freeze(bestEffortStringify);
2304
2742
  */
2305
2743
  })()
2306
2744
  ,
2307
- // === 6. ses ./src/error/internal-types.js ===
2745
+ // === 9. ses ./src/error/internal-types.js ===
2308
2746
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2309
2747
 
2310
2748
  /**
@@ -2405,10 +2843,15 @@ freeze(bestEffortStringify);
2405
2843
  */
2406
2844
  })()
2407
2845
  ,
2408
- // === 7. ses ./src/make-lru-cachemap.js ===
2846
+ // === 10. cache-map ./src/cachemap.js ===
2409
2847
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2848
+ /* global globalThis */
2410
2849
  /* eslint-disable @endo/no-polymorphic-call */
2411
2850
 
2851
+ // eslint-disable-next-line no-restricted-globals
2852
+ const { Error, TypeError, WeakMap } = globalThis;
2853
+ // eslint-disable-next-line no-restricted-globals
2854
+ const { parse, stringify } = JSON;
2412
2855
  // eslint-disable-next-line no-restricted-globals
2413
2856
  const { isSafeInteger } = Number;
2414
2857
  // eslint-disable-next-line no-restricted-globals
@@ -2416,227 +2859,323 @@ const { freeze } = Object;
2416
2859
  // eslint-disable-next-line no-restricted-globals
2417
2860
  const { toStringTag: toStringTagSymbol } = Symbol;
2418
2861
 
2862
+ // eslint-disable-next-line no-restricted-globals
2863
+ const UNKNOWN_KEY = Symbol('UNKNOWN_KEY');
2864
+
2419
2865
  /**
2420
- * @template Data
2421
- * @typedef {object} DoublyLinkedCell
2422
- * A cell of a doubly-linked ring, i.e., a doubly-linked circular list.
2423
- * DoublyLinkedCells are not frozen, and so should be closely encapsulated by
2424
- * any abstraction that uses them.
2425
- * @property {DoublyLinkedCell<Data>} next
2426
- * @property {DoublyLinkedCell<Data>} prev
2427
- * @property {Data} data
2866
+ * @template T
2867
+ * @typedef {T extends object ? { -readonly [K in keyof T]: T[K] } : never} WritableDeep
2868
+ * Intentionally limited to local needs; refer to
2869
+ * https://github.com/sindresorhus/type-fest if insufficient.
2428
2870
  */
2429
2871
 
2430
2872
  /**
2431
- * Makes a new self-linked cell. There are two reasons to do so:
2432
- * * To make the head sigil of a new initially-empty doubly-linked ring.
2433
- * * To make a non-sigil cell to be `spliceAfter`ed.
2434
- *
2435
- * @template Data
2436
- * @param {Data} data
2437
- * @returns {DoublyLinkedCell<Data>}
2873
+ * @template T
2874
+ * @param {T} value
2875
+ * @param {<U,>(name: string, value: U) => U} [reviver]
2876
+ * @returns {WritableDeep<T>}
2438
2877
  */
2439
- const makeSelfCell = data => {
2440
- /** @type {Partial<DoublyLinkedCell<Data>>} */
2441
- const incompleteCell = {
2442
- next: undefined,
2443
- prev: undefined,
2444
- data,
2445
- };
2446
- const selfCell = /** @type {DoublyLinkedCell<Data>} */ (incompleteCell);
2447
- selfCell.next = selfCell;
2448
- selfCell.prev = selfCell;
2449
- // Not frozen!
2450
- return selfCell;
2878
+ const deepCopyJsonable = (value, reviver) => {
2879
+ const encoded = stringify(value);
2880
+ const decoded = parse(encoded, reviver);
2881
+ return decoded;
2451
2882
  };
2452
2883
 
2884
+ const freezingReviver = (_name, value) => freeze(value);
2885
+
2886
+ /** @type {<T,>(value: T) => T} */
2887
+ const deepCopyAndFreezeJsonable = value =>
2888
+ deepCopyJsonable(value, freezingReviver);
2889
+
2453
2890
  /**
2454
- * Splices a self-linked non-sigil cell into a ring after `prev`.
2455
- * `prev` could be the head sigil, or it could be some other non-sigil
2456
- * cell within a ring.
2891
+ * A cache of bounded size, implementing the WeakMap interface but holding keys
2892
+ * strongly if created with a non-weak `makeMap` option of
2893
+ * {@link makeCacheMapKit}.
2457
2894
  *
2458
- * @template Data
2459
- * @param {DoublyLinkedCell<Data>} prev
2460
- * @param {DoublyLinkedCell<Data>} selfCell
2895
+ * @template K
2896
+ * @template V
2897
+ * @typedef {Pick<Map<K, V>, Exclude<keyof WeakMap<WeakKey, *>, 'set'>> & {set: (key: K, value: V) => WeakMapAPI<K, V>}} WeakMapAPI
2461
2898
  */
2462
- const spliceAfter = (prev, selfCell) => {
2463
- if (prev === selfCell) {
2464
- // eslint-disable-next-line no-restricted-globals
2465
- throw TypeError('Cannot splice a cell into itself');
2466
- }
2467
- if (selfCell.next !== selfCell || selfCell.prev !== selfCell) {
2468
- // eslint-disable-next-line no-restricted-globals
2469
- throw TypeError('Expected self-linked cell');
2470
- }
2471
- const cell = selfCell;
2472
- // rename variable cause it isn't self-linked after this point.
2473
2899
 
2474
- const next = prev.next;
2475
- cell.prev = prev;
2476
- cell.next = next;
2900
+ /**
2901
+ * @template K
2902
+ * @template V
2903
+ * @typedef {WeakMapAPI<K, V> & ({clear?: undefined} | Pick<Map<K, V>, 'clear'>)} SingleEntryMap
2904
+ */
2905
+
2906
+ /**
2907
+ * A cell of a doubly-linked ring (circular list) for a cache map.
2908
+ * Instances are not frozen, and so should be closely encapsulated.
2909
+ *
2910
+ * @template K
2911
+ * @template V
2912
+ * @typedef {object} CacheMapCell
2913
+ * @property {number} id for debugging
2914
+ * @property {CacheMapCell<K, V>} next
2915
+ * @property {CacheMapCell<K, V>} prev
2916
+ * @property {SingleEntryMap<K, V>} data
2917
+ */
2918
+
2919
+ /**
2920
+ * @template K
2921
+ * @template V
2922
+ * @param {CacheMapCell<K, V>} prev
2923
+ * @param {number} id
2924
+ * @param {SingleEntryMap<K, V>} data
2925
+ * @returns {CacheMapCell<K, V>}
2926
+ */
2927
+ const appendNewCell = (prev, id, data) => {
2928
+ const next = prev?.next;
2929
+ const cell = { id, next, prev, data };
2477
2930
  prev.next = cell;
2478
2931
  next.prev = cell;
2479
- // Not frozen!
2480
2932
  return cell;
2481
2933
  };
2482
2934
 
2483
2935
  /**
2484
- * @template Data
2485
- * @param {DoublyLinkedCell<Data>} cell
2486
- * No-op if the cell is self-linked.
2936
+ * @template K
2937
+ * @template V
2938
+ * @param {CacheMapCell<K, V>} cell
2939
+ * @param {CacheMapCell<K, V>} prev
2940
+ * @param {CacheMapCell<K, V>} [next]
2487
2941
  */
2488
- const spliceOut = cell => {
2489
- const { prev, next } = cell;
2490
- prev.next = next;
2491
- next.prev = prev;
2492
- cell.prev = cell;
2493
- cell.next = cell;
2942
+ const moveCellAfter = (cell, prev, next = prev.next) => {
2943
+ if (cell === prev || cell === next) return; // already in position
2944
+
2945
+ // Splice out cell.
2946
+ const { prev: oldPrev, next: oldNext } = cell;
2947
+ oldPrev.next = oldNext;
2948
+ oldNext.prev = oldPrev;
2949
+
2950
+ // Splice in cell after prev.
2951
+ cell.prev = prev;
2952
+ cell.next = next;
2953
+ prev.next = cell;
2954
+ next.prev = cell;
2494
2955
  };
2495
2956
 
2496
2957
  /**
2497
- * The LRUCacheMap is used within the implementation of `assert` and so
2498
- * at a layer below SES or harden. Thus, we give it a `WeakMap`-like interface
2499
- * rather than a `WeakMapStore`-like interface. To work before `lockdown`,
2500
- * the implementation must use `freeze` manually, but still exhaustively.
2958
+ * Clear out a cell to prepare it for future use. Its map is preserved when
2959
+ * possible, but must instead be replaced if the associated key is not known.
2501
2960
  *
2502
- * It implements the WeakMap interface, and holds its keys weakly. Cached
2503
- * values are only held while the key is held by the user and the key/value
2504
- * bookkeeping cell has not been pushed off the end of the cache by `budget`
2505
- * number of more recently referenced cells. If the key is dropped by the user,
2506
- * the value will no longer be held by the cache, but the bookkeeping cell
2507
- * itself will stay in memory.
2508
- *
2509
- * @template {{}} K
2510
- * @template {unknown} V
2511
- * @param {number} keysBudget
2512
- * @returns {WeakMap<K,V>}
2961
+ * @template K
2962
+ * @template V
2963
+ * @param {CacheMapCell<K, V>} cell
2964
+ * @param {K | UNKNOWN_KEY} oldKey
2965
+ * @param {() => SingleEntryMap<K, V>} [makeMap] required when the key is unknown
2513
2966
  */
2514
- const makeLRUCacheMap = keysBudget => {
2515
- if (!isSafeInteger(keysBudget) || keysBudget < 0) {
2516
- // eslint-disable-next-line no-restricted-globals
2517
- throw TypeError('keysBudget must be a safe non-negative integer number');
2967
+ const resetCell = (cell, oldKey, makeMap) => {
2968
+ if (oldKey !== UNKNOWN_KEY) {
2969
+ cell.data.delete(oldKey);
2970
+ return;
2518
2971
  }
2519
- /** @typedef {DoublyLinkedCell<WeakMap<K, V> | undefined>} LRUCacheCell */
2520
- /** @type {WeakMap<K, LRUCacheCell>} */
2521
- // eslint-disable-next-line no-restricted-globals
2522
- const keyToCell = new WeakMap();
2523
- let size = 0; // `size` must remain <= `keysBudget`
2524
- // As a sigil, `head` uniquely is not in the `keyToCell` map.
2525
- /** @type {LRUCacheCell} */
2526
- const head = makeSelfCell(undefined);
2972
+ if (cell.data.clear) {
2973
+ cell.data.clear();
2974
+ return;
2975
+ }
2976
+ // WeakMap instances must be replaced when the key is unknown.
2977
+ if (!makeMap) {
2978
+ throw Error('internal: makeMap is required with UNKNOWN_KEY');
2979
+ }
2980
+ cell.data = makeMap();
2981
+ };
2527
2982
 
2528
- const touchCell = key => {
2529
- const cell = keyToCell.get(key);
2530
- if (cell === undefined || cell.data === undefined) {
2531
- // Either the key was GCed, or the cell was condemned.
2532
- return undefined;
2533
- }
2534
- // Becomes most recently used
2535
- spliceOut(cell);
2536
- spliceAfter(head, cell);
2537
- return cell;
2538
- };
2983
+ const zeroMetrics = freeze({
2984
+ totalQueryCount: 0,
2985
+ totalHitCount: 0
2986
+ // TODO?
2987
+ // * method-specific counts
2988
+ // * liveTouchStats/evictedTouchStats { count, sum, mean, min, max }
2989
+ // * p50/p90/p95/p99 via Ben-Haim/Tom-Tov streaming histograms
2990
+ });
2991
+ /** @typedef {typeof zeroMetrics} CacheMapMetrics */
2992
+
2993
+ /**
2994
+ * @template {MapConstructor | WeakMapConstructor} [C=WeakMapConstructor]
2995
+ * @template {Parameters<InstanceType<C>['set']>[0]} [K=Parameters<InstanceType<C>['set']>[0]]
2996
+ * @template {unknown} [V=unknown]
2997
+ * @typedef {object} CacheMapKit
2998
+ * @property {WeakMapAPI<K, V>} cache
2999
+ * @property {() => CacheMapMetrics} getMetrics
3000
+ */
3001
+
3002
+ /**
3003
+ * Create a bounded-size cache having WeakMap-compatible
3004
+ * `has`/`get`/`set`/`delete` methods, capable of supporting SES (specifically
3005
+ * `assert` error notes).
3006
+ * Key validity, comparison, and referential strength are controlled by the
3007
+ * `makeMap` option, which defaults to `WeakMap` but can be set to any producer
3008
+ * of objects with those methods (e.g., using `Map` allows for arbitrary keys
3009
+ * which will be strongly held).
3010
+ * Cache eviction policy is not currently configurable, but strives for a hit
3011
+ * ratio at least as good as
3012
+ * [LRU](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU) (e.g., it
3013
+ * might be
3014
+ * [CLOCK](https://en.wikipedia.org/wiki/Page_replacement_algorithm#Clock)
3015
+ * or [SIEVE](https://sievecache.com/)).
3016
+ *
3017
+ * @template {MapConstructor | WeakMapConstructor} [C=WeakMapConstructor]
3018
+ * @template {Parameters<InstanceType<C>['set']>[0]} [K=Parameters<InstanceType<C>['set']>[0]]
3019
+ * @template {unknown} [V=unknown]
3020
+ * @param {number} capacity
3021
+ * @param {object} [options]
3022
+ * @param {C | (() => SingleEntryMap<K, V>)} [options.makeMap]
3023
+ * @returns {CacheMapKit<C, K, V>}
3024
+ */
3025
+ const makeCacheMapKit = (capacity, options = {}) => {
3026
+ if (!isSafeInteger(capacity) || capacity < 0) {
3027
+ throw TypeError(
3028
+ 'capacity must be a non-negative safe integer number <= 2**53 - 1',
3029
+ );
3030
+ }
2539
3031
 
2540
3032
  /**
2541
- * @param {K} key
3033
+ * @template V
3034
+ * @type {<V,>() => SingleEntryMap<K, V>}
2542
3035
  */
2543
- const has = key => touchCell(key) !== undefined;
2544
- freeze(has);
3036
+ const makeMap = (MaybeCtor => {
3037
+ try {
3038
+ // @ts-expect-error
3039
+ MaybeCtor();
3040
+ return /** @type {any} */ (MaybeCtor);
3041
+ } catch (err) {
3042
+ // @ts-expect-error
3043
+ const constructNewMap = () => new MaybeCtor();
3044
+ return constructNewMap;
3045
+ }
3046
+ })(options.makeMap ?? WeakMap);
3047
+ const tag =
3048
+ /** @type {any} */ (makeMap()).clear === undefined
3049
+ ? 'WeakCacheMap'
3050
+ : 'CacheMap';
3051
+
3052
+ /** @type {WeakMapAPI<K, CacheMapCell<K, V>>} */
3053
+ const keyToCell = makeMap();
3054
+ // @ts-expect-error this sentinel head is special
3055
+ const head = /** @type {CacheMapCell<K, V>} */ ({
3056
+ id: 0,
3057
+ // next and prev are established below as self-referential.
3058
+ next: undefined,
3059
+ prev: undefined,
3060
+ data: {
3061
+ has: () => {
3062
+ throw Error('internal: sentinel head cell has no data');
3063
+ },
3064
+ },
3065
+ });
3066
+ head.next = head;
3067
+ head.prev = head;
3068
+ let cellCount = 0;
3069
+
3070
+ const metrics = deepCopyJsonable(zeroMetrics);
3071
+ const getMetrics = () => deepCopyAndFreezeJsonable(metrics);
2545
3072
 
2546
3073
  /**
2547
- * @param {K} key
3074
+ * Touching moves a cell to first position so LRU eviction can target the last
3075
+ * cell (`head.prev`).
3076
+ *
3077
+ * @type {(key: K) => (CacheMapCell<K, V> | undefined)}
2548
3078
  */
2549
- // UNTIL https://github.com/endojs/endo/issues/1514
2550
- // Prefer: const get = key => touchCell(key)?.data?.get(key);
3079
+ const touchKey = key => {
3080
+ metrics.totalQueryCount += 1;
3081
+ const cell = keyToCell.get(key);
3082
+ if (!cell?.data.has(key)) return undefined;
3083
+
3084
+ metrics.totalHitCount += 1;
3085
+ moveCellAfter(cell, head);
3086
+ return cell;
3087
+ };
3088
+
3089
+ /** @type {WeakMapAPI<K, V>['has']} */
3090
+ const has = key => {
3091
+ const cell = touchKey(key);
3092
+ return cell !== undefined;
3093
+ };
3094
+ freeze(has);
3095
+
3096
+ /** @type {WeakMapAPI<K, V>['get']} */
2551
3097
  const get = key => {
2552
- const cell = touchCell(key);
2553
- return cell && cell.data && cell.data.get(key);
3098
+ const cell = touchKey(key);
3099
+ return cell?.data.get(key);
2554
3100
  };
2555
3101
  freeze(get);
2556
3102
 
2557
- /**
2558
- * @param {K} key
2559
- * @param {V} value
2560
- */
3103
+ /** @type {WeakMapAPI<K, V>['set']} */
2561
3104
  const set = (key, value) => {
2562
- if (keysBudget < 1) {
3105
+ let cell = touchKey(key);
3106
+ if (cell) {
3107
+ cell.data.set(key, value);
2563
3108
  // eslint-disable-next-line no-use-before-define
2564
- return lruCacheMap; // Implements WeakMap.set
3109
+ return implementation;
2565
3110
  }
2566
3111
 
2567
- let cell = touchCell(key);
2568
- if (cell === undefined) {
2569
- cell = makeSelfCell(undefined);
2570
- spliceAfter(head, cell); // start most recently used
2571
- }
2572
- if (!cell.data) {
2573
- // Either a fresh cell or a reused condemned cell.
2574
- size += 1;
2575
- // Add its data.
2576
- // eslint-disable-next-line no-restricted-globals
2577
- cell.data = new WeakMap();
2578
- // Advertise the cell for this key.
2579
- keyToCell.set(key, cell);
2580
- while (size > keysBudget) {
2581
- const condemned = head.prev;
2582
- spliceOut(condemned); // Drop least recently used
2583
- condemned.data = undefined;
2584
- size -= 1;
2585
- }
3112
+ if (cellCount < capacity) {
3113
+ // Add and use a new cell at first position.
3114
+ cell = appendNewCell(head, cellCount + 1, makeMap());
3115
+ cellCount += 1; // intentionally follows cell creation
3116
+ cell.data.set(key, value);
3117
+ } else if (capacity > 0) {
3118
+ // Reuse the current tail, moving it to first position.
3119
+ cell = head.prev;
3120
+ resetCell(/** @type {any} */ (cell), UNKNOWN_KEY, makeMap);
3121
+ cell.data.set(key, value);
3122
+ moveCellAfter(cell, head);
2586
3123
  }
2587
3124
 
2588
- // Update the data.
2589
- cell.data.set(key, value);
3125
+ // Don't establish this entry until prior steps succeed.
3126
+ if (cell) keyToCell.set(key, cell);
2590
3127
 
2591
3128
  // eslint-disable-next-line no-use-before-define
2592
- return lruCacheMap; // Implements WeakMap.set
3129
+ return implementation;
2593
3130
  };
2594
3131
  freeze(set);
2595
3132
 
2596
3133
  // "delete" is a keyword.
2597
- /**
2598
- * @param {K} key
2599
- */
2600
- const deleteIt = key => {
2601
- const cell = keyToCell.get(key);
2602
- if (cell === undefined) {
2603
- return false;
2604
- }
2605
- spliceOut(cell);
2606
- keyToCell.delete(key);
2607
- if (cell.data === undefined) {
2608
- // Already condemned.
2609
- return false;
2610
- }
2611
-
2612
- cell.data = undefined;
2613
- size -= 1;
2614
- return true;
3134
+ const { delete: deleteEntry } = {
3135
+ /** @type {WeakMapAPI<K, V>['delete']} */
3136
+ delete: key => {
3137
+ const cell = keyToCell.get(key);
3138
+ if (!cell?.data.has(key)) {
3139
+ keyToCell.delete(key);
3140
+ return false;
3141
+ }
3142
+ moveCellAfter(cell, head.prev);
3143
+ resetCell(cell, key);
3144
+ keyToCell.delete(key);
3145
+ return true;
3146
+ },
2615
3147
  };
2616
- freeze(deleteIt);
3148
+ freeze(deleteEntry);
2617
3149
 
2618
- const lruCacheMap = freeze({
3150
+ const implementation = /** @type {WeakMapAPI<K, V>} */ ({
2619
3151
  has,
2620
3152
  get,
2621
3153
  set,
2622
- delete: deleteIt,
3154
+ delete: deleteEntry,
2623
3155
  // eslint-disable-next-line jsdoc/check-types
2624
- [/** @type {typeof Symbol.toStringTag} */ (toStringTagSymbol)]:
2625
- 'LRUCacheMap',
3156
+ [/** @type {typeof Symbol.toStringTag} */ (toStringTagSymbol)]: tag,
2626
3157
  });
2627
- return lruCacheMap;
2628
- };$h͏_once.makeLRUCacheMap(makeLRUCacheMap);
2629
- freeze(makeLRUCacheMap);
3158
+ freeze(implementation);
3159
+
3160
+ const kit = { cache: implementation, getMetrics };
3161
+ return freeze(kit);
3162
+ };$h͏_once.makeCacheMapKit(makeCacheMapKit);
3163
+ freeze(makeCacheMapKit);
2630
3164
  })()
2631
3165
  ,
2632
- // === 8. ses ./src/error/note-log-args.js ===
2633
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let makeLRUCacheMap;$h͏_imports([["../make-lru-cachemap.js", [["makeLRUCacheMap",[$h͏_a => (makeLRUCacheMap = $h͏_a)]]]]]);
3166
+ // === 11. cache-map ./index.js ===
3167
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/cachemap.js", []]]);
3168
+ })()
3169
+ ,
3170
+ // === 12. ses ./src/error/note-log-args.js ===
3171
+ ({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)]]]]]);
2634
3172
 
2635
3173
 
2636
3174
 
2637
3175
 
2638
3176
 
2639
3177
  /**
3178
+ * @import {CacheMapKit} from '@endo/cache-map';
2640
3179
  * @import {LogArgs} from './internal-types.js';
2641
3180
  */
2642
3181
 
@@ -2661,16 +3200,16 @@ const defaultArgsPerErrorBudget = 100;
2661
3200
  }
2662
3201
 
2663
3202
  /**
2664
- * @type {WeakMap<Error, LogArgs[]>}
2665
- *
2666
3203
  * Maps from an error to an array of log args, where each log args is
2667
3204
  * remembered as an annotation on that error. This can be used, for example,
2668
3205
  * to keep track of additional causes of the error. The elements of any
2669
3206
  * log args may include errors which are associated with further annotations.
2670
3207
  * An augmented console, like the causal console of `console.js`, could
2671
3208
  * then retrieve the graph of such annotations.
3209
+ *
3210
+ * @type {CacheMapKit<WeakMapConstructor, Error, LogArgs[]>}
2672
3211
  */
2673
- const noteLogArgsArrayMap = makeLRUCacheMap(errorsBudget);
3212
+ const { cache: noteLogArgsArrayMap } = makeCacheMapKit(errorsBudget);
2674
3213
 
2675
3214
  /**
2676
3215
  * @param {Error} error
@@ -2708,8 +3247,8 @@ const defaultArgsPerErrorBudget = 100;
2708
3247
  freeze(makeNoteLogArgsArrayKit);
2709
3248
  })()
2710
3249
  ,
2711
- // === 9. ses ./src/error/assert.js ===
2712
- ({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,regexpTest,stringIndexOf,stringReplace,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,getOwnPropertyDescriptors,ownKeys,create,objectPrototype,objectHasOwnProperty,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)]],["regexpTest",[$h͏_a => (regexpTest = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringReplace",[$h͏_a => (stringReplace = $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)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $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)]]]]]);
3250
+ // === 13. ses ./src/error/assert.js ===
3251
+ ({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,regexpTest,stringIndexOf,stringReplace,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)]],["regexpTest",[$h͏_a => (regexpTest = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringReplace",[$h͏_a => (stringReplace = $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)]]]]]);
2713
3252
 
2714
3253
 
2715
3254
 
@@ -3018,7 +3557,7 @@ const tagError = (err, optErrorName = err.name) => {
3018
3557
  for (const name of ownKeys(error)) {
3019
3558
  // @ts-expect-error TS still confused by symbols as property names
3020
3559
  const desc = descs[name];
3021
- if (desc && objectHasOwnProperty(desc, 'get')) {
3560
+ if (desc && hasOwn(desc, 'get')) {
3022
3561
  defineProperty(error, name, {
3023
3562
  value: error[name] // invoke the getter to convert to data property
3024
3563
  });
@@ -3286,8 +3825,8 @@ const assert = makeAssert();$h͏_once.assert(assert);
3286
3825
  const assertEqual = assert.equal;$h͏_once.assertEqual(assertEqual);
3287
3826
  })()
3288
3827
  ,
3289
- // === 10. ses ./src/make-hardener.js ===
3290
- ({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,isObject,objectHasOwnProperty,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)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $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)]]]]]);
3828
+ // === 14. ses ./src/make-hardener.js ===
3829
+ ({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)]]]]]);
3291
3830
 
3292
3831
 
3293
3832
 
@@ -3440,7 +3979,7 @@ const freezeTypedArray = array => {
3440
3979
  * @param {any} val
3441
3980
  */
3442
3981
  function enqueue(val) {
3443
- if (!isObject(val)) {
3982
+ if (isPrimitive(val)) {
3444
3983
  // ignore primitives
3445
3984
  return;
3446
3985
  }
@@ -3495,7 +4034,7 @@ const freezeTypedArray = array => {
3495
4034
  // test could be confused. We use hasOwnProperty to be sure about
3496
4035
  // whether 'value' is present or not, which tells us for sure that
3497
4036
  // this is a data property.
3498
- if (objectHasOwnProperty(desc, 'value')) {
4037
+ if (hasOwn(desc, 'value')) {
3499
4038
  enqueue(desc.value);
3500
4039
  } else {
3501
4040
  enqueue(desc.get);
@@ -3564,8 +4103,8 @@ const freezeTypedArray = array => {
3564
4103
  };$h͏_once.makeHardener(makeHardener);
3565
4104
  })()
3566
4105
  ,
3567
- // === 11. ses ./src/cauterize-property.js ===
3568
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let objectHasOwnProperty;$h͏_imports([["./commons.js", [["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]]]]]);
4106
+ // === 15. ses ./src/cauterize-property.js ===
4107
+ ({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)]]]]]);
3569
4108
 
3570
4109
  /**
3571
4110
  * @import {Reporter} from './reporting-types.js'
@@ -3619,7 +4158,7 @@ const freezeTypedArray = array => {
3619
4158
  try {
3620
4159
  delete obj[prop];
3621
4160
  } catch (err) {
3622
- if (objectHasOwnProperty(obj, prop)) {
4161
+ if (hasOwn(obj, prop)) {
3623
4162
  if (typeof obj === 'function' && prop === 'prototype') {
3624
4163
  obj.prototype = undefined;
3625
4164
  if (obj.prototype === undefined) {
@@ -3636,7 +4175,7 @@ const freezeTypedArray = array => {
3636
4175
  };$h͏_once.cauterizeProperty(cauterizeProperty);
3637
4176
  })()
3638
4177
  ,
3639
- // === 12. ses ./src/permits.js ===
4178
+ // === 16. ses ./src/permits.js ===
3640
4179
  ({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)]]]]]);
3641
4180
 
3642
4181
 
@@ -3645,12 +4184,14 @@ const freezeTypedArray = array => {
3645
4184
  /** @import {GenericErrorConstructor} from '../types.js' */
3646
4185
 
3647
4186
  /**
3648
- * @module Exports {@code permits}, a recursively defined
4187
+ * Exports {@code permits}, a recursively defined
3649
4188
  * JSON record enumerating all intrinsics and their properties
3650
4189
  * according to ECMA specs.
3651
4190
  *
3652
4191
  * @author JF Paradis
3653
4192
  * @author Mark S. Miller
4193
+ *
4194
+ * @module
3654
4195
  */
3655
4196
 
3656
4197
  /**
@@ -4995,6 +5536,35 @@ const CommonMath = {
4995
5536
  // https://github.com/tc39/proposal-arraybuffer-transfer
4996
5537
  transferToFixedLength: fn,
4997
5538
  detached: getter,
5539
+ // https://github.com/endojs/endo/pull/2309#issuecomment-2155513240
5540
+ // to be proposed
5541
+ transferToImmutable: fn,
5542
+ sliceToImmutable: fn,
5543
+ immutable: getter,
5544
+ },
5545
+
5546
+ // If this exists, it is purely an artifact of how we currently shim
5547
+ // `transferToImmutable`. As natively implemented, there would be no
5548
+ // such extra prototype.
5549
+ '%ImmutableArrayBufferPrototype%': {
5550
+ '[[Proto]]': '%ArrayBufferPrototype%',
5551
+ byteLength: getter,
5552
+ slice: fn,
5553
+ // See https://github.com/endojs/endo/tree/master/packages/immutable-arraybuffer#purposeful-violation
5554
+ '@@toStringTag': 'string',
5555
+ // See https://github.com/tc39/proposal-resizablearraybuffer
5556
+ transfer: fn,
5557
+ resize: fn,
5558
+ resizable: getter,
5559
+ maxByteLength: getter,
5560
+ // https://github.com/tc39/proposal-arraybuffer-transfer
5561
+ transferToFixedLength: fn,
5562
+ detached: getter,
5563
+ // https://github.com/endojs/endo/pull/2309#issuecomment-2155513240
5564
+ // to be proposed
5565
+ transferToImmutable: fn,
5566
+ sliceToImmutable: fn,
5567
+ immutable: getter,
4998
5568
  },
4999
5569
 
5000
5570
  // SharedArrayBuffer Objects
@@ -5369,8 +5939,8 @@ const CommonMath = {
5369
5939
  };$h͏_once.permitted(permitted);
5370
5940
  })()
5371
5941
  ,
5372
- // === 13. ses ./src/intrinsics.js ===
5373
- ({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,isObject,objectHasOwnProperty,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)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $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)]]]]]);
5942
+ // === 17. ses ./src/intrinsics.js ===
5943
+ ({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)]]]]]);
5374
5944
 
5375
5945
 
5376
5946
 
@@ -5409,7 +5979,7 @@ const isFunction = obj => typeof obj === 'function';
5409
5979
  // get masked as one overwrites the other. Accordingly, the thrown error
5410
5980
  // complains of a "Conflicting definition".
5411
5981
  function initProperty(obj, name, desc) {
5412
- if (objectHasOwnProperty(obj, name)) {
5982
+ if (hasOwn(obj, name)) {
5413
5983
  const preDesc = getOwnPropertyDescriptor(obj, name);
5414
5984
  if (
5415
5985
  !preDesc ||
@@ -5441,7 +6011,7 @@ function initProperties(obj, descs) {
5441
6011
  function sampleGlobals(globalObject, newPropertyNames) {
5442
6012
  const newIntrinsics = { __proto__: null };
5443
6013
  for (const [globalName, intrinsicName] of entries(newPropertyNames)) {
5444
- if (objectHasOwnProperty(globalObject, globalName)) {
6014
+ if (hasOwn(globalObject, globalName)) {
5445
6015
  newIntrinsics[intrinsicName] = globalObject[globalName];
5446
6016
  }
5447
6017
  }
@@ -5466,11 +6036,11 @@ function sampleGlobals(globalObject, newPropertyNames) {
5466
6036
  // to the intrinsics.
5467
6037
  const completePrototypes = () => {
5468
6038
  for (const [name, intrinsic] of entries(intrinsics)) {
5469
- if (!isObject(intrinsic)) {
6039
+ if (isPrimitive(intrinsic)) {
5470
6040
  // eslint-disable-next-line no-continue
5471
6041
  continue;
5472
6042
  }
5473
- if (!objectHasOwnProperty(intrinsic, 'prototype')) {
6043
+ if (!hasOwn(intrinsic, 'prototype')) {
5474
6044
  // eslint-disable-next-line no-continue
5475
6045
  continue;
5476
6046
  }
@@ -5492,12 +6062,12 @@ function sampleGlobals(globalObject, newPropertyNames) {
5492
6062
  }
5493
6063
  if (
5494
6064
  typeof namePrototype !== 'string' ||
5495
- !objectHasOwnProperty(permitted, namePrototype)
6065
+ !hasOwn(permitted, namePrototype)
5496
6066
  ) {
5497
6067
  throw TypeError(`Unrecognized ${name}.prototype permits entry`);
5498
6068
  }
5499
6069
  const intrinsicPrototype = intrinsic.prototype;
5500
- if (objectHasOwnProperty(intrinsics, namePrototype)) {
6070
+ if (hasOwn(intrinsics, namePrototype)) {
5501
6071
  if (intrinsics[namePrototype] !== intrinsicPrototype) {
5502
6072
  throw TypeError(`Conflicting bindings of ${namePrototype}`);
5503
6073
  }
@@ -5564,8 +6134,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
5564
6134
  };$h͏_once.getGlobalIntrinsics(getGlobalIntrinsics);
5565
6135
  })()
5566
6136
  ,
5567
- // === 14. ses ./src/permits-intrinsics.js ===
5568
- ({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,isObject,mapGet,objectHasOwnProperty,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)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["symbolKeyFor",[$h͏_a => (symbolKeyFor = $h͏_a)]]]],["./cauterize-property.js", [["cauterizeProperty",[$h͏_a => (cauterizeProperty = $h͏_a)]]]]]);
6137
+ // === 18. ses ./src/permits-intrinsics.js ===
6138
+ ({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)]]]]]);
5569
6139
 
5570
6140
 
5571
6141
 
@@ -5698,8 +6268,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
5698
6268
  * Validate the object's [[prototype]] against a permit.
5699
6269
  */
5700
6270
  function visitPrototype(path, obj, protoName) {
5701
- if (!isObject(obj)) {
5702
- throw TypeError(`Object expected: ${path}, ${obj}, ${protoName}`);
6271
+ if (isPrimitive(obj)) {
6272
+ throw TypeError(`Object expected: ${path}, ${String(obj)}, ${protoName}`);
5703
6273
  }
5704
6274
  const proto = getPrototypeOf(obj);
5705
6275
 
@@ -5752,7 +6322,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
5752
6322
  // Assert: the permit is the name of an intrinsic.
5753
6323
  // Assert: the property value is equal to that intrinsic.
5754
6324
 
5755
- if (objectHasOwnProperty(intrinsics, permit)) {
6325
+ if (hasOwn(intrinsics, permit)) {
5756
6326
  if (value !== intrinsics[permit]) {
5757
6327
  throw TypeError(`Does not match permit for ${path}`);
5758
6328
  }
@@ -5792,7 +6362,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
5792
6362
  }
5793
6363
 
5794
6364
  // Is this a value property?
5795
- if (objectHasOwnProperty(desc, 'value')) {
6365
+ if (hasOwn(desc, 'value')) {
5796
6366
  if (isAccessorPermit(permit)) {
5797
6367
  throw TypeError(`Accessor expected at ${path}`);
5798
6368
  }
@@ -5812,12 +6382,12 @@ function sampleGlobals(globalObject, newPropertyNames) {
5812
6382
  */
5813
6383
  function getSubPermit(obj, permit, prop) {
5814
6384
  const permitProp = prop === '__proto__' ? '--proto--' : prop;
5815
- if (objectHasOwnProperty(permit, permitProp)) {
6385
+ if (hasOwn(permit, permitProp)) {
5816
6386
  return permit[permitProp];
5817
6387
  }
5818
6388
 
5819
6389
  if (typeof obj === 'function') {
5820
- if (objectHasOwnProperty(FunctionInstance, permitProp)) {
6390
+ if (hasOwn(FunctionInstance, permitProp)) {
5821
6391
  return FunctionInstance[permitProp];
5822
6392
  }
5823
6393
  }
@@ -5858,7 +6428,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
5858
6428
  }$h͏_once.default( removeUnpermittedIntrinsics);
5859
6429
  })()
5860
6430
  ,
5861
- // === 15. ses ./src/tame-function-constructors.js ===
6431
+ // === 19. ses ./src/tame-function-constructors.js ===
5862
6432
  ({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)]]]]]);
5863
6433
 
5864
6434
 
@@ -6001,7 +6571,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6001
6571
  }$h͏_once.default( tameFunctionConstructors);
6002
6572
  })()
6003
6573
  ,
6004
- // === 16. ses ./src/tame-date-constructor.js ===
6574
+ // === 20. ses ./src/tame-date-constructor.js ===
6005
6575
  ({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)]]]]]);
6006
6576
 
6007
6577
 
@@ -6131,7 +6701,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6131
6701
  }$h͏_once.default( tameDateConstructor);
6132
6702
  })()
6133
6703
  ,
6134
- // === 17. ses ./src/tame-math-object.js ===
6704
+ // === 21. ses ./src/tame-math-object.js ===
6135
6705
  ({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)]]]]]);
6136
6706
 
6137
6707
 
@@ -6175,7 +6745,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6175
6745
  }$h͏_once.default( tameMathObject);
6176
6746
  })()
6177
6747
  ,
6178
- // === 18. ses ./src/tame-regexp-constructor.js ===
6748
+ // === 22. ses ./src/tame-regexp-constructor.js ===
6179
6749
  ({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)]]]]]);
6180
6750
 
6181
6751
 
@@ -6186,9 +6756,6 @@ function sampleGlobals(globalObject, newPropertyNames) {
6186
6756
 
6187
6757
 
6188
6758
  function tameRegExpConstructor(regExpTaming = 'safe') {
6189
- if (regExpTaming !== 'safe' && regExpTaming !== 'unsafe') {
6190
- throw TypeError(`unrecognized regExpTaming ${regExpTaming}`);
6191
- }
6192
6759
  const RegExpPrototype = FERAL_REG_EXP.prototype;
6193
6760
 
6194
6761
  const makeRegExpConstructor = (_ = {}) => {
@@ -6246,17 +6813,19 @@ function sampleGlobals(globalObject, newPropertyNames) {
6246
6813
  }$h͏_once.default( tameRegExpConstructor);
6247
6814
  })()
6248
6815
  ,
6249
- // === 19. ses ./src/enablements.js ===
6816
+ // === 23. ses ./src/enablements.js ===
6250
6817
  ({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)]]]]]);
6251
6818
 
6252
6819
  /**
6253
- * @module Exports {@code enablements}, a recursively defined
6820
+ * Exports {@code enablements}, a recursively defined
6254
6821
  * JSON record defining the optimum set of intrinsics properties
6255
6822
  * that need to be "repaired" before hardening is applied on
6256
6823
  * enviromments subject to the override mistake.
6257
6824
  *
6258
6825
  * @author JF Paradis
6259
6826
  * @author Mark S. Miller
6827
+ *
6828
+ * @module
6260
6829
  */
6261
6830
 
6262
6831
  /**
@@ -6491,8 +7060,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
6491
7060
  };$h͏_once.severeEnablements(severeEnablements);
6492
7061
  })()
6493
7062
  ,
6494
- // === 20. ses ./src/enable-property-overrides.js ===
6495
- ({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,isObject,objectHasOwnProperty,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)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $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)]]]]]);
7063
+ // === 24. ses ./src/enable-property-overrides.js ===
7064
+ ({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)]]]]]);
6496
7065
 
6497
7066
 
6498
7067
 
@@ -6603,7 +7172,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6603
7172
  )}' of '${path}'`,
6604
7173
  );
6605
7174
  }
6606
- if (objectHasOwnProperty(this, prop)) {
7175
+ if (hasOwn(this, prop)) {
6607
7176
  this[prop] = newValue;
6608
7177
  } else {
6609
7178
  if (isDebug) {
@@ -6673,7 +7242,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6673
7242
  enableProperty(subPath, obj, prop);
6674
7243
  } else if (subPlan === '*') {
6675
7244
  enableAllProperties(subPath, desc.value);
6676
- } else if (isObject(subPlan)) {
7245
+ } else if (!isPrimitive(subPlan)) {
6677
7246
  enableProperties(subPath, desc.value, subPlan);
6678
7247
  } else {
6679
7248
  throw TypeError(`Unexpected override enablement plan ${subPath}`);
@@ -6705,8 +7274,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
6705
7274
  }$h͏_once.default( enablePropertyOverrides);
6706
7275
  })()
6707
7276
  ,
6708
- // === 21. ses ./src/tame-locale-methods.js ===
6709
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Number,String,TypeError,defineProperty,getOwnPropertyNames,isObject,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)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
7277
+ // === 25. ses ./src/tame-locale-methods.js ===
7278
+ ({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)]]]]]);
6710
7279
 
6711
7280
 
6712
7281
 
@@ -6752,9 +7321,6 @@ const nonLocaleCompare = tamedMethods.localeCompare;
6752
7321
  const numberToString = tamedMethods.toString;
6753
7322
 
6754
7323
  function tameLocaleMethods(intrinsics, localeTaming = 'safe') {
6755
- if (localeTaming !== 'safe' && localeTaming !== 'unsafe') {
6756
- throw TypeError(`unrecognized localeTaming ${localeTaming}`);
6757
- }
6758
7324
  if (localeTaming === 'unsafe') {
6759
7325
  return;
6760
7326
  }
@@ -6765,7 +7331,7 @@ const numberToString = tamedMethods.toString;
6765
7331
 
6766
7332
  for (const intrinsicName of getOwnPropertyNames(intrinsics)) {
6767
7333
  const intrinsic = intrinsics[intrinsicName];
6768
- if (isObject(intrinsic)) {
7334
+ if (!isPrimitive(intrinsic)) {
6769
7335
  for (const methodName of getOwnPropertyNames(intrinsic)) {
6770
7336
  const match = regexpExec(localePattern, methodName);
6771
7337
  if (match) {
@@ -6789,15 +7355,16 @@ const numberToString = tamedMethods.toString;
6789
7355
  }$h͏_once.default( tameLocaleMethods);
6790
7356
  })()
6791
7357
  ,
6792
- // === 22. ses ./src/make-eval-function.js ===
7358
+ // === 26. ses ./src/make-eval-function.js ===
6793
7359
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/**
6794
7360
  * makeEvalFunction()
6795
7361
  * A safe version of the native eval function which relies on
6796
- * the safety of safeEvaluate for confinement.
7362
+ * the safety of `safe-eval` for confinement, unless `no-eval`
7363
+ * is specified (then a TypeError is thrown on use).
6797
7364
  *
6798
- * @param {Function} safeEvaluate
7365
+ * @param {Function} evaluator
6799
7366
  */
6800
- const makeEvalFunction = safeEvaluate => {
7367
+ const makeEvalFunction = evaluator => {
6801
7368
  // We use the concise method syntax to create an eval without a
6802
7369
  // [[Construct]] behavior (such that the invocation "new eval()" throws
6803
7370
  // TypeError: eval is not a constructor"), but which still accepts a
@@ -6811,7 +7378,7 @@ const numberToString = tamedMethods.toString;
6811
7378
  // rule. Track.
6812
7379
  return source;
6813
7380
  }
6814
- return safeEvaluate(source);
7381
+ return evaluator(source);
6815
7382
  },
6816
7383
  }.eval;
6817
7384
 
@@ -6819,7 +7386,7 @@ const numberToString = tamedMethods.toString;
6819
7386
  };$h͏_once.makeEvalFunction(makeEvalFunction);
6820
7387
  })()
6821
7388
  ,
6822
- // === 23. ses ./src/make-function-constructor.js ===
7389
+ // === 27. ses ./src/make-function-constructor.js ===
6823
7390
  ({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)]]]]]);
6824
7391
 
6825
7392
 
@@ -6834,9 +7401,10 @@ const { Fail } = assert;
6834
7401
  /*
6835
7402
  * makeFunctionConstructor()
6836
7403
  * A safe version of the native Function which relies on
6837
- * the safety of safeEvaluate for confinement.
7404
+ * the safety of `safe-eval` for confinement, unless `no-eval`
7405
+ * is specified (then a TypeError is thrown on use).
6838
7406
  */
6839
- const makeFunctionConstructor = safeEvaluate => {
7407
+ const makeFunctionConstructor = evaluator => {
6840
7408
  // Define an unused parameter to ensure Function.length === 1
6841
7409
  const newFunction = function Function(_body) {
6842
7410
  // Sanitize all parameters at the entry point.
@@ -6876,7 +7444,7 @@ const { Fail } = assert;
6876
7444
  // TODO: since we create an anonymous function, the 'this' value
6877
7445
  // isn't bound to the global object as per specs, but set as undefined.
6878
7446
  const src = `(function anonymous(${parameters}\n) {\n${bodyText}\n})`;
6879
- return safeEvaluate(src);
7447
+ return evaluator(src);
6880
7448
  };
6881
7449
 
6882
7450
  defineProperties(newFunction, {
@@ -6894,14 +7462,14 @@ const { Fail } = assert;
6894
7462
  getPrototypeOf(FERAL_FUNCTION) === FERAL_FUNCTION.prototype ||
6895
7463
  Fail`Function prototype is the same accross compartments`;
6896
7464
  getPrototypeOf(newFunction) === FERAL_FUNCTION.prototype ||
6897
- Fail`Function constructor prototype is the same accross compartments`;
7465
+ Fail`Function constructor prototype is the same across compartments`;
6898
7466
 
6899
7467
  return newFunction;
6900
7468
  };$h͏_once.makeFunctionConstructor(makeFunctionConstructor);
6901
7469
  })()
6902
7470
  ,
6903
- // === 24. ses ./src/global-object.js ===
6904
- ({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,objectHasOwnProperty,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)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $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)]]]]]);
7471
+ // === 28. ses ./src/global-object.js ===
7472
+ ({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)]]]]]);
6905
7473
 
6906
7474
 
6907
7475
 
@@ -6990,7 +7558,7 @@ const { Fail } = assert;
6990
7558
  },
6991
7559
  ) => {
6992
7560
  for (const [name, intrinsicName] of entries(universalPropertyNames)) {
6993
- if (objectHasOwnProperty(intrinsics, intrinsicName)) {
7561
+ if (hasOwn(intrinsics, intrinsicName)) {
6994
7562
  defineProperty(globalObject, name, {
6995
7563
  value: intrinsics[intrinsicName],
6996
7564
  writable: true,
@@ -7001,7 +7569,7 @@ const { Fail } = assert;
7001
7569
  }
7002
7570
 
7003
7571
  for (const [name, intrinsicName] of entries(newGlobalPropertyNames)) {
7004
- if (objectHasOwnProperty(intrinsics, intrinsicName)) {
7572
+ if (hasOwn(intrinsics, intrinsicName)) {
7005
7573
  defineProperty(globalObject, name, {
7006
7574
  value: intrinsics[intrinsicName],
7007
7575
  writable: true,
@@ -7078,7 +7646,7 @@ const { Fail } = assert;
7078
7646
  };$h͏_once.setGlobalObjectEvaluators(setGlobalObjectEvaluators);
7079
7647
  })()
7080
7648
  ,
7081
- // === 25. ses ./src/strict-scope-terminator.js ===
7649
+ // === 29. ses ./src/strict-scope-terminator.js ===
7082
7650
  ({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)]]]]]);
7083
7651
 
7084
7652
 
@@ -7180,7 +7748,7 @@ const scopeProxyHandlerProperties = {
7180
7748
  );$h͏_once.strictScopeTerminator(strictScopeTerminator);
7181
7749
  })()
7182
7750
  ,
7183
- // === 26. ses ./src/sloppy-globals-scope-terminator.js ===
7751
+ // === 30. ses ./src/sloppy-globals-scope-terminator.js ===
7184
7752
  ({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)]]]]]);
7185
7753
 
7186
7754
 
@@ -7244,7 +7812,7 @@ const objTarget = freeze({ __proto__: null });
7244
7812
  freeze(createSloppyGlobalsScopeTerminator);
7245
7813
  })()
7246
7814
  ,
7247
- // === 27. ses ./src/eval-scope.js ===
7815
+ // === 31. ses ./src/eval-scope.js ===
7248
7816
  ({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)]]]]]);
7249
7817
 
7250
7818
 
@@ -7336,7 +7904,7 @@ const { Fail } = assert;
7336
7904
  };$h͏_once.makeEvalScopeKit(makeEvalScopeKit);
7337
7905
  })()
7338
7906
  ,
7339
- // === 28. ses ./src/get-source-url.js ===
7907
+ // === 32. ses ./src/get-source-url.js ===
7340
7908
  ({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)]]]]]);
7341
7909
 
7342
7910
  // Captures a key and value of the form #key=value or @key=value
@@ -7389,7 +7957,7 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
7389
7957
  };$h͏_once.getSourceURL(getSourceURL);
7390
7958
  })()
7391
7959
  ,
7392
- // === 29. ses ./src/transforms.js ===
7960
+ // === 33. ses ./src/transforms.js ===
7393
7961
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,stringReplace,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)]],["stringReplace",[$h͏_a => (stringReplace = $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)]]]]]);
7394
7962
 
7395
7963
 
@@ -7659,8 +8227,8 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
7659
8227
  });$h͏_once.transforms(transforms);
7660
8228
  })()
7661
8229
  ,
7662
- // === 30. ses ./src/scope-constants.js ===
7663
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,objectHasOwnProperty,regexpTest;$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)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]],["regexpTest",[$h͏_a => (regexpTest = $h͏_a)]]]]]);
8230
+ // === 34. ses ./src/scope-constants.js ===
8231
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,hasOwn,regexpTest;$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)]],["regexpTest",[$h͏_a => (regexpTest = $h͏_a)]]]]]);
7664
8232
 
7665
8233
 
7666
8234
 
@@ -7793,7 +8361,7 @@ function isImmutableDataProperty(obj, name) {
7793
8361
  // can't have accessors and value properties at the same time, therefore
7794
8362
  // this check is sufficient. Using explicit own property deal with the
7795
8363
  // case where Object.prototype has been poisoned.
7796
- objectHasOwnProperty(desc, 'value')
8364
+ hasOwn(desc, 'value')
7797
8365
  );
7798
8366
  }
7799
8367
 
@@ -7842,7 +8410,7 @@ function isImmutableDataProperty(obj, name) {
7842
8410
  };$h͏_once.getScopeConstants(getScopeConstants);
7843
8411
  })()
7844
8412
  ,
7845
- // === 31. ses ./src/make-evaluate.js ===
8413
+ // === 35. ses ./src/make-evaluate.js ===
7846
8414
  ({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)]]]]]);
7847
8415
 
7848
8416
 
@@ -7955,7 +8523,7 @@ function buildOptimizer(constants, name) {
7955
8523
  };$h͏_once.makeEvaluate(makeEvaluate);
7956
8524
  })()
7957
8525
  ,
7958
- // === 32. ses ./src/make-safe-evaluator.js ===
8526
+ // === 36. ses ./src/make-safe-evaluator.js ===
7959
8527
  ({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)]]]]]);
7960
8528
 
7961
8529
 
@@ -8070,7 +8638,7 @@ const { Fail } = assert;
8070
8638
  };$h͏_once.makeSafeEvaluator(makeSafeEvaluator);
8071
8639
  })()
8072
8640
  ,
8073
- // === 33. ses ./src/tame-function-tostring.js ===
8641
+ // === 37. ses ./src/tame-function-tostring.js ===
8074
8642
  ({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)]]]]]);
8075
8643
 
8076
8644
 
@@ -8123,7 +8691,7 @@ let markVirtualizedNativeFunction;
8123
8691
  };$h͏_once.tameFunctionToString(tameFunctionToString);
8124
8692
  })()
8125
8693
  ,
8126
- // === 34. ses ./src/tame-domains.js ===
8694
+ // === 38. ses ./src/tame-domains.js ===
8127
8695
  ({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);
8128
8696
 
8129
8697
 
@@ -8134,10 +8702,6 @@ let markVirtualizedNativeFunction;
8134
8702
 
8135
8703
 
8136
8704
  function tameDomains(domainTaming = 'safe') {
8137
- if (domainTaming !== 'safe' && domainTaming !== 'unsafe') {
8138
- throw TypeError(`unrecognized domainTaming ${domainTaming}`);
8139
- }
8140
-
8141
8705
  if (domainTaming === 'unsafe') {
8142
8706
  return;
8143
8707
  }
@@ -8171,7 +8735,7 @@ let markVirtualizedNativeFunction;
8171
8735
  }
8172
8736
  })()
8173
8737
  ,
8174
- // === 35. ses ./src/tame-module-source.js ===
8738
+ // === 39. ses ./src/tame-module-source.js ===
8175
8739
  ({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)]]]]]);
8176
8740
 
8177
8741
 
@@ -8225,7 +8789,7 @@ let markVirtualizedNativeFunction;
8225
8789
  };$h͏_once.tameModuleSource(tameModuleSource);
8226
8790
  })()
8227
8791
  ,
8228
- // === 36. ses ./src/error/console.js ===
8792
+ // === 40. ses ./src/error/console.js ===
8229
8793
  ({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)]]]]]);
8230
8794
 
8231
8795
 
@@ -8769,7 +9333,7 @@ freeze(defineCausalConsoleFromLogger);
8769
9333
  freeze(filterConsole);
8770
9334
  })()
8771
9335
  ,
8772
- // === 37. ses ./src/error/unhandled-rejection.js ===
9336
+ // === 41. ses ./src/error/unhandled-rejection.js ===
8773
9337
  ({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)]]]]]);
8774
9338
 
8775
9339
 
@@ -8894,7 +9458,7 @@ freeze(filterConsole);
8894
9458
  };$h͏_once.makeRejectionHandlers(makeRejectionHandlers);
8895
9459
  })()
8896
9460
  ,
8897
- // === 38. ses ./src/error/tame-console.js ===
9461
+ // === 42. ses ./src/error/tame-console.js ===
8898
9462
  ({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)]]]]]);
8899
9463
 
8900
9464
 
@@ -8938,10 +9502,6 @@ const wrapLogger = (logger, thisArg) =>
8938
9502
  unhandledRejectionTrapping = 'report',
8939
9503
  optGetStackString = undefined,
8940
9504
  ) => {
8941
- consoleTaming === 'safe' ||
8942
- consoleTaming === 'unsafe' ||
8943
- failFast(`unrecognized consoleTaming ${consoleTaming}`);
8944
-
8945
9505
  let loggedErrorHandler;
8946
9506
  if (optGetStackString === undefined) {
8947
9507
  loggedErrorHandler = defaultHandler;
@@ -9098,7 +9658,7 @@ const wrapLogger = (logger, thisArg) =>
9098
9658
  };$h͏_once.tameConsole(tameConsole);
9099
9659
  })()
9100
9660
  ,
9101
- // === 39. ses ./src/error/tame-v8-error-constructor.js ===
9661
+ // === 43. ses ./src/error/tame-v8-error-constructor.js ===
9102
9662
  ({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,regexpTest,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)]],["regexpTest",[$h͏_a => (regexpTest = $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)]]]]]);
9103
9663
 
9104
9664
 
@@ -9172,10 +9732,9 @@ const FILENAME_NODE_DEPENDENTS_CENSOR = /\/node_modules\//;
9172
9732
  // stack traces.
9173
9733
  const FILENAME_NODE_INTERNALS_CENSOR = /^(?:node:)?internal\//;
9174
9734
 
9175
- // Frames within the `assert.js` package should be dropped from
9176
- // concise stack traces, as these are just steps towards creating the
9177
- // error object in question.
9178
- const FILENAME_ASSERT_CENSOR = /\/packages\/ses\/src\/error\/assert.js$/;
9735
+ // Frames within SES `assert.js` should be dropped from concise stack traces, as
9736
+ // these are just steps towards creating the error object in question.
9737
+ const FILENAME_ASSERT_CENSOR = /\/packages\/ses\/src\/error\/assert\.js$/;
9179
9738
 
9180
9739
  // Frames within the `eventual-send` shim should be dropped so that concise
9181
9740
  // deep stacks omit the internals of the eventual-sending mechanism causing
@@ -9184,6 +9743,10 @@ const FILENAME_ASSERT_CENSOR = /\/packages\/ses\/src\/error\/assert.js$/;
9184
9743
  // Endo, so this rule will be of general interest.
9185
9744
  const FILENAME_EVENTUAL_SEND_CENSOR = /\/packages\/eventual-send\/src\//;
9186
9745
 
9746
+ // Frames within the `ses-ava` package should be dropped from concise stack
9747
+ // traces, as they just support exposing error details to AVA.
9748
+ const FILENAME_SES_AVA_CENSOR = /\/packages\/ses-ava\/src\/ses-ava-test\.js$/;
9749
+
9187
9750
  // Any stack frame whose `fileName` matches any of these censor patterns
9188
9751
  // will be omitted from concise stacks.
9189
9752
  // TODO Enable users to configure FILENAME_CENSORS via `lockdown` options.
@@ -9192,6 +9755,7 @@ const FILENAME_CENSORS = [
9192
9755
  FILENAME_NODE_INTERNALS_CENSOR,
9193
9756
  FILENAME_ASSERT_CENSOR,
9194
9757
  FILENAME_EVENTUAL_SEND_CENSOR,
9758
+ FILENAME_SES_AVA_CENSOR,
9195
9759
  ];
9196
9760
 
9197
9761
  // Should a stack frame with this as its fileName be included in a concise
@@ -9215,34 +9779,64 @@ const FILENAME_CENSORS = [
9215
9779
  // likely url-path prefix, ending in a `/.../` should get dropped.
9216
9780
  // Anything to the left of the likely path text is kept.
9217
9781
  // Everything to the right of `/.../` is kept. Thus
9218
- // `'Object.bar (/vat-v1/.../eventual-send/test/test-deep-send.js:13:21)'`
9782
+ // `'Object.bar (/vat-v1/.../eventual-send/test/deep-send.test.js:13:21)'`
9219
9783
  // simplifies to
9220
- // `'Object.bar (eventual-send/test/test-deep-send.js:13:21)'`.
9784
+ // `'Object.bar (eventual-send/test/deep-send.test.js:13:21)'`.
9221
9785
  //
9222
9786
  // See thread starting at
9223
9787
  // https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
9224
- $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSES_PATTERN=/^((?:.*[( ])?)[:/\w_-]*\/\.\.\.\/(.+)$/;
9788
+ $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSIS_PATTERN1=/^((?:.*[( ])?)[:/\w_-]*\/\.\.\.\/(.+)$/;
9789
+
9790
+ // The ad-hoc rule of the current pattern is that any likely-file-path or
9791
+ // likely url-path prefix consisting of `.../` should get dropped.
9792
+ // Anything to the left of the likely path text is kept.
9793
+ // Everything to the right of `.../` is kept. Thus
9794
+ // `'Object.bar (.../eventual-send/test/deep-send.test.js:13:21)'`
9795
+ // simplifies to
9796
+ // `'Object.bar (eventual-send/test/deep-send.test.js:13:21)'`.
9797
+ //
9798
+ // See thread starting at
9799
+ // https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
9800
+ const CALLSITE_ELLIPSIS_PATTERN2 = /^((?:.*[( ])?)\.\.\.\/(.+)$/;
9225
9801
 
9226
9802
  // The ad-hoc rule of the current pattern is that any likely-file-path or
9227
9803
  // likely url-path prefix, ending in a `/` and prior to `package/` should get
9228
9804
  // dropped.
9229
9805
  // Anything to the left of the likely path prefix text is kept. `package/` and
9230
9806
  // everything to its right is kept. Thus
9231
- // `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/test-deep-send.js:13:21)'`
9807
+ // `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/deep-send.test.js:13:21)'`
9232
9808
  // simplifies to
9233
- // `'Object.bar (packages/eventual-send/test/test-deep-send.js:13:21)'`.
9809
+ // `'Object.bar (packages/eventual-send/test/deep-send.test.js:13:21)'`.
9234
9810
  // Note that `/packages/` is a convention for monorepos encouraged by
9235
9811
  // lerna.
9236
9812
  const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
9237
9813
 
9814
+ // The ad-hoc rule of the current pattern is that any likely-file-path or
9815
+ // likely url-path prefix of the form `file://` but not `file:///` gets
9816
+ // dropped.
9817
+ // Anything to the left of the likely path prefix text is kept. Everything to
9818
+ // the right of `file://` is kept. Thus
9819
+ // `'Object.bar (file:///Users/markmiller/src/ongithub/endojs/endo/packages/eventual-send/test/deep-send.test.js:13:21)'` is unchanged but
9820
+ // `'Object.bar (file://test/deep-send.test.js:13:21)'`
9821
+
9822
+ // simplifies to
9823
+ // `'Object.bar (test/deep-send.test.js:13:21)'`.
9824
+ // The reason is that `file:///` usually precedes an absolute path which is
9825
+ // clickable without removing the `file:///`, whereas `file://` usually precedes
9826
+ // a relative path which, for whatever vscode reason, is not clickable until the
9827
+ // `file://` is removed.
9828
+ const CALLSITE_FILE_2SLASH_PATTERN = /^((?:.*[( ])?)file:\/\/([^/].*)$/;
9829
+
9238
9830
  // The use of these callSite patterns below assumes that any match will bind
9239
9831
  // capture groups containing the parts of the original string we want
9240
9832
  // to keep. The parts outside those capture groups will be dropped from concise
9241
9833
  // stacks.
9242
9834
  // TODO Enable users to configure CALLSITE_PATTERNS via `lockdown` options.
9243
9835
  const CALLSITE_PATTERNS = [
9244
- CALLSITE_ELLIPSES_PATTERN,
9836
+ CALLSITE_ELLIPSIS_PATTERN1,
9837
+ CALLSITE_ELLIPSIS_PATTERN2,
9245
9838
  CALLSITE_PACKAGES_PATTERN,
9839
+ CALLSITE_FILE_2SLASH_PATTERN,
9246
9840
  ];
9247
9841
 
9248
9842
  // For a stack frame that should be included in a concise stack trace, if
@@ -9250,6 +9844,9 @@ const CALLSITE_PATTERNS = [
9250
9844
  // possibly-shorter stringified stack frame that should be shown instead.
9251
9845
  // Exported only so it can be unit tested.
9252
9846
  // TODO Move so that it applies not just to v8.
9847
+ /**
9848
+ * @param {string} callSiteString
9849
+ */
9253
9850
  const shortenCallSiteString = callSiteString => {
9254
9851
  for (const filter of CALLSITE_PATTERNS) {
9255
9852
  const match = regexpExec(filter, callSiteString);
@@ -9276,18 +9873,24 @@ const CALLSITE_PATTERNS = [
9276
9873
 
9277
9874
  const originalCaptureStackTrace = OriginalError.captureStackTrace;
9278
9875
 
9876
+ const omitFrames =
9877
+ stackFiltering === 'concise' || stackFiltering === 'omit-frames';
9878
+
9879
+ const shortenPaths =
9880
+ stackFiltering === 'concise' || stackFiltering === 'shorten-paths';
9881
+
9279
9882
  // const callSiteFilter = _callSite => true;
9280
9883
  const callSiteFilter = callSite => {
9281
- if (stackFiltering === 'verbose') {
9282
- return true;
9884
+ if (omitFrames) {
9885
+ // eslint-disable-next-line @endo/no-polymorphic-call
9886
+ return filterFileName(callSite.getFileName());
9283
9887
  }
9284
- // eslint-disable-next-line @endo/no-polymorphic-call
9285
- return filterFileName(callSite.getFileName());
9888
+ return true;
9286
9889
  };
9287
9890
 
9288
9891
  const callSiteStringifier = callSite => {
9289
9892
  let callSiteString = `${callSite}`;
9290
- if (stackFiltering === 'concise') {
9893
+ if (shortenPaths) {
9291
9894
  callSiteString = shortenCallSiteString(callSiteString);
9292
9895
  }
9293
9896
  return `\n at ${callSiteString}`;
@@ -9444,9 +10047,8 @@ const CALLSITE_PATTERNS = [
9444
10047
  };$h͏_once.tameV8ErrorConstructor(tameV8ErrorConstructor);
9445
10048
  })()
9446
10049
  ,
9447
- // === 40. ses ./src/error/tame-error-constructor.js ===
9448
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_ERROR,TypeError,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,defineProperty,getOwnPropertyDescriptors,NativeErrors,tameV8ErrorConstructor;$h͏_imports([["../commons.js", [["FERAL_ERROR",[$h͏_a => (FERAL_ERROR = $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)]],["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)]]]]]);
9449
-
10050
+ // === 44. ses ./src/error/tame-error-constructor.js ===
10051
+ ({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)]]]]]);
9450
10052
 
9451
10053
 
9452
10054
 
@@ -9483,16 +10085,6 @@ let initialGetStackString = tamedMethods.getStackString;
9483
10085
  errorTaming = 'safe',
9484
10086
  stackFiltering = 'concise',
9485
10087
  ) {
9486
- if (
9487
- errorTaming !== 'safe' &&
9488
- errorTaming !== 'unsafe' &&
9489
- errorTaming !== 'unsafe-debug'
9490
- ) {
9491
- throw TypeError(`unrecognized errorTaming ${errorTaming}`);
9492
- }
9493
- if (stackFiltering !== 'concise' && stackFiltering !== 'verbose') {
9494
- throw TypeError(`unrecognized stackFiltering ${stackFiltering}`);
9495
- }
9496
10088
  const ErrorPrototype = FERAL_ERROR.prototype;
9497
10089
 
9498
10090
  const { captureStackTrace: originalCaptureStackTrace } = FERAL_ERROR;
@@ -9742,8 +10334,8 @@ let initialGetStackString = tamedMethods.getStackString;
9742
10334
  }$h͏_once.default( tameErrorConstructor);
9743
10335
  })()
9744
10336
  ,
9745
- // === 41. ses ./src/module-load.js ===
9746
- ({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,isObject,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)]],["isObject",[$h͏_a => (isObject = $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)]]]]]);
10337
+ // === 45. ses ./src/module-load.js ===
10338
+ ({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)]]]]]);
9747
10339
 
9748
10340
 
9749
10341
 
@@ -9931,7 +10523,7 @@ function* loadWithoutErrorAnnotation(
9931
10523
  )} in parent compartment, use {source} module descriptor`,
9932
10524
  TypeError,
9933
10525
  );
9934
- } else if (isObject(moduleDescriptor)) {
10526
+ } else if (!isPrimitive(moduleDescriptor)) {
9935
10527
  // In this shim (and not in XS, and not in the standard we imagine), we
9936
10528
  // allow a module namespace object to stand in for a module descriptor that
9937
10529
  // describes its original {compartment, specifier} so that it can be used
@@ -9954,7 +10546,7 @@ function* loadWithoutErrorAnnotation(
9954
10546
  namespace: aliasSpecifier,
9955
10547
  } = moduleDescriptor;
9956
10548
  if (
9957
- !isObject(aliasCompartment) ||
10549
+ isPrimitive(aliasCompartment) ||
9958
10550
  !weakmapHas(compartmentPrivateFields, aliasCompartment)
9959
10551
  ) {
9960
10552
  throw makeError(
@@ -9978,7 +10570,7 @@ function* loadWithoutErrorAnnotation(
9978
10570
 
9979
10571
  // All remaining objects must either be a module namespace, or be
9980
10572
  // promoted into a module namespace with a virtual module source.
9981
- if (isObject(moduleDescriptor.namespace)) {
10573
+ if (!isPrimitive(moduleDescriptor.namespace)) {
9982
10574
  const { namespace } = moduleDescriptor;
9983
10575
  // Brand-check SES shim module exports namespaces:
9984
10576
  aliasDescriptor = weakmapGet(moduleAliases, namespace);
@@ -10151,7 +10743,7 @@ function* loadWithoutErrorAnnotation(
10151
10743
  moduleDescriptor.specifier !== undefined
10152
10744
  ) {
10153
10745
  if (
10154
- !isObject(moduleDescriptor.compartment) ||
10746
+ isPrimitive(moduleDescriptor.compartment) ||
10155
10747
  !weakmapHas(compartmentPrivateFields, moduleDescriptor.compartment) ||
10156
10748
  typeof moduleDescriptor.specifier !== 'string'
10157
10749
  ) {
@@ -10252,31 +10844,37 @@ const memoizedLoadWithErrorAnnotation = (
10252
10844
  return moduleLoading;
10253
10845
  };
10254
10846
 
10255
- const asyncJobQueue = () => {
10847
+ /**
10848
+ * If `aggregateErrors` is `false`, the `errors` property of the fulfilled object
10849
+ * will always be empty.
10850
+ * @param {{errors?: Error[], noAggregateErrors?: boolean}} [options]
10851
+ */
10852
+ const asyncJobQueue = ({ errors = [], noAggregateErrors = false } = {}) => {
10256
10853
  /** @type {Set<Promise<undefined>>} */
10257
10854
  const pendingJobs = new Set();
10258
- /** @type {Array<Error>} */
10259
- const errors = [];
10260
10855
 
10261
10856
  /**
10262
10857
  * Enqueues a job that starts immediately but won't be awaited until drainQueue is called.
10263
10858
  *
10264
- * @template {any[]} T
10265
- * @param {(...args: T)=>Promise<*>} func
10266
- * @param {T} args
10859
+ * @template {(...args: any[]) => Promise<void>} F
10860
+ * @param {F} func - An async function to execute
10861
+ * @param {Parameters<F>} args - Arguments to pass to the function
10862
+ * @returns {void}
10267
10863
  */
10268
10864
  const enqueueJob = (func, args) => {
10269
10865
  setAdd(
10270
10866
  pendingJobs,
10271
10867
  promiseThen(func(...args), noop, error => {
10272
- arrayPush(errors, error);
10868
+ if (noAggregateErrors) {
10869
+ throw error;
10870
+ } else {
10871
+ arrayPush(errors, error);
10872
+ }
10273
10873
  }),
10274
10874
  );
10275
10875
  };
10276
10876
  /**
10277
10877
  * Sequentially awaits pending jobs and returns an array of errors
10278
- *
10279
- * @returns {Promise<Array<Error>>}
10280
10878
  */
10281
10879
  const drainQueue = async () => {
10282
10880
  await null;
@@ -10284,9 +10882,51 @@ const asyncJobQueue = () => {
10284
10882
  // eslint-disable-next-line no-await-in-loop
10285
10883
  await job;
10286
10884
  }
10287
- return errors;
10288
10885
  };
10289
- return { enqueueJob, drainQueue };
10886
+ return { enqueueJob, drainQueue, errors };
10887
+ };
10888
+
10889
+ /**
10890
+ * If `aggregateErrors` is `false`, the `errors` property of the returned object
10891
+ * will always be empty.
10892
+ * @param {{errors?: Error[], noAggregateErrors?: boolean}} [options]
10893
+ */
10894
+ const syncJobQueue = ({ errors = [], noAggregateErrors = false } = {}) => {
10895
+ let current = [];
10896
+ let next = [];
10897
+
10898
+ /**
10899
+ * Enqueues a job
10900
+ *
10901
+ * @template {(...args: any[]) => void} F
10902
+ * @param {F} func - An async function to execute
10903
+ * @param {Parameters<F>} args - Arguments to pass to the function
10904
+ * @returns {void}
10905
+ */
10906
+ const enqueueJob = (func, args) => {
10907
+ arrayPush(next, [func, args]);
10908
+ };
10909
+ const drainQueue = () => {
10910
+ // Attention: load bearing flow order. Calling another enqueued function in the
10911
+ // synchronous usecase must happen after the one that enqueued it has finished.
10912
+ // Jobs enqueued in one pass do not interleave with jobs resulting from them.
10913
+ // It's necessary for efficient memoization and to break cycles.
10914
+ for (const [func, args] of current) {
10915
+ try {
10916
+ func(...args);
10917
+ } catch (error) {
10918
+ if (noAggregateErrors) {
10919
+ throw error;
10920
+ } else {
10921
+ arrayPush(errors, error);
10922
+ }
10923
+ }
10924
+ }
10925
+ current = next;
10926
+ next = [];
10927
+ if (current.length > 0) drainQueue();
10928
+ };
10929
+ return { enqueueJob, drainQueue, errors };
10290
10930
  };
10291
10931
 
10292
10932
  /**
@@ -10298,7 +10938,8 @@ const throwAggregateError = ({ errors, errorPrefix }) => {
10298
10938
  // Throw an aggregate error if there were any errors.
10299
10939
  if (errors.length > 0) {
10300
10940
  const verbose =
10301
- getenv('COMPARTMENT_LOAD_ERRORS', '', ['verbose']) === 'verbose';
10941
+ /** @type {'' | 'verbose'} */
10942
+ (getenv('COMPARTMENT_LOAD_ERRORS', '', ['verbose'])) === 'verbose';
10302
10943
  throw TypeError(
10303
10944
  `${errorPrefix} (${errors.length} underlying failures: ${arrayJoin(
10304
10945
  arrayMap(errors, error => error.message + (verbose ? error.stack : '')),
@@ -10311,18 +10952,24 @@ const throwAggregateError = ({ errors, errorPrefix }) => {
10311
10952
  const preferSync = (_asyncImpl, syncImpl) => syncImpl;
10312
10953
  const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10313
10954
 
10314
- /*
10955
+ /**
10315
10956
  * `load` asynchronously gathers the module records for a module and its
10316
10957
  * transitive dependencies.
10317
10958
  * The module records refer to each other by a reference to the dependency's
10318
10959
  * compartment and the specifier of the module within its own compartment.
10319
10960
  * This graph is then ready to be synchronously linked and executed.
10961
+ * @param {WeakMap<Compartment, any>} compartmentPrivateFields
10962
+ * @param {WeakMap<object, object>} moduleAliases
10963
+ * @param {Compartment} compartment
10964
+ * @param {string} moduleSpecifier - The module specifier to load.
10965
+ * @param {{ noAggregateErrors?: boolean}} options
10320
10966
  */
10321
10967
  const load = async (
10322
10968
  compartmentPrivateFields,
10323
10969
  moduleAliases,
10324
10970
  compartment,
10325
10971
  moduleSpecifier,
10972
+ { noAggregateErrors = false } = {},
10326
10973
  ) => {
10327
10974
  const { name: compartmentName } = weakmapGet(
10328
10975
  compartmentPrivateFields,
@@ -10332,7 +10979,9 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10332
10979
  /** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
10333
10980
  const moduleLoads = new Map();
10334
10981
 
10335
- const { enqueueJob, drainQueue } = asyncJobQueue();
10982
+ const { enqueueJob, drainQueue, errors } = asyncJobQueue({
10983
+ noAggregateErrors,
10984
+ });
10336
10985
 
10337
10986
  enqueueJob(memoizedLoadWithErrorAnnotation, [
10338
10987
  compartmentPrivateFields,
@@ -10344,8 +10993,7 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10344
10993
  moduleLoads,
10345
10994
  ]);
10346
10995
 
10347
- // Drain pending jobs queue and throw an aggregate error
10348
- const errors = await drainQueue();
10996
+ await drainQueue();
10349
10997
 
10350
10998
  throwAggregateError({
10351
10999
  errors,
@@ -10355,18 +11003,25 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10355
11003
  });
10356
11004
  };
10357
11005
 
10358
- /*
11006
+ /**
10359
11007
  * `loadNow` synchronously gathers the module records for a specified module
10360
11008
  * and its transitive dependencies.
10361
11009
  * The module records refer to each other by a reference to the dependency's
10362
11010
  * compartment and the specifier of the module within its own compartment.
10363
11011
  * This graph is then ready to be synchronously linked and executed.
11012
+ * @param {WeakMap<Compartment, any>} compartmentPrivateFields
11013
+ * @param {WeakMap<object, object>} moduleAliases
11014
+ * @param {Compartment} compartment
11015
+ * @param {string} moduleSpecifier - The module specifier to load.
11016
+ * @param {{ noAggregateErrors?: boolean}} options
10364
11017
  */$h͏_once.load(load);
11018
+
10365
11019
  const loadNow = (
10366
11020
  compartmentPrivateFields,
10367
11021
  moduleAliases,
10368
11022
  compartment,
10369
11023
  moduleSpecifier,
11024
+ { noAggregateErrors = false } = {},
10370
11025
  ) => {
10371
11026
  const { name: compartmentName } = weakmapGet(
10372
11027
  compartmentPrivateFields,
@@ -10376,16 +11031,9 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10376
11031
  /** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
10377
11032
  const moduleLoads = new Map();
10378
11033
 
10379
- /** @type {Array<Error>} */
10380
- const errors = [];
10381
-
10382
- const enqueueJob = (func, args) => {
10383
- try {
10384
- func(...args);
10385
- } catch (error) {
10386
- arrayPush(errors, error);
10387
- }
10388
- };
11034
+ const { enqueueJob, drainQueue, errors } = syncJobQueue({
11035
+ noAggregateErrors,
11036
+ });
10389
11037
 
10390
11038
  enqueueJob(memoizedLoadWithErrorAnnotation, [
10391
11039
  compartmentPrivateFields,
@@ -10397,6 +11045,8 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10397
11045
  moduleLoads,
10398
11046
  ]);
10399
11047
 
11048
+ drainQueue();
11049
+
10400
11050
  throwAggregateError({
10401
11051
  errors,
10402
11052
  errorPrefix: `Failed to load module ${q(moduleSpecifier)} in package ${q(
@@ -10406,7 +11056,7 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10406
11056
  };$h͏_once.loadNow(loadNow);
10407
11057
  })()
10408
11058
  ,
10409
- // === 42. ses ./src/module-proxy.js ===
11059
+ // === 46. ses ./src/module-proxy.js ===
10410
11060
  ({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)]]]]]);
10411
11061
 
10412
11062
 
@@ -10609,7 +11259,7 @@ const { quote: q } = assert;
10609
11259
  };$h͏_once.getDeferredExports(getDeferredExports);
10610
11260
  })()
10611
11261
  ,
10612
- // === 43. ses ./src/compartment-evaluate.js ===
11262
+ // === 47. ses ./src/compartment-evaluate.js ===
10613
11263
  ({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)]]]]]);
10614
11264
 
10615
11265
 
@@ -10705,7 +11355,7 @@ const { quote: q } = assert;
10705
11355
  };$h͏_once.compartmentEvaluate(compartmentEvaluate);
10706
11356
  })()
10707
11357
  ,
10708
- // === 44. ses ./src/module-instance.js ===
11358
+ // === 48. ses ./src/module-instance.js ===
10709
11359
  ({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)]]]]]);
10710
11360
 
10711
11361
 
@@ -11205,8 +11855,8 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
11205
11855
  };$h͏_once.makeModuleInstance(makeModuleInstance);
11206
11856
  })()
11207
11857
  ,
11208
- // === 45. ses ./src/module-link.js ===
11209
- ({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,isObject,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)]],["isObject",[$h͏_a => (isObject = $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)]]]]]);
11858
+ // === 49. ses ./src/module-link.js ===
11859
+ ({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)]]]]]);
11210
11860
 
11211
11861
 
11212
11862
 
@@ -11267,11 +11917,11 @@ function mayBePrecompiledModuleSource(moduleSource) {
11267
11917
 
11268
11918
  function validatePrecompiledModuleSource(moduleSource, moduleSpecifier) {
11269
11919
  const { __fixedExportMap__, __liveExportMap__ } = moduleSource;
11270
- isObject(__fixedExportMap__) ||
11920
+ !isPrimitive(__fixedExportMap__) ||
11271
11921
  Fail`Property '__fixedExportMap__' of a precompiled module source must be an object, got ${q(
11272
11922
  __fixedExportMap__,
11273
11923
  )}, for module ${q(moduleSpecifier)}`;
11274
- isObject(__liveExportMap__) ||
11924
+ !isPrimitive(__liveExportMap__) ||
11275
11925
  Fail`Property '__liveExportMap__' of a precompiled module source must be an object, got ${q(
11276
11926
  __liveExportMap__,
11277
11927
  )}, for module ${q(moduleSpecifier)}`;
@@ -11290,7 +11940,7 @@ function validateVirtualModuleSource(moduleSource, moduleSpecifier) {
11290
11940
  }
11291
11941
 
11292
11942
  function validateModuleSource(moduleSource, moduleSpecifier) {
11293
- isObject(moduleSource) ||
11943
+ !isPrimitive(moduleSource) ||
11294
11944
  Fail`Invalid module source: must be of type object, got ${q(
11295
11945
  moduleSource,
11296
11946
  )}, for module ${q(moduleSpecifier)}`;
@@ -11367,7 +12017,7 @@ function validateModuleSource(moduleSource, moduleSpecifier) {
11367
12017
  };$h͏_once.instantiate(instantiate);
11368
12018
  })()
11369
12019
  ,
11370
- // === 46. ses ./src/compartment.js ===
12020
+ // === 50. ses ./src/compartment.js ===
11371
12021
  ({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)]]]]]);
11372
12022
 
11373
12023
 
@@ -11436,17 +12086,51 @@ function validateModuleSource(moduleSource, moduleSpecifier) {
11436
12086
 
11437
12087
 
11438
12088
 
11439
- /** @import {ModuleDescriptor, ModuleExportsNamespace} from '../types.js' */
11440
12089
 
11441
- // moduleAliases associates every public module exports namespace with its
11442
- // corresponding compartment and specifier so they can be used to link modules
11443
- // across compartments.
11444
- // The mechanism to thread an alias is to use the compartment.module function
11445
- // to obtain the exports namespace of a foreign module and pass it into another
11446
- // compartment's moduleMap constructor option.
12090
+ /**
12091
+ * @import {ImportHook, ImportMetaHook, ImportNowHook, ModuleDescriptor, ModuleExportsNamespace, ModuleMap, ModuleMapHook, ResolveHook, ModuleSource, CompartmentOptions} from '../types.js'
12092
+ * @import {Transform} from './lockdown.js'
12093
+ * @import {DeferredExports} from './module-proxy.js'
12094
+ */
12095
+
12096
+ /**
12097
+ * Associates every public module exports namespace with its corresponding
12098
+ * compartment and specifier so they can be used to link modules across
12099
+ * compartments. The mechanism to thread an alias is to use the
12100
+ * {@link Compartment.module} function to obtain the exports namespace of a foreign
12101
+ * module and pass it into another compartment's `moduleMap` constructor option
12102
+ * @type {WeakMap<ModuleExportsNamespace, Compartment>}
12103
+ *
12104
+ */
11447
12105
  const moduleAliases = new WeakMap();
11448
12106
 
11449
- // privateFields captures the private state for each compartment.
12107
+ /**
12108
+ * Private fields for `Compartment` instances
12109
+ * @typedef {object} CompartmentFields
12110
+ * @property {string} name
12111
+ * @property {object} globalObject
12112
+ * @property {Array<Transform>} globalTransforms
12113
+ * @property {(source: string, options?: {localTransforms?: Array<Transform>}) => void} safeEvaluate
12114
+ * @property {ResolveHook} resolveHook
12115
+ * @property {ImportHook} importHook
12116
+ * @property {ImportNowHook} importNowHook
12117
+ * @property {ModuleMap} moduleMap
12118
+ * @property {ModuleMapHook} moduleMapHook
12119
+ * @property {ImportMetaHook} importMetaHook
12120
+ * @property {Map<string, ModuleSource>} moduleRecords
12121
+ * @property {Array<Transform>} __shimTransforms__
12122
+ * @property {DeferredExports} deferredExports
12123
+ * @property {Map<string, ModuleDescriptor>} instances
12124
+ * @property {Compartment} [parentCompartment]
12125
+ * @property {boolean} noNamespaceBox
12126
+ * @property {(fullSpecifier: string) => Promise<ModuleExportsNamespace>} compartmentImport
12127
+ * @property {boolean} [noAggregateLoadErrors]
12128
+ */
12129
+
12130
+ /**
12131
+ * Captures the private state for each {@link Compartment}
12132
+ * @type {WeakMap<Compartment, CompartmentFields>}
12133
+ */
11450
12134
  const privateFields = new WeakMap();
11451
12135
 
11452
12136
  const InertCompartment = function Compartment(
@@ -11462,6 +12146,7 @@ const privateFields = new WeakMap();
11462
12146
  /**
11463
12147
  * @param {Compartment} compartment
11464
12148
  * @param {string} specifier
12149
+ * @returns {{namespace: ModuleExportsNamespace}}
11465
12150
  */$h͏_once.InertCompartment(InertCompartment);
11466
12151
  const compartmentImportNow = (compartment, specifier) => {
11467
12152
  const { execute, exportsProxy } = link(
@@ -11474,27 +12159,20 @@ const compartmentImportNow = (compartment, specifier) => {
11474
12159
  return exportsProxy;
11475
12160
  };
11476
12161
 
12162
+ /** @type {Compartment & {constructor: typeof InertCompartment}} */
11477
12163
  const CompartmentPrototype = {
11478
12164
  constructor: InertCompartment,
11479
12165
 
11480
12166
  get globalThis() {
11481
- return weakmapGet(privateFields, this).globalObject;
12167
+ return /** @type {CompartmentFields} */ (weakmapGet(privateFields, this))
12168
+ .globalObject;
11482
12169
  },
11483
12170
 
11484
12171
  get name() {
11485
- return weakmapGet(privateFields, this).name;
12172
+ return /** @type {CompartmentFields} */ (weakmapGet(privateFields, this))
12173
+ .name;
11486
12174
  },
11487
12175
 
11488
- /**
11489
- * @param {string} source is a JavaScript program grammar construction.
11490
- * @param {object} [options]
11491
- * @param {Array<import('./lockdown-shim').Transform>} [options.transforms]
11492
- * @param {boolean} [options.sloppyGlobalsMode]
11493
- * @param {object} [options.__moduleShimLexicals__]
11494
- * @param {boolean} [options.__evadeHtmlCommentTest__]
11495
- * @param {boolean} [options.__evadeImportExpressionTest__]
11496
- * @param {boolean} [options.__rejectSomeDirectEvalExpressions__]
11497
- */
11498
12176
  evaluate(source, options = {}) {
11499
12177
  const compartmentFields = weakmapGet(privateFields, this);
11500
12178
  return compartmentEvaluate(compartmentFields, source, options);
@@ -11516,14 +12194,17 @@ const compartmentImportNow = (compartment, specifier) => {
11516
12194
  },
11517
12195
 
11518
12196
  async import(specifier) {
11519
- const { noNamespaceBox } = weakmapGet(privateFields, this);
12197
+ const { noNamespaceBox, noAggregateLoadErrors } =
12198
+ /** @type {CompartmentFields} */ (weakmapGet(privateFields, this));
11520
12199
 
11521
12200
  if (typeof specifier !== 'string') {
11522
12201
  throw TypeError('first argument of import() must be a string');
11523
12202
  }
11524
12203
 
11525
12204
  return promiseThen(
11526
- load(privateFields, moduleAliases, this, specifier),
12205
+ load(privateFields, moduleAliases, this, specifier, {
12206
+ noAggregateErrors: noAggregateLoadErrors,
12207
+ }),
11527
12208
  () => {
11528
12209
  // The namespace box is a contentious design and likely to be a breaking
11529
12210
  // change in an appropriately numbered future version.
@@ -11546,15 +12227,26 @@ const compartmentImportNow = (compartment, specifier) => {
11546
12227
  throw TypeError('first argument of load() must be a string');
11547
12228
  }
11548
12229
 
11549
- return load(privateFields, moduleAliases, this, specifier);
12230
+ const { noAggregateLoadErrors } = /** @type {CompartmentFields} */ (
12231
+ weakmapGet(privateFields, this)
12232
+ );
12233
+
12234
+ return load(privateFields, moduleAliases, this, specifier, {
12235
+ noAggregateErrors: noAggregateLoadErrors,
12236
+ });
11550
12237
  },
11551
12238
 
11552
12239
  importNow(specifier) {
11553
12240
  if (typeof specifier !== 'string') {
11554
12241
  throw TypeError('first argument of importNow() must be a string');
11555
12242
  }
12243
+ const { noAggregateLoadErrors } = /** @type {CompartmentFields} */ (
12244
+ weakmapGet(privateFields, this)
12245
+ );
11556
12246
 
11557
- loadNow(privateFields, moduleAliases, this, specifier);
12247
+ loadNow(privateFields, moduleAliases, this, specifier, {
12248
+ noAggregateErrors: noAggregateLoadErrors,
12249
+ });
11558
12250
  return compartmentImportNow(/** @type {Compartment} */ (this), specifier);
11559
12251
  },
11560
12252
  };
@@ -11586,15 +12278,35 @@ defineProperties(InertCompartment, {
11586
12278
  * @returns {Compartment['constructor']}
11587
12279
  */
11588
12280
 
11589
- // In order to facilitate migration from the deprecated signature
11590
- // of the compartment constructor,
11591
- // new Compartent(globals?, modules?, options?)
11592
- // to the new signature:
11593
- // new Compartment(options?)
11594
- // where globals and modules are expressed in the options bag instead of
11595
- // positional arguments, this function detects the temporary sigil __options__
11596
- // on the first argument and coerces compartments arguments into a single
11597
- // compartments object.
12281
+ /**
12282
+ * "Options bag"-style `Compartment` constructor arguments.
12283
+ * @typedef {[options?: CompartmentOptions & { __options__: true }]} CompartmentOptionsArgs
12284
+ */
12285
+
12286
+ /**
12287
+ * Legacy `Compartment` constructor arguments.
12288
+ *
12289
+ * @deprecated
12290
+ * @typedef {[globals?: Map<string, any>, modules?: Map<string, ModuleDescriptor>, options?: CompartmentOptions]} LegacyCompartmentOptionsArgs
12291
+ */
12292
+
12293
+ /**
12294
+ * In order to facilitate migration from the deprecated signature of the
12295
+ * compartment constructor,
12296
+ *
12297
+ * `new Compartent(globals?, modules?, options?)`
12298
+ *
12299
+ * to the new signature:
12300
+ *
12301
+ * `new Compartment(options?)`
12302
+ *
12303
+ * ...where globals and modules are expressed in the options bag instead of
12304
+ * positional arguments, this function detects the temporary sigil __options__
12305
+ * on the first argument and coerces compartments arguments into a single
12306
+ * compartments object.
12307
+ * @param {CompartmentOptionsArgs|LegacyCompartmentOptionsArgs} args
12308
+ * @returns {CompartmentOptions}
12309
+ */
11598
12310
  const compartmentOptions = (...args) => {
11599
12311
  if (args.length === 0) {
11600
12312
  return {};
@@ -11616,7 +12328,7 @@ defineProperties(InertCompartment, {
11616
12328
  globals = /** @type {Map<string, any>} */ ({}),
11617
12329
  modules = /** @type {Map<string, ModuleDescriptor>} */ ({}),
11618
12330
  options = {},
11619
- ] = args;
12331
+ ] = /** @type {LegacyCompartmentOptionsArgs} */ (args);
11620
12332
  assertEqual(
11621
12333
  options.modules,
11622
12334
  undefined,
@@ -11642,6 +12354,10 @@ defineProperties(InertCompartment, {
11642
12354
  markVirtualizedNativeFunction,
11643
12355
  { parentCompartment = undefined, enforceNew = false } = {},
11644
12356
  ) => {
12357
+ /**
12358
+ *
12359
+ * @param {CompartmentOptionsArgs|LegacyCompartmentOptionsArgs} args
12360
+ */
11645
12361
  function Compartment(...args) {
11646
12362
  if (enforceNew && new.target === undefined) {
11647
12363
  throw TypeError(
@@ -11662,6 +12378,7 @@ defineProperties(InertCompartment, {
11662
12378
  moduleMapHook,
11663
12379
  importMetaHook,
11664
12380
  __noNamespaceBox__: noNamespaceBox = false,
12381
+ noAggregateLoadErrors = false,
11665
12382
  } = compartmentOptions(...args);
11666
12383
  const globalTransforms = arrayFlatMap(
11667
12384
  [transforms, __shimTransforms__],
@@ -11739,7 +12456,9 @@ defineProperties(InertCompartment, {
11739
12456
  `Compartment does not support dynamic import: no configured resolveHook for compartment ${q(name)}`,
11740
12457
  );
11741
12458
  }
11742
- await load(privateFields, moduleAliases, compartment, fullSpecifier);
12459
+ await load(privateFields, moduleAliases, compartment, fullSpecifier, {
12460
+ noAggregateErrors: noAggregateLoadErrors,
12461
+ });
11743
12462
  const { execute, exportsProxy } = link(
11744
12463
  privateFields,
11745
12464
  moduleAliases,
@@ -11768,6 +12487,7 @@ defineProperties(InertCompartment, {
11768
12487
  parentCompartment,
11769
12488
  noNamespaceBox,
11770
12489
  compartmentImport,
12490
+ noAggregateLoadErrors,
11771
12491
  });
11772
12492
  }
11773
12493
 
@@ -11777,8 +12497,9 @@ defineProperties(InertCompartment, {
11777
12497
  };$h͏_once.makeCompartmentConstructor(makeCompartmentConstructor);
11778
12498
  })()
11779
12499
  ,
11780
- // === 47. ses ./src/get-anonymous-intrinsics.js ===
11781
- ({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,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)]]]],["./compartment.js", [["InertCompartment",[$h͏_a => (InertCompartment = $h͏_a)]]]]]);
12500
+ // === 51. ses ./src/get-anonymous-intrinsics.js ===
12501
+ ({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)]]]]]);
12502
+
11782
12503
 
11783
12504
 
11784
12505
 
@@ -11946,22 +12667,28 @@ function makeArguments() {
11946
12667
  );
11947
12668
  }
11948
12669
 
12670
+ const ab = new ArrayBuffer(0);
12671
+ // @ts-expect-error TODO How do I add sliceToImmutable to ArrayBuffer type?
12672
+ // eslint-disable-next-line @endo/no-polymorphic-call
12673
+ const iab = ab.sliceToImmutable();
12674
+ const iabProto = getPrototypeOf(iab);
12675
+ if (iabProto !== ArrayBuffer.prototype) {
12676
+ // In a native implementation, these will be the same prototype
12677
+ intrinsics['%ImmutableArrayBufferPrototype%'] = iabProto;
12678
+ }
12679
+
11949
12680
  return intrinsics;
11950
12681
  };$h͏_once.getAnonymousIntrinsics(getAnonymousIntrinsics);
11951
12682
  })()
11952
12683
  ,
11953
- // === 48. ses ./src/tame-harden.js ===
11954
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,freeze;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]]]);
12684
+ // === 52. ses ./src/tame-harden.js ===
12685
+ ({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)]]]]]);
11955
12686
 
11956
12687
 
11957
12688
  /** @import {Harden} from '../types.js'; */
11958
12689
 
11959
12690
  /** @type {(safeHarden: Harden, hardenTaming: 'safe' | 'unsafe') => Harden} */
11960
12691
  const tameHarden = (safeHarden, hardenTaming) => {
11961
- if (hardenTaming !== 'safe' && hardenTaming !== 'unsafe') {
11962
- throw TypeError(`unrecognized fakeHardenOption ${hardenTaming}`);
11963
- }
11964
-
11965
12692
  if (hardenTaming === 'safe') {
11966
12693
  return safeHarden;
11967
12694
  }
@@ -11986,7 +12713,7 @@ function makeArguments() {
11986
12713
  freeze(tameHarden);
11987
12714
  })()
11988
12715
  ,
11989
- // === 49. ses ./src/tame-symbol-constructor.js ===
12716
+ // === 53. ses ./src/tame-symbol-constructor.js ===
11990
12717
  ({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)]]]]]);
11991
12718
 
11992
12719
 
@@ -12053,7 +12780,7 @@ freeze(tameHarden);
12053
12780
  };$h͏_once.tameSymbolConstructor(tameSymbolConstructor);
12054
12781
  })()
12055
12782
  ,
12056
- // === 50. ses ./src/tame-faux-data-properties.js ===
12783
+ // === 54. ses ./src/tame-faux-data-properties.js ===
12057
12784
  ({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)]]]]]);
12058
12785
 
12059
12786
 
@@ -12266,8 +12993,8 @@ const throws = thunk => {
12266
12993
  };$h͏_once.tameFauxDataProperties(tameFauxDataProperties);
12267
12994
  })()
12268
12995
  ,
12269
- // === 51. ses ./src/tame-regenerator-runtime.js ===
12270
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let defineProperty,iteratorPrototype,iteratorSymbol,objectHasOwnProperty;$h͏_imports([["./commons.js", [["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["iteratorPrototype",[$h͏_a => (iteratorPrototype = $h͏_a)]],["iteratorSymbol",[$h͏_a => (iteratorSymbol = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]]]]]);
12996
+ // === 55. ses ./src/tame-regenerator-runtime.js ===
12997
+ ({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)]]]]]);
12271
12998
 
12272
12999
 
12273
13000
 
@@ -12284,7 +13011,7 @@ const throws = thunk => {
12284
13011
  set(value) {
12285
13012
  // ignore the assignment on IteratorPrototype
12286
13013
  if (this === iteratorPrototype) return;
12287
- if (objectHasOwnProperty(this, iteratorSymbol)) {
13014
+ if (hasOwn(this, iteratorSymbol)) {
12288
13015
  this[iteratorSymbol] = value;
12289
13016
  }
12290
13017
  defineProperty(this, iteratorSymbol, {
@@ -12298,7 +13025,7 @@ const throws = thunk => {
12298
13025
  };$h͏_once.tameRegeneratorRuntime(tameRegeneratorRuntime);
12299
13026
  })()
12300
13027
  ,
12301
- // === 52. ses ./src/shim-arraybuffer-transfer.js ===
13028
+ // === 56. ses ./src/shim-arraybuffer-transfer.js ===
12302
13029
  ({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)]]]]]);
12303
13030
 
12304
13031
 
@@ -12312,7 +13039,6 @@ const throws = thunk => {
12312
13039
 
12313
13040
 
12314
13041
  const shimArrayBufferTransfer = () => {
12315
- // @ts-expect-error TODO extend ArrayBuffer type to include transfer, etc.
12316
13042
  if (typeof arrayBufferPrototype.transfer === 'function') {
12317
13043
  // Assume already exists so does not need to be shimmed.
12318
13044
  // Such conditional shimming is ok in this case since ArrayBuffer.p.transfer
@@ -12387,8 +13113,8 @@ const throws = thunk => {
12387
13113
  };$h͏_once.shimArrayBufferTransfer(shimArrayBufferTransfer);
12388
13114
  })()
12389
13115
  ,
12390
- // === 53. ses ./src/reporting.js ===
12391
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,functionBind,globalThis,assert;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["functionBind",[$h͏_a => (functionBind = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
13116
+ // === 57. ses ./src/reporting.js ===
13117
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let functionBind,globalThis,assert;$h͏_imports([["./commons.js", [["functionBind",[$h͏_a => (functionBind = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
12392
13118
 
12393
13119
 
12394
13120
  /**
@@ -12441,9 +13167,6 @@ const mute = () => {};
12441
13167
  if (reporting === 'none') {
12442
13168
  return makeReportPrinter(mute);
12443
13169
  }
12444
- if (reporting !== 'platform' && reporting !== 'console') {
12445
- throw new TypeError(`Invalid lockdown reporting option: ${reporting}`);
12446
- }
12447
13170
  if (
12448
13171
  reporting === 'console' ||
12449
13172
  globalThis.window === globalThis ||
@@ -12498,8 +13221,9 @@ const mute = () => {};
12498
13221
  };$h͏_once.reportInGroup(reportInGroup);
12499
13222
  })()
12500
13223
  ,
12501
- // === 54. ses ./src/lockdown.js ===
12502
- ({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)]]]],["./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)]],["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)]]]]]);
13224
+ // === 58. ses ./src/lockdown.js ===
13225
+ ({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.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)]],["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)]]]]]);
13226
+
12503
13227
 
12504
13228
 
12505
13229
 
@@ -12601,10 +13325,32 @@ const safeHarden = makeHardener();
12601
13325
  // only ever need to be called once and that simplifying lockdown will improve
12602
13326
  // the quality of audits.
12603
13327
 
12604
- const assertDirectEvalAvailable = () => {
12605
- let allowed = false;
13328
+ const probeHostEvaluators = () => {
13329
+ let functionAllowed;
12606
13330
  try {
12607
- allowed = FERAL_FUNCTION(
13331
+ functionAllowed = FERAL_FUNCTION('return true')();
13332
+ } catch (_error) {
13333
+ // We reach here if the Function() constructor is outright forbidden by a
13334
+ // strict Content Security Policy (containing either a `default-src` or a
13335
+ // `script-src` directive), not been implemented in the host, or the host
13336
+ // is configured to throw an exception instead of `new Function`.
13337
+ functionAllowed = false;
13338
+ }
13339
+
13340
+ let evalAllowed;
13341
+ try {
13342
+ evalAllowed = FERAL_EVAL('true');
13343
+ } catch (_error) {
13344
+ // We reach here if `eval` is outright forbidden by a strict Content Security Policy,
13345
+ // not implemented in the host, or the host is configured to throw an exception.
13346
+ // We allow this for SES usage that delegates the responsibility to isolate
13347
+ // guest code to production code generation.
13348
+ evalAllowed = false;
13349
+ }
13350
+
13351
+ let directEvalAllowed;
13352
+ if (functionAllowed && evalAllowed) {
13353
+ directEvalAllowed = FERAL_FUNCTION(
12608
13354
  'eval',
12609
13355
  'SES_changed',
12610
13356
  `\
@@ -12616,21 +13362,12 @@ const assertDirectEvalAvailable = () => {
12616
13362
  // and indirect, which generally creates a new global.
12617
13363
  // We are going to throw an exception for failing to initialize SES, but
12618
13364
  // good neighbors clean up.
12619
- if (!allowed) {
13365
+ if (!directEvalAllowed) {
12620
13366
  delete globalThis.SES_changed;
12621
13367
  }
12622
- } catch (_error) {
12623
- // We reach here if eval is outright forbidden by a Content Security Policy.
12624
- // We allow this for SES usage that delegates the responsibility to isolate
12625
- // guest code to production code generation.
12626
- allowed = true;
12627
- }
12628
- if (!allowed) {
12629
- // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_DIRECT_EVAL.md
12630
- throw TypeError(
12631
- `SES cannot initialize unless 'eval' is the original intrinsic 'eval', suitable for direct-eval (dynamically scoped eval) (SES_DIRECT_EVAL)`,
12632
- );
12633
13368
  }
13369
+
13370
+ return { functionAllowed, evalAllowed, directEvalAllowed };
12634
13371
  };
12635
13372
 
12636
13373
  /**
@@ -12653,65 +13390,85 @@ const assertDirectEvalAvailable = () => {
12653
13390
  // The `stackFiltering` is not a safety issue. Rather it is a tradeoff
12654
13391
  // between relevance and completeness of the stack frames shown on the
12655
13392
  // console. Setting`stackFiltering` to `'verbose'` applies no filters, providing
12656
- // the raw stack frames that can be quite versbose. Setting
13393
+ // the raw stack frames that can be quite verbose. Setting
12657
13394
  // `stackFrameFiltering` to`'concise'` limits the display to the stack frame
12658
13395
  // information most likely to be relevant, eliminating distracting frames
12659
13396
  // such as those from the infrastructure. However, the bug you're trying to
12660
- // track down might be in the infrastrure, in which case the `'verbose'` setting
13397
+ // track down might be in the infrastructure, in which case the `'verbose'` setting
12661
13398
  // is useful. See
12662
13399
  // [`stackFiltering` options](https://github.com/Agoric/SES-shim/blob/master/packages/ses/docs/lockdown.md#stackfiltering-options)
12663
13400
  // for an explanation.
12664
13401
 
12665
13402
  const {
12666
- errorTaming = getenv('LOCKDOWN_ERROR_TAMING', 'safe'),
12667
- errorTrapping = /** @type {"platform" | "none" | "report" | "abort" | "exit"} */ (
12668
- getenv('LOCKDOWN_ERROR_TRAPPING', 'platform')
13403
+ errorTaming = /** @type {'safe' | 'unsafe' | 'unsafe-debug'} */ (
13404
+ getenv('LOCKDOWN_ERROR_TAMING', 'safe', ['unsafe', 'unsafe-debug'])
12669
13405
  ),
12670
- reporting = /** @type {"platform" | "console" | "none"} */ (
12671
- getenv('LOCKDOWN_REPORTING', 'platform')
13406
+ errorTrapping = /** @type {'platform' | 'none' | 'report' | 'abort' | 'exit'} */ (
13407
+ getenv('LOCKDOWN_ERROR_TRAPPING', 'platform', [
13408
+ 'none',
13409
+ 'report',
13410
+ 'abort',
13411
+ 'exit',
13412
+ ])
12672
13413
  ),
12673
- unhandledRejectionTrapping = /** @type {"none" | "report"} */ (
12674
- getenv('LOCKDOWN_UNHANDLED_REJECTION_TRAPPING', 'report')
13414
+ reporting = /** @type {'platform' | 'console' | 'none'} */ (
13415
+ getenv('LOCKDOWN_REPORTING', 'platform', ['console', 'none'])
13416
+ ),
13417
+ unhandledRejectionTrapping = /** @type {'none' | 'report'} */ (
13418
+ getenv('LOCKDOWN_UNHANDLED_REJECTION_TRAPPING', 'report', ['none'])
13419
+ ),
13420
+ regExpTaming = /** @type {'safe' | 'unsafe'} */ (
13421
+ getenv('LOCKDOWN_REGEXP_TAMING', 'safe', ['unsafe'])
13422
+ ),
13423
+ localeTaming = /** @type {'safe' | 'unsafe'} */ (
13424
+ getenv('LOCKDOWN_LOCALE_TAMING', 'safe', ['unsafe'])
12675
13425
  ),
12676
- regExpTaming = getenv('LOCKDOWN_REGEXP_TAMING', 'safe'),
12677
- localeTaming = getenv('LOCKDOWN_LOCALE_TAMING', 'safe'),
12678
-
12679
13426
  consoleTaming = /** @type {'unsafe' | 'safe'} */ (
12680
- getenv('LOCKDOWN_CONSOLE_TAMING', 'safe')
13427
+ getenv('LOCKDOWN_CONSOLE_TAMING', 'safe', ['unsafe'])
12681
13428
  ),
12682
13429
  overrideTaming = /** @type {'moderate' | 'min' | 'severe'} */ (
12683
- getenv('LOCKDOWN_OVERRIDE_TAMING', 'moderate')
13430
+ getenv('LOCKDOWN_OVERRIDE_TAMING', 'moderate', ['min', 'severe'])
13431
+ ),
13432
+ stackFiltering = /** @type {'concise' | 'omit-frames' | 'shorten-paths' | 'verbose'} */ (
13433
+ getenv('LOCKDOWN_STACK_FILTERING', 'concise', [
13434
+ 'omit-frames',
13435
+ 'shorten-paths',
13436
+ 'verbose',
13437
+ ])
13438
+ ),
13439
+ domainTaming = /** @type {'safe' | 'unsafe'} */ (
13440
+ getenv('LOCKDOWN_DOMAIN_TAMING', 'safe', ['unsafe'])
13441
+ ),
13442
+ evalTaming = /** @type {'safe-eval' | 'unsafe-eval' | 'no-eval'} */ (
13443
+ getenv('LOCKDOWN_EVAL_TAMING', 'safe-eval', [
13444
+ 'unsafe-eval',
13445
+ 'no-eval',
13446
+ // deprecated
13447
+ 'safeEval',
13448
+ 'unsafeEval',
13449
+ 'noEval',
13450
+ ])
12684
13451
  ),
12685
- stackFiltering = getenv('LOCKDOWN_STACK_FILTERING', 'concise'),
12686
- domainTaming = getenv('LOCKDOWN_DOMAIN_TAMING', 'safe'),
12687
- evalTaming = getenv('LOCKDOWN_EVAL_TAMING', 'safe-eval'),
12688
- overrideDebug = arrayFilter(
12689
- stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','),
12690
- /** @param {string} debugName */
12691
- debugName => debugName !== '',
13452
+ overrideDebug = /** @type {string[]} */ (
13453
+ arrayFilter(
13454
+ stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','),
13455
+ /** @param {string} debugName */
13456
+ debugName => debugName !== '',
13457
+ )
12692
13458
  ),
12693
- legacyRegeneratorRuntimeTaming = getenv(
12694
- 'LOCKDOWN_LEGACY_REGENERATOR_RUNTIME_TAMING',
12695
- 'safe',
13459
+ legacyRegeneratorRuntimeTaming = /** @type {'safe' | 'unsafe-ignore'} */ (
13460
+ getenv('LOCKDOWN_LEGACY_REGENERATOR_RUNTIME_TAMING', 'safe', [
13461
+ 'unsafe-ignore',
13462
+ ])
13463
+ ),
13464
+ __hardenTaming__ = /** @type {'safe' | 'unsafe'} */ (
13465
+ getenv('LOCKDOWN_HARDEN_TAMING', 'safe', ['unsafe'])
12696
13466
  ),
12697
- __hardenTaming__ = getenv('LOCKDOWN_HARDEN_TAMING', 'safe'),
12698
13467
  dateTaming, // deprecated
12699
13468
  mathTaming, // deprecated
12700
13469
  ...extraOptions
12701
13470
  } = options;
12702
13471
 
12703
- legacyRegeneratorRuntimeTaming === 'safe' ||
12704
- legacyRegeneratorRuntimeTaming === 'unsafe-ignore' ||
12705
- Fail`lockdown(): non supported option legacyRegeneratorRuntimeTaming: ${q(legacyRegeneratorRuntimeTaming)}`;
12706
-
12707
- evalTaming === 'unsafe-eval' ||
12708
- evalTaming === 'unsafeEval' || // deprecated
12709
- evalTaming === 'safe-eval' ||
12710
- evalTaming === 'safeEval' || // deprecated
12711
- evalTaming === 'no-eval' ||
12712
- evalTaming === 'noEval' || // deprecated
12713
- Fail`lockdown(): non supported option evalTaming: ${q(evalTaming)}`;
12714
-
12715
13472
  // Assert that only supported options were passed.
12716
13473
  // Use Reflect.ownKeys to reject symbol-named properties as well.
12717
13474
  const extraOptionsNames = ownKeys(extraOptions);
@@ -12722,13 +13479,11 @@ const assertDirectEvalAvailable = () => {
12722
13479
  const { warn } = reporter;
12723
13480
 
12724
13481
  if (dateTaming !== undefined) {
12725
- // eslint-disable-next-line no-console
12726
13482
  warn(
12727
13483
  `SES The 'dateTaming' option is deprecated and does nothing. In the future specifying it will be an error.`,
12728
13484
  );
12729
13485
  }
12730
13486
  if (mathTaming !== undefined) {
12731
- // eslint-disable-next-line no-console
12732
13487
  warn(
12733
13488
  `SES The 'mathTaming' option is deprecated and does nothing. In the future specifying it will be an error.`,
12734
13489
  );
@@ -12746,7 +13501,19 @@ const assertDirectEvalAvailable = () => {
12746
13501
  // trace retained:
12747
13502
  priorRepairIntrinsics.stack;
12748
13503
 
12749
- assertDirectEvalAvailable();
13504
+ const { functionAllowed, evalAllowed, directEvalAllowed } =
13505
+ probeHostEvaluators();
13506
+
13507
+ if (
13508
+ directEvalAllowed === false &&
13509
+ evalTaming === 'safe-eval' &&
13510
+ (functionAllowed || evalAllowed)
13511
+ ) {
13512
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_DIRECT_EVAL.md
13513
+ throw TypeError(
13514
+ "SES cannot initialize unless 'eval' is the original intrinsic 'eval', suitable for direct eval (dynamically scoped eval) (SES_DIRECT_EVAL)",
13515
+ );
13516
+ }
12750
13517
 
12751
13518
  /**
12752
13519
  * Because of packagers and bundlers, etc, multiple invocations of lockdown
@@ -12801,7 +13568,6 @@ const assertDirectEvalAvailable = () => {
12801
13568
  const { addIntrinsics, completePrototypes, finalIntrinsics } =
12802
13569
  makeIntrinsicsCollector(reporter);
12803
13570
 
12804
- // @ts-expect-error __hardenTaming__ could be any string
12805
13571
  const tamedHarden = tameHarden(safeHarden, __hardenTaming__);
12806
13572
  addIntrinsics({ harden: tamedHarden });
12807
13573
 
@@ -13016,7 +13782,7 @@ const assertDirectEvalAvailable = () => {
13016
13782
  };$h͏_once.repairIntrinsics(repairIntrinsics);
13017
13783
  })()
13018
13784
  ,
13019
- // === 55. ses ./src/lockdown-shim.js ===
13785
+ // === 59. ses ./src/lockdown-shim.js ===
13020
13786
  ({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)]]]]]);
13021
13787
 
13022
13788
 
@@ -13056,7 +13822,7 @@ globalThis.repairIntrinsics = options => {
13056
13822
  };
13057
13823
  })()
13058
13824
  ,
13059
- // === 56. ses ./src/compartment-shim.js ===
13825
+ // === 60. ses ./src/compartment-shim.js ===
13060
13826
  ({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)]]]]]);
13061
13827
 
13062
13828
 
@@ -13081,14 +13847,14 @@ globalThis.Compartment = makeCompartmentConstructor(
13081
13847
  );
13082
13848
  })()
13083
13849
  ,
13084
- // === 57. ses ./src/assert-shim.js ===
13850
+ // === 61. ses ./src/assert-shim.js ===
13085
13851
  ({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)]]]]]);
13086
13852
 
13087
13853
 
13088
13854
  globalThis.assert = assert;
13089
13855
  })()
13090
13856
  ,
13091
- // === 58. ses ./src/console-shim.js ===
13857
+ // === 62. ses ./src/console-shim.js ===
13092
13858
  ({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)]]]]]);
13093
13859
 
13094
13860
 
@@ -13141,7 +13907,7 @@ globalThis[MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA] =
13141
13907
  makeCausalConsoleFromLoggerForSesAva;
13142
13908
  })()
13143
13909
  ,
13144
- // === 59. ses ./index.js ===
13910
+ // === 63. ses ./index.js ===
13145
13911
  ({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", []]]);
13146
13912
  })()
13147
13913
  ,
@@ -13150,3 +13916,12 @@ globalThis[MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA] =
13150
13916
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13151
13917
 
13152
13918
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
13919
+
13920
+ /**
13921
+ * @license
13922
+ * Lodash <https://lodash.com/>
13923
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
13924
+ * Released under MIT license <https://lodash.com/license>
13925
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
13926
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
13927
+ */