ses 1.12.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lockdown.cjs CHANGED
@@ -1,4 +1,4 @@
1
- // ses@1.12.0
1
+ // ses@1.13.1
2
2
  (functors => options => {
3
3
  'use strict';
4
4
 
@@ -206,6 +206,13 @@
206
206
  },
207
207
  {
208
208
  },
209
+ {
210
+ transferBufferToImmutable: cell("transferBufferToImmutable"),
211
+ isBufferImmutable: cell("isBufferImmutable"),
212
+ sliceBufferToImmutable: cell("sliceBufferToImmutable"),
213
+ },
214
+ {
215
+ },
209
216
  {
210
217
  an: cell("an"),
211
218
  bestEffortStringify: cell("bestEffortStringify"),
@@ -651,20 +658,20 @@ function observeImports(map, importName, importIndex) {
651
658
  functors[4]({
652
659
  imports(entries) {
653
660
  const map = new Map(entries);
654
- observeImports(map, "../commons.js", 0);
655
661
  },
656
662
  liveVar: {
657
663
  },
658
664
  onceVar: {
659
- an: cells[4].an.set,
660
- bestEffortStringify: cells[4].bestEffortStringify.set,
661
- enJoin: cells[4].enJoin.set,
665
+ transferBufferToImmutable: cells[4].transferBufferToImmutable.set,
666
+ isBufferImmutable: cells[4].isBufferImmutable.set,
667
+ sliceBufferToImmutable: cells[4].sliceBufferToImmutable.set,
662
668
  },
663
669
  importMeta: {},
664
670
  });
665
671
  functors[5]({
666
672
  imports(entries) {
667
673
  const map = new Map(entries);
674
+ observeImports(map, "./index.js", 4);
668
675
  },
669
676
  liveVar: {
670
677
  },
@@ -675,10 +682,14 @@ function observeImports(map, importName, importIndex) {
675
682
  functors[6]({
676
683
  imports(entries) {
677
684
  const map = new Map(entries);
685
+ observeImports(map, "../commons.js", 0);
678
686
  },
679
687
  liveVar: {
680
688
  },
681
689
  onceVar: {
690
+ an: cells[6].an.set,
691
+ bestEffortStringify: cells[6].bestEffortStringify.set,
692
+ enJoin: cells[6].enJoin.set,
682
693
  },
683
694
  importMeta: {},
684
695
  });
@@ -689,71 +700,65 @@ function observeImports(map, importName, importIndex) {
689
700
  liveVar: {
690
701
  },
691
702
  onceVar: {
692
- makeLRUCacheMap: cells[7].makeLRUCacheMap.set,
693
703
  },
694
704
  importMeta: {},
695
705
  });
696
706
  functors[8]({
697
707
  imports(entries) {
698
708
  const map = new Map(entries);
699
- observeImports(map, "../make-lru-cachemap.js", 7);
700
709
  },
701
710
  liveVar: {
702
711
  },
703
712
  onceVar: {
704
- makeNoteLogArgsArrayKit: cells[8].makeNoteLogArgsArrayKit.set,
705
713
  },
706
714
  importMeta: {},
707
715
  });
708
716
  functors[9]({
709
717
  imports(entries) {
710
718
  const map = new Map(entries);
711
- observeImports(map, "../commons.js", 0);
712
- observeImports(map, "./stringify-utils.js", 4);
713
- observeImports(map, "./types.js", 5);
714
- observeImports(map, "./internal-types.js", 6);
715
- observeImports(map, "./note-log-args.js", 8);
716
719
  },
717
720
  liveVar: {
718
721
  },
719
722
  onceVar: {
720
- quote: cells[9].q.set,
721
- bare: cells[9].b.set,
722
- redactedDetails: cells[9].X.set,
723
- unredactedDetails: cells[9].unredactedDetails.set,
724
- makeError: cells[9].makeError.set,
725
- note: cells[9].annotateError.set,
726
- loggedErrorHandler: cells[9].loggedErrorHandler.set,
727
- makeAssert: cells[9].makeAssert.set,
728
- assert: cells[9].assert.set,
729
- assertEqual: cells[9].assertEqual.set,
730
- sanitizeError: cells[9].sanitizeError.set,
723
+ makeLRUCacheMap: cells[9].makeLRUCacheMap.set,
731
724
  },
732
725
  importMeta: {},
733
726
  });
734
727
  functors[10]({
735
728
  imports(entries) {
736
729
  const map = new Map(entries);
737
- observeImports(map, "./commons.js", 0);
738
- observeImports(map, "./error/assert.js", 9);
730
+ observeImports(map, "../make-lru-cachemap.js", 9);
739
731
  },
740
732
  liveVar: {
741
733
  },
742
734
  onceVar: {
743
- isTypedArray: cells[10].isTypedArray.set,
744
- makeHardener: cells[10].makeHardener.set,
735
+ makeNoteLogArgsArrayKit: cells[10].makeNoteLogArgsArrayKit.set,
745
736
  },
746
737
  importMeta: {},
747
738
  });
748
739
  functors[11]({
749
740
  imports(entries) {
750
741
  const map = new Map(entries);
751
- observeImports(map, "./commons.js", 0);
742
+ observeImports(map, "../commons.js", 0);
743
+ observeImports(map, "./stringify-utils.js", 6);
744
+ observeImports(map, "./types.js", 7);
745
+ observeImports(map, "./internal-types.js", 8);
746
+ observeImports(map, "./note-log-args.js", 10);
752
747
  },
753
748
  liveVar: {
754
749
  },
755
750
  onceVar: {
756
- cauterizeProperty: cells[11].cauterizeProperty.set,
751
+ quote: cells[11].q.set,
752
+ bare: cells[11].b.set,
753
+ redactedDetails: cells[11].X.set,
754
+ unredactedDetails: cells[11].unredactedDetails.set,
755
+ makeError: cells[11].makeError.set,
756
+ note: cells[11].annotateError.set,
757
+ loggedErrorHandler: cells[11].loggedErrorHandler.set,
758
+ makeAssert: cells[11].makeAssert.set,
759
+ assert: cells[11].assert.set,
760
+ assertEqual: cells[11].assertEqual.set,
761
+ sanitizeError: cells[11].sanitizeError.set,
757
762
  },
758
763
  importMeta: {},
759
764
  });
@@ -761,68 +766,70 @@ function observeImports(map, importName, importIndex) {
761
766
  imports(entries) {
762
767
  const map = new Map(entries);
763
768
  observeImports(map, "./commons.js", 0);
769
+ observeImports(map, "./error/assert.js", 11);
764
770
  },
765
771
  liveVar: {
766
772
  },
767
773
  onceVar: {
768
- NativeErrors: cells[12].NativeErrors.set,
769
- constantProperties: cells[12].constantProperties.set,
770
- universalPropertyNames: cells[12].universalPropertyNames.set,
771
- initialGlobalPropertyNames: cells[12].initialGlobalPropertyNames.set,
772
- sharedGlobalPropertyNames: cells[12].sharedGlobalPropertyNames.set,
773
- uniqueGlobalPropertyNames: cells[12].uniqueGlobalPropertyNames.set,
774
- FunctionInstance: cells[12].FunctionInstance.set,
775
- AsyncFunctionInstance: cells[12].AsyncFunctionInstance.set,
776
- isAccessorPermit: cells[12].isAccessorPermit.set,
777
- permitted: cells[12].permitted.set,
774
+ isTypedArray: cells[12].isTypedArray.set,
775
+ makeHardener: cells[12].makeHardener.set,
778
776
  },
779
777
  importMeta: {},
780
778
  });
781
779
  functors[13]({
782
780
  imports(entries) {
783
781
  const map = new Map(entries);
784
- observeImports(map, "./cauterize-property.js", 11);
785
782
  observeImports(map, "./commons.js", 0);
786
- observeImports(map, "./permits.js", 12);
787
783
  },
788
784
  liveVar: {
789
785
  },
790
786
  onceVar: {
791
- makeIntrinsicsCollector: cells[13].makeIntrinsicsCollector.set,
792
- getGlobalIntrinsics: cells[13].getGlobalIntrinsics.set,
787
+ cauterizeProperty: cells[13].cauterizeProperty.set,
793
788
  },
794
789
  importMeta: {},
795
790
  });
796
791
  functors[14]({
797
792
  imports(entries) {
798
793
  const map = new Map(entries);
799
- observeImports(map, "./permits.js", 12);
800
794
  observeImports(map, "./commons.js", 0);
801
- observeImports(map, "./cauterize-property.js", 11);
802
795
  },
803
796
  liveVar: {
804
797
  },
805
798
  onceVar: {
806
- default: cells[14].default.set,
799
+ NativeErrors: cells[14].NativeErrors.set,
800
+ constantProperties: cells[14].constantProperties.set,
801
+ universalPropertyNames: cells[14].universalPropertyNames.set,
802
+ initialGlobalPropertyNames: cells[14].initialGlobalPropertyNames.set,
803
+ sharedGlobalPropertyNames: cells[14].sharedGlobalPropertyNames.set,
804
+ uniqueGlobalPropertyNames: cells[14].uniqueGlobalPropertyNames.set,
805
+ FunctionInstance: cells[14].FunctionInstance.set,
806
+ AsyncFunctionInstance: cells[14].AsyncFunctionInstance.set,
807
+ isAccessorPermit: cells[14].isAccessorPermit.set,
808
+ permitted: cells[14].permitted.set,
807
809
  },
808
810
  importMeta: {},
809
811
  });
810
812
  functors[15]({
811
813
  imports(entries) {
812
814
  const map = new Map(entries);
815
+ observeImports(map, "./cauterize-property.js", 13);
813
816
  observeImports(map, "./commons.js", 0);
817
+ observeImports(map, "./permits.js", 14);
814
818
  },
815
819
  liveVar: {
816
820
  },
817
821
  onceVar: {
818
- default: cells[15].default.set,
822
+ makeIntrinsicsCollector: cells[15].makeIntrinsicsCollector.set,
823
+ getGlobalIntrinsics: cells[15].getGlobalIntrinsics.set,
819
824
  },
820
825
  importMeta: {},
821
826
  });
822
827
  functors[16]({
823
828
  imports(entries) {
824
829
  const map = new Map(entries);
830
+ observeImports(map, "./permits.js", 14);
825
831
  observeImports(map, "./commons.js", 0);
832
+ observeImports(map, "./cauterize-property.js", 13);
826
833
  },
827
834
  liveVar: {
828
835
  },
@@ -863,9 +870,7 @@ function observeImports(map, importName, importIndex) {
863
870
  liveVar: {
864
871
  },
865
872
  onceVar: {
866
- minEnablements: cells[19].minEnablements.set,
867
- moderateEnablements: cells[19].moderateEnablements.set,
868
- severeEnablements: cells[19].severeEnablements.set,
873
+ default: cells[19].default.set,
869
874
  },
870
875
  importMeta: {},
871
876
  });
@@ -873,7 +878,6 @@ function observeImports(map, importName, importIndex) {
873
878
  imports(entries) {
874
879
  const map = new Map(entries);
875
880
  observeImports(map, "./commons.js", 0);
876
- observeImports(map, "./enablements.js", 19);
877
881
  },
878
882
  liveVar: {
879
883
  },
@@ -886,23 +890,26 @@ function observeImports(map, importName, importIndex) {
886
890
  imports(entries) {
887
891
  const map = new Map(entries);
888
892
  observeImports(map, "./commons.js", 0);
889
- observeImports(map, "./error/assert.js", 9);
890
893
  },
891
894
  liveVar: {
892
895
  },
893
896
  onceVar: {
894
- default: cells[21].default.set,
897
+ minEnablements: cells[21].minEnablements.set,
898
+ moderateEnablements: cells[21].moderateEnablements.set,
899
+ severeEnablements: cells[21].severeEnablements.set,
895
900
  },
896
901
  importMeta: {},
897
902
  });
898
903
  functors[22]({
899
904
  imports(entries) {
900
905
  const map = new Map(entries);
906
+ observeImports(map, "./commons.js", 0);
907
+ observeImports(map, "./enablements.js", 21);
901
908
  },
902
909
  liveVar: {
903
910
  },
904
911
  onceVar: {
905
- makeEvalFunction: cells[22].makeEvalFunction.set,
912
+ default: cells[22].default.set,
906
913
  },
907
914
  importMeta: {},
908
915
  });
@@ -910,30 +917,23 @@ function observeImports(map, importName, importIndex) {
910
917
  imports(entries) {
911
918
  const map = new Map(entries);
912
919
  observeImports(map, "./commons.js", 0);
913
- observeImports(map, "./error/assert.js", 9);
920
+ observeImports(map, "./error/assert.js", 11);
914
921
  },
915
922
  liveVar: {
916
923
  },
917
924
  onceVar: {
918
- makeFunctionConstructor: cells[23].makeFunctionConstructor.set,
925
+ default: cells[23].default.set,
919
926
  },
920
927
  importMeta: {},
921
928
  });
922
929
  functors[24]({
923
930
  imports(entries) {
924
931
  const map = new Map(entries);
925
- observeImports(map, "./commons.js", 0);
926
- observeImports(map, "./make-eval-function.js", 22);
927
- observeImports(map, "./make-function-constructor.js", 23);
928
- observeImports(map, "./permits.js", 12);
929
932
  },
930
933
  liveVar: {
931
934
  },
932
935
  onceVar: {
933
- setGlobalObjectSymbolUnscopables: cells[24].setGlobalObjectSymbolUnscopables.set,
934
- setGlobalObjectConstantProperties: cells[24].setGlobalObjectConstantProperties.set,
935
- setGlobalObjectMutableProperties: cells[24].setGlobalObjectMutableProperties.set,
936
- setGlobalObjectEvaluators: cells[24].setGlobalObjectEvaluators.set,
936
+ makeEvalFunction: cells[24].makeEvalFunction.set,
937
937
  },
938
938
  importMeta: {},
939
939
  });
@@ -941,14 +941,12 @@ function observeImports(map, importName, importIndex) {
941
941
  imports(entries) {
942
942
  const map = new Map(entries);
943
943
  observeImports(map, "./commons.js", 0);
944
- observeImports(map, "./error/assert.js", 9);
944
+ observeImports(map, "./error/assert.js", 11);
945
945
  },
946
946
  liveVar: {
947
947
  },
948
948
  onceVar: {
949
- alwaysThrowHandler: cells[25].alwaysThrowHandler.set,
950
- strictScopeTerminatorHandler: cells[25].strictScopeTerminatorHandler.set,
951
- strictScopeTerminator: cells[25].strictScopeTerminator.set,
949
+ makeFunctionConstructor: cells[25].makeFunctionConstructor.set,
952
950
  },
953
951
  importMeta: {},
954
952
  });
@@ -956,12 +954,17 @@ function observeImports(map, importName, importIndex) {
956
954
  imports(entries) {
957
955
  const map = new Map(entries);
958
956
  observeImports(map, "./commons.js", 0);
959
- observeImports(map, "./strict-scope-terminator.js", 25);
957
+ observeImports(map, "./make-eval-function.js", 24);
958
+ observeImports(map, "./make-function-constructor.js", 25);
959
+ observeImports(map, "./permits.js", 14);
960
960
  },
961
961
  liveVar: {
962
962
  },
963
963
  onceVar: {
964
- createSloppyGlobalsScopeTerminator: cells[26].createSloppyGlobalsScopeTerminator.set,
964
+ setGlobalObjectSymbolUnscopables: cells[26].setGlobalObjectSymbolUnscopables.set,
965
+ setGlobalObjectConstantProperties: cells[26].setGlobalObjectConstantProperties.set,
966
+ setGlobalObjectMutableProperties: cells[26].setGlobalObjectMutableProperties.set,
967
+ setGlobalObjectEvaluators: cells[26].setGlobalObjectEvaluators.set,
965
968
  },
966
969
  importMeta: {},
967
970
  });
@@ -969,12 +972,14 @@ function observeImports(map, importName, importIndex) {
969
972
  imports(entries) {
970
973
  const map = new Map(entries);
971
974
  observeImports(map, "./commons.js", 0);
972
- observeImports(map, "./error/assert.js", 9);
975
+ observeImports(map, "./error/assert.js", 11);
973
976
  },
974
977
  liveVar: {
975
978
  },
976
979
  onceVar: {
977
- makeEvalScopeKit: cells[27].makeEvalScopeKit.set,
980
+ alwaysThrowHandler: cells[27].alwaysThrowHandler.set,
981
+ strictScopeTerminatorHandler: cells[27].strictScopeTerminatorHandler.set,
982
+ strictScopeTerminator: cells[27].strictScopeTerminator.set,
978
983
  },
979
984
  importMeta: {},
980
985
  });
@@ -982,11 +987,12 @@ function observeImports(map, importName, importIndex) {
982
987
  imports(entries) {
983
988
  const map = new Map(entries);
984
989
  observeImports(map, "./commons.js", 0);
990
+ observeImports(map, "./strict-scope-terminator.js", 27);
985
991
  },
986
992
  liveVar: {
987
993
  },
988
994
  onceVar: {
989
- getSourceURL: cells[28].getSourceURL.set,
995
+ createSloppyGlobalsScopeTerminator: cells[28].createSloppyGlobalsScopeTerminator.set,
990
996
  },
991
997
  importMeta: {},
992
998
  });
@@ -994,19 +1000,12 @@ function observeImports(map, importName, importIndex) {
994
1000
  imports(entries) {
995
1001
  const map = new Map(entries);
996
1002
  observeImports(map, "./commons.js", 0);
997
- observeImports(map, "./get-source-url.js", 28);
1003
+ observeImports(map, "./error/assert.js", 11);
998
1004
  },
999
1005
  liveVar: {
1000
1006
  },
1001
1007
  onceVar: {
1002
- rejectHtmlComments: cells[29].rejectHtmlComments.set,
1003
- evadeHtmlCommentTest: cells[29].evadeHtmlCommentTest.set,
1004
- rejectImportExpressions: cells[29].rejectImportExpressions.set,
1005
- evadeImportExpressionTest: cells[29].evadeImportExpressionTest.set,
1006
- rejectSomeDirectEvalExpressions: cells[29].rejectSomeDirectEvalExpressions.set,
1007
- mandatoryTransforms: cells[29].mandatoryTransforms.set,
1008
- applyTransforms: cells[29].applyTransforms.set,
1009
- transforms: cells[29].transforms.set,
1008
+ makeEvalScopeKit: cells[29].makeEvalScopeKit.set,
1010
1009
  },
1011
1010
  importMeta: {},
1012
1011
  });
@@ -1018,8 +1017,7 @@ function observeImports(map, importName, importIndex) {
1018
1017
  liveVar: {
1019
1018
  },
1020
1019
  onceVar: {
1021
- isValidIdentifierName: cells[30].isValidIdentifierName.set,
1022
- getScopeConstants: cells[30].getScopeConstants.set,
1020
+ getSourceURL: cells[30].getSourceURL.set,
1023
1021
  },
1024
1022
  importMeta: {},
1025
1023
  });
@@ -1027,12 +1025,19 @@ function observeImports(map, importName, importIndex) {
1027
1025
  imports(entries) {
1028
1026
  const map = new Map(entries);
1029
1027
  observeImports(map, "./commons.js", 0);
1030
- observeImports(map, "./scope-constants.js", 30);
1028
+ observeImports(map, "./get-source-url.js", 30);
1031
1029
  },
1032
1030
  liveVar: {
1033
1031
  },
1034
1032
  onceVar: {
1035
- makeEvaluate: cells[31].makeEvaluate.set,
1033
+ rejectHtmlComments: cells[31].rejectHtmlComments.set,
1034
+ evadeHtmlCommentTest: cells[31].evadeHtmlCommentTest.set,
1035
+ rejectImportExpressions: cells[31].rejectImportExpressions.set,
1036
+ evadeImportExpressionTest: cells[31].evadeImportExpressionTest.set,
1037
+ rejectSomeDirectEvalExpressions: cells[31].rejectSomeDirectEvalExpressions.set,
1038
+ mandatoryTransforms: cells[31].mandatoryTransforms.set,
1039
+ applyTransforms: cells[31].applyTransforms.set,
1040
+ transforms: cells[31].transforms.set,
1036
1041
  },
1037
1042
  importMeta: {},
1038
1043
  });
@@ -1040,17 +1045,12 @@ function observeImports(map, importName, importIndex) {
1040
1045
  imports(entries) {
1041
1046
  const map = new Map(entries);
1042
1047
  observeImports(map, "./commons.js", 0);
1043
- observeImports(map, "./strict-scope-terminator.js", 25);
1044
- observeImports(map, "./sloppy-globals-scope-terminator.js", 26);
1045
- observeImports(map, "./eval-scope.js", 27);
1046
- observeImports(map, "./transforms.js", 29);
1047
- observeImports(map, "./make-evaluate.js", 31);
1048
- observeImports(map, "./error/assert.js", 9);
1049
1048
  },
1050
1049
  liveVar: {
1051
1050
  },
1052
1051
  onceVar: {
1053
- makeSafeEvaluator: cells[32].makeSafeEvaluator.set,
1052
+ isValidIdentifierName: cells[32].isValidIdentifierName.set,
1053
+ getScopeConstants: cells[32].getScopeConstants.set,
1054
1054
  },
1055
1055
  importMeta: {},
1056
1056
  });
@@ -1058,11 +1058,12 @@ function observeImports(map, importName, importIndex) {
1058
1058
  imports(entries) {
1059
1059
  const map = new Map(entries);
1060
1060
  observeImports(map, "./commons.js", 0);
1061
+ observeImports(map, "./scope-constants.js", 32);
1061
1062
  },
1062
1063
  liveVar: {
1063
1064
  },
1064
1065
  onceVar: {
1065
- tameFunctionToString: cells[33].tameFunctionToString.set,
1066
+ makeEvaluate: cells[33].makeEvaluate.set,
1066
1067
  },
1067
1068
  importMeta: {},
1068
1069
  });
@@ -1070,11 +1071,17 @@ function observeImports(map, importName, importIndex) {
1070
1071
  imports(entries) {
1071
1072
  const map = new Map(entries);
1072
1073
  observeImports(map, "./commons.js", 0);
1074
+ observeImports(map, "./strict-scope-terminator.js", 27);
1075
+ observeImports(map, "./sloppy-globals-scope-terminator.js", 28);
1076
+ observeImports(map, "./eval-scope.js", 29);
1077
+ observeImports(map, "./transforms.js", 31);
1078
+ observeImports(map, "./make-evaluate.js", 33);
1079
+ observeImports(map, "./error/assert.js", 11);
1073
1080
  },
1074
1081
  liveVar: {
1075
1082
  },
1076
1083
  onceVar: {
1077
- tameDomains: cells[34].tameDomains.set,
1084
+ makeSafeEvaluator: cells[34].makeSafeEvaluator.set,
1078
1085
  },
1079
1086
  importMeta: {},
1080
1087
  });
@@ -1086,37 +1093,31 @@ function observeImports(map, importName, importIndex) {
1086
1093
  liveVar: {
1087
1094
  },
1088
1095
  onceVar: {
1089
- tameModuleSource: cells[35].tameModuleSource.set,
1096
+ tameFunctionToString: cells[35].tameFunctionToString.set,
1090
1097
  },
1091
1098
  importMeta: {},
1092
1099
  });
1093
1100
  functors[36]({
1094
1101
  imports(entries) {
1095
1102
  const map = new Map(entries);
1096
- observeImports(map, "../commons.js", 0);
1103
+ observeImports(map, "./commons.js", 0);
1097
1104
  },
1098
1105
  liveVar: {
1099
1106
  },
1100
1107
  onceVar: {
1101
- consoleLevelMethods: cells[36].consoleLevelMethods.set,
1102
- consoleOtherMethods: cells[36].consoleOtherMethods.set,
1103
- makeLoggingConsoleKit: cells[36].makeLoggingConsoleKit.set,
1104
- pumpLogToConsole: cells[36].pumpLogToConsole.set,
1105
- makeCausalConsole: cells[36].makeCausalConsole.set,
1106
- defineCausalConsoleFromLogger: cells[36].defineCausalConsoleFromLogger.set,
1107
- filterConsole: cells[36].filterConsole.set,
1108
+ tameDomains: cells[36].tameDomains.set,
1108
1109
  },
1109
1110
  importMeta: {},
1110
1111
  });
1111
1112
  functors[37]({
1112
1113
  imports(entries) {
1113
1114
  const map = new Map(entries);
1114
- observeImports(map, "../commons.js", 0);
1115
+ observeImports(map, "./commons.js", 0);
1115
1116
  },
1116
1117
  liveVar: {
1117
1118
  },
1118
1119
  onceVar: {
1119
- makeRejectionHandlers: cells[37].makeRejectionHandlers.set,
1120
+ tameModuleSource: cells[37].tameModuleSource.set,
1120
1121
  },
1121
1122
  importMeta: {},
1122
1123
  });
@@ -1124,14 +1125,17 @@ function observeImports(map, importName, importIndex) {
1124
1125
  imports(entries) {
1125
1126
  const map = new Map(entries);
1126
1127
  observeImports(map, "../commons.js", 0);
1127
- observeImports(map, "./assert.js", 9);
1128
- observeImports(map, "./console.js", 36);
1129
- observeImports(map, "./unhandled-rejection.js", 37);
1130
1128
  },
1131
1129
  liveVar: {
1132
1130
  },
1133
1131
  onceVar: {
1134
- tameConsole: cells[38].tameConsole.set,
1132
+ consoleLevelMethods: cells[38].consoleLevelMethods.set,
1133
+ consoleOtherMethods: cells[38].consoleOtherMethods.set,
1134
+ makeLoggingConsoleKit: cells[38].makeLoggingConsoleKit.set,
1135
+ pumpLogToConsole: cells[38].pumpLogToConsole.set,
1136
+ makeCausalConsole: cells[38].makeCausalConsole.set,
1137
+ defineCausalConsoleFromLogger: cells[38].defineCausalConsoleFromLogger.set,
1138
+ filterConsole: cells[38].filterConsole.set,
1135
1139
  },
1136
1140
  importMeta: {},
1137
1141
  });
@@ -1143,9 +1147,7 @@ function observeImports(map, importName, importIndex) {
1143
1147
  liveVar: {
1144
1148
  },
1145
1149
  onceVar: {
1146
- filterFileName: cells[39].filterFileName.set,
1147
- shortenCallSiteString: cells[39].shortenCallSiteString.set,
1148
- tameV8ErrorConstructor: cells[39].tameV8ErrorConstructor.set,
1150
+ makeRejectionHandlers: cells[39].makeRejectionHandlers.set,
1149
1151
  },
1150
1152
  importMeta: {},
1151
1153
  });
@@ -1153,126 +1155,119 @@ function observeImports(map, importName, importIndex) {
1153
1155
  imports(entries) {
1154
1156
  const map = new Map(entries);
1155
1157
  observeImports(map, "../commons.js", 0);
1156
- observeImports(map, "../permits.js", 12);
1157
- observeImports(map, "./tame-v8-error-constructor.js", 39);
1158
+ observeImports(map, "./assert.js", 11);
1159
+ observeImports(map, "./console.js", 38);
1160
+ observeImports(map, "./unhandled-rejection.js", 39);
1158
1161
  },
1159
1162
  liveVar: {
1160
1163
  },
1161
1164
  onceVar: {
1162
- default: cells[40].default.set,
1165
+ tameConsole: cells[40].tameConsole.set,
1163
1166
  },
1164
1167
  importMeta: {},
1165
1168
  });
1166
1169
  functors[41]({
1167
1170
  imports(entries) {
1168
1171
  const map = new Map(entries);
1169
- observeImports(map, "@endo/env-options", 3);
1170
- observeImports(map, "./commons.js", 0);
1171
- observeImports(map, "./error/assert.js", 9);
1172
+ observeImports(map, "../commons.js", 0);
1172
1173
  },
1173
1174
  liveVar: {
1174
1175
  },
1175
1176
  onceVar: {
1176
- makeAlias: cells[41].makeAlias.set,
1177
- load: cells[41].load.set,
1178
- loadNow: cells[41].loadNow.set,
1177
+ filterFileName: cells[41].filterFileName.set,
1178
+ shortenCallSiteString: cells[41].shortenCallSiteString.set,
1179
+ tameV8ErrorConstructor: cells[41].tameV8ErrorConstructor.set,
1179
1180
  },
1180
1181
  importMeta: {},
1181
1182
  });
1182
1183
  functors[42]({
1183
1184
  imports(entries) {
1184
1185
  const map = new Map(entries);
1185
- observeImports(map, "./module-load.js", 41);
1186
- observeImports(map, "./commons.js", 0);
1187
- observeImports(map, "./error/assert.js", 9);
1186
+ observeImports(map, "../commons.js", 0);
1187
+ observeImports(map, "../permits.js", 14);
1188
+ observeImports(map, "./tame-v8-error-constructor.js", 41);
1188
1189
  },
1189
1190
  liveVar: {
1190
1191
  },
1191
1192
  onceVar: {
1192
- deferExports: cells[42].deferExports.set,
1193
- getDeferredExports: cells[42].getDeferredExports.set,
1193
+ default: cells[42].default.set,
1194
1194
  },
1195
1195
  importMeta: {},
1196
1196
  });
1197
1197
  functors[43]({
1198
1198
  imports(entries) {
1199
1199
  const map = new Map(entries);
1200
+ observeImports(map, "@endo/env-options", 3);
1200
1201
  observeImports(map, "./commons.js", 0);
1201
- observeImports(map, "./transforms.js", 29);
1202
- observeImports(map, "./make-safe-evaluator.js", 32);
1202
+ observeImports(map, "./error/assert.js", 11);
1203
1203
  },
1204
1204
  liveVar: {
1205
1205
  },
1206
1206
  onceVar: {
1207
- provideCompartmentEvaluator: cells[43].provideCompartmentEvaluator.set,
1208
- compartmentEvaluate: cells[43].compartmentEvaluate.set,
1207
+ makeAlias: cells[43].makeAlias.set,
1208
+ load: cells[43].load.set,
1209
+ loadNow: cells[43].loadNow.set,
1209
1210
  },
1210
1211
  importMeta: {},
1211
1212
  });
1212
1213
  functors[44]({
1213
1214
  imports(entries) {
1214
1215
  const map = new Map(entries);
1215
- observeImports(map, "./error/assert.js", 9);
1216
- observeImports(map, "./module-proxy.js", 42);
1216
+ observeImports(map, "./module-load.js", 43);
1217
1217
  observeImports(map, "./commons.js", 0);
1218
- observeImports(map, "./compartment-evaluate.js", 43);
1218
+ observeImports(map, "./error/assert.js", 11);
1219
1219
  },
1220
1220
  liveVar: {
1221
1221
  },
1222
1222
  onceVar: {
1223
- makeVirtualModuleInstance: cells[44].makeVirtualModuleInstance.set,
1224
- makeModuleInstance: cells[44].makeModuleInstance.set,
1223
+ deferExports: cells[44].deferExports.set,
1224
+ getDeferredExports: cells[44].getDeferredExports.set,
1225
1225
  },
1226
1226
  importMeta: {},
1227
1227
  });
1228
1228
  functors[45]({
1229
1229
  imports(entries) {
1230
1230
  const map = new Map(entries);
1231
- observeImports(map, "./error/assert.js", 9);
1232
- observeImports(map, "./module-instance.js", 44);
1233
1231
  observeImports(map, "./commons.js", 0);
1232
+ observeImports(map, "./transforms.js", 31);
1233
+ observeImports(map, "./make-safe-evaluator.js", 34);
1234
1234
  },
1235
1235
  liveVar: {
1236
1236
  },
1237
1237
  onceVar: {
1238
- link: cells[45].link.set,
1239
- instantiate: cells[45].instantiate.set,
1238
+ provideCompartmentEvaluator: cells[45].provideCompartmentEvaluator.set,
1239
+ compartmentEvaluate: cells[45].compartmentEvaluate.set,
1240
1240
  },
1241
1241
  importMeta: {},
1242
1242
  });
1243
1243
  functors[46]({
1244
1244
  imports(entries) {
1245
1245
  const map = new Map(entries);
1246
+ observeImports(map, "./error/assert.js", 11);
1247
+ observeImports(map, "./module-proxy.js", 44);
1246
1248
  observeImports(map, "./commons.js", 0);
1247
- observeImports(map, "./global-object.js", 24);
1248
- observeImports(map, "./error/assert.js", 9);
1249
- observeImports(map, "./permits.js", 12);
1250
- observeImports(map, "./module-load.js", 41);
1251
- observeImports(map, "./module-link.js", 45);
1252
- observeImports(map, "./module-proxy.js", 42);
1253
- observeImports(map, "./compartment-evaluate.js", 43);
1254
- observeImports(map, "./make-safe-evaluator.js", 32);
1249
+ observeImports(map, "./compartment-evaluate.js", 45);
1255
1250
  },
1256
1251
  liveVar: {
1257
1252
  },
1258
1253
  onceVar: {
1259
- InertCompartment: cells[46].InertCompartment.set,
1260
- CompartmentPrototype: cells[46].CompartmentPrototype.set,
1261
- compartmentOptions: cells[46].compartmentOptions.set,
1262
- makeCompartmentConstructor: cells[46].makeCompartmentConstructor.set,
1254
+ makeVirtualModuleInstance: cells[46].makeVirtualModuleInstance.set,
1255
+ makeModuleInstance: cells[46].makeModuleInstance.set,
1263
1256
  },
1264
1257
  importMeta: {},
1265
1258
  });
1266
1259
  functors[47]({
1267
1260
  imports(entries) {
1268
1261
  const map = new Map(entries);
1262
+ observeImports(map, "./error/assert.js", 11);
1263
+ observeImports(map, "./module-instance.js", 46);
1269
1264
  observeImports(map, "./commons.js", 0);
1270
- observeImports(map, "./compartment.js", 46);
1271
1265
  },
1272
1266
  liveVar: {
1273
1267
  },
1274
1268
  onceVar: {
1275
- getAnonymousIntrinsics: cells[47].getAnonymousIntrinsics.set,
1269
+ link: cells[47].link.set,
1270
+ instantiate: cells[47].instantiate.set,
1276
1271
  },
1277
1272
  importMeta: {},
1278
1273
  });
@@ -1280,11 +1275,22 @@ function observeImports(map, importName, importIndex) {
1280
1275
  imports(entries) {
1281
1276
  const map = new Map(entries);
1282
1277
  observeImports(map, "./commons.js", 0);
1278
+ observeImports(map, "./global-object.js", 26);
1279
+ observeImports(map, "./error/assert.js", 11);
1280
+ observeImports(map, "./permits.js", 14);
1281
+ observeImports(map, "./module-load.js", 43);
1282
+ observeImports(map, "./module-link.js", 47);
1283
+ observeImports(map, "./module-proxy.js", 44);
1284
+ observeImports(map, "./compartment-evaluate.js", 45);
1285
+ observeImports(map, "./make-safe-evaluator.js", 34);
1283
1286
  },
1284
1287
  liveVar: {
1285
1288
  },
1286
1289
  onceVar: {
1287
- tameHarden: cells[48].tameHarden.set,
1290
+ InertCompartment: cells[48].InertCompartment.set,
1291
+ CompartmentPrototype: cells[48].CompartmentPrototype.set,
1292
+ compartmentOptions: cells[48].compartmentOptions.set,
1293
+ makeCompartmentConstructor: cells[48].makeCompartmentConstructor.set,
1288
1294
  },
1289
1295
  importMeta: {},
1290
1296
  });
@@ -1292,11 +1298,12 @@ function observeImports(map, importName, importIndex) {
1292
1298
  imports(entries) {
1293
1299
  const map = new Map(entries);
1294
1300
  observeImports(map, "./commons.js", 0);
1301
+ observeImports(map, "./compartment.js", 48);
1295
1302
  },
1296
1303
  liveVar: {
1297
1304
  },
1298
1305
  onceVar: {
1299
- tameSymbolConstructor: cells[49].tameSymbolConstructor.set,
1306
+ getAnonymousIntrinsics: cells[49].getAnonymousIntrinsics.set,
1300
1307
  },
1301
1308
  importMeta: {},
1302
1309
  });
@@ -1308,8 +1315,7 @@ function observeImports(map, importName, importIndex) {
1308
1315
  liveVar: {
1309
1316
  },
1310
1317
  onceVar: {
1311
- tameFauxDataProperty: cells[50].tameFauxDataProperty.set,
1312
- tameFauxDataProperties: cells[50].tameFauxDataProperties.set,
1318
+ tameHarden: cells[50].tameHarden.set,
1313
1319
  },
1314
1320
  importMeta: {},
1315
1321
  });
@@ -1321,7 +1327,7 @@ function observeImports(map, importName, importIndex) {
1321
1327
  liveVar: {
1322
1328
  },
1323
1329
  onceVar: {
1324
- tameRegeneratorRuntime: cells[51].tameRegeneratorRuntime.set,
1330
+ tameSymbolConstructor: cells[51].tameSymbolConstructor.set,
1325
1331
  },
1326
1332
  importMeta: {},
1327
1333
  });
@@ -1333,7 +1339,8 @@ function observeImports(map, importName, importIndex) {
1333
1339
  liveVar: {
1334
1340
  },
1335
1341
  onceVar: {
1336
- shimArrayBufferTransfer: cells[52].shimArrayBufferTransfer.set,
1342
+ tameFauxDataProperty: cells[52].tameFauxDataProperty.set,
1343
+ tameFauxDataProperties: cells[52].tameFauxDataProperties.set,
1337
1344
  },
1338
1345
  importMeta: {},
1339
1346
  });
@@ -1341,88 +1348,86 @@ function observeImports(map, importName, importIndex) {
1341
1348
  imports(entries) {
1342
1349
  const map = new Map(entries);
1343
1350
  observeImports(map, "./commons.js", 0);
1344
- observeImports(map, "./error/assert.js", 9);
1345
1351
  },
1346
1352
  liveVar: {
1347
1353
  },
1348
1354
  onceVar: {
1349
- chooseReporter: cells[53].chooseReporter.set,
1350
- reportInGroup: cells[53].reportInGroup.set,
1355
+ tameRegeneratorRuntime: cells[53].tameRegeneratorRuntime.set,
1351
1356
  },
1352
1357
  importMeta: {},
1353
1358
  });
1354
1359
  functors[54]({
1355
1360
  imports(entries) {
1356
1361
  const map = new Map(entries);
1357
- observeImports(map, "@endo/env-options", 3);
1358
1362
  observeImports(map, "./commons.js", 0);
1359
- observeImports(map, "./make-hardener.js", 10);
1360
- observeImports(map, "./intrinsics.js", 13);
1361
- observeImports(map, "./permits-intrinsics.js", 14);
1362
- observeImports(map, "./tame-function-constructors.js", 15);
1363
- observeImports(map, "./tame-date-constructor.js", 16);
1364
- observeImports(map, "./tame-math-object.js", 17);
1365
- observeImports(map, "./tame-regexp-constructor.js", 18);
1366
- observeImports(map, "./enable-property-overrides.js", 20);
1367
- observeImports(map, "./tame-locale-methods.js", 21);
1368
- observeImports(map, "./global-object.js", 24);
1369
- observeImports(map, "./make-safe-evaluator.js", 32);
1370
- observeImports(map, "./permits.js", 12);
1371
- observeImports(map, "./tame-function-tostring.js", 33);
1372
- observeImports(map, "./tame-domains.js", 34);
1373
- observeImports(map, "./tame-module-source.js", 35);
1374
- observeImports(map, "./error/tame-console.js", 38);
1375
- observeImports(map, "./error/tame-error-constructor.js", 40);
1376
- observeImports(map, "./error/assert.js", 9);
1377
- observeImports(map, "./get-anonymous-intrinsics.js", 47);
1378
- observeImports(map, "./compartment.js", 46);
1379
- observeImports(map, "./tame-harden.js", 48);
1380
- observeImports(map, "./tame-symbol-constructor.js", 49);
1381
- observeImports(map, "./tame-faux-data-properties.js", 50);
1382
- observeImports(map, "./tame-regenerator-runtime.js", 51);
1383
- observeImports(map, "./shim-arraybuffer-transfer.js", 52);
1384
- observeImports(map, "./reporting.js", 53);
1385
1363
  },
1386
1364
  liveVar: {
1387
1365
  },
1388
1366
  onceVar: {
1389
- repairIntrinsics: cells[54].repairIntrinsics.set,
1367
+ shimArrayBufferTransfer: cells[54].shimArrayBufferTransfer.set,
1390
1368
  },
1391
1369
  importMeta: {},
1392
1370
  });
1393
1371
  functors[55]({
1394
1372
  imports(entries) {
1395
1373
  const map = new Map(entries);
1396
- observeImports(map, "./assert-sloppy-mode.js", 1);
1397
1374
  observeImports(map, "./commons.js", 0);
1398
- observeImports(map, "./lockdown.js", 54);
1375
+ observeImports(map, "./error/assert.js", 11);
1399
1376
  },
1400
1377
  liveVar: {
1401
1378
  },
1402
1379
  onceVar: {
1380
+ chooseReporter: cells[55].chooseReporter.set,
1381
+ reportInGroup: cells[55].reportInGroup.set,
1403
1382
  },
1404
1383
  importMeta: {},
1405
1384
  });
1406
1385
  functors[56]({
1407
1386
  imports(entries) {
1408
1387
  const map = new Map(entries);
1388
+ observeImports(map, "@endo/env-options", 3);
1389
+ observeImports(map, "@endo/immutable-arraybuffer/shim.js", 5);
1409
1390
  observeImports(map, "./commons.js", 0);
1410
- observeImports(map, "./compartment.js", 46);
1411
- observeImports(map, "./tame-function-tostring.js", 33);
1412
- observeImports(map, "./intrinsics.js", 13);
1413
- observeImports(map, "./reporting.js", 53);
1391
+ observeImports(map, "./make-hardener.js", 12);
1392
+ observeImports(map, "./intrinsics.js", 15);
1393
+ observeImports(map, "./permits-intrinsics.js", 16);
1394
+ observeImports(map, "./tame-function-constructors.js", 17);
1395
+ observeImports(map, "./tame-date-constructor.js", 18);
1396
+ observeImports(map, "./tame-math-object.js", 19);
1397
+ observeImports(map, "./tame-regexp-constructor.js", 20);
1398
+ observeImports(map, "./enable-property-overrides.js", 22);
1399
+ observeImports(map, "./tame-locale-methods.js", 23);
1400
+ observeImports(map, "./global-object.js", 26);
1401
+ observeImports(map, "./make-safe-evaluator.js", 34);
1402
+ observeImports(map, "./permits.js", 14);
1403
+ observeImports(map, "./tame-function-tostring.js", 35);
1404
+ observeImports(map, "./tame-domains.js", 36);
1405
+ observeImports(map, "./tame-module-source.js", 37);
1406
+ observeImports(map, "./error/tame-console.js", 40);
1407
+ observeImports(map, "./error/tame-error-constructor.js", 42);
1408
+ observeImports(map, "./error/assert.js", 11);
1409
+ observeImports(map, "./get-anonymous-intrinsics.js", 49);
1410
+ observeImports(map, "./compartment.js", 48);
1411
+ observeImports(map, "./tame-harden.js", 50);
1412
+ observeImports(map, "./tame-symbol-constructor.js", 51);
1413
+ observeImports(map, "./tame-faux-data-properties.js", 52);
1414
+ observeImports(map, "./tame-regenerator-runtime.js", 53);
1415
+ observeImports(map, "./shim-arraybuffer-transfer.js", 54);
1416
+ observeImports(map, "./reporting.js", 55);
1414
1417
  },
1415
1418
  liveVar: {
1416
1419
  },
1417
1420
  onceVar: {
1421
+ repairIntrinsics: cells[56].repairIntrinsics.set,
1418
1422
  },
1419
1423
  importMeta: {},
1420
1424
  });
1421
1425
  functors[57]({
1422
1426
  imports(entries) {
1423
1427
  const map = new Map(entries);
1428
+ observeImports(map, "./assert-sloppy-mode.js", 1);
1424
1429
  observeImports(map, "./commons.js", 0);
1425
- observeImports(map, "./error/assert.js", 9);
1430
+ observeImports(map, "./lockdown.js", 56);
1426
1431
  },
1427
1432
  liveVar: {
1428
1433
  },
@@ -1434,8 +1439,10 @@ function observeImports(map, importName, importIndex) {
1434
1439
  imports(entries) {
1435
1440
  const map = new Map(entries);
1436
1441
  observeImports(map, "./commons.js", 0);
1437
- observeImports(map, "./error/console.js", 36);
1438
- observeImports(map, "./error/assert.js", 9);
1442
+ observeImports(map, "./compartment.js", 48);
1443
+ observeImports(map, "./tame-function-tostring.js", 35);
1444
+ observeImports(map, "./intrinsics.js", 15);
1445
+ observeImports(map, "./reporting.js", 55);
1439
1446
  },
1440
1447
  liveVar: {
1441
1448
  },
@@ -1446,10 +1453,35 @@ function observeImports(map, importName, importIndex) {
1446
1453
  functors[59]({
1447
1454
  imports(entries) {
1448
1455
  const map = new Map(entries);
1449
- observeImports(map, "./src/lockdown-shim.js", 55);
1450
- observeImports(map, "./src/compartment-shim.js", 56);
1451
- observeImports(map, "./src/assert-shim.js", 57);
1452
- observeImports(map, "./src/console-shim.js", 58);
1456
+ observeImports(map, "./commons.js", 0);
1457
+ observeImports(map, "./error/assert.js", 11);
1458
+ },
1459
+ liveVar: {
1460
+ },
1461
+ onceVar: {
1462
+ },
1463
+ importMeta: {},
1464
+ });
1465
+ functors[60]({
1466
+ imports(entries) {
1467
+ const map = new Map(entries);
1468
+ observeImports(map, "./commons.js", 0);
1469
+ observeImports(map, "./error/console.js", 38);
1470
+ observeImports(map, "./error/assert.js", 11);
1471
+ },
1472
+ liveVar: {
1473
+ },
1474
+ onceVar: {
1475
+ },
1476
+ importMeta: {},
1477
+ });
1478
+ functors[61]({
1479
+ imports(entries) {
1480
+ const map = new Map(entries);
1481
+ observeImports(map, "./src/lockdown-shim.js", 57);
1482
+ observeImports(map, "./src/compartment-shim.js", 58);
1483
+ observeImports(map, "./src/assert-shim.js", 59);
1484
+ observeImports(map, "./src/console-shim.js", 60);
1453
1485
  },
1454
1486
  liveVar: {
1455
1487
  },
@@ -1462,7 +1494,7 @@ function observeImports(map, importName, importIndex) {
1462
1494
  })([
1463
1495
  // === 0. ses ./src/commons.js ===
1464
1496
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/**
1465
- * @module Captures native intrinsics during initialization, so vetted shims
1497
+ * Captures native intrinsics during initialization, so vetted shims
1466
1498
  * (running between initialization of SES and calling lockdown) are free to
1467
1499
  * modify the environment without compromising the integrity of SES. For
1468
1500
  * example, a vetted shim can modify Object.assign because we capture and
@@ -1472,6 +1504,8 @@ function observeImports(map, importName, importIndex) {
1472
1504
  * This pattern of use is enforced by eslint rules no-restricted-globals and
1473
1505
  * no-polymorphic-call.
1474
1506
  * We maintain the list of restricted globals in ../package.json.
1507
+ *
1508
+ * @module
1475
1509
  */
1476
1510
 
1477
1511
  /* global globalThis */
@@ -1946,6 +1980,7 @@ const Fail = (literals, ...args) => {
1946
1980
  * names used.
1947
1981
  */
1948
1982
  const makeEnvironmentCaptor = (aGlobal, dropNames = false) => {
1983
+ /** @type {string[]} */
1949
1984
  const capturedEnvironmentOptionNames = [];
1950
1985
 
1951
1986
  /**
@@ -2002,8 +2037,9 @@ const Fail = (literals, ...args) => {
2002
2037
  freeze(getEnvironmentOption);
2003
2038
 
2004
2039
  /**
2040
+ * @template {string} [T=string]
2005
2041
  * @param {string} optionName
2006
- * @returns {string[]}
2042
+ * @returns {T[]}
2007
2043
  */
2008
2044
  const getEnvironmentOptionsList = optionName => {
2009
2045
  const option = getEnvironmentOption(optionName, '');
@@ -2011,6 +2047,12 @@ const Fail = (literals, ...args) => {
2011
2047
  };
2012
2048
  freeze(getEnvironmentOptionsList);
2013
2049
 
2050
+ /**
2051
+ * @template {string} [T=string]
2052
+ * @param {string} optionName
2053
+ * @param {T} element
2054
+ * @returns {boolean}
2055
+ */
2014
2056
  const environmentOptionsListHas = (optionName, element) =>
2015
2057
  arrayIncludes(getEnvironmentOptionsList(optionName), element);
2016
2058
 
@@ -2043,7 +2085,305 @@ freeze(makeEnvironmentCaptor);
2043
2085
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/env-options.js", []]]);
2044
2086
  })()
2045
2087
  ,
2046
- // === 4. ses ./src/error/stringify-utils.js ===
2088
+ // === 4. immutable-arraybuffer ./index.js ===
2089
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/* global globalThis */
2090
+
2091
+ const { setPrototypeOf, getOwnPropertyDescriptors, defineProperties } = Object;
2092
+ const { apply } = Reflect;
2093
+ const { prototype: arrayBufferPrototype } = ArrayBuffer;
2094
+ // Capture structuredClone before it could be scuttled.
2095
+ const { structuredClone: originalStructuredCloneMaybe } = globalThis;
2096
+
2097
+ const {
2098
+ slice,
2099
+ // TODO used to be a-ts-expect-error, but my local IDE's TS server
2100
+ // seems to use a more recent definition of the `ArrayBuffer` type.
2101
+ // @ts-ignore At the time of this writing, the `ArrayBuffer` type built
2102
+ // into TypeScript does not know about the recent standard `transfer` method.
2103
+ // Indeed, the `transfer` method is absent from Node <= 20.
2104
+ transfer,
2105
+ } = arrayBufferPrototype;
2106
+
2107
+ /**
2108
+ * Enforces that `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2109
+ *
2110
+ * @param {ArrayBuffer} arrayBuffer
2111
+ * @param {number} [start]
2112
+ * @param {number} [end]
2113
+ * @returns {ArrayBuffer}
2114
+ */
2115
+ const arrayBufferSlice = (arrayBuffer, start = undefined, end = undefined) =>
2116
+ apply(slice, arrayBuffer, [start, end]);
2117
+
2118
+ /**
2119
+ * Enforces that `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2120
+ * Return a new fresh `ArrayBuffer` exotic object, where the contents of the
2121
+ * original `arrayBuffer` has been moved into the new one, and the original
2122
+ * `arrayBuffer` has been detached.
2123
+ *
2124
+ * @param {ArrayBuffer} arrayBuffer
2125
+ * @returns {ArrayBuffer}
2126
+ */
2127
+ let arrayBufferTransfer;
2128
+
2129
+ if (transfer) {
2130
+ arrayBufferTransfer = arrayBuffer => apply(transfer, arrayBuffer, []);
2131
+ } else if (originalStructuredCloneMaybe) {
2132
+ arrayBufferTransfer = arrayBuffer => {
2133
+ // Hopefully, a zero-length slice is cheap, but still enforces that
2134
+ // `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2135
+ arrayBufferSlice(arrayBuffer, 0, 0);
2136
+ return originalStructuredCloneMaybe(arrayBuffer, {
2137
+ transfer: [arrayBuffer],
2138
+ });
2139
+ };
2140
+ } else {
2141
+ // Indeed, Node <= 16 has neither.
2142
+ throw TypeError(
2143
+ `Can only emulate immutable ArrayBuffer on a platform with either "structuredClone" or "ArrayBuffer.prototype.transfer"`,
2144
+ );
2145
+ }
2146
+
2147
+ /**
2148
+ * This class only exists as an artifact of this ponyfill and shim,
2149
+ * as a convenience for imperfectly emulating the
2150
+ * *Immutable ArrayBuffer* proposal, which would not have this class.
2151
+ * In the proposal,
2152
+ * `transferToImmutable` makes a new `ArrayBuffer` that inherits directly from
2153
+ * `ArrayBuffer.prototype` as you'd expect. In the ponyfill and shim,
2154
+ * `transferToImmutable` makes a normal object that inherits directly from
2155
+ * `immutableArrayBufferPrototype`, which has been surgically
2156
+ * altered to inherit directly from `ArrayBuffer.prototype`. The constructor is
2157
+ * captured for use internal to this module, and is made otherwise inaccessible.
2158
+ * Therefore, `immutableArrayBufferPrototype` and all its methods
2159
+ * and accessor functions effectively become hidden intrinsics.
2160
+ * They are not encapsulated. Rather, they are trivially discoverable if you
2161
+ * know how, but are not discoverable merely by enumerating naming paths.
2162
+ */
2163
+ class ImmutableArrayBufferInternal {
2164
+ /** @type {ArrayBuffer} */
2165
+ #buffer;
2166
+
2167
+ constructor(buffer) {
2168
+ // This constructor is deleted from the prototype below.
2169
+ this.#buffer = arrayBufferTransfer(buffer);
2170
+ }
2171
+
2172
+ get byteLength() {
2173
+ return this.#buffer.byteLength;
2174
+ }
2175
+
2176
+ get detached() {
2177
+ this.#buffer; // shim brand check
2178
+ return false;
2179
+ }
2180
+
2181
+ get maxByteLength() {
2182
+ // Not underlying maxByteLength, which is irrelevant
2183
+ return this.#buffer.byteLength;
2184
+ }
2185
+
2186
+ get resizable() {
2187
+ this.#buffer; // shim brand check
2188
+ return false;
2189
+ }
2190
+
2191
+ get immutable() {
2192
+ this.#buffer; // shim brand check
2193
+ return true;
2194
+ }
2195
+
2196
+ slice(start = undefined, end = undefined) {
2197
+ return arrayBufferSlice(this.#buffer, start, end);
2198
+ }
2199
+
2200
+ sliceToImmutable(start = undefined, end = undefined) {
2201
+ // eslint-disable-next-line no-use-before-define
2202
+ return sliceBufferToImmutable(this.#buffer, start, end);
2203
+ }
2204
+
2205
+ resize(_newByteLength = undefined) {
2206
+ this.#buffer; // shim brand check
2207
+ throw TypeError('Cannot resize an immutable ArrayBuffer');
2208
+ }
2209
+
2210
+ transfer(_newLength = undefined) {
2211
+ this.#buffer; // shim brand check
2212
+ throw TypeError('Cannot detach an immutable ArrayBuffer');
2213
+ }
2214
+
2215
+ transferToFixedLength(_newLength = undefined) {
2216
+ this.#buffer; // shim brand check
2217
+ throw TypeError('Cannot detach an immutable ArrayBuffer');
2218
+ }
2219
+
2220
+ transferToImmutable(_newLength = undefined) {
2221
+ this.#buffer; // shim brand check
2222
+ throw TypeError('Cannot detach an immutable ArrayBuffer');
2223
+ }
2224
+ }
2225
+
2226
+ const immutableArrayBufferPrototype = ImmutableArrayBufferInternal.prototype;
2227
+ // @ts-expect-error can only delete optionals
2228
+ delete immutableArrayBufferPrototype.constructor;
2229
+
2230
+ const {
2231
+ slice: { value: sliceOfImmutable },
2232
+ immutable: { get: isImmutableGetter },
2233
+ } = getOwnPropertyDescriptors(immutableArrayBufferPrototype);
2234
+
2235
+ setPrototypeOf(immutableArrayBufferPrototype, arrayBufferPrototype);
2236
+
2237
+ // See https://github.com/endojs/endo/tree/master/packages/immutable-arraybuffer#purposeful-violation
2238
+ defineProperties(immutableArrayBufferPrototype, {
2239
+ [Symbol.toStringTag]: {
2240
+ value: 'ImmutableArrayBuffer',
2241
+ writable: false,
2242
+ enumerable: false,
2243
+ configurable: true,
2244
+ },
2245
+ });
2246
+
2247
+ /**
2248
+ * Transfer the contents to a new Immutable ArrayBuffer
2249
+ *
2250
+ * @param {ArrayBuffer} buffer The original buffer.
2251
+ * @param {number} [newLength] The start index.
2252
+ * @returns {ArrayBuffer}
2253
+ */
2254
+ const transferBufferToImmutable = (buffer, newLength = undefined) => {
2255
+ if (newLength !== undefined) {
2256
+ if (transfer) {
2257
+ buffer = apply(transfer, buffer, [newLength]);
2258
+ } else {
2259
+ buffer = arrayBufferTransfer(buffer);
2260
+ const oldLength = buffer.byteLength;
2261
+ // eslint-disable-next-line @endo/restrict-comparison-operands
2262
+ if (newLength <= oldLength) {
2263
+ buffer = arrayBufferSlice(buffer, 0, newLength);
2264
+ } else {
2265
+ const oldTA = new Uint8Array(buffer);
2266
+ const newTA = new Uint8Array(newLength);
2267
+ newTA.set(oldTA);
2268
+ buffer = newTA.buffer;
2269
+ }
2270
+ }
2271
+ }
2272
+ const result = new ImmutableArrayBufferInternal(buffer);
2273
+ return /** @type {ArrayBuffer} */ (/** @type {unknown} */ (result));
2274
+ };$h͏_once.transferBufferToImmutable(transferBufferToImmutable);
2275
+
2276
+ const isBufferImmutable = buffer => {
2277
+ try {
2278
+ // @ts-expect-error Getter should be typed as this-sensitive
2279
+ return apply(isImmutableGetter, buffer, []);
2280
+ } catch (err) {
2281
+ if (err instanceof TypeError) {
2282
+ // Enforce that `buffer` is a genuine ArrayBuffer before returning.
2283
+ arrayBufferSlice(buffer, 0, 0);
2284
+ return false;
2285
+ }
2286
+ throw err;
2287
+ }
2288
+ };
2289
+
2290
+ /**
2291
+ * Enforces that `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2292
+ *
2293
+ * @param {ArrayBuffer} buffer
2294
+ * @param {number} [start]
2295
+ * @param {number} [end]
2296
+ * @returns {ArrayBuffer}
2297
+ */$h͏_once.isBufferImmutable(isBufferImmutable);
2298
+ const sliceBuffer = (buffer, start = undefined, end = undefined) => {
2299
+ try {
2300
+ // @ts-expect-error We know it is really there
2301
+ return apply(sliceOfImmutable, buffer, [start, end]);
2302
+ } catch (err) {
2303
+ if (err instanceof TypeError) {
2304
+ return arrayBufferSlice(buffer, start, end);
2305
+ }
2306
+ throw err;
2307
+ }
2308
+ };
2309
+
2310
+ /**
2311
+ * Creates an immutable slice of the given buffer.
2312
+ *
2313
+ * @param {ArrayBuffer} buffer The original buffer.
2314
+ * @param {number} [start] The start index.
2315
+ * @param {number} [end] The end index.
2316
+ * @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
2317
+ */
2318
+ const sliceBufferToImmutable = (
2319
+ buffer,
2320
+ start = undefined,
2321
+ end = undefined,
2322
+ ) => transferBufferToImmutable(sliceBuffer(buffer, start, end));$h͏_once.sliceBufferToImmutable(sliceBufferToImmutable);
2323
+ })()
2324
+ ,
2325
+ // === 5. immutable-arraybuffer ./shim.js ===
2326
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let transferBufferToImmutable,isBufferImmutable,sliceBufferToImmutable;$h͏_imports([["./index.js", [["transferBufferToImmutable",[$h͏_a => (transferBufferToImmutable = $h͏_a)]],["isBufferImmutable",[$h͏_a => (isBufferImmutable = $h͏_a)]],["sliceBufferToImmutable",[$h͏_a => (sliceBufferToImmutable = $h͏_a)]]]]]);
2327
+
2328
+
2329
+
2330
+
2331
+
2332
+ const { getOwnPropertyDescriptors, defineProperties } = Object;
2333
+ const { prototype: arrayBufferPrototype } = ArrayBuffer;
2334
+
2335
+ const arrayBufferMethods = {
2336
+ /**
2337
+ * Transfer the contents to a new Immutable ArrayBuffer
2338
+ *
2339
+ * @this {ArrayBuffer} buffer The original buffer.
2340
+ * @param {number} [newLength] The start index.
2341
+ * @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
2342
+ */
2343
+ transferToImmutable(newLength = undefined) {
2344
+ return transferBufferToImmutable(this, newLength);
2345
+ },
2346
+
2347
+ /**
2348
+ * Creates an immutable slice of the given buffer.
2349
+ *
2350
+ * @this {ArrayBuffer} buffer The original buffer.
2351
+ * @param {number} [start] The start index.
2352
+ * @param {number} [end] The end index.
2353
+ * @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
2354
+ */
2355
+ sliceToImmutable(start = undefined, end = undefined) {
2356
+ return sliceBufferToImmutable(this, start, end);
2357
+ },
2358
+
2359
+ get immutable() {
2360
+ return isBufferImmutable(this);
2361
+ },
2362
+ };
2363
+
2364
+ if ('sliceToImmutable' in arrayBufferPrototype) {
2365
+ // Modern shim practice frowns on conditional installation, at least for
2366
+ // proposals prior to stage 3. This is so changes to the proposal since
2367
+ // an old shim was distributed don't need to worry about the proposal
2368
+ // breaking old code depending on the old shim. Thus, if we detect that
2369
+ // we're about to overwrite a prior installation, we simply issue this
2370
+ // warning and continue.
2371
+ //
2372
+ // TODO, if the primordials are frozen after the prior implementation, such as
2373
+ // by `lockdown`, then this precludes overwriting as expected. However, for
2374
+ // this case, the following warning text will be confusing.
2375
+ console.warn(
2376
+ 'About to overwrite a prior implementation of "sliceToImmutable"',
2377
+ );
2378
+ }
2379
+
2380
+ defineProperties(
2381
+ arrayBufferPrototype,
2382
+ getOwnPropertyDescriptors(arrayBufferMethods),
2383
+ );
2384
+ })()
2385
+ ,
2386
+ // === 6. ses ./src/error/stringify-utils.js ===
2047
2387
  ({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)]]]]]);
2048
2388
 
2049
2389
 
@@ -2240,7 +2580,7 @@ const bestEffortStringify = (payload, spaces = undefined) => {
2240
2580
  freeze(bestEffortStringify);
2241
2581
  })()
2242
2582
  ,
2243
- // === 5. ses ./src/error/types.js ===
2583
+ // === 7. ses ./src/error/types.js ===
2244
2584
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2245
2585
 
2246
2586
  /** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken, StringablePayload} from '../../types.js' */
@@ -2302,7 +2642,7 @@ freeze(bestEffortStringify);
2302
2642
  */
2303
2643
  })()
2304
2644
  ,
2305
- // === 6. ses ./src/error/internal-types.js ===
2645
+ // === 8. ses ./src/error/internal-types.js ===
2306
2646
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2307
2647
 
2308
2648
  /**
@@ -2403,7 +2743,7 @@ freeze(bestEffortStringify);
2403
2743
  */
2404
2744
  })()
2405
2745
  ,
2406
- // === 7. ses ./src/make-lru-cachemap.js ===
2746
+ // === 9. ses ./src/make-lru-cachemap.js ===
2407
2747
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2408
2748
  /* eslint-disable @endo/no-polymorphic-call */
2409
2749
 
@@ -2627,7 +2967,7 @@ const spliceOut = cell => {
2627
2967
  freeze(makeLRUCacheMap);
2628
2968
  })()
2629
2969
  ,
2630
- // === 8. ses ./src/error/note-log-args.js ===
2970
+ // === 10. ses ./src/error/note-log-args.js ===
2631
2971
  ({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)]]]]]);
2632
2972
 
2633
2973
 
@@ -2706,7 +3046,7 @@ const defaultArgsPerErrorBudget = 100;
2706
3046
  freeze(makeNoteLogArgsArrayKit);
2707
3047
  })()
2708
3048
  ,
2709
- // === 9. ses ./src/error/assert.js ===
3049
+ // === 11. ses ./src/error/assert.js ===
2710
3050
  ({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)]]]]]);
2711
3051
 
2712
3052
 
@@ -3284,7 +3624,7 @@ const assert = makeAssert();$h͏_once.assert(assert);
3284
3624
  const assertEqual = assert.equal;$h͏_once.assertEqual(assertEqual);
3285
3625
  })()
3286
3626
  ,
3287
- // === 10. ses ./src/make-hardener.js ===
3627
+ // === 12. ses ./src/make-hardener.js ===
3288
3628
  ({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)]]]]]);
3289
3629
 
3290
3630
 
@@ -3562,7 +3902,7 @@ const freezeTypedArray = array => {
3562
3902
  };$h͏_once.makeHardener(makeHardener);
3563
3903
  })()
3564
3904
  ,
3565
- // === 11. ses ./src/cauterize-property.js ===
3905
+ // === 13. ses ./src/cauterize-property.js ===
3566
3906
  ({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)]]]]]);
3567
3907
 
3568
3908
  /**
@@ -3634,7 +3974,7 @@ const freezeTypedArray = array => {
3634
3974
  };$h͏_once.cauterizeProperty(cauterizeProperty);
3635
3975
  })()
3636
3976
  ,
3637
- // === 12. ses ./src/permits.js ===
3977
+ // === 14. ses ./src/permits.js ===
3638
3978
  ({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)]]]]]);
3639
3979
 
3640
3980
 
@@ -3643,12 +3983,14 @@ const freezeTypedArray = array => {
3643
3983
  /** @import {GenericErrorConstructor} from '../types.js' */
3644
3984
 
3645
3985
  /**
3646
- * @module Exports {@code permits}, a recursively defined
3986
+ * Exports {@code permits}, a recursively defined
3647
3987
  * JSON record enumerating all intrinsics and their properties
3648
3988
  * according to ECMA specs.
3649
3989
  *
3650
3990
  * @author JF Paradis
3651
3991
  * @author Mark S. Miller
3992
+ *
3993
+ * @module
3652
3994
  */
3653
3995
 
3654
3996
  /**
@@ -4993,6 +5335,35 @@ const CommonMath = {
4993
5335
  // https://github.com/tc39/proposal-arraybuffer-transfer
4994
5336
  transferToFixedLength: fn,
4995
5337
  detached: getter,
5338
+ // https://github.com/endojs/endo/pull/2309#issuecomment-2155513240
5339
+ // to be proposed
5340
+ transferToImmutable: fn,
5341
+ sliceToImmutable: fn,
5342
+ immutable: getter,
5343
+ },
5344
+
5345
+ // If this exists, it is purely an artifact of how we currently shim
5346
+ // `transferToImmutable`. As natively implemented, there would be no
5347
+ // such extra prototype.
5348
+ '%ImmutableArrayBufferPrototype%': {
5349
+ '[[Proto]]': '%ArrayBufferPrototype%',
5350
+ byteLength: getter,
5351
+ slice: fn,
5352
+ // See https://github.com/endojs/endo/tree/master/packages/immutable-arraybuffer#purposeful-violation
5353
+ '@@toStringTag': 'string',
5354
+ // See https://github.com/tc39/proposal-resizablearraybuffer
5355
+ transfer: fn,
5356
+ resize: fn,
5357
+ resizable: getter,
5358
+ maxByteLength: getter,
5359
+ // https://github.com/tc39/proposal-arraybuffer-transfer
5360
+ transferToFixedLength: fn,
5361
+ detached: getter,
5362
+ // https://github.com/endojs/endo/pull/2309#issuecomment-2155513240
5363
+ // to be proposed
5364
+ transferToImmutable: fn,
5365
+ sliceToImmutable: fn,
5366
+ immutable: getter,
4996
5367
  },
4997
5368
 
4998
5369
  // SharedArrayBuffer Objects
@@ -5367,7 +5738,7 @@ const CommonMath = {
5367
5738
  };$h͏_once.permitted(permitted);
5368
5739
  })()
5369
5740
  ,
5370
- // === 13. ses ./src/intrinsics.js ===
5741
+ // === 15. ses ./src/intrinsics.js ===
5371
5742
  ({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)]]]]]);
5372
5743
 
5373
5744
 
@@ -5562,7 +5933,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
5562
5933
  };$h͏_once.getGlobalIntrinsics(getGlobalIntrinsics);
5563
5934
  })()
5564
5935
  ,
5565
- // === 14. ses ./src/permits-intrinsics.js ===
5936
+ // === 16. ses ./src/permits-intrinsics.js ===
5566
5937
  ({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)]]]]]);
5567
5938
 
5568
5939
 
@@ -5856,7 +6227,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
5856
6227
  }$h͏_once.default( removeUnpermittedIntrinsics);
5857
6228
  })()
5858
6229
  ,
5859
- // === 15. ses ./src/tame-function-constructors.js ===
6230
+ // === 17. ses ./src/tame-function-constructors.js ===
5860
6231
  ({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)]]]]]);
5861
6232
 
5862
6233
 
@@ -5999,7 +6370,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
5999
6370
  }$h͏_once.default( tameFunctionConstructors);
6000
6371
  })()
6001
6372
  ,
6002
- // === 16. ses ./src/tame-date-constructor.js ===
6373
+ // === 18. ses ./src/tame-date-constructor.js ===
6003
6374
  ({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)]]]]]);
6004
6375
 
6005
6376
 
@@ -6129,7 +6500,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6129
6500
  }$h͏_once.default( tameDateConstructor);
6130
6501
  })()
6131
6502
  ,
6132
- // === 17. ses ./src/tame-math-object.js ===
6503
+ // === 19. ses ./src/tame-math-object.js ===
6133
6504
  ({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)]]]]]);
6134
6505
 
6135
6506
 
@@ -6173,7 +6544,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6173
6544
  }$h͏_once.default( tameMathObject);
6174
6545
  })()
6175
6546
  ,
6176
- // === 18. ses ./src/tame-regexp-constructor.js ===
6547
+ // === 20. ses ./src/tame-regexp-constructor.js ===
6177
6548
  ({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)]]]]]);
6178
6549
 
6179
6550
 
@@ -6184,9 +6555,6 @@ function sampleGlobals(globalObject, newPropertyNames) {
6184
6555
 
6185
6556
 
6186
6557
  function tameRegExpConstructor(regExpTaming = 'safe') {
6187
- if (regExpTaming !== 'safe' && regExpTaming !== 'unsafe') {
6188
- throw TypeError(`unrecognized regExpTaming ${regExpTaming}`);
6189
- }
6190
6558
  const RegExpPrototype = FERAL_REG_EXP.prototype;
6191
6559
 
6192
6560
  const makeRegExpConstructor = (_ = {}) => {
@@ -6244,17 +6612,19 @@ function sampleGlobals(globalObject, newPropertyNames) {
6244
6612
  }$h͏_once.default( tameRegExpConstructor);
6245
6613
  })()
6246
6614
  ,
6247
- // === 19. ses ./src/enablements.js ===
6615
+ // === 21. ses ./src/enablements.js ===
6248
6616
  ({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)]]]]]);
6249
6617
 
6250
6618
  /**
6251
- * @module Exports {@code enablements}, a recursively defined
6619
+ * Exports {@code enablements}, a recursively defined
6252
6620
  * JSON record defining the optimum set of intrinsics properties
6253
6621
  * that need to be "repaired" before hardening is applied on
6254
6622
  * enviromments subject to the override mistake.
6255
6623
  *
6256
6624
  * @author JF Paradis
6257
6625
  * @author Mark S. Miller
6626
+ *
6627
+ * @module
6258
6628
  */
6259
6629
 
6260
6630
  /**
@@ -6489,7 +6859,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6489
6859
  };$h͏_once.severeEnablements(severeEnablements);
6490
6860
  })()
6491
6861
  ,
6492
- // === 20. ses ./src/enable-property-overrides.js ===
6862
+ // === 22. ses ./src/enable-property-overrides.js ===
6493
6863
  ({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)]]]]]);
6494
6864
 
6495
6865
 
@@ -6703,7 +7073,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6703
7073
  }$h͏_once.default( enablePropertyOverrides);
6704
7074
  })()
6705
7075
  ,
6706
- // === 21. ses ./src/tame-locale-methods.js ===
7076
+ // === 23. ses ./src/tame-locale-methods.js ===
6707
7077
  ({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)]]]]]);
6708
7078
 
6709
7079
 
@@ -6750,9 +7120,6 @@ const nonLocaleCompare = tamedMethods.localeCompare;
6750
7120
  const numberToString = tamedMethods.toString;
6751
7121
 
6752
7122
  function tameLocaleMethods(intrinsics, localeTaming = 'safe') {
6753
- if (localeTaming !== 'safe' && localeTaming !== 'unsafe') {
6754
- throw TypeError(`unrecognized localeTaming ${localeTaming}`);
6755
- }
6756
7123
  if (localeTaming === 'unsafe') {
6757
7124
  return;
6758
7125
  }
@@ -6787,15 +7154,16 @@ const numberToString = tamedMethods.toString;
6787
7154
  }$h͏_once.default( tameLocaleMethods);
6788
7155
  })()
6789
7156
  ,
6790
- // === 22. ses ./src/make-eval-function.js ===
7157
+ // === 24. ses ./src/make-eval-function.js ===
6791
7158
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/**
6792
7159
  * makeEvalFunction()
6793
7160
  * A safe version of the native eval function which relies on
6794
- * the safety of safeEvaluate for confinement.
7161
+ * the safety of `safe-eval` for confinement, unless `no-eval`
7162
+ * is specified (then a TypeError is thrown on use).
6795
7163
  *
6796
- * @param {Function} safeEvaluate
7164
+ * @param {Function} evaluator
6797
7165
  */
6798
- const makeEvalFunction = safeEvaluate => {
7166
+ const makeEvalFunction = evaluator => {
6799
7167
  // We use the concise method syntax to create an eval without a
6800
7168
  // [[Construct]] behavior (such that the invocation "new eval()" throws
6801
7169
  // TypeError: eval is not a constructor"), but which still accepts a
@@ -6809,7 +7177,7 @@ const numberToString = tamedMethods.toString;
6809
7177
  // rule. Track.
6810
7178
  return source;
6811
7179
  }
6812
- return safeEvaluate(source);
7180
+ return evaluator(source);
6813
7181
  },
6814
7182
  }.eval;
6815
7183
 
@@ -6817,7 +7185,7 @@ const numberToString = tamedMethods.toString;
6817
7185
  };$h͏_once.makeEvalFunction(makeEvalFunction);
6818
7186
  })()
6819
7187
  ,
6820
- // === 23. ses ./src/make-function-constructor.js ===
7188
+ // === 25. ses ./src/make-function-constructor.js ===
6821
7189
  ({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)]]]]]);
6822
7190
 
6823
7191
 
@@ -6832,9 +7200,10 @@ const { Fail } = assert;
6832
7200
  /*
6833
7201
  * makeFunctionConstructor()
6834
7202
  * A safe version of the native Function which relies on
6835
- * the safety of safeEvaluate for confinement.
7203
+ * the safety of `safe-eval` for confinement, unless `no-eval`
7204
+ * is specified (then a TypeError is thrown on use).
6836
7205
  */
6837
- const makeFunctionConstructor = safeEvaluate => {
7206
+ const makeFunctionConstructor = evaluator => {
6838
7207
  // Define an unused parameter to ensure Function.length === 1
6839
7208
  const newFunction = function Function(_body) {
6840
7209
  // Sanitize all parameters at the entry point.
@@ -6874,7 +7243,7 @@ const { Fail } = assert;
6874
7243
  // TODO: since we create an anonymous function, the 'this' value
6875
7244
  // isn't bound to the global object as per specs, but set as undefined.
6876
7245
  const src = `(function anonymous(${parameters}\n) {\n${bodyText}\n})`;
6877
- return safeEvaluate(src);
7246
+ return evaluator(src);
6878
7247
  };
6879
7248
 
6880
7249
  defineProperties(newFunction, {
@@ -6892,13 +7261,13 @@ const { Fail } = assert;
6892
7261
  getPrototypeOf(FERAL_FUNCTION) === FERAL_FUNCTION.prototype ||
6893
7262
  Fail`Function prototype is the same accross compartments`;
6894
7263
  getPrototypeOf(newFunction) === FERAL_FUNCTION.prototype ||
6895
- Fail`Function constructor prototype is the same accross compartments`;
7264
+ Fail`Function constructor prototype is the same across compartments`;
6896
7265
 
6897
7266
  return newFunction;
6898
7267
  };$h͏_once.makeFunctionConstructor(makeFunctionConstructor);
6899
7268
  })()
6900
7269
  ,
6901
- // === 24. ses ./src/global-object.js ===
7270
+ // === 26. ses ./src/global-object.js ===
6902
7271
  ({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)]]]]]);
6903
7272
 
6904
7273
 
@@ -7076,7 +7445,7 @@ const { Fail } = assert;
7076
7445
  };$h͏_once.setGlobalObjectEvaluators(setGlobalObjectEvaluators);
7077
7446
  })()
7078
7447
  ,
7079
- // === 25. ses ./src/strict-scope-terminator.js ===
7448
+ // === 27. ses ./src/strict-scope-terminator.js ===
7080
7449
  ({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)]]]]]);
7081
7450
 
7082
7451
 
@@ -7178,7 +7547,7 @@ const scopeProxyHandlerProperties = {
7178
7547
  );$h͏_once.strictScopeTerminator(strictScopeTerminator);
7179
7548
  })()
7180
7549
  ,
7181
- // === 26. ses ./src/sloppy-globals-scope-terminator.js ===
7550
+ // === 28. ses ./src/sloppy-globals-scope-terminator.js ===
7182
7551
  ({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)]]]]]);
7183
7552
 
7184
7553
 
@@ -7242,7 +7611,7 @@ const objTarget = freeze({ __proto__: null });
7242
7611
  freeze(createSloppyGlobalsScopeTerminator);
7243
7612
  })()
7244
7613
  ,
7245
- // === 27. ses ./src/eval-scope.js ===
7614
+ // === 29. ses ./src/eval-scope.js ===
7246
7615
  ({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)]]]]]);
7247
7616
 
7248
7617
 
@@ -7334,7 +7703,7 @@ const { Fail } = assert;
7334
7703
  };$h͏_once.makeEvalScopeKit(makeEvalScopeKit);
7335
7704
  })()
7336
7705
  ,
7337
- // === 28. ses ./src/get-source-url.js ===
7706
+ // === 30. ses ./src/get-source-url.js ===
7338
7707
  ({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)]]]]]);
7339
7708
 
7340
7709
  // Captures a key and value of the form #key=value or @key=value
@@ -7387,7 +7756,7 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
7387
7756
  };$h͏_once.getSourceURL(getSourceURL);
7388
7757
  })()
7389
7758
  ,
7390
- // === 29. ses ./src/transforms.js ===
7759
+ // === 31. ses ./src/transforms.js ===
7391
7760
  ({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)]]]]]);
7392
7761
 
7393
7762
 
@@ -7657,7 +8026,7 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
7657
8026
  });$h͏_once.transforms(transforms);
7658
8027
  })()
7659
8028
  ,
7660
- // === 30. ses ./src/scope-constants.js ===
8029
+ // === 32. ses ./src/scope-constants.js ===
7661
8030
  ({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)]]]]]);
7662
8031
 
7663
8032
 
@@ -7840,7 +8209,7 @@ function isImmutableDataProperty(obj, name) {
7840
8209
  };$h͏_once.getScopeConstants(getScopeConstants);
7841
8210
  })()
7842
8211
  ,
7843
- // === 31. ses ./src/make-evaluate.js ===
8212
+ // === 33. ses ./src/make-evaluate.js ===
7844
8213
  ({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)]]]]]);
7845
8214
 
7846
8215
 
@@ -7953,7 +8322,7 @@ function buildOptimizer(constants, name) {
7953
8322
  };$h͏_once.makeEvaluate(makeEvaluate);
7954
8323
  })()
7955
8324
  ,
7956
- // === 32. ses ./src/make-safe-evaluator.js ===
8325
+ // === 34. ses ./src/make-safe-evaluator.js ===
7957
8326
  ({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)]]]]]);
7958
8327
 
7959
8328
 
@@ -8068,7 +8437,7 @@ const { Fail } = assert;
8068
8437
  };$h͏_once.makeSafeEvaluator(makeSafeEvaluator);
8069
8438
  })()
8070
8439
  ,
8071
- // === 33. ses ./src/tame-function-tostring.js ===
8440
+ // === 35. ses ./src/tame-function-tostring.js ===
8072
8441
  ({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)]]]]]);
8073
8442
 
8074
8443
 
@@ -8121,7 +8490,7 @@ let markVirtualizedNativeFunction;
8121
8490
  };$h͏_once.tameFunctionToString(tameFunctionToString);
8122
8491
  })()
8123
8492
  ,
8124
- // === 34. ses ./src/tame-domains.js ===
8493
+ // === 36. ses ./src/tame-domains.js ===
8125
8494
  ({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);
8126
8495
 
8127
8496
 
@@ -8132,10 +8501,6 @@ let markVirtualizedNativeFunction;
8132
8501
 
8133
8502
 
8134
8503
  function tameDomains(domainTaming = 'safe') {
8135
- if (domainTaming !== 'safe' && domainTaming !== 'unsafe') {
8136
- throw TypeError(`unrecognized domainTaming ${domainTaming}`);
8137
- }
8138
-
8139
8504
  if (domainTaming === 'unsafe') {
8140
8505
  return;
8141
8506
  }
@@ -8169,7 +8534,7 @@ let markVirtualizedNativeFunction;
8169
8534
  }
8170
8535
  })()
8171
8536
  ,
8172
- // === 35. ses ./src/tame-module-source.js ===
8537
+ // === 37. ses ./src/tame-module-source.js ===
8173
8538
  ({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)]]]]]);
8174
8539
 
8175
8540
 
@@ -8223,7 +8588,7 @@ let markVirtualizedNativeFunction;
8223
8588
  };$h͏_once.tameModuleSource(tameModuleSource);
8224
8589
  })()
8225
8590
  ,
8226
- // === 36. ses ./src/error/console.js ===
8591
+ // === 38. ses ./src/error/console.js ===
8227
8592
  ({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)]]]]]);
8228
8593
 
8229
8594
 
@@ -8767,7 +9132,7 @@ freeze(defineCausalConsoleFromLogger);
8767
9132
  freeze(filterConsole);
8768
9133
  })()
8769
9134
  ,
8770
- // === 37. ses ./src/error/unhandled-rejection.js ===
9135
+ // === 39. ses ./src/error/unhandled-rejection.js ===
8771
9136
  ({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)]]]]]);
8772
9137
 
8773
9138
 
@@ -8892,7 +9257,7 @@ freeze(filterConsole);
8892
9257
  };$h͏_once.makeRejectionHandlers(makeRejectionHandlers);
8893
9258
  })()
8894
9259
  ,
8895
- // === 38. ses ./src/error/tame-console.js ===
9260
+ // === 40. ses ./src/error/tame-console.js ===
8896
9261
  ({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)]]]]]);
8897
9262
 
8898
9263
 
@@ -8936,10 +9301,6 @@ const wrapLogger = (logger, thisArg) =>
8936
9301
  unhandledRejectionTrapping = 'report',
8937
9302
  optGetStackString = undefined,
8938
9303
  ) => {
8939
- consoleTaming === 'safe' ||
8940
- consoleTaming === 'unsafe' ||
8941
- failFast(`unrecognized consoleTaming ${consoleTaming}`);
8942
-
8943
9304
  let loggedErrorHandler;
8944
9305
  if (optGetStackString === undefined) {
8945
9306
  loggedErrorHandler = defaultHandler;
@@ -9096,7 +9457,7 @@ const wrapLogger = (logger, thisArg) =>
9096
9457
  };$h͏_once.tameConsole(tameConsole);
9097
9458
  })()
9098
9459
  ,
9099
- // === 39. ses ./src/error/tame-v8-error-constructor.js ===
9460
+ // === 41. ses ./src/error/tame-v8-error-constructor.js ===
9100
9461
  ({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)]]]]]);
9101
9462
 
9102
9463
 
@@ -9170,10 +9531,9 @@ const FILENAME_NODE_DEPENDENTS_CENSOR = /\/node_modules\//;
9170
9531
  // stack traces.
9171
9532
  const FILENAME_NODE_INTERNALS_CENSOR = /^(?:node:)?internal\//;
9172
9533
 
9173
- // Frames within the `assert.js` package should be dropped from
9174
- // concise stack traces, as these are just steps towards creating the
9175
- // error object in question.
9176
- const FILENAME_ASSERT_CENSOR = /\/packages\/ses\/src\/error\/assert.js$/;
9534
+ // Frames within SES `assert.js` should be dropped from concise stack traces, as
9535
+ // these are just steps towards creating the error object in question.
9536
+ const FILENAME_ASSERT_CENSOR = /\/packages\/ses\/src\/error\/assert\.js$/;
9177
9537
 
9178
9538
  // Frames within the `eventual-send` shim should be dropped so that concise
9179
9539
  // deep stacks omit the internals of the eventual-sending mechanism causing
@@ -9182,6 +9542,10 @@ const FILENAME_ASSERT_CENSOR = /\/packages\/ses\/src\/error\/assert.js$/;
9182
9542
  // Endo, so this rule will be of general interest.
9183
9543
  const FILENAME_EVENTUAL_SEND_CENSOR = /\/packages\/eventual-send\/src\//;
9184
9544
 
9545
+ // Frames within the `ses-ava` package should be dropped from concise stack
9546
+ // traces, as they just support exposing error details to AVA.
9547
+ const FILENAME_SES_AVA_CENSOR = /\/packages\/ses-ava\/src\/ses-ava-test\.js$/;
9548
+
9185
9549
  // Any stack frame whose `fileName` matches any of these censor patterns
9186
9550
  // will be omitted from concise stacks.
9187
9551
  // TODO Enable users to configure FILENAME_CENSORS via `lockdown` options.
@@ -9190,6 +9554,7 @@ const FILENAME_CENSORS = [
9190
9554
  FILENAME_NODE_INTERNALS_CENSOR,
9191
9555
  FILENAME_ASSERT_CENSOR,
9192
9556
  FILENAME_EVENTUAL_SEND_CENSOR,
9557
+ FILENAME_SES_AVA_CENSOR,
9193
9558
  ];
9194
9559
 
9195
9560
  // Should a stack frame with this as its fileName be included in a concise
@@ -9213,34 +9578,64 @@ const FILENAME_CENSORS = [
9213
9578
  // likely url-path prefix, ending in a `/.../` should get dropped.
9214
9579
  // Anything to the left of the likely path text is kept.
9215
9580
  // Everything to the right of `/.../` is kept. Thus
9216
- // `'Object.bar (/vat-v1/.../eventual-send/test/test-deep-send.js:13:21)'`
9581
+ // `'Object.bar (/vat-v1/.../eventual-send/test/deep-send.test.js:13:21)'`
9217
9582
  // simplifies to
9218
- // `'Object.bar (eventual-send/test/test-deep-send.js:13:21)'`.
9583
+ // `'Object.bar (eventual-send/test/deep-send.test.js:13:21)'`.
9219
9584
  //
9220
9585
  // See thread starting at
9221
9586
  // https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
9222
- $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSES_PATTERN=/^((?:.*[( ])?)[:/\w_-]*\/\.\.\.\/(.+)$/;
9587
+ $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSIS_PATTERN1=/^((?:.*[( ])?)[:/\w_-]*\/\.\.\.\/(.+)$/;
9588
+
9589
+ // The ad-hoc rule of the current pattern is that any likely-file-path or
9590
+ // likely url-path prefix consisting of `.../` should get dropped.
9591
+ // Anything to the left of the likely path text is kept.
9592
+ // Everything to the right of `.../` is kept. Thus
9593
+ // `'Object.bar (.../eventual-send/test/deep-send.test.js:13:21)'`
9594
+ // simplifies to
9595
+ // `'Object.bar (eventual-send/test/deep-send.test.js:13:21)'`.
9596
+ //
9597
+ // See thread starting at
9598
+ // https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
9599
+ const CALLSITE_ELLIPSIS_PATTERN2 = /^((?:.*[( ])?)\.\.\.\/(.+)$/;
9223
9600
 
9224
9601
  // The ad-hoc rule of the current pattern is that any likely-file-path or
9225
9602
  // likely url-path prefix, ending in a `/` and prior to `package/` should get
9226
9603
  // dropped.
9227
9604
  // Anything to the left of the likely path prefix text is kept. `package/` and
9228
9605
  // everything to its right is kept. Thus
9229
- // `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/test-deep-send.js:13:21)'`
9606
+ // `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/deep-send.test.js:13:21)'`
9230
9607
  // simplifies to
9231
- // `'Object.bar (packages/eventual-send/test/test-deep-send.js:13:21)'`.
9608
+ // `'Object.bar (packages/eventual-send/test/deep-send.test.js:13:21)'`.
9232
9609
  // Note that `/packages/` is a convention for monorepos encouraged by
9233
9610
  // lerna.
9234
9611
  const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
9235
9612
 
9613
+ // The ad-hoc rule of the current pattern is that any likely-file-path or
9614
+ // likely url-path prefix of the form `file://` but not `file:///` gets
9615
+ // dropped.
9616
+ // Anything to the left of the likely path prefix text is kept. Everything to
9617
+ // the right of `file://` is kept. Thus
9618
+ // `'Object.bar (file:///Users/markmiller/src/ongithub/endojs/endo/packages/eventual-send/test/deep-send.test.js:13:21)'` is unchanged but
9619
+ // `'Object.bar (file://test/deep-send.test.js:13:21)'`
9620
+
9621
+ // simplifies to
9622
+ // `'Object.bar (test/deep-send.test.js:13:21)'`.
9623
+ // The reason is that `file:///` usually precedes an absolute path which is
9624
+ // clickable without removing the `file:///`, whereas `file://` usually precedes
9625
+ // a relative path which, for whatever vscode reason, is not clickable until the
9626
+ // `file://` is removed.
9627
+ const CALLSITE_FILE_2SLASH_PATTERN = /^((?:.*[( ])?)file:\/\/([^/].*)$/;
9628
+
9236
9629
  // The use of these callSite patterns below assumes that any match will bind
9237
9630
  // capture groups containing the parts of the original string we want
9238
9631
  // to keep. The parts outside those capture groups will be dropped from concise
9239
9632
  // stacks.
9240
9633
  // TODO Enable users to configure CALLSITE_PATTERNS via `lockdown` options.
9241
9634
  const CALLSITE_PATTERNS = [
9242
- CALLSITE_ELLIPSES_PATTERN,
9635
+ CALLSITE_ELLIPSIS_PATTERN1,
9636
+ CALLSITE_ELLIPSIS_PATTERN2,
9243
9637
  CALLSITE_PACKAGES_PATTERN,
9638
+ CALLSITE_FILE_2SLASH_PATTERN,
9244
9639
  ];
9245
9640
 
9246
9641
  // For a stack frame that should be included in a concise stack trace, if
@@ -9248,6 +9643,9 @@ const CALLSITE_PATTERNS = [
9248
9643
  // possibly-shorter stringified stack frame that should be shown instead.
9249
9644
  // Exported only so it can be unit tested.
9250
9645
  // TODO Move so that it applies not just to v8.
9646
+ /**
9647
+ * @param {string} callSiteString
9648
+ */
9251
9649
  const shortenCallSiteString = callSiteString => {
9252
9650
  for (const filter of CALLSITE_PATTERNS) {
9253
9651
  const match = regexpExec(filter, callSiteString);
@@ -9274,18 +9672,24 @@ const CALLSITE_PATTERNS = [
9274
9672
 
9275
9673
  const originalCaptureStackTrace = OriginalError.captureStackTrace;
9276
9674
 
9675
+ const omitFrames =
9676
+ stackFiltering === 'concise' || stackFiltering === 'omit-frames';
9677
+
9678
+ const shortenPaths =
9679
+ stackFiltering === 'concise' || stackFiltering === 'shorten-paths';
9680
+
9277
9681
  // const callSiteFilter = _callSite => true;
9278
9682
  const callSiteFilter = callSite => {
9279
- if (stackFiltering === 'verbose') {
9280
- return true;
9683
+ if (omitFrames) {
9684
+ // eslint-disable-next-line @endo/no-polymorphic-call
9685
+ return filterFileName(callSite.getFileName());
9281
9686
  }
9282
- // eslint-disable-next-line @endo/no-polymorphic-call
9283
- return filterFileName(callSite.getFileName());
9687
+ return true;
9284
9688
  };
9285
9689
 
9286
9690
  const callSiteStringifier = callSite => {
9287
9691
  let callSiteString = `${callSite}`;
9288
- if (stackFiltering === 'concise') {
9692
+ if (shortenPaths) {
9289
9693
  callSiteString = shortenCallSiteString(callSiteString);
9290
9694
  }
9291
9695
  return `\n at ${callSiteString}`;
@@ -9442,9 +9846,8 @@ const CALLSITE_PATTERNS = [
9442
9846
  };$h͏_once.tameV8ErrorConstructor(tameV8ErrorConstructor);
9443
9847
  })()
9444
9848
  ,
9445
- // === 40. ses ./src/error/tame-error-constructor.js ===
9446
- ({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)]]]]]);
9447
-
9849
+ // === 42. ses ./src/error/tame-error-constructor.js ===
9850
+ ({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)]]]]]);
9448
9851
 
9449
9852
 
9450
9853
 
@@ -9481,16 +9884,6 @@ let initialGetStackString = tamedMethods.getStackString;
9481
9884
  errorTaming = 'safe',
9482
9885
  stackFiltering = 'concise',
9483
9886
  ) {
9484
- if (
9485
- errorTaming !== 'safe' &&
9486
- errorTaming !== 'unsafe' &&
9487
- errorTaming !== 'unsafe-debug'
9488
- ) {
9489
- throw TypeError(`unrecognized errorTaming ${errorTaming}`);
9490
- }
9491
- if (stackFiltering !== 'concise' && stackFiltering !== 'verbose') {
9492
- throw TypeError(`unrecognized stackFiltering ${stackFiltering}`);
9493
- }
9494
9887
  const ErrorPrototype = FERAL_ERROR.prototype;
9495
9888
 
9496
9889
  const { captureStackTrace: originalCaptureStackTrace } = FERAL_ERROR;
@@ -9740,7 +10133,7 @@ let initialGetStackString = tamedMethods.getStackString;
9740
10133
  }$h͏_once.default( tameErrorConstructor);
9741
10134
  })()
9742
10135
  ,
9743
- // === 41. ses ./src/module-load.js ===
10136
+ // === 43. ses ./src/module-load.js ===
9744
10137
  ({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)]]]]]);
9745
10138
 
9746
10139
 
@@ -10250,18 +10643,17 @@ const memoizedLoadWithErrorAnnotation = (
10250
10643
  return moduleLoading;
10251
10644
  };
10252
10645
 
10253
- const asyncJobQueue = () => {
10646
+ const asyncJobQueue = (errors = []) => {
10254
10647
  /** @type {Set<Promise<undefined>>} */
10255
10648
  const pendingJobs = new Set();
10256
- /** @type {Array<Error>} */
10257
- const errors = [];
10258
10649
 
10259
10650
  /**
10260
10651
  * Enqueues a job that starts immediately but won't be awaited until drainQueue is called.
10261
10652
  *
10262
- * @template {any[]} T
10263
- * @param {(...args: T)=>Promise<*>} func
10264
- * @param {T} args
10653
+ * @template {(...args: any[]) => Promise<void>} F
10654
+ * @param {F} func - An async function to execute
10655
+ * @param {Parameters<F>} args - Arguments to pass to the function
10656
+ * @returns {void}
10265
10657
  */
10266
10658
  const enqueueJob = (func, args) => {
10267
10659
  setAdd(
@@ -10273,8 +10665,6 @@ const asyncJobQueue = () => {
10273
10665
  };
10274
10666
  /**
10275
10667
  * Sequentially awaits pending jobs and returns an array of errors
10276
- *
10277
- * @returns {Promise<Array<Error>>}
10278
10668
  */
10279
10669
  const drainQueue = async () => {
10280
10670
  await null;
@@ -10282,9 +10672,42 @@ const asyncJobQueue = () => {
10282
10672
  // eslint-disable-next-line no-await-in-loop
10283
10673
  await job;
10284
10674
  }
10285
- return errors;
10286
10675
  };
10287
- return { enqueueJob, drainQueue };
10676
+ return { enqueueJob, drainQueue, errors };
10677
+ };
10678
+
10679
+ const syncJobQueue = (errors = []) => {
10680
+ let current = [];
10681
+ let next = [];
10682
+
10683
+ /**
10684
+ * Enqueues a job
10685
+ *
10686
+ * @template {(...args: any[]) => void} F
10687
+ * @param {F} func - An async function to execute
10688
+ * @param {Parameters<F>} args - Arguments to pass to the function
10689
+ * @returns {void}
10690
+ */
10691
+ const enqueueJob = (func, args) => {
10692
+ arrayPush(next, [func, args]);
10693
+ };
10694
+ const drainQueue = () => {
10695
+ // Attention: load bearing flow order. Calling another enqueued function in the
10696
+ // synchronous usecase must happen after the one that enqueued it has finished.
10697
+ // Jobs enqueued in one pass do not interleave with jobs resulting from them.
10698
+ // It's necessary for efficient memoization and to break cycles.
10699
+ for (const [func, args] of current) {
10700
+ try {
10701
+ func(...args);
10702
+ } catch (error) {
10703
+ arrayPush(errors, error);
10704
+ }
10705
+ }
10706
+ current = next;
10707
+ next = [];
10708
+ if (current.length > 0) drainQueue();
10709
+ };
10710
+ return { enqueueJob, drainQueue, errors };
10288
10711
  };
10289
10712
 
10290
10713
  /**
@@ -10296,7 +10719,8 @@ const throwAggregateError = ({ errors, errorPrefix }) => {
10296
10719
  // Throw an aggregate error if there were any errors.
10297
10720
  if (errors.length > 0) {
10298
10721
  const verbose =
10299
- getenv('COMPARTMENT_LOAD_ERRORS', '', ['verbose']) === 'verbose';
10722
+ /** @type {'' | 'verbose'} */
10723
+ (getenv('COMPARTMENT_LOAD_ERRORS', '', ['verbose'])) === 'verbose';
10300
10724
  throw TypeError(
10301
10725
  `${errorPrefix} (${errors.length} underlying failures: ${arrayJoin(
10302
10726
  arrayMap(errors, error => error.message + (verbose ? error.stack : '')),
@@ -10330,7 +10754,7 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10330
10754
  /** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
10331
10755
  const moduleLoads = new Map();
10332
10756
 
10333
- const { enqueueJob, drainQueue } = asyncJobQueue();
10757
+ const { enqueueJob, drainQueue, errors } = asyncJobQueue();
10334
10758
 
10335
10759
  enqueueJob(memoizedLoadWithErrorAnnotation, [
10336
10760
  compartmentPrivateFields,
@@ -10342,8 +10766,7 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10342
10766
  moduleLoads,
10343
10767
  ]);
10344
10768
 
10345
- // Drain pending jobs queue and throw an aggregate error
10346
- const errors = await drainQueue();
10769
+ await drainQueue();
10347
10770
 
10348
10771
  throwAggregateError({
10349
10772
  errors,
@@ -10374,16 +10797,7 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10374
10797
  /** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
10375
10798
  const moduleLoads = new Map();
10376
10799
 
10377
- /** @type {Array<Error>} */
10378
- const errors = [];
10379
-
10380
- const enqueueJob = (func, args) => {
10381
- try {
10382
- func(...args);
10383
- } catch (error) {
10384
- arrayPush(errors, error);
10385
- }
10386
- };
10800
+ const { enqueueJob, drainQueue, errors } = syncJobQueue();
10387
10801
 
10388
10802
  enqueueJob(memoizedLoadWithErrorAnnotation, [
10389
10803
  compartmentPrivateFields,
@@ -10395,6 +10809,8 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10395
10809
  moduleLoads,
10396
10810
  ]);
10397
10811
 
10812
+ drainQueue();
10813
+
10398
10814
  throwAggregateError({
10399
10815
  errors,
10400
10816
  errorPrefix: `Failed to load module ${q(moduleSpecifier)} in package ${q(
@@ -10404,7 +10820,7 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10404
10820
  };$h͏_once.loadNow(loadNow);
10405
10821
  })()
10406
10822
  ,
10407
- // === 42. ses ./src/module-proxy.js ===
10823
+ // === 44. ses ./src/module-proxy.js ===
10408
10824
  ({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)]]]]]);
10409
10825
 
10410
10826
 
@@ -10607,7 +11023,7 @@ const { quote: q } = assert;
10607
11023
  };$h͏_once.getDeferredExports(getDeferredExports);
10608
11024
  })()
10609
11025
  ,
10610
- // === 43. ses ./src/compartment-evaluate.js ===
11026
+ // === 45. ses ./src/compartment-evaluate.js ===
10611
11027
  ({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)]]]]]);
10612
11028
 
10613
11029
 
@@ -10703,7 +11119,7 @@ const { quote: q } = assert;
10703
11119
  };$h͏_once.compartmentEvaluate(compartmentEvaluate);
10704
11120
  })()
10705
11121
  ,
10706
- // === 44. ses ./src/module-instance.js ===
11122
+ // === 46. ses ./src/module-instance.js ===
10707
11123
  ({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)]]]]]);
10708
11124
 
10709
11125
 
@@ -11203,7 +11619,7 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
11203
11619
  };$h͏_once.makeModuleInstance(makeModuleInstance);
11204
11620
  })()
11205
11621
  ,
11206
- // === 45. ses ./src/module-link.js ===
11622
+ // === 47. ses ./src/module-link.js ===
11207
11623
  ({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)]]]]]);
11208
11624
 
11209
11625
 
@@ -11365,7 +11781,7 @@ function validateModuleSource(moduleSource, moduleSpecifier) {
11365
11781
  };$h͏_once.instantiate(instantiate);
11366
11782
  })()
11367
11783
  ,
11368
- // === 46. ses ./src/compartment.js ===
11784
+ // === 48. ses ./src/compartment.js ===
11369
11785
  ({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)]]]]]);
11370
11786
 
11371
11787
 
@@ -11434,17 +11850,50 @@ function validateModuleSource(moduleSource, moduleSpecifier) {
11434
11850
 
11435
11851
 
11436
11852
 
11437
- /** @import {ModuleDescriptor, ModuleExportsNamespace} from '../types.js' */
11438
11853
 
11439
- // moduleAliases associates every public module exports namespace with its
11440
- // corresponding compartment and specifier so they can be used to link modules
11441
- // across compartments.
11442
- // The mechanism to thread an alias is to use the compartment.module function
11443
- // to obtain the exports namespace of a foreign module and pass it into another
11444
- // compartment's moduleMap constructor option.
11854
+ /**
11855
+ * @import {ImportHook, ImportMetaHook, ImportNowHook, ModuleDescriptor, ModuleExportsNamespace, ModuleMap, ModuleMapHook, ResolveHook, ModuleSource, CompartmentOptions} from '../types.js'
11856
+ * @import {Transform} from './lockdown.js'
11857
+ * @import {DeferredExports} from './module-proxy.js'
11858
+ */
11859
+
11860
+ /**
11861
+ * Associates every public module exports namespace with its corresponding
11862
+ * compartment and specifier so they can be used to link modules across
11863
+ * compartments. The mechanism to thread an alias is to use the
11864
+ * {@link Compartment.module} function to obtain the exports namespace of a foreign
11865
+ * module and pass it into another compartment's `moduleMap` constructor option
11866
+ * @type {WeakMap<ModuleExportsNamespace, Compartment>}
11867
+ *
11868
+ */
11445
11869
  const moduleAliases = new WeakMap();
11446
11870
 
11447
- // privateFields captures the private state for each compartment.
11871
+ /**
11872
+ * Private fields for `Compartment` instances
11873
+ * @typedef {object} CompartmentFields
11874
+ * @property {string} name
11875
+ * @property {object} globalObject
11876
+ * @property {Array<Transform>} globalTransforms
11877
+ * @property {(source: string, options?: {localTransforms?: Array<Transform>}) => void} safeEvaluate
11878
+ * @property {ResolveHook} resolveHook
11879
+ * @property {ImportHook} importHook
11880
+ * @property {ImportNowHook} importNowHook
11881
+ * @property {ModuleMap} moduleMap
11882
+ * @property {ModuleMapHook} moduleMapHook
11883
+ * @property {ImportMetaHook} importMetaHook
11884
+ * @property {Map<string, ModuleSource>} moduleRecords
11885
+ * @property {Array<Transform>} __shimTransforms__
11886
+ * @property {DeferredExports} deferredExports
11887
+ * @property {Map<string, ModuleDescriptor>} instances
11888
+ * @property {Compartment} [parentCompartment]
11889
+ * @property {boolean} noNamespaceBox
11890
+ * @property {(fullSpecifier: string) => Promise<ModuleExportsNamespace>} compartmentImport
11891
+ */
11892
+
11893
+ /**
11894
+ * Captures the private state for each {@link Compartment}
11895
+ * @type {WeakMap<Compartment, CompartmentFields>}
11896
+ */
11448
11897
  const privateFields = new WeakMap();
11449
11898
 
11450
11899
  const InertCompartment = function Compartment(
@@ -11460,6 +11909,7 @@ const privateFields = new WeakMap();
11460
11909
  /**
11461
11910
  * @param {Compartment} compartment
11462
11911
  * @param {string} specifier
11912
+ * @returns {{namespace: ModuleExportsNamespace}}
11463
11913
  */$h͏_once.InertCompartment(InertCompartment);
11464
11914
  const compartmentImportNow = (compartment, specifier) => {
11465
11915
  const { execute, exportsProxy } = link(
@@ -11472,27 +11922,20 @@ const compartmentImportNow = (compartment, specifier) => {
11472
11922
  return exportsProxy;
11473
11923
  };
11474
11924
 
11925
+ /** @type {Compartment & {constructor: typeof InertCompartment}} */
11475
11926
  const CompartmentPrototype = {
11476
11927
  constructor: InertCompartment,
11477
11928
 
11478
11929
  get globalThis() {
11479
- return weakmapGet(privateFields, this).globalObject;
11930
+ return /** @type {CompartmentFields} */ (weakmapGet(privateFields, this))
11931
+ .globalObject;
11480
11932
  },
11481
11933
 
11482
11934
  get name() {
11483
- return weakmapGet(privateFields, this).name;
11935
+ return /** @type {CompartmentFields} */ (weakmapGet(privateFields, this))
11936
+ .name;
11484
11937
  },
11485
11938
 
11486
- /**
11487
- * @param {string} source is a JavaScript program grammar construction.
11488
- * @param {object} [options]
11489
- * @param {Array<import('./lockdown-shim').Transform>} [options.transforms]
11490
- * @param {boolean} [options.sloppyGlobalsMode]
11491
- * @param {object} [options.__moduleShimLexicals__]
11492
- * @param {boolean} [options.__evadeHtmlCommentTest__]
11493
- * @param {boolean} [options.__evadeImportExpressionTest__]
11494
- * @param {boolean} [options.__rejectSomeDirectEvalExpressions__]
11495
- */
11496
11939
  evaluate(source, options = {}) {
11497
11940
  const compartmentFields = weakmapGet(privateFields, this);
11498
11941
  return compartmentEvaluate(compartmentFields, source, options);
@@ -11514,7 +11957,9 @@ const compartmentImportNow = (compartment, specifier) => {
11514
11957
  },
11515
11958
 
11516
11959
  async import(specifier) {
11517
- const { noNamespaceBox } = weakmapGet(privateFields, this);
11960
+ const { noNamespaceBox } = /** @type {CompartmentFields} */ (
11961
+ weakmapGet(privateFields, this)
11962
+ );
11518
11963
 
11519
11964
  if (typeof specifier !== 'string') {
11520
11965
  throw TypeError('first argument of import() must be a string');
@@ -11553,7 +11998,7 @@ const compartmentImportNow = (compartment, specifier) => {
11553
11998
  }
11554
11999
 
11555
12000
  loadNow(privateFields, moduleAliases, this, specifier);
11556
- return compartmentImportNow(/** @type {Compartment} */ (this), specifier);
12001
+ return compartmentImportNow(this, specifier);
11557
12002
  },
11558
12003
  };
11559
12004
 
@@ -11584,15 +12029,35 @@ defineProperties(InertCompartment, {
11584
12029
  * @returns {Compartment['constructor']}
11585
12030
  */
11586
12031
 
11587
- // In order to facilitate migration from the deprecated signature
11588
- // of the compartment constructor,
11589
- // new Compartent(globals?, modules?, options?)
11590
- // to the new signature:
11591
- // new Compartment(options?)
11592
- // where globals and modules are expressed in the options bag instead of
11593
- // positional arguments, this function detects the temporary sigil __options__
11594
- // on the first argument and coerces compartments arguments into a single
11595
- // compartments object.
12032
+ /**
12033
+ * "Options bag"-style `Compartment` constructor arguments.
12034
+ * @typedef {[options?: CompartmentOptions & { __options__: true }]} CompartmentOptionsArgs
12035
+ */
12036
+
12037
+ /**
12038
+ * Legacy `Compartment` constructor arguments.
12039
+ *
12040
+ * @deprecated
12041
+ * @typedef {[globals?: Map<string, any>, modules?: Map<string, ModuleDescriptor>, options?: CompartmentOptions]} LegacyCompartmentOptionsArgs
12042
+ */
12043
+
12044
+ /**
12045
+ * In order to facilitate migration from the deprecated signature of the
12046
+ * compartment constructor,
12047
+ *
12048
+ * `new Compartent(globals?, modules?, options?)`
12049
+ *
12050
+ * to the new signature:
12051
+ *
12052
+ * `new Compartment(options?)`
12053
+ *
12054
+ * ...where globals and modules are expressed in the options bag instead of
12055
+ * positional arguments, this function detects the temporary sigil __options__
12056
+ * on the first argument and coerces compartments arguments into a single
12057
+ * compartments object.
12058
+ * @param {CompartmentOptionsArgs|LegacyCompartmentOptionsArgs} args
12059
+ * @returns {CompartmentOptions}
12060
+ */
11596
12061
  const compartmentOptions = (...args) => {
11597
12062
  if (args.length === 0) {
11598
12063
  return {};
@@ -11614,7 +12079,7 @@ defineProperties(InertCompartment, {
11614
12079
  globals = /** @type {Map<string, any>} */ ({}),
11615
12080
  modules = /** @type {Map<string, ModuleDescriptor>} */ ({}),
11616
12081
  options = {},
11617
- ] = args;
12082
+ ] = /** @type {LegacyCompartmentOptionsArgs} */ (args);
11618
12083
  assertEqual(
11619
12084
  options.modules,
11620
12085
  undefined,
@@ -11640,6 +12105,10 @@ defineProperties(InertCompartment, {
11640
12105
  markVirtualizedNativeFunction,
11641
12106
  { parentCompartment = undefined, enforceNew = false } = {},
11642
12107
  ) => {
12108
+ /**
12109
+ *
12110
+ * @param {CompartmentOptionsArgs|LegacyCompartmentOptionsArgs} args
12111
+ */
11643
12112
  function Compartment(...args) {
11644
12113
  if (enforceNew && new.target === undefined) {
11645
12114
  throw TypeError(
@@ -11775,8 +12244,9 @@ defineProperties(InertCompartment, {
11775
12244
  };$h͏_once.makeCompartmentConstructor(makeCompartmentConstructor);
11776
12245
  })()
11777
12246
  ,
11778
- // === 47. ses ./src/get-anonymous-intrinsics.js ===
11779
- ({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)]]]]]);
12247
+ // === 49. ses ./src/get-anonymous-intrinsics.js ===
12248
+ ({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)]]]]]);
12249
+
11780
12250
 
11781
12251
 
11782
12252
 
@@ -11944,22 +12414,28 @@ function makeArguments() {
11944
12414
  );
11945
12415
  }
11946
12416
 
12417
+ const ab = new ArrayBuffer(0);
12418
+ // @ts-expect-error TODO How do I add sliceToImmutable to ArrayBuffer type?
12419
+ // eslint-disable-next-line @endo/no-polymorphic-call
12420
+ const iab = ab.sliceToImmutable();
12421
+ const iabProto = getPrototypeOf(iab);
12422
+ if (iabProto !== ArrayBuffer.prototype) {
12423
+ // In a native implementation, these will be the same prototype
12424
+ intrinsics['%ImmutableArrayBufferPrototype%'] = iabProto;
12425
+ }
12426
+
11947
12427
  return intrinsics;
11948
12428
  };$h͏_once.getAnonymousIntrinsics(getAnonymousIntrinsics);
11949
12429
  })()
11950
12430
  ,
11951
- // === 48. ses ./src/tame-harden.js ===
11952
- ({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)]]]]]);
12431
+ // === 50. ses ./src/tame-harden.js ===
12432
+ ({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)]]]]]);
11953
12433
 
11954
12434
 
11955
12435
  /** @import {Harden} from '../types.js'; */
11956
12436
 
11957
12437
  /** @type {(safeHarden: Harden, hardenTaming: 'safe' | 'unsafe') => Harden} */
11958
12438
  const tameHarden = (safeHarden, hardenTaming) => {
11959
- if (hardenTaming !== 'safe' && hardenTaming !== 'unsafe') {
11960
- throw TypeError(`unrecognized fakeHardenOption ${hardenTaming}`);
11961
- }
11962
-
11963
12439
  if (hardenTaming === 'safe') {
11964
12440
  return safeHarden;
11965
12441
  }
@@ -11984,7 +12460,7 @@ function makeArguments() {
11984
12460
  freeze(tameHarden);
11985
12461
  })()
11986
12462
  ,
11987
- // === 49. ses ./src/tame-symbol-constructor.js ===
12463
+ // === 51. ses ./src/tame-symbol-constructor.js ===
11988
12464
  ({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)]]]]]);
11989
12465
 
11990
12466
 
@@ -12051,7 +12527,7 @@ freeze(tameHarden);
12051
12527
  };$h͏_once.tameSymbolConstructor(tameSymbolConstructor);
12052
12528
  })()
12053
12529
  ,
12054
- // === 50. ses ./src/tame-faux-data-properties.js ===
12530
+ // === 52. ses ./src/tame-faux-data-properties.js ===
12055
12531
  ({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)]]]]]);
12056
12532
 
12057
12533
 
@@ -12264,7 +12740,7 @@ const throws = thunk => {
12264
12740
  };$h͏_once.tameFauxDataProperties(tameFauxDataProperties);
12265
12741
  })()
12266
12742
  ,
12267
- // === 51. ses ./src/tame-regenerator-runtime.js ===
12743
+ // === 53. ses ./src/tame-regenerator-runtime.js ===
12268
12744
  ({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)]]]]]);
12269
12745
 
12270
12746
 
@@ -12296,7 +12772,7 @@ const throws = thunk => {
12296
12772
  };$h͏_once.tameRegeneratorRuntime(tameRegeneratorRuntime);
12297
12773
  })()
12298
12774
  ,
12299
- // === 52. ses ./src/shim-arraybuffer-transfer.js ===
12775
+ // === 54. ses ./src/shim-arraybuffer-transfer.js ===
12300
12776
  ({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)]]]]]);
12301
12777
 
12302
12778
 
@@ -12310,7 +12786,6 @@ const throws = thunk => {
12310
12786
 
12311
12787
 
12312
12788
  const shimArrayBufferTransfer = () => {
12313
- // @ts-expect-error TODO extend ArrayBuffer type to include transfer, etc.
12314
12789
  if (typeof arrayBufferPrototype.transfer === 'function') {
12315
12790
  // Assume already exists so does not need to be shimmed.
12316
12791
  // Such conditional shimming is ok in this case since ArrayBuffer.p.transfer
@@ -12385,8 +12860,8 @@ const throws = thunk => {
12385
12860
  };$h͏_once.shimArrayBufferTransfer(shimArrayBufferTransfer);
12386
12861
  })()
12387
12862
  ,
12388
- // === 53. ses ./src/reporting.js ===
12389
- ({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)]]]]]);
12863
+ // === 55. ses ./src/reporting.js ===
12864
+ ({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)]]]]]);
12390
12865
 
12391
12866
 
12392
12867
  /**
@@ -12439,9 +12914,6 @@ const mute = () => {};
12439
12914
  if (reporting === 'none') {
12440
12915
  return makeReportPrinter(mute);
12441
12916
  }
12442
- if (reporting !== 'platform' && reporting !== 'console') {
12443
- throw new TypeError(`Invalid lockdown reporting option: ${reporting}`);
12444
- }
12445
12917
  if (
12446
12918
  reporting === 'console' ||
12447
12919
  globalThis.window === globalThis ||
@@ -12496,8 +12968,9 @@ const mute = () => {};
12496
12968
  };$h͏_once.reportInGroup(reportInGroup);
12497
12969
  })()
12498
12970
  ,
12499
- // === 54. ses ./src/lockdown.js ===
12500
- ({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)]]]]]);
12971
+ // === 56. ses ./src/lockdown.js ===
12972
+ ({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)]]]]]);
12973
+
12501
12974
 
12502
12975
 
12503
12976
 
@@ -12599,10 +13072,32 @@ const safeHarden = makeHardener();
12599
13072
  // only ever need to be called once and that simplifying lockdown will improve
12600
13073
  // the quality of audits.
12601
13074
 
12602
- const assertDirectEvalAvailable = () => {
12603
- let allowed = false;
13075
+ const probeHostEvaluators = () => {
13076
+ let functionAllowed;
13077
+ try {
13078
+ functionAllowed = FERAL_FUNCTION('return true')();
13079
+ } catch (_error) {
13080
+ // We reach here if the Function() constructor is outright forbidden by a
13081
+ // strict Content Security Policy (containing either a `default-src` or a
13082
+ // `script-src` directive), not been implemented in the host, or the host
13083
+ // is configured to throw an exception instead of `new Function`.
13084
+ functionAllowed = false;
13085
+ }
13086
+
13087
+ let evalAllowed;
12604
13088
  try {
12605
- allowed = FERAL_FUNCTION(
13089
+ evalAllowed = FERAL_EVAL('true');
13090
+ } catch (_error) {
13091
+ // We reach here if `eval` is outright forbidden by a strict Content Security Policy,
13092
+ // not implemented in the host, or the host is configured to throw an exception.
13093
+ // We allow this for SES usage that delegates the responsibility to isolate
13094
+ // guest code to production code generation.
13095
+ evalAllowed = false;
13096
+ }
13097
+
13098
+ let directEvalAllowed;
13099
+ if (functionAllowed && evalAllowed) {
13100
+ directEvalAllowed = FERAL_FUNCTION(
12606
13101
  'eval',
12607
13102
  'SES_changed',
12608
13103
  `\
@@ -12614,21 +13109,12 @@ const assertDirectEvalAvailable = () => {
12614
13109
  // and indirect, which generally creates a new global.
12615
13110
  // We are going to throw an exception for failing to initialize SES, but
12616
13111
  // good neighbors clean up.
12617
- if (!allowed) {
13112
+ if (!directEvalAllowed) {
12618
13113
  delete globalThis.SES_changed;
12619
13114
  }
12620
- } catch (_error) {
12621
- // We reach here if eval is outright forbidden by a Content Security Policy.
12622
- // We allow this for SES usage that delegates the responsibility to isolate
12623
- // guest code to production code generation.
12624
- allowed = true;
12625
- }
12626
- if (!allowed) {
12627
- // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_DIRECT_EVAL.md
12628
- throw TypeError(
12629
- `SES cannot initialize unless 'eval' is the original intrinsic 'eval', suitable for direct-eval (dynamically scoped eval) (SES_DIRECT_EVAL)`,
12630
- );
12631
13115
  }
13116
+
13117
+ return { functionAllowed, evalAllowed, directEvalAllowed };
12632
13118
  };
12633
13119
 
12634
13120
  /**
@@ -12651,65 +13137,85 @@ const assertDirectEvalAvailable = () => {
12651
13137
  // The `stackFiltering` is not a safety issue. Rather it is a tradeoff
12652
13138
  // between relevance and completeness of the stack frames shown on the
12653
13139
  // console. Setting`stackFiltering` to `'verbose'` applies no filters, providing
12654
- // the raw stack frames that can be quite versbose. Setting
13140
+ // the raw stack frames that can be quite verbose. Setting
12655
13141
  // `stackFrameFiltering` to`'concise'` limits the display to the stack frame
12656
13142
  // information most likely to be relevant, eliminating distracting frames
12657
13143
  // such as those from the infrastructure. However, the bug you're trying to
12658
- // track down might be in the infrastrure, in which case the `'verbose'` setting
13144
+ // track down might be in the infrastructure, in which case the `'verbose'` setting
12659
13145
  // is useful. See
12660
13146
  // [`stackFiltering` options](https://github.com/Agoric/SES-shim/blob/master/packages/ses/docs/lockdown.md#stackfiltering-options)
12661
13147
  // for an explanation.
12662
13148
 
12663
13149
  const {
12664
- errorTaming = getenv('LOCKDOWN_ERROR_TAMING', 'safe'),
12665
- errorTrapping = /** @type {"platform" | "none" | "report" | "abort" | "exit"} */ (
12666
- getenv('LOCKDOWN_ERROR_TRAPPING', 'platform')
13150
+ errorTaming = /** @type {'safe' | 'unsafe' | 'unsafe-debug'} */ (
13151
+ getenv('LOCKDOWN_ERROR_TAMING', 'safe', ['unsafe', 'unsafe-debug'])
12667
13152
  ),
12668
- reporting = /** @type {"platform" | "console" | "none"} */ (
12669
- getenv('LOCKDOWN_REPORTING', 'platform')
13153
+ errorTrapping = /** @type {'platform' | 'none' | 'report' | 'abort' | 'exit'} */ (
13154
+ getenv('LOCKDOWN_ERROR_TRAPPING', 'platform', [
13155
+ 'none',
13156
+ 'report',
13157
+ 'abort',
13158
+ 'exit',
13159
+ ])
12670
13160
  ),
12671
- unhandledRejectionTrapping = /** @type {"none" | "report"} */ (
12672
- getenv('LOCKDOWN_UNHANDLED_REJECTION_TRAPPING', 'report')
13161
+ reporting = /** @type {'platform' | 'console' | 'none'} */ (
13162
+ getenv('LOCKDOWN_REPORTING', 'platform', ['console', 'none'])
13163
+ ),
13164
+ unhandledRejectionTrapping = /** @type {'none' | 'report'} */ (
13165
+ getenv('LOCKDOWN_UNHANDLED_REJECTION_TRAPPING', 'report', ['none'])
13166
+ ),
13167
+ regExpTaming = /** @type {'safe' | 'unsafe'} */ (
13168
+ getenv('LOCKDOWN_REGEXP_TAMING', 'safe', ['unsafe'])
13169
+ ),
13170
+ localeTaming = /** @type {'safe' | 'unsafe'} */ (
13171
+ getenv('LOCKDOWN_LOCALE_TAMING', 'safe', ['unsafe'])
12673
13172
  ),
12674
- regExpTaming = getenv('LOCKDOWN_REGEXP_TAMING', 'safe'),
12675
- localeTaming = getenv('LOCKDOWN_LOCALE_TAMING', 'safe'),
12676
-
12677
13173
  consoleTaming = /** @type {'unsafe' | 'safe'} */ (
12678
- getenv('LOCKDOWN_CONSOLE_TAMING', 'safe')
13174
+ getenv('LOCKDOWN_CONSOLE_TAMING', 'safe', ['unsafe'])
12679
13175
  ),
12680
13176
  overrideTaming = /** @type {'moderate' | 'min' | 'severe'} */ (
12681
- getenv('LOCKDOWN_OVERRIDE_TAMING', 'moderate')
13177
+ getenv('LOCKDOWN_OVERRIDE_TAMING', 'moderate', ['min', 'severe'])
13178
+ ),
13179
+ stackFiltering = /** @type {'concise' | 'omit-frames' | 'shorten-paths' | 'verbose'} */ (
13180
+ getenv('LOCKDOWN_STACK_FILTERING', 'concise', [
13181
+ 'omit-frames',
13182
+ 'shorten-paths',
13183
+ 'verbose',
13184
+ ])
12682
13185
  ),
12683
- stackFiltering = getenv('LOCKDOWN_STACK_FILTERING', 'concise'),
12684
- domainTaming = getenv('LOCKDOWN_DOMAIN_TAMING', 'safe'),
12685
- evalTaming = getenv('LOCKDOWN_EVAL_TAMING', 'safe-eval'),
12686
- overrideDebug = arrayFilter(
12687
- stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','),
12688
- /** @param {string} debugName */
12689
- debugName => debugName !== '',
13186
+ domainTaming = /** @type {'safe' | 'unsafe'} */ (
13187
+ getenv('LOCKDOWN_DOMAIN_TAMING', 'safe', ['unsafe'])
12690
13188
  ),
12691
- legacyRegeneratorRuntimeTaming = getenv(
12692
- 'LOCKDOWN_LEGACY_REGENERATOR_RUNTIME_TAMING',
12693
- 'safe',
13189
+ evalTaming = /** @type {'safe-eval' | 'unsafe-eval' | 'no-eval'} */ (
13190
+ getenv('LOCKDOWN_EVAL_TAMING', 'safe-eval', [
13191
+ 'unsafe-eval',
13192
+ 'no-eval',
13193
+ // deprecated
13194
+ 'safeEval',
13195
+ 'unsafeEval',
13196
+ 'noEval',
13197
+ ])
13198
+ ),
13199
+ overrideDebug = /** @type {string[]} */ (
13200
+ arrayFilter(
13201
+ stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','),
13202
+ /** @param {string} debugName */
13203
+ debugName => debugName !== '',
13204
+ )
13205
+ ),
13206
+ legacyRegeneratorRuntimeTaming = /** @type {'safe' | 'unsafe-ignore'} */ (
13207
+ getenv('LOCKDOWN_LEGACY_REGENERATOR_RUNTIME_TAMING', 'safe', [
13208
+ 'unsafe-ignore',
13209
+ ])
13210
+ ),
13211
+ __hardenTaming__ = /** @type {'safe' | 'unsafe'} */ (
13212
+ getenv('LOCKDOWN_HARDEN_TAMING', 'safe', ['unsafe'])
12694
13213
  ),
12695
- __hardenTaming__ = getenv('LOCKDOWN_HARDEN_TAMING', 'safe'),
12696
13214
  dateTaming, // deprecated
12697
13215
  mathTaming, // deprecated
12698
13216
  ...extraOptions
12699
13217
  } = options;
12700
13218
 
12701
- legacyRegeneratorRuntimeTaming === 'safe' ||
12702
- legacyRegeneratorRuntimeTaming === 'unsafe-ignore' ||
12703
- Fail`lockdown(): non supported option legacyRegeneratorRuntimeTaming: ${q(legacyRegeneratorRuntimeTaming)}`;
12704
-
12705
- evalTaming === 'unsafe-eval' ||
12706
- evalTaming === 'unsafeEval' || // deprecated
12707
- evalTaming === 'safe-eval' ||
12708
- evalTaming === 'safeEval' || // deprecated
12709
- evalTaming === 'no-eval' ||
12710
- evalTaming === 'noEval' || // deprecated
12711
- Fail`lockdown(): non supported option evalTaming: ${q(evalTaming)}`;
12712
-
12713
13219
  // Assert that only supported options were passed.
12714
13220
  // Use Reflect.ownKeys to reject symbol-named properties as well.
12715
13221
  const extraOptionsNames = ownKeys(extraOptions);
@@ -12720,13 +13226,11 @@ const assertDirectEvalAvailable = () => {
12720
13226
  const { warn } = reporter;
12721
13227
 
12722
13228
  if (dateTaming !== undefined) {
12723
- // eslint-disable-next-line no-console
12724
13229
  warn(
12725
13230
  `SES The 'dateTaming' option is deprecated and does nothing. In the future specifying it will be an error.`,
12726
13231
  );
12727
13232
  }
12728
13233
  if (mathTaming !== undefined) {
12729
- // eslint-disable-next-line no-console
12730
13234
  warn(
12731
13235
  `SES The 'mathTaming' option is deprecated and does nothing. In the future specifying it will be an error.`,
12732
13236
  );
@@ -12744,7 +13248,19 @@ const assertDirectEvalAvailable = () => {
12744
13248
  // trace retained:
12745
13249
  priorRepairIntrinsics.stack;
12746
13250
 
12747
- assertDirectEvalAvailable();
13251
+ const { functionAllowed, evalAllowed, directEvalAllowed } =
13252
+ probeHostEvaluators();
13253
+
13254
+ if (
13255
+ directEvalAllowed === false &&
13256
+ evalTaming === 'safe-eval' &&
13257
+ (functionAllowed || evalAllowed)
13258
+ ) {
13259
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_DIRECT_EVAL.md
13260
+ throw TypeError(
13261
+ "SES cannot initialize unless 'eval' is the original intrinsic 'eval', suitable for direct eval (dynamically scoped eval) (SES_DIRECT_EVAL)",
13262
+ );
13263
+ }
12748
13264
 
12749
13265
  /**
12750
13266
  * Because of packagers and bundlers, etc, multiple invocations of lockdown
@@ -12799,7 +13315,6 @@ const assertDirectEvalAvailable = () => {
12799
13315
  const { addIntrinsics, completePrototypes, finalIntrinsics } =
12800
13316
  makeIntrinsicsCollector(reporter);
12801
13317
 
12802
- // @ts-expect-error __hardenTaming__ could be any string
12803
13318
  const tamedHarden = tameHarden(safeHarden, __hardenTaming__);
12804
13319
  addIntrinsics({ harden: tamedHarden });
12805
13320
 
@@ -13014,7 +13529,7 @@ const assertDirectEvalAvailable = () => {
13014
13529
  };$h͏_once.repairIntrinsics(repairIntrinsics);
13015
13530
  })()
13016
13531
  ,
13017
- // === 55. ses ./src/lockdown-shim.js ===
13532
+ // === 57. ses ./src/lockdown-shim.js ===
13018
13533
  ({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)]]]]]);
13019
13534
 
13020
13535
 
@@ -13054,7 +13569,7 @@ globalThis.repairIntrinsics = options => {
13054
13569
  };
13055
13570
  })()
13056
13571
  ,
13057
- // === 56. ses ./src/compartment-shim.js ===
13572
+ // === 58. ses ./src/compartment-shim.js ===
13058
13573
  ({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)]]]]]);
13059
13574
 
13060
13575
 
@@ -13079,14 +13594,14 @@ globalThis.Compartment = makeCompartmentConstructor(
13079
13594
  );
13080
13595
  })()
13081
13596
  ,
13082
- // === 57. ses ./src/assert-shim.js ===
13597
+ // === 59. ses ./src/assert-shim.js ===
13083
13598
  ({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)]]]]]);
13084
13599
 
13085
13600
 
13086
13601
  globalThis.assert = assert;
13087
13602
  })()
13088
13603
  ,
13089
- // === 58. ses ./src/console-shim.js ===
13604
+ // === 60. ses ./src/console-shim.js ===
13090
13605
  ({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)]]]]]);
13091
13606
 
13092
13607
 
@@ -13139,7 +13654,7 @@ globalThis[MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA] =
13139
13654
  makeCausalConsoleFromLoggerForSesAva;
13140
13655
  })()
13141
13656
  ,
13142
- // === 59. ses ./index.js ===
13657
+ // === 61. ses ./index.js ===
13143
13658
  ({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", []]]);
13144
13659
  })()
13145
13660
  ,