@metamask/snaps-execution-environments 11.0.0 → 11.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -2
- package/dist/webpack/iframe/bundle.js +1 -1
- package/dist/webpack/iframe/index.html +416 -269
- package/dist/webpack/node-process/bundle.js +417 -270
- package/dist/webpack/node-process/bundle.js.LICENSE.txt +416 -269
- package/dist/webpack/node-thread/bundle.js +417 -270
- package/dist/webpack/node-thread/bundle.js.LICENSE.txt +416 -269
- package/dist/webpack/webview/index.html +417 -270
- package/package.json +10 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! SES sources included by LavaMoat. Do not optimize or minify. */
|
|
2
2
|
;
|
|
3
|
-
// ses@1.
|
|
3
|
+
// ses@1.15.0
|
|
4
4
|
(functors => options => {
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
@@ -97,11 +97,11 @@
|
|
|
97
97
|
setPrototypeOf: cell("setPrototypeOf"),
|
|
98
98
|
values: cell("values"),
|
|
99
99
|
fromEntries: cell("fromEntries"),
|
|
100
|
-
hasOwn: cell("hasOwn"),
|
|
101
100
|
speciesSymbol: cell("speciesSymbol"),
|
|
102
101
|
toStringTagSymbol: cell("toStringTagSymbol"),
|
|
103
102
|
iteratorSymbol: cell("iteratorSymbol"),
|
|
104
103
|
matchAllSymbol: cell("matchAllSymbol"),
|
|
104
|
+
replaceSymbol: cell("replaceSymbol"),
|
|
105
105
|
unscopablesSymbol: cell("unscopablesSymbol"),
|
|
106
106
|
symbolKeyFor: cell("symbolKeyFor"),
|
|
107
107
|
symbolFor: cell("symbolFor"),
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
iteratorPrototype: cell("iteratorPrototype"),
|
|
134
134
|
typedArrayPrototype: cell("typedArrayPrototype"),
|
|
135
135
|
uncurryThis: cell("uncurryThis"),
|
|
136
|
-
|
|
136
|
+
hasOwn: cell("hasOwn"),
|
|
137
137
|
arrayFilter: cell("arrayFilter"),
|
|
138
138
|
arrayForEach: cell("arrayForEach"),
|
|
139
139
|
arrayIncludes: cell("arrayIncludes"),
|
|
@@ -160,16 +160,14 @@
|
|
|
160
160
|
setForEach: cell("setForEach"),
|
|
161
161
|
setHas: cell("setHas"),
|
|
162
162
|
iterateSet: cell("iterateSet"),
|
|
163
|
-
regexpTest: cell("regexpTest"),
|
|
164
163
|
regexpExec: cell("regexpExec"),
|
|
164
|
+
regexpReplace: cell("regexpReplace"),
|
|
165
165
|
matchAllRegExp: cell("matchAllRegExp"),
|
|
166
|
+
sealRegexp: cell("sealRegexp"),
|
|
166
167
|
stringEndsWith: cell("stringEndsWith"),
|
|
167
168
|
stringIncludes: cell("stringIncludes"),
|
|
168
169
|
stringIndexOf: cell("stringIndexOf"),
|
|
169
170
|
stringMatch: cell("stringMatch"),
|
|
170
|
-
generatorNext: cell("generatorNext"),
|
|
171
|
-
generatorThrow: cell("generatorThrow"),
|
|
172
|
-
stringReplace: cell("stringReplace"),
|
|
173
171
|
stringSearch: cell("stringSearch"),
|
|
174
172
|
stringSlice: cell("stringSlice"),
|
|
175
173
|
stringSplit: cell("stringSplit"),
|
|
@@ -183,12 +181,13 @@
|
|
|
183
181
|
weaksetHas: cell("weaksetHas"),
|
|
184
182
|
functionToString: cell("functionToString"),
|
|
185
183
|
functionBind: cell("functionBind"),
|
|
184
|
+
generatorNext: cell("generatorNext"),
|
|
185
|
+
generatorThrow: cell("generatorThrow"),
|
|
186
186
|
promiseAll: cell("promiseAll"),
|
|
187
187
|
promiseCatch: cell("promiseCatch"),
|
|
188
188
|
promiseThen: cell("promiseThen"),
|
|
189
189
|
finalizationRegistryRegister: cell("finalizationRegistryRegister"),
|
|
190
190
|
finalizationRegistryUnregister: cell("finalizationRegistryUnregister"),
|
|
191
|
-
getConstructorOf: cell("getConstructorOf"),
|
|
192
191
|
isPrimitive: cell("isPrimitive"),
|
|
193
192
|
isError: cell("isError"),
|
|
194
193
|
identity: cell("identity"),
|
|
@@ -244,10 +243,10 @@
|
|
|
244
243
|
makeError: cell("makeError"),
|
|
245
244
|
annotateError: cell("annotateError"),
|
|
246
245
|
loggedErrorHandler: cell("loggedErrorHandler"),
|
|
247
|
-
makeAssert: cell("makeAssert"),
|
|
248
246
|
assert: cell("assert"),
|
|
249
247
|
assertEqual: cell("assertEqual"),
|
|
250
248
|
sanitizeError: cell("sanitizeError"),
|
|
249
|
+
makeAssert: cell("makeAssert"),
|
|
251
250
|
},
|
|
252
251
|
{
|
|
253
252
|
isTypedArray: cell("isTypedArray"),
|
|
@@ -526,11 +525,11 @@ function observeImports(map, importName, importIndex) {
|
|
|
526
525
|
setPrototypeOf: cells[0].setPrototypeOf.set,
|
|
527
526
|
values: cells[0].values.set,
|
|
528
527
|
fromEntries: cells[0].fromEntries.set,
|
|
529
|
-
hasOwn: cells[0].hasOwn.set,
|
|
530
528
|
speciesSymbol: cells[0].speciesSymbol.set,
|
|
531
529
|
toStringTagSymbol: cells[0].toStringTagSymbol.set,
|
|
532
530
|
iteratorSymbol: cells[0].iteratorSymbol.set,
|
|
533
531
|
matchAllSymbol: cells[0].matchAllSymbol.set,
|
|
532
|
+
replaceSymbol: cells[0].replaceSymbol.set,
|
|
534
533
|
unscopablesSymbol: cells[0].unscopablesSymbol.set,
|
|
535
534
|
symbolKeyFor: cells[0].symbolKeyFor.set,
|
|
536
535
|
symbolFor: cells[0].symbolFor.set,
|
|
@@ -562,7 +561,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
562
561
|
iteratorPrototype: cells[0].iteratorPrototype.set,
|
|
563
562
|
typedArrayPrototype: cells[0].typedArrayPrototype.set,
|
|
564
563
|
uncurryThis: cells[0].uncurryThis.set,
|
|
565
|
-
|
|
564
|
+
hasOwn: cells[0].hasOwn.set,
|
|
566
565
|
arrayFilter: cells[0].arrayFilter.set,
|
|
567
566
|
arrayForEach: cells[0].arrayForEach.set,
|
|
568
567
|
arrayIncludes: cells[0].arrayIncludes.set,
|
|
@@ -589,16 +588,14 @@ function observeImports(map, importName, importIndex) {
|
|
|
589
588
|
setForEach: cells[0].setForEach.set,
|
|
590
589
|
setHas: cells[0].setHas.set,
|
|
591
590
|
iterateSet: cells[0].iterateSet.set,
|
|
592
|
-
regexpTest: cells[0].regexpTest.set,
|
|
593
591
|
regexpExec: cells[0].regexpExec.set,
|
|
592
|
+
regexpReplace: cells[0].regexpReplace.set,
|
|
594
593
|
matchAllRegExp: cells[0].matchAllRegExp.set,
|
|
594
|
+
sealRegexp: cells[0].sealRegexp.set,
|
|
595
595
|
stringEndsWith: cells[0].stringEndsWith.set,
|
|
596
596
|
stringIncludes: cells[0].stringIncludes.set,
|
|
597
597
|
stringIndexOf: cells[0].stringIndexOf.set,
|
|
598
598
|
stringMatch: cells[0].stringMatch.set,
|
|
599
|
-
generatorNext: cells[0].generatorNext.set,
|
|
600
|
-
generatorThrow: cells[0].generatorThrow.set,
|
|
601
|
-
stringReplace: cells[0].stringReplace.set,
|
|
602
599
|
stringSearch: cells[0].stringSearch.set,
|
|
603
600
|
stringSlice: cells[0].stringSlice.set,
|
|
604
601
|
stringSplit: cells[0].stringSplit.set,
|
|
@@ -612,12 +609,13 @@ function observeImports(map, importName, importIndex) {
|
|
|
612
609
|
weaksetHas: cells[0].weaksetHas.set,
|
|
613
610
|
functionToString: cells[0].functionToString.set,
|
|
614
611
|
functionBind: cells[0].functionBind.set,
|
|
612
|
+
generatorNext: cells[0].generatorNext.set,
|
|
613
|
+
generatorThrow: cells[0].generatorThrow.set,
|
|
615
614
|
promiseAll: cells[0].promiseAll.set,
|
|
616
615
|
promiseCatch: cells[0].promiseCatch.set,
|
|
617
616
|
promiseThen: cells[0].promiseThen.set,
|
|
618
617
|
finalizationRegistryRegister: cells[0].finalizationRegistryRegister.set,
|
|
619
618
|
finalizationRegistryUnregister: cells[0].finalizationRegistryUnregister.set,
|
|
620
|
-
getConstructorOf: cells[0].getConstructorOf.set,
|
|
621
619
|
isPrimitive: cells[0].isPrimitive.set,
|
|
622
620
|
isError: cells[0].isError.set,
|
|
623
621
|
identity: cells[0].identity.set,
|
|
@@ -788,10 +786,10 @@ function observeImports(map, importName, importIndex) {
|
|
|
788
786
|
makeError: cells[13].makeError.set,
|
|
789
787
|
note: cells[13].annotateError.set,
|
|
790
788
|
loggedErrorHandler: cells[13].loggedErrorHandler.set,
|
|
791
|
-
makeAssert: cells[13].makeAssert.set,
|
|
792
789
|
assert: cells[13].assert.set,
|
|
793
790
|
assertEqual: cells[13].assertEqual.set,
|
|
794
791
|
sanitizeError: cells[13].sanitizeError.set,
|
|
792
|
+
makeAssert: cells[13].makeAssert.set,
|
|
795
793
|
},
|
|
796
794
|
importMeta: {},
|
|
797
795
|
});
|
|
@@ -1605,18 +1603,18 @@ const universalThis = globalThis;$h͏_once.universalThis(universalThis);
|
|
|
1605
1603
|
setPrototypeOf,
|
|
1606
1604
|
values,
|
|
1607
1605
|
fromEntries,
|
|
1608
|
-
|
|
1609
|
-
} = Object;$h͏_once.assign(assign);$h͏_once.create(create);$h͏_once.defineProperties(defineProperties);$h͏_once.entries(entries);$h͏_once.freeze(freeze);$h͏_once.getOwnPropertyDescriptor(getOwnPropertyDescriptor);$h͏_once.getOwnPropertyDescriptors(getOwnPropertyDescriptors);$h͏_once.getOwnPropertyNames(getOwnPropertyNames);$h͏_once.getPrototypeOf(getPrototypeOf);$h͏_once.is(is);$h͏_once.isFrozen(isFrozen);$h͏_once.isSealed(isSealed);$h͏_once.isExtensible(isExtensible);$h͏_once.keys(keys);$h͏_once.objectPrototype(objectPrototype);$h͏_once.seal(seal);$h͏_once.preventExtensions(preventExtensions);$h͏_once.setPrototypeOf(setPrototypeOf);$h͏_once.values(values);$h͏_once.fromEntries(fromEntries);$h͏_once.hasOwn(hasOwn);
|
|
1606
|
+
} = Object;$h͏_once.assign(assign);$h͏_once.create(create);$h͏_once.defineProperties(defineProperties);$h͏_once.entries(entries);$h͏_once.freeze(freeze);$h͏_once.getOwnPropertyDescriptor(getOwnPropertyDescriptor);$h͏_once.getOwnPropertyDescriptors(getOwnPropertyDescriptors);$h͏_once.getOwnPropertyNames(getOwnPropertyNames);$h͏_once.getPrototypeOf(getPrototypeOf);$h͏_once.is(is);$h͏_once.isFrozen(isFrozen);$h͏_once.isSealed(isSealed);$h͏_once.isExtensible(isExtensible);$h͏_once.keys(keys);$h͏_once.objectPrototype(objectPrototype);$h͏_once.seal(seal);$h͏_once.preventExtensions(preventExtensions);$h͏_once.setPrototypeOf(setPrototypeOf);$h͏_once.values(values);$h͏_once.fromEntries(fromEntries);
|
|
1610
1607
|
|
|
1611
1608
|
const {
|
|
1612
1609
|
species: speciesSymbol,
|
|
1613
1610
|
toStringTag: toStringTagSymbol,
|
|
1614
1611
|
iterator: iteratorSymbol,
|
|
1615
1612
|
matchAll: matchAllSymbol,
|
|
1613
|
+
replace: replaceSymbol,
|
|
1616
1614
|
unscopables: unscopablesSymbol,
|
|
1617
1615
|
keyFor: symbolKeyFor,
|
|
1618
1616
|
for: symbolFor,
|
|
1619
|
-
} = Symbol;$h͏_once.speciesSymbol(speciesSymbol);$h͏_once.toStringTagSymbol(toStringTagSymbol);$h͏_once.iteratorSymbol(iteratorSymbol);$h͏_once.matchAllSymbol(matchAllSymbol);$h͏_once.unscopablesSymbol(unscopablesSymbol);$h͏_once.symbolKeyFor(symbolKeyFor);$h͏_once.symbolFor(symbolFor);
|
|
1617
|
+
} = Symbol;$h͏_once.speciesSymbol(speciesSymbol);$h͏_once.toStringTagSymbol(toStringTagSymbol);$h͏_once.iteratorSymbol(iteratorSymbol);$h͏_once.matchAllSymbol(matchAllSymbol);$h͏_once.replaceSymbol(replaceSymbol);$h͏_once.unscopablesSymbol(unscopablesSymbol);$h͏_once.symbolKeyFor(symbolKeyFor);$h͏_once.symbolFor(symbolFor);
|
|
1620
1618
|
|
|
1621
1619
|
const { isInteger } = Number;$h͏_once.isInteger(isInteger);
|
|
1622
1620
|
|
|
@@ -1695,12 +1693,29 @@ const { bind } = functionPrototype;
|
|
|
1695
1693
|
*/
|
|
1696
1694
|
const uncurryThis = bind.bind(bind.call); // eslint-disable-line @endo/no-polymorphic-call
|
|
1697
1695
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1696
|
+
// See https://github.com/endojs/endo/issues/2930
|
|
1697
|
+
$h͏_once.uncurryThis(uncurryThis);if(!('hasOwn'in Object)){
|
|
1698
|
+
const ObjectPrototypeHasOwnProperty = objectPrototype.hasOwnProperty;
|
|
1699
|
+
const hasOwnShim = (obj, key) => {
|
|
1700
|
+
if (obj === undefined || obj === null) {
|
|
1701
|
+
// We need to add this extra test because of differences in
|
|
1702
|
+
// the order in which `hasOwn` vs `hasOwnProperty` validates
|
|
1703
|
+
// arguments.
|
|
1704
|
+
throw TypeError('Cannot convert undefined or null to object');
|
|
1705
|
+
}
|
|
1706
|
+
return apply(ObjectPrototypeHasOwnProperty, obj, [key]);
|
|
1707
|
+
};
|
|
1708
|
+
defineProperty(Object, 'hasOwn', {
|
|
1709
|
+
value: hasOwnShim,
|
|
1710
|
+
writable: true,
|
|
1711
|
+
enumerable: false,
|
|
1712
|
+
configurable: true,
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
const { hasOwn } = Object;
|
|
1702
1717
|
//
|
|
1703
|
-
$h͏_once.
|
|
1718
|
+
$h͏_once.hasOwn(hasOwn);const arrayFilter=uncurryThis(arrayPrototype.filter);$h͏_once.arrayFilter(arrayFilter);
|
|
1704
1719
|
const arrayForEach = uncurryThis(arrayPrototype.forEach);$h͏_once.arrayForEach(arrayForEach);
|
|
1705
1720
|
const arrayIncludes = uncurryThis(arrayPrototype.includes);$h͏_once.arrayIncludes(arrayIncludes);
|
|
1706
1721
|
const arrayJoin = uncurryThis(arrayPrototype.join);
|
|
@@ -1739,32 +1754,53 @@ $h͏_once.iterateMap(iterateMap);const setAdd=uncurryThis(setPrototype.add);$h͏
|
|
|
1739
1754
|
const setHas = uncurryThis(setPrototype.has);$h͏_once.setHas(setHas);
|
|
1740
1755
|
const iterateSet = uncurryThis(setPrototype[iteratorSymbol]);
|
|
1741
1756
|
//
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
const stringIncludes = uncurryThis(stringPrototype.includes);$h͏_once.stringIncludes(stringIncludes);
|
|
1748
|
-
const stringIndexOf = uncurryThis(stringPrototype.indexOf);$h͏_once.stringIndexOf(stringIndexOf);
|
|
1749
|
-
const stringMatch = uncurryThis(stringPrototype.match);$h͏_once.stringMatch(stringMatch);
|
|
1750
|
-
const generatorNext = uncurryThis(generatorPrototype.next);$h͏_once.generatorNext(generatorNext);
|
|
1751
|
-
const generatorThrow = uncurryThis(generatorPrototype.throw);
|
|
1752
|
-
|
|
1757
|
+
/**
|
|
1758
|
+
* `regexpExec` is provided in exclusion of `regexpTest`, which would be
|
|
1759
|
+
* vulnerable to RegExp.prototype poisoning.
|
|
1760
|
+
*/$h͏_once.iterateSet(iterateSet);
|
|
1761
|
+
const regexpExec = uncurryThis(regexpPrototype.exec);
|
|
1753
1762
|
/**
|
|
1754
1763
|
* @type { &
|
|
1755
|
-
* ((thisArg:
|
|
1756
|
-
* ((thisArg:
|
|
1764
|
+
* ((thisArg: RegExp, string: string, replaceValue: string) => string) &
|
|
1765
|
+
* ((thisArg: RegExp, string: string, replacer: (substring: string, ...args: any[]) => string) => string)
|
|
1757
1766
|
* }
|
|
1758
|
-
*/$h͏_once.
|
|
1759
|
-
const
|
|
1760
|
-
uncurryThis(
|
|
1761
|
-
);$h͏_once.
|
|
1762
|
-
const
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1767
|
+
*/$h͏_once.regexpExec(regexpExec);
|
|
1768
|
+
const regexpReplace = /** @type {any} */ (
|
|
1769
|
+
uncurryThis(regexpPrototype[replaceSymbol])
|
|
1770
|
+
);$h͏_once.regexpReplace(regexpReplace);
|
|
1771
|
+
const matchAllRegExp = uncurryThis(regexpPrototype[matchAllSymbol]);$h͏_once.matchAllRegExp(matchAllRegExp);
|
|
1772
|
+
const { _regexpConstructor, ...regexpDescriptors } =
|
|
1773
|
+
getOwnPropertyDescriptors(regexpPrototype);
|
|
1774
|
+
arrayForEach(ownKeys(regexpDescriptors), key => {
|
|
1775
|
+
const desc = regexpDescriptors[/** @type {any} */ (key)];
|
|
1776
|
+
desc.configurable = false;
|
|
1777
|
+
if (desc.writable) desc.writable = false;
|
|
1778
|
+
});
|
|
1779
|
+
/**
|
|
1780
|
+
* Protect a RegExp instance against RegExp.prototype poisoning ("exec",
|
|
1781
|
+
* "flags", Symbol.replace, etc.).
|
|
1782
|
+
* @type {<T extends RegExp>(regexp: T) => T}
|
|
1783
|
+
*/
|
|
1784
|
+
const sealRegexp = regexp =>
|
|
1785
|
+
seal(defineProperties(regexp, regexpDescriptors));
|
|
1786
|
+
//
|
|
1787
|
+
$h͏_once.sealRegexp(sealRegexp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h͏_once.stringEndsWith(stringEndsWith);
|
|
1788
|
+
const stringIncludes = uncurryThis(stringPrototype.includes);$h͏_once.stringIncludes(stringIncludes);
|
|
1789
|
+
const stringIndexOf = uncurryThis(stringPrototype.indexOf);$h͏_once.stringIndexOf(stringIndexOf);
|
|
1790
|
+
const stringMatch = uncurryThis(stringPrototype.match);
|
|
1791
|
+
// `stringReplace` is intentionally omitted because it would be vulnerable to
|
|
1792
|
+
// RegExp.prototype poisoning; use `regexpReplace(re, str, replacer)` instead
|
|
1793
|
+
// (and `sealRegexp` on its regular expressions).
|
|
1794
|
+
$h͏_once.stringMatch(stringMatch);const stringSearch=uncurryThis(stringPrototype.search);$h͏_once.stringSearch(stringSearch);
|
|
1795
|
+
const stringSlice = uncurryThis(stringPrototype.slice);
|
|
1796
|
+
/**
|
|
1797
|
+
* `stringSplit` should only be used with a string separator; regular
|
|
1798
|
+
* expressions are vulnerable to RegExp.prototype poisoning.
|
|
1799
|
+
* @type {(thisArg: string, separator: string, limit?: number) => string[]}
|
|
1800
|
+
*/$h͏_once.stringSlice(stringSlice);
|
|
1801
|
+
const stringSplit = /** @type {any} */ (
|
|
1802
|
+
uncurryThis(stringPrototype.split)
|
|
1803
|
+
);$h͏_once.stringSplit(stringSplit);
|
|
1768
1804
|
const stringStartsWith = uncurryThis(stringPrototype.startsWith);$h͏_once.stringStartsWith(stringStartsWith);
|
|
1769
1805
|
const iterateString = uncurryThis(stringPrototype[iteratorSymbol]);
|
|
1770
1806
|
//
|
|
@@ -1780,7 +1816,10 @@ $h͏_once.weakmapSet(weakmapSet);const weaksetAdd=uncurryThis(weaksetPrototype.a
|
|
|
1780
1816
|
$h͏_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPrototype.toString);$h͏_once.functionToString(functionToString);
|
|
1781
1817
|
const functionBind = uncurryThis(bind);
|
|
1782
1818
|
//
|
|
1783
|
-
$h͏_once.functionBind(functionBind);const
|
|
1819
|
+
$h͏_once.functionBind(functionBind);const generatorNext=uncurryThis(generatorPrototype.next);$h͏_once.generatorNext(generatorNext);
|
|
1820
|
+
const generatorThrow = uncurryThis(generatorPrototype.throw);
|
|
1821
|
+
//
|
|
1822
|
+
$h͏_once.generatorThrow(generatorThrow);const{all}=Promise;
|
|
1784
1823
|
const promiseAll = promises => apply(all, Promise, [promises]);$h͏_once.promiseAll(promiseAll);
|
|
1785
1824
|
const promiseCatch = uncurryThis(promisePrototype.catch);
|
|
1786
1825
|
/** @type {<T, TResult1 = T, TResult2 = never>(thisArg: T, onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null) => Promise<TResult1 | TResult2>} */$h͏_once.promiseCatch(promiseCatch);
|
|
@@ -1794,15 +1833,6 @@ $h͏_once.promiseThen(promiseThen);const finalizationRegistryRegister=
|
|
|
1794
1833
|
FinalizationRegistry &&
|
|
1795
1834
|
uncurryThis(FinalizationRegistry.prototype.unregister);
|
|
1796
1835
|
|
|
1797
|
-
/**
|
|
1798
|
-
* getConstructorOf()
|
|
1799
|
-
* Return the constructor from an instance.
|
|
1800
|
-
*
|
|
1801
|
-
* @param {Function} fn
|
|
1802
|
-
*/$h͏_once.finalizationRegistryUnregister(finalizationRegistryUnregister);
|
|
1803
|
-
const getConstructorOf = fn =>
|
|
1804
|
-
reflectGet(getPrototypeOf(fn), 'constructor');
|
|
1805
|
-
|
|
1806
1836
|
/**
|
|
1807
1837
|
* TODO Consolidate with `isPrimitive` that's currently in `@endo/pass-style`.
|
|
1808
1838
|
* Layering constraints make this tricky, which is why we haven't yet figured
|
|
@@ -1815,7 +1845,7 @@ $h͏_once.promiseThen(promiseThen);const finalizationRegistryRegister=
|
|
|
1815
1845
|
* | bigint
|
|
1816
1846
|
* | string
|
|
1817
1847
|
* | symbol)}
|
|
1818
|
-
*/$h͏_once.
|
|
1848
|
+
*/$h͏_once.finalizationRegistryUnregister(finalizationRegistryUnregister);
|
|
1819
1849
|
const isPrimitive = val =>
|
|
1820
1850
|
!val || (typeof val !== 'object' && typeof val !== 'function');
|
|
1821
1851
|
|
|
@@ -1855,13 +1885,40 @@ $h͏_once.FERAL_EVAL(FERAL_EVAL);const FERAL_FUNCTION=Function;$h͏_once.FERAL_F
|
|
|
1855
1885
|
};
|
|
1856
1886
|
|
|
1857
1887
|
// ////////////////// FERAL_STACK_GETTER FERAL_STACK_SETTER ////////////////////
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1888
|
+
|
|
1889
|
+
// The error repair mechanism is very similar to code in
|
|
1890
|
+
// pass-style/src/error.js and these implementations should be kept in sync.
|
|
1891
|
+
|
|
1892
|
+
/**
|
|
1893
|
+
* We gratuitiously construct a TypeError instance using syntax in order to
|
|
1894
|
+
* obviate the possibility that code that ran before SES (for which we are
|
|
1895
|
+
* irreducable vulnerable) may have replaced the global TypeError constructor.
|
|
1896
|
+
* We treat the nature of this error instance as the source of truth for the
|
|
1897
|
+
* nature of runtime constructed errors on the platform, particularly whether
|
|
1898
|
+
* such errors will have an own "stack" property with getters and setters.
|
|
1899
|
+
* At time of writing (2025) we know of no comparable mechanism for obtaining a
|
|
1900
|
+
* host-generated base Error instance, but we corroborate the nature of the
|
|
1901
|
+
* global Error constructor's instances and refuse to initialize SES in an
|
|
1902
|
+
* environment where the syntactic TypeError and global Error produce
|
|
1903
|
+
* inconsistent "stack" properties.
|
|
1904
|
+
* @returns {TypeError}
|
|
1905
|
+
*/$h͏_once.noEvalEvaluate(noEvalEvaluate);
|
|
1906
|
+
const makeTypeError = () => {
|
|
1907
|
+
try {
|
|
1908
|
+
// @ts-expect-error deliberate TypeError
|
|
1909
|
+
null.null;
|
|
1910
|
+
throw TypeError('obligatory'); // To convince the type flow inferrence.
|
|
1911
|
+
} catch (error) {
|
|
1912
|
+
return error;
|
|
1913
|
+
}
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
const errorStackDesc = getOwnPropertyDescriptor(Error('obligatory'), 'stack');
|
|
1917
|
+
const typeErrorStackDesc = getOwnPropertyDescriptor(makeTypeError(), 'stack');
|
|
1861
1918
|
|
|
1862
1919
|
let feralStackGetter;
|
|
1863
1920
|
let feralStackSetter;
|
|
1864
|
-
if (
|
|
1921
|
+
if (typeErrorStackDesc && typeErrorStackDesc.get) {
|
|
1865
1922
|
// We should only encounter this case on v8 because of its problematic
|
|
1866
1923
|
// error own stack accessor behavior.
|
|
1867
1924
|
// Note that FF/SpiderMonkey, Moddable/XS, and the error stack proposal
|
|
@@ -1872,16 +1929,17 @@ if (er1StackDesc && er2StackDesc && er1StackDesc.get) {
|
|
|
1872
1929
|
// accessor property, but within the same realm, all these accessor
|
|
1873
1930
|
// properties have the same getter and have the same setter.
|
|
1874
1931
|
// This is therefore the case that we repair.
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1932
|
+
errorStackDesc &&
|
|
1933
|
+
typeof typeErrorStackDesc.get === 'function' &&
|
|
1934
|
+
typeErrorStackDesc.get === errorStackDesc.get &&
|
|
1935
|
+
typeof typeErrorStackDesc.set === 'function' &&
|
|
1936
|
+
typeErrorStackDesc.set === errorStackDesc.set
|
|
1879
1937
|
) {
|
|
1880
1938
|
// Otherwise, we have own stack accessor properties that are outside
|
|
1881
1939
|
// our expectations, that therefore need to be understood better
|
|
1882
1940
|
// before we know how to repair them.
|
|
1883
|
-
feralStackGetter = freeze(
|
|
1884
|
-
feralStackSetter = freeze(
|
|
1941
|
+
feralStackGetter = freeze(typeErrorStackDesc.get);
|
|
1942
|
+
feralStackSetter = freeze(typeErrorStackDesc.set);
|
|
1885
1943
|
} else {
|
|
1886
1944
|
// See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_UNEXPECTED_ERROR_OWN_STACK_ACCESSOR.md
|
|
1887
1945
|
throw TypeError(
|
|
@@ -2430,11 +2488,11 @@ const arrayBufferMethods = {
|
|
|
2430
2488
|
...(optTransferBufferToImmutable
|
|
2431
2489
|
? {
|
|
2432
2490
|
/**
|
|
2433
|
-
* Transfer the contents to a new
|
|
2491
|
+
* Transfer the contents to a new immutable ArrayBuffer
|
|
2434
2492
|
*
|
|
2435
2493
|
* @this {ArrayBuffer} buffer The original buffer.
|
|
2436
2494
|
* @param {number} [newLength] The start index.
|
|
2437
|
-
* @returns {ArrayBuffer} The
|
|
2495
|
+
* @returns {ArrayBuffer} The new immutable ArrayBuffer.
|
|
2438
2496
|
*/
|
|
2439
2497
|
transferToImmutable(newLength = undefined) {
|
|
2440
2498
|
return optTransferBufferToImmutable(this, newLength);
|
|
@@ -2507,12 +2565,12 @@ defineProperties(
|
|
|
2507
2565
|
|
|
2508
2566
|
|
|
2509
2567
|
|
|
2510
|
-
/** @import {
|
|
2568
|
+
/** @import {Stringable} from '../../types.js' */
|
|
2511
2569
|
|
|
2512
2570
|
/**
|
|
2513
2571
|
* Joins English terms with commas and an optional conjunction.
|
|
2514
2572
|
*
|
|
2515
|
-
* @param {(string |
|
|
2573
|
+
* @param {(string | Stringable)[]} terms
|
|
2516
2574
|
* @param {"and" | "or"} conjunction
|
|
2517
2575
|
*/
|
|
2518
2576
|
const enJoin = (terms, conjunction) => {
|
|
@@ -2683,7 +2741,7 @@ freeze(bestEffortStringify);
|
|
|
2683
2741
|
// === 8. ses ./src/error/types.js ===
|
|
2684
2742
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
|
|
2685
2743
|
|
|
2686
|
-
/** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken,
|
|
2744
|
+
/** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken, Stringable} from '../../types.js' */
|
|
2687
2745
|
|
|
2688
2746
|
/**
|
|
2689
2747
|
* @typedef {object} VirtualConsole
|
|
@@ -3248,7 +3306,8 @@ freeze(makeNoteLogArgsArrayKit);
|
|
|
3248
3306
|
})()
|
|
3249
3307
|
,
|
|
3250
3308
|
// === 13. ses ./src/error/assert.js ===
|
|
3251
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,
|
|
3309
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,regexpExec,regexpReplace,sealRegexp,stringIndexOf,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,getOwnPropertyDescriptors,ownKeys,create,objectPrototype,hasOwn,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h͏_imports([["../commons.js", [["RangeError",[$h͏_a => (RangeError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringStartsWith",[$h͏_a => (stringStartsWith = $h͏_a)]],["weakmapDelete",[$h͏_a => (weakmapDelete = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["AggregateError",[$h͏_a => (AggregateError = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]],["./stringify-utils.js", [["an",[$h͏_a => (an = $h͏_a)]],["bestEffortStringify",[$h͏_a => (bestEffortStringify = $h͏_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit",[$h͏_a => (makeNoteLogArgsArrayKit = $h͏_a)]]]]]);
|
|
3310
|
+
|
|
3252
3311
|
|
|
3253
3312
|
|
|
3254
3313
|
|
|
@@ -3297,24 +3356,28 @@ freeze(makeNoteLogArgsArrayKit);
|
|
|
3297
3356
|
|
|
3298
3357
|
|
|
3299
3358
|
/**
|
|
3300
|
-
* @import {BaseAssert, Assert, AssertionFunctions, AssertionUtilities,
|
|
3301
|
-
* @import {LogArgs, NoteCallback, LoggedErrorHandler} from
|
|
3359
|
+
* @import {BaseAssert, Assert, AssertionFunctions, AssertionUtilities, DeprecatedAssertionUtilities, Stringable, DetailsToken, MakeAssert} from '../../types.js';
|
|
3360
|
+
* @import {LogArgs, NoteCallback, LoggedErrorHandler} from './internal-types.js';
|
|
3302
3361
|
*/
|
|
3303
3362
|
|
|
3304
|
-
// For
|
|
3363
|
+
// For internal debugging purposes, uncomment
|
|
3305
3364
|
// const internalDebugConsole = console;
|
|
3306
3365
|
|
|
3307
3366
|
// /////////////////////////////////////////////////////////////////////////////
|
|
3308
3367
|
|
|
3309
|
-
/**
|
|
3368
|
+
/**
|
|
3369
|
+
* Maps the result of a `quote` or `bare` call back to its input value.
|
|
3370
|
+
*
|
|
3371
|
+
* @type {WeakMap<Stringable, any>}
|
|
3372
|
+
*/
|
|
3310
3373
|
const declassifiers = new WeakMap();
|
|
3311
3374
|
|
|
3312
3375
|
/** @type {AssertionUtilities['quote']} */
|
|
3313
|
-
const quote = (
|
|
3376
|
+
const quote = (value, spaces = undefined) => {
|
|
3314
3377
|
const result = freeze({
|
|
3315
|
-
toString: freeze(() => bestEffortStringify(
|
|
3378
|
+
toString: freeze(() => bestEffortStringify(value, spaces)),
|
|
3316
3379
|
});
|
|
3317
|
-
weakmapSet(declassifiers, result,
|
|
3380
|
+
weakmapSet(declassifiers, result, value);
|
|
3318
3381
|
return result;
|
|
3319
3382
|
};$h͏_once.quote(quote);
|
|
3320
3383
|
freeze(quote);
|
|
@@ -3324,14 +3387,14 @@ const canBeBare = freeze(/^[\w:-]( ?[\w:-])*$/);
|
|
|
3324
3387
|
/**
|
|
3325
3388
|
* @type {AssertionUtilities['bare']}
|
|
3326
3389
|
*/
|
|
3327
|
-
const bare = (
|
|
3328
|
-
if (typeof
|
|
3329
|
-
return quote(
|
|
3390
|
+
const bare = (text, spaces = undefined) => {
|
|
3391
|
+
if (typeof text !== 'string' || !regexpExec(canBeBare, text)) {
|
|
3392
|
+
return quote(text, spaces);
|
|
3330
3393
|
}
|
|
3331
3394
|
const result = freeze({
|
|
3332
|
-
toString: freeze(() =>
|
|
3395
|
+
toString: freeze(() => text),
|
|
3333
3396
|
});
|
|
3334
|
-
weakmapSet(declassifiers, result,
|
|
3397
|
+
weakmapSet(declassifiers, result, text);
|
|
3335
3398
|
return result;
|
|
3336
3399
|
};$h͏_once.bare(bare);
|
|
3337
3400
|
freeze(bare);
|
|
@@ -3339,24 +3402,28 @@ freeze(bare);
|
|
|
3339
3402
|
// /////////////////////////////////////////////////////////////////////////////
|
|
3340
3403
|
|
|
3341
3404
|
/**
|
|
3342
|
-
* @typedef {
|
|
3405
|
+
* @typedef {{ template: TemplateStringsArray | string[], args: any[] }} DetailsParts
|
|
3343
3406
|
*
|
|
3344
|
-
*
|
|
3407
|
+
* The contents of a `details` template literal tag: literal strings (always at
|
|
3408
|
+
* least one) and arbitrary substitution values from in between them.
|
|
3345
3409
|
*
|
|
3346
|
-
*
|
|
3347
|
-
*
|
|
3410
|
+
* Unquoted substitution values are sensitive (and are redacted in error
|
|
3411
|
+
* `message` strings), so a DetailsPart must not leak outside of this file.
|
|
3348
3412
|
*/
|
|
3349
3413
|
|
|
3350
3414
|
/**
|
|
3351
|
-
*
|
|
3415
|
+
* Maps the result of a `details` tagged template literal back to a record of
|
|
3416
|
+
* that template literal's contents.
|
|
3352
3417
|
*
|
|
3353
|
-
*
|
|
3354
|
-
* to a record of the contents of that template literal expression.
|
|
3418
|
+
* @type {WeakMap<DetailsToken, DetailsParts>}
|
|
3355
3419
|
*/
|
|
3356
3420
|
const hiddenDetailsMap = new WeakMap();
|
|
3357
3421
|
|
|
3358
3422
|
/**
|
|
3359
|
-
*
|
|
3423
|
+
* Construct an error message string from `details` template literal contents,
|
|
3424
|
+
* replacing unquoted substitution values with redactions.
|
|
3425
|
+
*
|
|
3426
|
+
* @param {DetailsParts} hiddenDetails
|
|
3360
3427
|
* @returns {string}
|
|
3361
3428
|
*/
|
|
3362
3429
|
const getMessageString = ({ template, args }) => {
|
|
@@ -3377,16 +3444,14 @@ const getMessageString = ({ template, args }) => {
|
|
|
3377
3444
|
};
|
|
3378
3445
|
|
|
3379
3446
|
/**
|
|
3380
|
-
*
|
|
3381
|
-
* creating new
|
|
3382
|
-
*
|
|
3383
|
-
*
|
|
3384
|
-
* `
|
|
3385
|
-
* registered in `redactedDetails`, which should be exactly the detailsTokens.
|
|
3447
|
+
* Define `toString` behavior for DetailsToken. To minimize the overhead of
|
|
3448
|
+
* creating new instances, we do this with an inherited `this`-sensitive method,
|
|
3449
|
+
* even though we normally avoid such sensitivity. To protect the method from
|
|
3450
|
+
* inappropriate application, it verifies that `this` is registered in
|
|
3451
|
+
* `redactedDetails` before doing interesting work.
|
|
3386
3452
|
*
|
|
3387
|
-
* The
|
|
3388
|
-
* the same
|
|
3389
|
-
* string for a thrown assertion error.
|
|
3453
|
+
* The behavior must not reveal anything redacted, so we use `getMessageString`
|
|
3454
|
+
* to return the same value as the message for a thrown assertion-failure error.
|
|
3390
3455
|
*/
|
|
3391
3456
|
const DetailsTokenProto = freeze({
|
|
3392
3457
|
toString() {
|
|
@@ -3406,16 +3471,15 @@ freeze(DetailsTokenProto.toString);
|
|
|
3406
3471
|
* given to `lockdown`, then `unredactedDetails` is used instead.
|
|
3407
3472
|
*
|
|
3408
3473
|
* There are some unconditional uses of `redactedDetails` in this module. All
|
|
3409
|
-
* of them should be uses where the template literal has no redacted
|
|
3410
|
-
* substitution values. In those cases,
|
|
3474
|
+
* of them should be uses where the template literal has no redacted (unquoted)
|
|
3475
|
+
* substitution values. In those cases, `redactedDetails` is equivalent to
|
|
3476
|
+
* `unredactedDetails`.
|
|
3411
3477
|
*
|
|
3412
3478
|
* @type {AssertionUtilities['details']}
|
|
3413
3479
|
*/
|
|
3414
3480
|
const redactedDetails = (template, ...args) => {
|
|
3415
|
-
//
|
|
3416
|
-
//
|
|
3417
|
-
// possible. Hence we store what we've got with little processing, postponing
|
|
3418
|
-
// all the work to happen only if needed, for example, if an assertion fails.
|
|
3481
|
+
// In case the result of this call is never used, perform as little processing
|
|
3482
|
+
// as possible here to keep things fast.
|
|
3419
3483
|
const detailsToken = freeze({ __proto__: DetailsTokenProto });
|
|
3420
3484
|
weakmapSet(hiddenDetailsMap, detailsToken, { template, args });
|
|
3421
3485
|
return /** @type {DetailsToken} */ (/** @type {unknown} */ (detailsToken));
|
|
@@ -3445,8 +3509,15 @@ const unredactedDetails = (template, ...args) => {
|
|
|
3445
3509
|
freeze(unredactedDetails);
|
|
3446
3510
|
|
|
3447
3511
|
|
|
3512
|
+
const leadingSpacePattern = sealRegexp(/^ /);
|
|
3513
|
+
const trailingSpacePattern = sealRegexp(/ $/);
|
|
3514
|
+
|
|
3448
3515
|
/**
|
|
3449
|
-
*
|
|
3516
|
+
* Get arguments suitable for a console logger function (e.g., `console.error`)
|
|
3517
|
+
* from `details` template literal contents, unquoting quoted substitution
|
|
3518
|
+
* values.
|
|
3519
|
+
*
|
|
3520
|
+
* @param {DetailsParts} hiddenDetails
|
|
3450
3521
|
* @returns {LogArgs}
|
|
3451
3522
|
*/
|
|
3452
3523
|
const getLogArgs = ({ template, args }) => {
|
|
@@ -3456,14 +3527,22 @@ const getLogArgs = ({ template, args }) => {
|
|
|
3456
3527
|
if (weakmapHas(declassifiers, arg)) {
|
|
3457
3528
|
arg = weakmapGet(declassifiers, arg);
|
|
3458
3529
|
}
|
|
3459
|
-
// Remove
|
|
3460
|
-
//
|
|
3461
|
-
const
|
|
3462
|
-
|
|
3463
|
-
|
|
3530
|
+
// Remove substitution-adjacent spaces from template fixed-string parts
|
|
3531
|
+
// (since console logging inserts its own argument-separating spaces).
|
|
3532
|
+
const prevLiteralPart = regexpReplace(
|
|
3533
|
+
trailingSpacePattern,
|
|
3534
|
+
arrayPop(logArgs) || '',
|
|
3535
|
+
'',
|
|
3536
|
+
);
|
|
3537
|
+
if (prevLiteralPart !== '') {
|
|
3538
|
+
arrayPush(logArgs, prevLiteralPart);
|
|
3464
3539
|
}
|
|
3465
|
-
const
|
|
3466
|
-
|
|
3540
|
+
const nextLiteralPart = regexpReplace(
|
|
3541
|
+
leadingSpacePattern,
|
|
3542
|
+
template[i + 1],
|
|
3543
|
+
'',
|
|
3544
|
+
);
|
|
3545
|
+
arrayPush(logArgs, arg, nextLiteralPart);
|
|
3467
3546
|
}
|
|
3468
3547
|
if (logArgs[logArgs.length - 1] === '') {
|
|
3469
3548
|
arrayPop(logArgs);
|
|
@@ -3472,11 +3551,11 @@ const getLogArgs = ({ template, args }) => {
|
|
|
3472
3551
|
};
|
|
3473
3552
|
|
|
3474
3553
|
/**
|
|
3475
|
-
*
|
|
3554
|
+
* Maps from an error object to arguments suitable for a privileged console
|
|
3555
|
+
* logger function such as `console.error`, including values that may be
|
|
3556
|
+
* redacted in the error's `message`.
|
|
3476
3557
|
*
|
|
3477
|
-
*
|
|
3478
|
-
* alternative message for that error. When logging the error, these
|
|
3479
|
-
* log args should be preferred to `error.message`.
|
|
3558
|
+
* @type {WeakMap<Error, LogArgs>}
|
|
3480
3559
|
*/
|
|
3481
3560
|
const hiddenMessageLogArgs = new WeakMap();
|
|
3482
3561
|
|
|
@@ -3547,27 +3626,24 @@ const tagError = (err, optErrorName = err.name) => {
|
|
|
3547
3626
|
for (const name of restNames) {
|
|
3548
3627
|
delete error[name];
|
|
3549
3628
|
}
|
|
3550
|
-
const
|
|
3629
|
+
const dropped = create(objectPrototype, restDescs);
|
|
3630
|
+
const droppedDetails = redactedDetails`originally with properties ${quote(dropped)}`;
|
|
3551
3631
|
// eslint-disable-next-line no-use-before-define
|
|
3552
|
-
note(
|
|
3553
|
-
error,
|
|
3554
|
-
redactedDetails`originally with properties ${quote(droppedNote)}`,
|
|
3555
|
-
);
|
|
3632
|
+
note(error, droppedDetails);
|
|
3556
3633
|
}
|
|
3557
3634
|
for (const name of ownKeys(error)) {
|
|
3558
|
-
// @ts-expect-error
|
|
3635
|
+
// @ts-expect-error TypeScript is still confused by symbols as property keys
|
|
3559
3636
|
const desc = descs[name];
|
|
3560
3637
|
if (desc && hasOwn(desc, 'get')) {
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
});
|
|
3638
|
+
const value = error[name]; // invokes the getter
|
|
3639
|
+
defineProperty(error, name, { value });
|
|
3564
3640
|
}
|
|
3565
3641
|
}
|
|
3566
3642
|
freeze(error);
|
|
3567
3643
|
};
|
|
3568
3644
|
|
|
3569
3645
|
/**
|
|
3570
|
-
* @type {AssertionUtilities['
|
|
3646
|
+
* @type {AssertionUtilities['makeError']}
|
|
3571
3647
|
*/$h͏_once.sanitizeError(sanitizeError);
|
|
3572
3648
|
const makeError = (
|
|
3573
3649
|
optDetails = redactedDetails`Assert failed`,
|
|
@@ -3579,9 +3655,9 @@ const makeError = (
|
|
|
3579
3655
|
sanitize = true,
|
|
3580
3656
|
} = {},
|
|
3581
3657
|
) => {
|
|
3658
|
+
// Promote string-valued `optDetails` into a minimal DetailsParts
|
|
3659
|
+
// consisting of that string as the sole literal part with no substitutions.
|
|
3582
3660
|
if (typeof optDetails === 'string') {
|
|
3583
|
-
// If it is a string, use it as the literal part of the template so
|
|
3584
|
-
// it doesn't get quoted.
|
|
3585
3661
|
optDetails = redactedDetails([optDetails]);
|
|
3586
3662
|
}
|
|
3587
3663
|
const hiddenDetails = weakmapGet(hiddenDetailsMap, optDetails);
|
|
@@ -3597,13 +3673,11 @@ const makeError = (
|
|
|
3597
3673
|
) {
|
|
3598
3674
|
error = AggregateError(errors || [], messageString, opts);
|
|
3599
3675
|
} else {
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3676
|
+
const ErrorCtor = /** @type {ErrorConstructor} */ (errConstructor);
|
|
3677
|
+
error = ErrorCtor(messageString, opts);
|
|
3678
|
+
// Since we need to tolerate `errors` on an AggregateError, we may as well
|
|
3679
|
+
// tolerate it on all errors.
|
|
3604
3680
|
if (errors !== undefined) {
|
|
3605
|
-
// Since we need to tolerate `errors` on an AggregateError, may as
|
|
3606
|
-
// well tolerate it on all errors.
|
|
3607
3681
|
defineProperty(error, 'errors', {
|
|
3608
3682
|
value: errors,
|
|
3609
3683
|
writable: true,
|
|
@@ -3626,11 +3700,10 @@ freeze(makeError);
|
|
|
3626
3700
|
|
|
3627
3701
|
// /////////////////////////////////////////////////////////////////////////////
|
|
3628
3702
|
|
|
3629
|
-
const { addLogArgs, takeLogArgsArray } =
|
|
3703
|
+
const { addLogArgs: addNoteLogArgs, takeLogArgsArray: takeAllNoteLogArgs } =
|
|
3704
|
+
makeNoteLogArgsArrayKit();
|
|
3630
3705
|
|
|
3631
3706
|
/**
|
|
3632
|
-
* @type {WeakMap<Error, NoteCallback[]>}
|
|
3633
|
-
*
|
|
3634
3707
|
* An augmented console will normally only take the hidden noteArgs array once,
|
|
3635
3708
|
* when it logs the error being annotated. Once that happens, further
|
|
3636
3709
|
* annotations of that error should go to the console immediately. We arrange
|
|
@@ -3639,14 +3712,16 @@ const { addLogArgs, takeLogArgsArray } = makeNoteLogArgsArrayKit();
|
|
|
3639
3712
|
* callback per error, but that depends on console behavior which we should not
|
|
3640
3713
|
* assume. We make this an array of callbacks so multiple registrations
|
|
3641
3714
|
* are independent.
|
|
3715
|
+
*
|
|
3716
|
+
* @type {WeakMap<Error, NoteCallback[]>}
|
|
3642
3717
|
*/
|
|
3643
|
-
const
|
|
3718
|
+
const hiddenNoteCallbacks = new WeakMap();
|
|
3644
3719
|
|
|
3645
3720
|
/** @type {AssertionUtilities['note']} */
|
|
3646
3721
|
const note = (error, detailsNote) => {
|
|
3722
|
+
// Promote string-valued `detailsNote` into a minimal DetailsParts consisting
|
|
3723
|
+
// of that string as the sole literal part with no substitutions.
|
|
3647
3724
|
if (typeof detailsNote === 'string') {
|
|
3648
|
-
// If it is a string, use it as the literal part of the template so
|
|
3649
|
-
// it doesn't get quoted.
|
|
3650
3725
|
detailsNote = redactedDetails([detailsNote]);
|
|
3651
3726
|
}
|
|
3652
3727
|
const hiddenDetails = weakmapGet(hiddenDetailsMap, detailsNote);
|
|
@@ -3654,13 +3729,13 @@ const note = (error, detailsNote) => {
|
|
|
3654
3729
|
throw TypeError(`unrecognized details ${quote(detailsNote)}`);
|
|
3655
3730
|
}
|
|
3656
3731
|
const logArgs = getLogArgs(hiddenDetails);
|
|
3657
|
-
const callbacks = weakmapGet(
|
|
3732
|
+
const callbacks = weakmapGet(hiddenNoteCallbacks, error);
|
|
3658
3733
|
if (callbacks !== undefined) {
|
|
3659
3734
|
for (const callback of callbacks) {
|
|
3660
3735
|
callback(error, logArgs);
|
|
3661
3736
|
}
|
|
3662
3737
|
} else {
|
|
3663
|
-
|
|
3738
|
+
addNoteLogArgs(error, logArgs);
|
|
3664
3739
|
}
|
|
3665
3740
|
};$h͏_once.note(note);
|
|
3666
3741
|
freeze(note);
|
|
@@ -3694,21 +3769,21 @@ const loggedErrorHandler = {
|
|
|
3694
3769
|
},
|
|
3695
3770
|
getMessageLogArgs: error => weakmapGet(hiddenMessageLogArgs, error),
|
|
3696
3771
|
takeMessageLogArgs: error => {
|
|
3697
|
-
const
|
|
3772
|
+
const logArgs = weakmapGet(hiddenMessageLogArgs, error);
|
|
3698
3773
|
weakmapDelete(hiddenMessageLogArgs, error);
|
|
3699
|
-
return
|
|
3774
|
+
return logArgs;
|
|
3700
3775
|
},
|
|
3701
3776
|
takeNoteLogArgsArray: (error, callback) => {
|
|
3702
|
-
const
|
|
3777
|
+
const logArgsArray = takeAllNoteLogArgs(error);
|
|
3703
3778
|
if (callback !== undefined) {
|
|
3704
|
-
const callbacks = weakmapGet(
|
|
3779
|
+
const callbacks = weakmapGet(hiddenNoteCallbacks, error);
|
|
3705
3780
|
if (callbacks) {
|
|
3706
3781
|
arrayPush(callbacks, callback);
|
|
3707
3782
|
} else {
|
|
3708
|
-
weakmapSet(
|
|
3783
|
+
weakmapSet(hiddenNoteCallbacks, error, [callback]);
|
|
3709
3784
|
}
|
|
3710
3785
|
}
|
|
3711
|
-
return
|
|
3786
|
+
return logArgsArray || [];
|
|
3712
3787
|
},
|
|
3713
3788
|
};$h͏_once.loggedErrorHandler(loggedErrorHandler);
|
|
3714
3789
|
freeze(loggedErrorHandler);
|
|
@@ -3719,7 +3794,7 @@ freeze(loggedErrorHandler);
|
|
|
3719
3794
|
/**
|
|
3720
3795
|
* @type {MakeAssert}
|
|
3721
3796
|
*/
|
|
3722
|
-
const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
3797
|
+
const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
3723
3798
|
const details = unredacted ? unredactedDetails : redactedDetails;
|
|
3724
3799
|
const assertFailedDetails = details`Check failed`;
|
|
3725
3800
|
|
|
@@ -3731,7 +3806,6 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
3731
3806
|
) => {
|
|
3732
3807
|
const reason = makeError(optDetails, errConstructor, options);
|
|
3733
3808
|
if (optRaise !== undefined) {
|
|
3734
|
-
// @ts-ignore returns `never` doesn't mean it isn't callable
|
|
3735
3809
|
optRaise(reason);
|
|
3736
3810
|
}
|
|
3737
3811
|
throw reason;
|
|
@@ -3741,18 +3815,16 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
3741
3815
|
/** @type {AssertionUtilities['Fail']} */
|
|
3742
3816
|
const Fail = (template, ...args) => fail(details(template, ...args));
|
|
3743
3817
|
|
|
3744
|
-
// Don't freeze or export `
|
|
3745
|
-
// TODO If I change this from a `function` function to an arrow
|
|
3746
|
-
// function, I seem to get type errors from TypeScript. Why?
|
|
3818
|
+
// Don't freeze or export `assert` until we add methods.
|
|
3747
3819
|
/** @type {BaseAssert} */
|
|
3748
|
-
|
|
3749
|
-
|
|
3820
|
+
const assert = (
|
|
3821
|
+
condition,
|
|
3750
3822
|
optDetails = undefined,
|
|
3751
3823
|
errConstructor = undefined,
|
|
3752
3824
|
options = undefined,
|
|
3753
|
-
) {
|
|
3754
|
-
|
|
3755
|
-
}
|
|
3825
|
+
) => {
|
|
3826
|
+
condition || fail(optDetails, errConstructor, options);
|
|
3827
|
+
};
|
|
3756
3828
|
|
|
3757
3829
|
/** @type {AssertionFunctions['equal']} */
|
|
3758
3830
|
const equal = (
|
|
@@ -3794,26 +3866,37 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
3794
3866
|
const assertString = (specimen, optDetails = undefined) =>
|
|
3795
3867
|
assertTypeof(specimen, 'string', optDetails);
|
|
3796
3868
|
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
const assert = assign(baseAssert, {
|
|
3800
|
-
error: makeError,
|
|
3801
|
-
fail,
|
|
3869
|
+
/** @type {Pick<AssertionFunctions, keyof AssertionFunctions>} */
|
|
3870
|
+
const assertionFunctions = {
|
|
3802
3871
|
equal,
|
|
3803
3872
|
typeof: assertTypeof,
|
|
3804
3873
|
string: assertString,
|
|
3874
|
+
fail,
|
|
3875
|
+
};
|
|
3876
|
+
|
|
3877
|
+
/** @type {AssertionUtilities} */
|
|
3878
|
+
const assertionUtilities = {
|
|
3879
|
+
makeError,
|
|
3805
3880
|
note,
|
|
3806
3881
|
details,
|
|
3807
3882
|
Fail,
|
|
3808
3883
|
quote,
|
|
3809
3884
|
bare,
|
|
3810
|
-
|
|
3885
|
+
};
|
|
3886
|
+
|
|
3887
|
+
/** @type {DeprecatedAssertionUtilities} */
|
|
3888
|
+
const deprecated = { error: makeError, makeAssert };
|
|
3889
|
+
|
|
3890
|
+
/** @type {Assert} */
|
|
3891
|
+
const finishedAssert = assign(assert, {
|
|
3892
|
+
...assertionFunctions,
|
|
3893
|
+
...assertionUtilities,
|
|
3894
|
+
...deprecated,
|
|
3811
3895
|
});
|
|
3812
|
-
return freeze(
|
|
3896
|
+
return freeze(finishedAssert);
|
|
3813
3897
|
};$h͏_once.makeAssert(makeAssert);
|
|
3814
3898
|
freeze(makeAssert);
|
|
3815
3899
|
|
|
3816
|
-
|
|
3817
3900
|
/** @type {Assert} */
|
|
3818
3901
|
const assert = makeAssert();$h͏_once.assert(assert);
|
|
3819
3902
|
|
|
@@ -4685,6 +4768,11 @@ const CommonMath = {
|
|
|
4685
4768
|
seal: fn,
|
|
4686
4769
|
setPrototypeOf: fn,
|
|
4687
4770
|
values: fn,
|
|
4771
|
+
'RegisteredSymbol(harden)': {
|
|
4772
|
+
...fn,
|
|
4773
|
+
// Installed with hardenTaming: 'unsafe'
|
|
4774
|
+
isFake: 'boolean',
|
|
4775
|
+
},
|
|
4688
4776
|
// https://github.com/tc39/proposal-accessible-object-hasownproperty
|
|
4689
4777
|
hasOwn: fn,
|
|
4690
4778
|
// https://github.com/tc39/proposal-array-grouping
|
|
@@ -6894,6 +6982,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6894
6982
|
'%ErrorPrototype%': {
|
|
6895
6983
|
name: true // set by "precond", "ava", "node-fetch"
|
|
6896
6984
|
},
|
|
6985
|
+
|
|
6897
6986
|
'%IteratorPrototype%': {
|
|
6898
6987
|
toString: true,
|
|
6899
6988
|
// https://github.com/tc39/proposal-iterator-helpers
|
|
@@ -6907,6 +6996,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6907
6996
|
* Moderate enablements are usually good enough for legacy compat.
|
|
6908
6997
|
*/$h͏_once.minEnablements(minEnablements);
|
|
6909
6998
|
const moderateEnablements = {
|
|
6999
|
+
...minEnablements,
|
|
7000
|
+
|
|
6910
7001
|
'%ObjectPrototype%': {
|
|
6911
7002
|
toString: true,
|
|
6912
7003
|
valueOf: true,
|
|
@@ -6919,6 +7010,10 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6919
7010
|
[iteratorSymbol]: true // set by mobx generated code (old TS compiler?)
|
|
6920
7011
|
},
|
|
6921
7012
|
|
|
7013
|
+
'%IteratorPrototype%': {
|
|
7014
|
+
[iteratorSymbol]: true // is sometimes used in custom iterators and generators implementations eg. @rive-app/canvas
|
|
7015
|
+
},
|
|
7016
|
+
|
|
6922
7017
|
// Function.prototype has no 'prototype' property to enable.
|
|
6923
7018
|
// Function instances have their own 'name' and 'length' properties
|
|
6924
7019
|
// which are configurable and non-writable. Thus, they are already
|
|
@@ -6984,14 +7079,6 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
6984
7079
|
name: true,
|
|
6985
7080
|
toString: true,
|
|
6986
7081
|
},
|
|
6987
|
-
|
|
6988
|
-
'%IteratorPrototype%': {
|
|
6989
|
-
toString: true,
|
|
6990
|
-
// https://github.com/tc39/proposal-iterator-helpers
|
|
6991
|
-
constructor: true,
|
|
6992
|
-
// https://github.com/tc39/proposal-iterator-helpers
|
|
6993
|
-
[toStringTagSymbol]: true,
|
|
6994
|
-
},
|
|
6995
7082
|
};
|
|
6996
7083
|
|
|
6997
7084
|
/**
|
|
@@ -7958,7 +8045,8 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
|
|
|
7958
8045
|
})()
|
|
7959
8046
|
,
|
|
7960
8047
|
// === 33. ses ./src/transforms.js ===
|
|
7961
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,
|
|
8048
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,regexpReplace,sealRegexp,stringSearch,stringSlice,stringSplit,freeze,getSourceURL;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringSearch",[$h͏_a => (stringSearch = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]],["./get-source-url.js", [["getSourceURL",[$h͏_a => (getSourceURL = $h͏_a)]]]]]);
|
|
8049
|
+
|
|
7962
8050
|
|
|
7963
8051
|
|
|
7964
8052
|
|
|
@@ -7995,7 +8083,9 @@ function getLineNumber(src, pattern) {
|
|
|
7995
8083
|
|
|
7996
8084
|
// /////////////////////////////////////////////////////////////////////////////
|
|
7997
8085
|
|
|
7998
|
-
const htmlCommentPattern =
|
|
8086
|
+
const htmlCommentPattern = sealRegexp(
|
|
8087
|
+
new FERAL_REG_EXP(`(?:${'<'}!--|--${'>'})`, 'g'),
|
|
8088
|
+
);
|
|
7999
8089
|
|
|
8000
8090
|
/**
|
|
8001
8091
|
* Conservatively reject the source text if it may contain text that some
|
|
@@ -8060,14 +8150,13 @@ const htmlCommentPattern = new FERAL_REG_EXP(`(?:${'<'}!--|--${'>'})`, 'g');
|
|
|
8060
8150
|
*/$h͏_once.rejectHtmlComments(rejectHtmlComments);
|
|
8061
8151
|
const evadeHtmlCommentTest = src => {
|
|
8062
8152
|
const replaceFn = match => (match[0] === '<' ? '< ! --' : '-- >');
|
|
8063
|
-
return
|
|
8153
|
+
return regexpReplace(htmlCommentPattern, src, replaceFn);
|
|
8064
8154
|
};
|
|
8065
8155
|
|
|
8066
8156
|
// /////////////////////////////////////////////////////////////////////////////
|
|
8067
8157
|
$h͏_once.evadeHtmlCommentTest(evadeHtmlCommentTest);
|
|
8068
|
-
const importPattern =
|
|
8069
|
-
'(^|[^.]|\\.\\.\\.)\\bimport(\\s*(?:\\(|/[/*]))',
|
|
8070
|
-
'g',
|
|
8158
|
+
const importPattern = sealRegexp(
|
|
8159
|
+
new FERAL_REG_EXP('(^|[^.]|\\.\\.\\.)\\bimport(\\s*(?:\\(|/[/*]))', 'g'),
|
|
8071
8160
|
);
|
|
8072
8161
|
|
|
8073
8162
|
/**
|
|
@@ -8130,7 +8219,7 @@ const importPattern = new FERAL_REG_EXP(
|
|
|
8130
8219
|
*/$h͏_once.rejectImportExpressions(rejectImportExpressions);
|
|
8131
8220
|
const evadeImportExpressionTest = src => {
|
|
8132
8221
|
const replaceFn = (_, p1, p2) => `${p1}__import__${p2}`;
|
|
8133
|
-
return
|
|
8222
|
+
return regexpReplace(importPattern, src, replaceFn);
|
|
8134
8223
|
};
|
|
8135
8224
|
|
|
8136
8225
|
// /////////////////////////////////////////////////////////////////////////////
|
|
@@ -8228,7 +8317,9 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
|
|
|
8228
8317
|
})()
|
|
8229
8318
|
,
|
|
8230
8319
|
// === 34. ses ./src/scope-constants.js ===
|
|
8231
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,hasOwn,
|
|
8320
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,hasOwn,regexpExec,Set,setHas;$h͏_imports([["./commons.js", [["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]]]]]);
|
|
8321
|
+
|
|
8322
|
+
|
|
8232
8323
|
|
|
8233
8324
|
|
|
8234
8325
|
|
|
@@ -8238,11 +8329,12 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
|
|
|
8238
8329
|
|
|
8239
8330
|
|
|
8240
8331
|
/**
|
|
8241
|
-
*
|
|
8242
|
-
* In JavaScript you cannot use
|
|
8243
|
-
*
|
|
8332
|
+
* reservedNames
|
|
8333
|
+
* In JavaScript you cannot use reserved words as variable names (except for
|
|
8334
|
+
* "eval", which is specially reserved to prevent shadowing).
|
|
8335
|
+
* https://tc39.es/ecma262/multipage/ecmascript-language-lexical-grammar.html#sec-identifier-names
|
|
8244
8336
|
*/
|
|
8245
|
-
const
|
|
8337
|
+
const reservedNames = new Set([
|
|
8246
8338
|
// 11.6.2.1 Keywords
|
|
8247
8339
|
'await',
|
|
8248
8340
|
'break',
|
|
@@ -8303,7 +8395,10 @@ const keywords = [
|
|
|
8303
8395
|
|
|
8304
8396
|
'this',
|
|
8305
8397
|
'arguments',
|
|
8306
|
-
|
|
8398
|
+
|
|
8399
|
+
// Reserved by us
|
|
8400
|
+
'eval',
|
|
8401
|
+
]);
|
|
8307
8402
|
|
|
8308
8403
|
/**
|
|
8309
8404
|
* identifierPattern
|
|
@@ -8319,24 +8414,12 @@ const identifierPattern = /^[a-zA-Z_$][\w$]*$/;
|
|
|
8319
8414
|
|
|
8320
8415
|
/**
|
|
8321
8416
|
* isValidIdentifierName()
|
|
8322
|
-
*
|
|
8323
|
-
* property names which can be variable names, including the names
|
|
8324
|
-
* of inherited properties. It excludes symbols and names which are
|
|
8325
|
-
* keywords. We drop symbols safely. Currently, this shim refuses
|
|
8326
|
-
* service if any of the names are keywords or keyword-like. This is
|
|
8327
|
-
* safe and only prevent performance optimization.
|
|
8417
|
+
* Is a value allowed as an arbitrary identifier name?
|
|
8328
8418
|
*
|
|
8329
8419
|
* @param {string} name
|
|
8330
8420
|
*/
|
|
8331
|
-
const isValidIdentifierName = name =>
|
|
8332
|
-
|
|
8333
|
-
// /../.test() to guard against the case where RegExp has been poisoned.
|
|
8334
|
-
return (
|
|
8335
|
-
name !== 'eval' &&
|
|
8336
|
-
!arrayIncludes(keywords, name) &&
|
|
8337
|
-
regexpTest(identifierPattern, name)
|
|
8338
|
-
);
|
|
8339
|
-
};
|
|
8421
|
+
const isValidIdentifierName = name =>
|
|
8422
|
+
!setHas(reservedNames, name) && !!regexpExec(identifierPattern, name);
|
|
8340
8423
|
|
|
8341
8424
|
/*
|
|
8342
8425
|
* isImmutableDataProperty
|
|
@@ -8367,12 +8450,12 @@ function isImmutableDataProperty(obj, name) {
|
|
|
8367
8450
|
|
|
8368
8451
|
/**
|
|
8369
8452
|
* getScopeConstants()
|
|
8370
|
-
* What variable names might
|
|
8453
|
+
* What variable names might be brought into scope? These include all
|
|
8371
8454
|
* property names which can be variable names, including the names
|
|
8372
8455
|
* of inherited properties. It excludes symbols and names which are
|
|
8373
8456
|
* keywords. We drop symbols safely. Currently, this shim refuses
|
|
8374
8457
|
* service if any of the names are keywords or keyword-like. This is
|
|
8375
|
-
* safe and only
|
|
8458
|
+
* safe and only affects performance optimization.
|
|
8376
8459
|
*
|
|
8377
8460
|
* @param {object} globalObject
|
|
8378
8461
|
* @param {object} moduleLexicals
|
|
@@ -9659,8 +9742,7 @@ const wrapLogger = (logger, thisArg) =>
|
|
|
9659
9742
|
})()
|
|
9660
9743
|
,
|
|
9661
9744
|
// === 43. ses ./src/error/tame-v8-error-constructor.js ===
|
|
9662
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,
|
|
9663
|
-
|
|
9745
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,TypeError;$h͏_imports([["../commons.js", [["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arraySlice",[$h͏_a => (arraySlice = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["reflectSet",[$h͏_a => (reflectSet = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]]]]]);
|
|
9664
9746
|
|
|
9665
9747
|
|
|
9666
9748
|
|
|
@@ -9763,12 +9845,12 @@ const FILENAME_CENSORS = [
|
|
|
9763
9845
|
// Exported only so it can be unit tested.
|
|
9764
9846
|
// TODO Move so that it applies not just to v8.
|
|
9765
9847
|
const filterFileName = fileName => {
|
|
9766
|
-
if (
|
|
9767
|
-
//
|
|
9768
|
-
return
|
|
9848
|
+
if (fileName === null) {
|
|
9849
|
+
// Seems to suppress builtins like `Array.every (<anonymous>)`
|
|
9850
|
+
return false;
|
|
9769
9851
|
}
|
|
9770
9852
|
for (const filter of FILENAME_CENSORS) {
|
|
9771
|
-
if (
|
|
9853
|
+
if (regexpExec(filter, fileName)) {
|
|
9772
9854
|
return false;
|
|
9773
9855
|
}
|
|
9774
9856
|
}
|
|
@@ -9779,9 +9861,9 @@ const FILENAME_CENSORS = [
|
|
|
9779
9861
|
// likely url-path prefix, ending in a `/.../` should get dropped.
|
|
9780
9862
|
// Anything to the left of the likely path text is kept.
|
|
9781
9863
|
// Everything to the right of `/.../` is kept. Thus
|
|
9782
|
-
// `'Object.bar (/vat-v1/.../
|
|
9864
|
+
// `'Object.bar (/vat-v1/.../errors/test/deep-send.test.js:13:21)'`
|
|
9783
9865
|
// simplifies to
|
|
9784
|
-
// `'Object.bar (
|
|
9866
|
+
// `'Object.bar (errors/test/deep-send.test.js:13:21)'`.
|
|
9785
9867
|
//
|
|
9786
9868
|
// See thread starting at
|
|
9787
9869
|
// https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
|
|
@@ -9791,9 +9873,9 @@ $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSIS_PATTERN1=/^((?:
|
|
|
9791
9873
|
// likely url-path prefix consisting of `.../` should get dropped.
|
|
9792
9874
|
// Anything to the left of the likely path text is kept.
|
|
9793
9875
|
// Everything to the right of `.../` is kept. Thus
|
|
9794
|
-
// `'Object.bar (.../
|
|
9876
|
+
// `'Object.bar (.../errors/test/deep-send.test.js:13:21)'`
|
|
9795
9877
|
// simplifies to
|
|
9796
|
-
// `'Object.bar (
|
|
9878
|
+
// `'Object.bar (errors/test/deep-send.test.js:13:21)'`.
|
|
9797
9879
|
//
|
|
9798
9880
|
// See thread starting at
|
|
9799
9881
|
// https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
|
|
@@ -9804,9 +9886,9 @@ const CALLSITE_ELLIPSIS_PATTERN2 = /^((?:.*[( ])?)\.\.\.\/(.+)$/;
|
|
|
9804
9886
|
// dropped.
|
|
9805
9887
|
// Anything to the left of the likely path prefix text is kept. `package/` and
|
|
9806
9888
|
// everything to its right is kept. Thus
|
|
9807
|
-
// `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/
|
|
9889
|
+
// `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/errors/test/deep-send.test.js:13:21)'`
|
|
9808
9890
|
// simplifies to
|
|
9809
|
-
// `'Object.bar (packages/
|
|
9891
|
+
// `'Object.bar (packages/errors/test/deep-send.test.js:13:21)'`.
|
|
9810
9892
|
// Note that `/packages/` is a convention for monorepos encouraged by
|
|
9811
9893
|
// lerna.
|
|
9812
9894
|
const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
|
|
@@ -9816,7 +9898,7 @@ const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
|
|
|
9816
9898
|
// dropped.
|
|
9817
9899
|
// Anything to the left of the likely path prefix text is kept. Everything to
|
|
9818
9900
|
// the right of `file://` is kept. Thus
|
|
9819
|
-
// `'Object.bar (file:///Users/markmiller/src/ongithub/endojs/endo/packages/
|
|
9901
|
+
// `'Object.bar (file:///Users/markmiller/src/ongithub/endojs/endo/packages/errors/test/deep-send.test.js:13:21)'` is unchanged but
|
|
9820
9902
|
// `'Object.bar (file://test/deep-send.test.js:13:21)'`
|
|
9821
9903
|
|
|
9822
9904
|
// simplifies to
|
|
@@ -9882,6 +9964,10 @@ const CALLSITE_PATTERNS = [
|
|
|
9882
9964
|
// const callSiteFilter = _callSite => true;
|
|
9883
9965
|
const callSiteFilter = callSite => {
|
|
9884
9966
|
if (omitFrames) {
|
|
9967
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
9968
|
+
if (callSite.getFunctionName()?.startsWith('__HIDE_')) {
|
|
9969
|
+
return false;
|
|
9970
|
+
}
|
|
9885
9971
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
9886
9972
|
return filterFileName(callSite.getFileName());
|
|
9887
9973
|
}
|
|
@@ -11712,6 +11798,25 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
|
|
|
11712
11798
|
};
|
|
11713
11799
|
notifiers['*'] = notifyStar;
|
|
11714
11800
|
|
|
11801
|
+
const wireUpExportNotifier = (exportName, notify) => {
|
|
11802
|
+
if (!notifiers[exportName] && notify !== false) {
|
|
11803
|
+
notifiers[exportName] = notify;
|
|
11804
|
+
|
|
11805
|
+
// exported live binding state
|
|
11806
|
+
let value;
|
|
11807
|
+
const update = newValue => (value = newValue);
|
|
11808
|
+
notify(update);
|
|
11809
|
+
exportsProps[exportName] = {
|
|
11810
|
+
get() {
|
|
11811
|
+
return value;
|
|
11812
|
+
},
|
|
11813
|
+
set: undefined,
|
|
11814
|
+
enumerable: true,
|
|
11815
|
+
configurable: false,
|
|
11816
|
+
};
|
|
11817
|
+
}
|
|
11818
|
+
};
|
|
11819
|
+
|
|
11715
11820
|
// Per the calling convention for the moduleFunctor generated from
|
|
11716
11821
|
// an ESM, the `imports` function gets called once up front
|
|
11717
11822
|
// to populate or arrange the population of imports and reexports.
|
|
@@ -11765,30 +11870,15 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
|
|
|
11765
11870
|
}
|
|
11766
11871
|
}
|
|
11767
11872
|
if (reexportMap[specifier]) {
|
|
11768
|
-
//
|
|
11873
|
+
// Set up reexport notifiers instantly so they are available in cycles.
|
|
11769
11874
|
for (const [localName, exportedName] of reexportMap[specifier]) {
|
|
11770
|
-
|
|
11875
|
+
wireUpExportNotifier(exportedName, importNotifiers[localName]);
|
|
11771
11876
|
}
|
|
11772
11877
|
}
|
|
11773
11878
|
}
|
|
11774
11879
|
|
|
11775
11880
|
for (const [exportName, notify] of entries(candidateAll)) {
|
|
11776
|
-
|
|
11777
|
-
notifiers[exportName] = notify;
|
|
11778
|
-
|
|
11779
|
-
// exported live binding state
|
|
11780
|
-
let value;
|
|
11781
|
-
const update = newValue => (value = newValue);
|
|
11782
|
-
notify(update);
|
|
11783
|
-
exportsProps[exportName] = {
|
|
11784
|
-
get() {
|
|
11785
|
-
return value;
|
|
11786
|
-
},
|
|
11787
|
-
set: undefined,
|
|
11788
|
-
enumerable: true,
|
|
11789
|
-
configurable: false,
|
|
11790
|
-
};
|
|
11791
|
-
}
|
|
11881
|
+
wireUpExportNotifier(exportName, notify);
|
|
11792
11882
|
}
|
|
11793
11883
|
|
|
11794
11884
|
// Sort the module exports namespace as per spec.
|
|
@@ -12668,7 +12758,6 @@ function makeArguments() {
|
|
|
12668
12758
|
}
|
|
12669
12759
|
|
|
12670
12760
|
const ab = new ArrayBuffer(0);
|
|
12671
|
-
// @ts-expect-error TODO How do I add sliceToImmutable to ArrayBuffer type?
|
|
12672
12761
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
12673
12762
|
const iab = ab.sliceToImmutable();
|
|
12674
12763
|
const iabProto = getPrototypeOf(iab);
|
|
@@ -13114,16 +13203,48 @@ const throws = thunk => {
|
|
|
13114
13203
|
})()
|
|
13115
13204
|
,
|
|
13116
13205
|
// === 57. ses ./src/reporting.js ===
|
|
13117
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let
|
|
13206
|
+
({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)]]]]]);
|
|
13118
13207
|
|
|
13119
13208
|
|
|
13120
13209
|
/**
|
|
13121
13210
|
* @import {Reporter, GroupReporter} from './reporting-types.js'
|
|
13122
13211
|
*/
|
|
13123
13212
|
|
|
13213
|
+
/* eslint-disable @endo/no-polymorphic-call */
|
|
13214
|
+
/**
|
|
13215
|
+
* To address https://github.com/endojs/endo/issues/2908,
|
|
13216
|
+
* the `consoleReporter` uses the current `console` rather
|
|
13217
|
+
* than the original one.
|
|
13218
|
+
*
|
|
13219
|
+
* @type {GroupReporter}
|
|
13220
|
+
*/
|
|
13221
|
+
const consoleReporter = {
|
|
13222
|
+
warn(...args) {
|
|
13223
|
+
globalThis.console.warn(...args);
|
|
13224
|
+
},
|
|
13225
|
+
error(...args) {
|
|
13226
|
+
globalThis.console.error(...args);
|
|
13227
|
+
},
|
|
13228
|
+
...(globalThis.console?.groupCollapsed
|
|
13229
|
+
? {
|
|
13230
|
+
groupCollapsed(...args) {
|
|
13231
|
+
globalThis.console.groupCollapsed(...args);
|
|
13232
|
+
},
|
|
13233
|
+
}
|
|
13234
|
+
: undefined),
|
|
13235
|
+
...(globalThis.console?.groupEnd
|
|
13236
|
+
? {
|
|
13237
|
+
groupEnd() {
|
|
13238
|
+
globalThis.console.groupEnd();
|
|
13239
|
+
},
|
|
13240
|
+
}
|
|
13241
|
+
: undefined),
|
|
13242
|
+
};
|
|
13243
|
+
/* eslint-enable @endo/no-polymorphic-call */
|
|
13244
|
+
|
|
13124
13245
|
/**
|
|
13125
13246
|
* Creates a suitable reporter for internal errors and warnings out of the
|
|
13126
|
-
* Node.js console.error to ensure all messages to
|
|
13247
|
+
* Node.js console.error to ensure all messages go to stderr, including the
|
|
13127
13248
|
* group label.
|
|
13128
13249
|
* Accounts for the extra space introduced by console.error as a delimiter
|
|
13129
13250
|
* between the indent and subsequent arguments.
|
|
@@ -13167,18 +13288,22 @@ const mute = () => {};
|
|
|
13167
13288
|
if (reporting === 'none') {
|
|
13168
13289
|
return makeReportPrinter(mute);
|
|
13169
13290
|
}
|
|
13170
|
-
if (
|
|
13171
|
-
reporting === 'console' ||
|
|
13172
|
-
globalThis.window === globalThis ||
|
|
13173
|
-
globalThis.importScripts !== undefined
|
|
13174
|
-
) {
|
|
13175
|
-
return console;
|
|
13176
|
-
}
|
|
13177
13291
|
if (globalThis.console !== undefined) {
|
|
13292
|
+
if (
|
|
13293
|
+
reporting === 'console' || // asks for console explicitly
|
|
13294
|
+
globalThis.window === globalThis || // likely on browser
|
|
13295
|
+
globalThis.importScripts !== undefined // likely on worker
|
|
13296
|
+
) {
|
|
13297
|
+
// reporter just delegates directly to the current console
|
|
13298
|
+
return consoleReporter;
|
|
13299
|
+
}
|
|
13300
|
+
assert(reporting === 'platform');
|
|
13178
13301
|
// On Node.js, we send all feedback to stderr, regardless of purported level.
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13302
|
+
// This uses `consoleReporter.error` instead of `console.error` because we
|
|
13303
|
+
// want the constructed reporter to use the `console.error` of the current
|
|
13304
|
+
// `console`, not the `console` that was installed when the reporter
|
|
13305
|
+
// was created.
|
|
13306
|
+
return makeReportPrinter(consoleReporter.error);
|
|
13182
13307
|
}
|
|
13183
13308
|
if (globalThis.print !== undefined) {
|
|
13184
13309
|
return makeReportPrinter(globalThis.print);
|
|
@@ -13222,7 +13347,8 @@ const mute = () => {};
|
|
|
13222
13347
|
})()
|
|
13223
13348
|
,
|
|
13224
13349
|
// === 58. ses ./src/lockdown.js ===
|
|
13225
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,noEvalEvaluate,getOwnPropertyNames,getPrototypeOf,makeHardener,makeIntrinsicsCollector,removeUnpermittedIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameModuleSource,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor,tameFauxDataProperties,tameRegeneratorRuntime,shimArrayBufferTransfer,reportInGroup,chooseReporter;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["@endo/immutable-arraybuffer/shim.js", []],["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["FERAL_EVAL",[$h͏_a => (FERAL_EVAL = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["noEvalEvaluate",[$h͏_a => (noEvalEvaluate = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]]]],["./make-hardener.js", [["makeHardener",[$h͏_a => (makeHardener = $h͏_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector",[$h͏_a => (makeIntrinsicsCollector = $h͏_a)]]]],["./permits-intrinsics.js", [["default",[$h͏_a => (removeUnpermittedIntrinsics = $h͏_a)]]]],["./tame-function-constructors.js", [["default",[$h͏_a => (tameFunctionConstructors = $h͏_a)]]]],["./tame-date-constructor.js", [["default",[$h͏_a => (tameDateConstructor = $h͏_a)]]]],["./tame-math-object.js", [["default",[$h͏_a => (tameMathObject = $h͏_a)]]]],["./tame-regexp-constructor.js", [["default",[$h͏_a => (tameRegExpConstructor = $h͏_a)]]]],["./enable-property-overrides.js", [["default",[$h͏_a => (enablePropertyOverrides = $h͏_a)]]]],["./tame-locale-methods.js", [["default",[$h͏_a => (tameLocaleMethods = $h͏_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties",[$h͏_a => (setGlobalObjectConstantProperties = $h͏_a)]],["setGlobalObjectMutableProperties",[$h͏_a => (setGlobalObjectMutableProperties = $h͏_a)]],["setGlobalObjectEvaluators",[$h͏_a => (setGlobalObjectEvaluators = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]],["./permits.js", [["initialGlobalPropertyNames",[$h͏_a => (initialGlobalPropertyNames = $h͏_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString",[$h͏_a => (tameFunctionToString = $h͏_a)]]]],["./tame-domains.js", [["tameDomains",[$h͏_a => (tameDomains = $h͏_a)]]]],["./tame-module-source.js", [["tameModuleSource",[$h͏_a => (tameModuleSource = $h͏_a)]]]],["./error/tame-console.js", [["tameConsole",[$h͏_a => (tameConsole = $h͏_a)]]]],["./error/tame-error-constructor.js", [["default",[$h͏_a => (tameErrorConstructor = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]],["makeAssert",[$h͏_a => (makeAssert = $h͏_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics",[$h͏_a => (getAnonymousIntrinsics = $h͏_a)]]]],["./compartment.js", [["makeCompartmentConstructor",[$h͏_a => (makeCompartmentConstructor = $h͏_a)]]]],["./tame-harden.js", [["tameHarden",[$h͏_a => (tameHarden = $h͏_a)]]]],["./tame-symbol-constructor.js", [["tameSymbolConstructor",[$h͏_a => (tameSymbolConstructor = $h͏_a)]]]],["./tame-faux-data-properties.js", [["tameFauxDataProperties",[$h͏_a => (tameFauxDataProperties = $h͏_a)]]]],["./tame-regenerator-runtime.js", [["tameRegeneratorRuntime",[$h͏_a => (tameRegeneratorRuntime = $h͏_a)]]]],["./shim-arraybuffer-transfer.js", [["shimArrayBufferTransfer",[$h͏_a => (shimArrayBufferTransfer = $h͏_a)]]]],["./reporting.js", [["reportInGroup",[$h͏_a => (reportInGroup = $h͏_a)]],["chooseReporter",[$h͏_a => (chooseReporter = $h͏_a)]]]]]);
|
|
13350
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,symbolFor,noEvalEvaluate,getOwnPropertyNames,getPrototypeOf,makeHardener,makeIntrinsicsCollector,removeUnpermittedIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameModuleSource,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor,tameFauxDataProperties,tameRegeneratorRuntime,shimArrayBufferTransfer,reportInGroup,chooseReporter;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["@endo/immutable-arraybuffer/shim.js", []],["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["FERAL_EVAL",[$h͏_a => (FERAL_EVAL = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["symbolFor",[$h͏_a => (symbolFor = $h͏_a)]],["noEvalEvaluate",[$h͏_a => (noEvalEvaluate = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]]]],["./make-hardener.js", [["makeHardener",[$h͏_a => (makeHardener = $h͏_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector",[$h͏_a => (makeIntrinsicsCollector = $h͏_a)]]]],["./permits-intrinsics.js", [["default",[$h͏_a => (removeUnpermittedIntrinsics = $h͏_a)]]]],["./tame-function-constructors.js", [["default",[$h͏_a => (tameFunctionConstructors = $h͏_a)]]]],["./tame-date-constructor.js", [["default",[$h͏_a => (tameDateConstructor = $h͏_a)]]]],["./tame-math-object.js", [["default",[$h͏_a => (tameMathObject = $h͏_a)]]]],["./tame-regexp-constructor.js", [["default",[$h͏_a => (tameRegExpConstructor = $h͏_a)]]]],["./enable-property-overrides.js", [["default",[$h͏_a => (enablePropertyOverrides = $h͏_a)]]]],["./tame-locale-methods.js", [["default",[$h͏_a => (tameLocaleMethods = $h͏_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties",[$h͏_a => (setGlobalObjectConstantProperties = $h͏_a)]],["setGlobalObjectMutableProperties",[$h͏_a => (setGlobalObjectMutableProperties = $h͏_a)]],["setGlobalObjectEvaluators",[$h͏_a => (setGlobalObjectEvaluators = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]],["./permits.js", [["initialGlobalPropertyNames",[$h͏_a => (initialGlobalPropertyNames = $h͏_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString",[$h͏_a => (tameFunctionToString = $h͏_a)]]]],["./tame-domains.js", [["tameDomains",[$h͏_a => (tameDomains = $h͏_a)]]]],["./tame-module-source.js", [["tameModuleSource",[$h͏_a => (tameModuleSource = $h͏_a)]]]],["./error/tame-console.js", [["tameConsole",[$h͏_a => (tameConsole = $h͏_a)]]]],["./error/tame-error-constructor.js", [["default",[$h͏_a => (tameErrorConstructor = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]],["makeAssert",[$h͏_a => (makeAssert = $h͏_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics",[$h͏_a => (getAnonymousIntrinsics = $h͏_a)]]]],["./compartment.js", [["makeCompartmentConstructor",[$h͏_a => (makeCompartmentConstructor = $h͏_a)]]]],["./tame-harden.js", [["tameHarden",[$h͏_a => (tameHarden = $h͏_a)]]]],["./tame-symbol-constructor.js", [["tameSymbolConstructor",[$h͏_a => (tameSymbolConstructor = $h͏_a)]]]],["./tame-faux-data-properties.js", [["tameFauxDataProperties",[$h͏_a => (tameFauxDataProperties = $h͏_a)]]]],["./tame-regenerator-runtime.js", [["tameRegeneratorRuntime",[$h͏_a => (tameRegeneratorRuntime = $h͏_a)]]]],["./shim-arraybuffer-transfer.js", [["shimArrayBufferTransfer",[$h͏_a => (shimArrayBufferTransfer = $h͏_a)]]]],["./reporting.js", [["reportInGroup",[$h͏_a => (reportInGroup = $h͏_a)]],["chooseReporter",[$h͏_a => (chooseReporter = $h͏_a)]]]]]);
|
|
13351
|
+
|
|
13226
13352
|
|
|
13227
13353
|
|
|
13228
13354
|
|
|
@@ -13587,6 +13713,30 @@ const probeHostEvaluators = () => {
|
|
|
13587
13713
|
|
|
13588
13714
|
const intrinsics = finalIntrinsics();
|
|
13589
13715
|
|
|
13716
|
+
// Install Object[@harden] or abort.
|
|
13717
|
+
const symbolForHarden = symbolFor('harden');
|
|
13718
|
+
const priorHarden = intrinsics.Object[symbolForHarden];
|
|
13719
|
+
if (priorHarden) {
|
|
13720
|
+
// By convention, if a module like @endo/harden gets used before lockdown,
|
|
13721
|
+
// it will install itself as a non-configurable, non-writable property over
|
|
13722
|
+
// Object[@harden] so that versions of SES predating the introduction of
|
|
13723
|
+
// Object[@harden] will fail to lockdown because they cannot remove an
|
|
13724
|
+
// unknown intrinsic.
|
|
13725
|
+
// All newer versions explicitly check for Object[@harden] (here).
|
|
13726
|
+
// The @endo/harden implementation additionally captures a stack trace
|
|
13727
|
+
// where harden was first used to assist developers in tracking down the
|
|
13728
|
+
// hardened module that was initialized before lockdown.
|
|
13729
|
+
if (priorHarden.lockdownError) {
|
|
13730
|
+
throw priorHarden.lockdownError;
|
|
13731
|
+
}
|
|
13732
|
+
// And in the event a library installs Object[@harden] without leaving a
|
|
13733
|
+
// hint, we fall back to a generic lockdown error.
|
|
13734
|
+
throw new TypeError(
|
|
13735
|
+
'Cannot lockdown (repairIntrinsics) if a prior harden implementation has been used and installed. Check for libraries using @endo/harden before lockdown.',
|
|
13736
|
+
);
|
|
13737
|
+
}
|
|
13738
|
+
intrinsics.Object[symbolForHarden] = tamedHarden;
|
|
13739
|
+
|
|
13590
13740
|
const hostIntrinsics = { __proto__: null };
|
|
13591
13741
|
|
|
13592
13742
|
// The Node.js Buffer is a derived class of Uint8Array, and as such is often
|
|
@@ -13628,19 +13778,16 @@ const probeHostEvaluators = () => {
|
|
|
13628
13778
|
);
|
|
13629
13779
|
}
|
|
13630
13780
|
|
|
13781
|
+
// The default `assert` installed by `assert-shim.js` does not redact errors,
|
|
13782
|
+
// leaving `lockdown` or `repairIntrinsics` with the obligation to replace it
|
|
13783
|
+
// with a redacting version, unless the caller opts-out with errorTaming set
|
|
13784
|
+
// to `unsafe` or `unsafe-debug`.
|
|
13785
|
+
// The inverse was true through version 1.13.0, except the configuration
|
|
13786
|
+
// was disregarded and the redacting `assert` left in place if lexical
|
|
13787
|
+
// `assert` differed from `globalThis.assert`.
|
|
13631
13788
|
// @ts-ignore assert is absent on globalThis type def.
|
|
13632
|
-
if (
|
|
13633
|
-
|
|
13634
|
-
globalThis.assert === assert
|
|
13635
|
-
) {
|
|
13636
|
-
// If errorTaming is 'unsafe' or 'unsafe-debug' we replace the
|
|
13637
|
-
// global assert with
|
|
13638
|
-
// one whose `details` template literal tag does not redact
|
|
13639
|
-
// unmarked substitution values. IOW, it blabs information that
|
|
13640
|
-
// was supposed to be secret from callers, as an aid to debugging
|
|
13641
|
-
// at a further cost in safety.
|
|
13642
|
-
// @ts-ignore assert is absent on globalThis type def.
|
|
13643
|
-
globalThis.assert = makeAssert(undefined, true);
|
|
13789
|
+
if (errorTaming !== 'unsafe' && errorTaming !== 'unsafe-debug') {
|
|
13790
|
+
globalThis.assert = makeAssert();
|
|
13644
13791
|
}
|
|
13645
13792
|
|
|
13646
13793
|
// Replace *Locale* methods with their non-locale equivalents
|
|
@@ -13848,10 +13995,10 @@ globalThis.Compartment = makeCompartmentConstructor(
|
|
|
13848
13995
|
})()
|
|
13849
13996
|
,
|
|
13850
13997
|
// === 61. ses ./src/assert-shim.js ===
|
|
13851
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,
|
|
13998
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,makeAssert;$h͏_imports([["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["makeAssert",[$h͏_a => (makeAssert = $h͏_a)]]]]]);
|
|
13852
13999
|
|
|
13853
14000
|
|
|
13854
|
-
globalThis.assert =
|
|
14001
|
+
globalThis.assert = makeAssert(undefined, true);
|
|
13855
14002
|
})()
|
|
13856
14003
|
,
|
|
13857
14004
|
// === 62. ses ./src/console-shim.js ===
|