ses 0.15.22 → 0.15.23
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 +16 -0
- package/NEWS.md +26 -20
- package/dist/lockdown.cjs +65 -23
- package/dist/lockdown.mjs +65 -23
- package/dist/lockdown.umd.js +65 -23
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +65 -23
- package/dist/ses.mjs +65 -23
- package/dist/ses.umd.js +65 -23
- package/dist/ses.umd.min.js +1 -1
- package/package.json +4 -4
- package/src/commons.js +14 -9
- package/src/compartment-shim.js +5 -2
- package/src/error/console.js +1 -1
- package/src/error/stringify-utils.js +1 -1
- package/src/error/tame-error-constructor.js +34 -0
- package/src/error/unhandled-rejection.js +1 -1
package/dist/lockdown.umd.js
CHANGED
|
@@ -147,35 +147,32 @@ const { prototype: weaksetPrototype}= WeakSet;$h_once.weaksetPrototy
|
|
|
147
147
|
const { prototype: functionPrototype}= Function;$h_once.functionPrototype(functionPrototype);
|
|
148
148
|
const { prototype: promisePrototype}= Promise;$h_once.promisePrototype(promisePrototype);
|
|
149
149
|
|
|
150
|
-
const typedArrayPrototype= getPrototypeOf(Uint8Array.prototype);
|
|
150
|
+
const typedArrayPrototype= getPrototypeOf(Uint8Array.prototype);$h_once.typedArrayPrototype(typedArrayPrototype);
|
|
151
151
|
|
|
152
|
+
const { bind}= functionPrototype;
|
|
152
153
|
/**
|
|
153
154
|
* uncurryThis()
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* The original uncurry uses:
|
|
157
|
-
* const bind = Function.prototype.bind;
|
|
158
|
-
* const uncurryThis = bind.bind(bind.call);
|
|
155
|
+
* Equivalent of: fn => (thisArg, ...args) => apply(fn, thisArg, args)
|
|
159
156
|
*
|
|
160
157
|
* See those reference for a complete explanation:
|
|
161
158
|
* http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
|
|
162
159
|
* which only lives at
|
|
163
160
|
* http://web.archive.org/web/20160805225710/http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
|
|
164
161
|
*
|
|
165
|
-
* @
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const uncurryThis= (fn)=>(thisArg, ...args)=> apply(fn, thisArg, args);$h_once.uncurryThis(uncurryThis);
|
|
170
|
-
|
|
162
|
+
* @type {<F extends (this: any, ...args: any[]) => any>(fn: F) => ((thisArg: ThisParameterType<F>, ...args: Parameters<F>) => ReturnType<F>)}
|
|
163
|
+
*/
|
|
164
|
+
const uncurryThis= bind.bind(bind.call); // eslint-disable-line @endo/no-polymorphic-call
|
|
165
|
+
$h_once.uncurryThis(uncurryThis);
|
|
171
166
|
const objectHasOwnProperty= uncurryThis(objectPrototype.hasOwnProperty);
|
|
172
167
|
//
|
|
173
168
|
$h_once.objectHasOwnProperty(objectHasOwnProperty);const arrayFilter=uncurryThis(arrayPrototype.filter);$h_once.arrayFilter(arrayFilter);
|
|
174
169
|
const arrayForEach= uncurryThis(arrayPrototype.forEach);$h_once.arrayForEach(arrayForEach);
|
|
175
170
|
const arrayIncludes= uncurryThis(arrayPrototype.includes);$h_once.arrayIncludes(arrayIncludes);
|
|
176
|
-
const arrayJoin= uncurryThis(arrayPrototype.join)
|
|
171
|
+
const arrayJoin= uncurryThis(arrayPrototype.join);
|
|
172
|
+
/** @type {<T, U>(thisArg: readonly T[], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[]} */$h_once.arrayJoin(arrayJoin);
|
|
177
173
|
const arrayMap= uncurryThis(arrayPrototype.map);$h_once.arrayMap(arrayMap);
|
|
178
|
-
const arrayPop= uncurryThis(arrayPrototype.pop)
|
|
174
|
+
const arrayPop= uncurryThis(arrayPrototype.pop);
|
|
175
|
+
/** @type {<T>(thisArg: T[], ...items: T[]) => number} */$h_once.arrayPop(arrayPop);
|
|
179
176
|
const arrayPush= uncurryThis(arrayPrototype.push);$h_once.arrayPush(arrayPush);
|
|
180
177
|
const arraySlice= uncurryThis(arrayPrototype.slice);$h_once.arraySlice(arraySlice);
|
|
181
178
|
const arraySome= uncurryThis(arrayPrototype.some);$h_once.arraySome(arraySome);
|
|
@@ -202,10 +199,17 @@ const matchAllRegExp= uncurryThis(regexpPrototype[matchAllSymbol]);
|
|
|
202
199
|
$h_once.matchAllRegExp(matchAllRegExp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h_once.stringEndsWith(stringEndsWith);
|
|
203
200
|
const stringIncludes= uncurryThis(stringPrototype.includes);$h_once.stringIncludes(stringIncludes);
|
|
204
201
|
const stringIndexOf= uncurryThis(stringPrototype.indexOf);$h_once.stringIndexOf(stringIndexOf);
|
|
205
|
-
const stringMatch= uncurryThis(stringPrototype.match)
|
|
202
|
+
const stringMatch= uncurryThis(stringPrototype.match);
|
|
203
|
+
/**
|
|
204
|
+
* @type {
|
|
205
|
+
* ((thisArg: string, searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string) => string) |
|
|
206
|
+
* ((thisArg: string, searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string) => string)
|
|
207
|
+
* }
|
|
208
|
+
*/$h_once.stringMatch(stringMatch);
|
|
206
209
|
const stringReplace= uncurryThis(stringPrototype.replace);$h_once.stringReplace(stringReplace);
|
|
207
210
|
const stringSearch= uncurryThis(stringPrototype.search);$h_once.stringSearch(stringSearch);
|
|
208
|
-
const stringSlice= uncurryThis(stringPrototype.slice)
|
|
211
|
+
const stringSlice= uncurryThis(stringPrototype.slice);
|
|
212
|
+
/** @type {(thisArg: string, splitter: string | RegExp | { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number) => string[]} */$h_once.stringSlice(stringSlice);
|
|
209
213
|
const stringSplit= uncurryThis(stringPrototype.split);$h_once.stringSplit(stringSplit);
|
|
210
214
|
const stringStartsWith= uncurryThis(stringPrototype.startsWith);$h_once.stringStartsWith(stringStartsWith);
|
|
211
215
|
const iterateString= uncurryThis(stringPrototype[iteratorSymbol]);
|
|
@@ -224,7 +228,8 @@ $h_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPro
|
|
|
224
228
|
//
|
|
225
229
|
$h_once.functionToString(functionToString);const{all}=Promise;
|
|
226
230
|
const promiseAll= (promises)=>apply(all, Promise, [promises]);$h_once.promiseAll(promiseAll);
|
|
227
|
-
const promiseCatch= uncurryThis(promisePrototype.catch)
|
|
231
|
+
const promiseCatch= uncurryThis(promisePrototype.catch);
|
|
232
|
+
/** @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);
|
|
228
233
|
const promiseThen= uncurryThis(promisePrototype.then);
|
|
229
234
|
//
|
|
230
235
|
$h_once.promiseThen(promiseThen);const finalizationRegistryRegister=
|
|
@@ -412,7 +417,7 @@ const noEvalEvaluate= ()=> {
|
|
|
412
417
|
/**
|
|
413
418
|
* Joins English terms with commas and an optional conjunction.
|
|
414
419
|
*
|
|
415
|
-
* @param {string[]} terms
|
|
420
|
+
* @param {(string | StringablePayload)[]} terms
|
|
416
421
|
* @param {"and" | "or"} conjunction
|
|
417
422
|
*/
|
|
418
423
|
const enJoin= (terms, conjunction)=> {
|
|
@@ -5318,7 +5323,10 @@ const CompartmentPrototype= {
|
|
|
5318
5323
|
()=> {
|
|
5319
5324
|
// The namespace box is a contentious design and likely to be a breaking
|
|
5320
5325
|
// change in an appropriately numbered future version.
|
|
5321
|
-
const namespace= compartmentImportNow(
|
|
5326
|
+
const namespace= compartmentImportNow(
|
|
5327
|
+
/** @type {Compartment} */ this,
|
|
5328
|
+
specifier);
|
|
5329
|
+
|
|
5322
5330
|
return { namespace};
|
|
5323
5331
|
});
|
|
5324
5332
|
|
|
@@ -5341,7 +5349,7 @@ const CompartmentPrototype= {
|
|
|
5341
5349
|
|
|
5342
5350
|
assertModuleHooks(this);
|
|
5343
5351
|
|
|
5344
|
-
return compartmentImportNow(this,
|
|
5352
|
+
return compartmentImportNow(/** @type {Compartment} */ this, specifier);
|
|
5345
5353
|
}};$h_once.CompartmentPrototype(CompartmentPrototype);
|
|
5346
5354
|
|
|
5347
5355
|
|
|
@@ -6539,9 +6547,9 @@ const makeCausalConsole= (baseConsole, loggedErrorHandler)=> {
|
|
|
6539
6547
|
const levelMethod= (...logArgs)=> {
|
|
6540
6548
|
const subErrors= [];
|
|
6541
6549
|
const argTags= extractErrorArgs(logArgs, subErrors);
|
|
6542
|
-
// @ts-ignore
|
|
6543
6550
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
6544
6551
|
baseConsole[level](...argTags);
|
|
6552
|
+
// @ts-expect-error ConsoleProp vs LogSeverity mismatch
|
|
6545
6553
|
logSubErrors(level, subErrors);
|
|
6546
6554
|
};
|
|
6547
6555
|
defineProperty(levelMethod, 'name', { value: level});
|
|
@@ -6666,7 +6674,7 @@ const makeRejectionHandlers= (reportReason)=>{
|
|
|
6666
6674
|
* @param {ReasonId} heldReasonId
|
|
6667
6675
|
*/
|
|
6668
6676
|
const finalizeDroppedPromise= (heldReasonId)=>{
|
|
6669
|
-
if( mapHas(idToReason)) {
|
|
6677
|
+
if( mapHas(idToReason, heldReasonId)) {
|
|
6670
6678
|
const reason= mapGet(idToReason, heldReasonId);
|
|
6671
6679
|
removeReasonId(heldReasonId);
|
|
6672
6680
|
reportReason(reason);
|
|
@@ -7209,7 +7217,8 @@ const tameV8ErrorConstructor= (
|
|
|
7209
7217
|
})
|
|
7210
7218
|
,
|
|
7211
7219
|
// === functors[29] ===
|
|
7212
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => { let FERAL_ERROR,TypeError,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,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)]]]],["../whitelist.js", [["NativeErrors", [$h_a => (NativeErrors = $h_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor", [$h_a => (tameV8ErrorConstructor = $h_a)]]]]]);
|
|
7220
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => { let FERAL_ERROR,TypeError,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,defineProperty,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)]]]],["../whitelist.js", [["NativeErrors", [$h_a => (NativeErrors = $h_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor", [$h_a => (tameV8ErrorConstructor = $h_a)]]]]]);
|
|
7221
|
+
|
|
7213
7222
|
|
|
7214
7223
|
|
|
7215
7224
|
|
|
@@ -7348,6 +7357,39 @@ function tameErrorConstructor(
|
|
|
7348
7357
|
|
|
7349
7358
|
|
|
7350
7359
|
|
|
7360
|
+
if( platform=== 'v8') {
|
|
7361
|
+
// `SharedError.prepareStackTrace`, if it exists, must also be
|
|
7362
|
+
// powerless. However, from what we've heard, depd expects to be able to
|
|
7363
|
+
// assign to it without the assignment throwing. It is normally a function
|
|
7364
|
+
// that returns a stack string to be magically added to error objects.
|
|
7365
|
+
// However, as long as we're adding a lenient standin, we may as well
|
|
7366
|
+
// accommodate any who expect to get a function they can call and get
|
|
7367
|
+
// a string back. This prepareStackTrace is a do-nothing function that
|
|
7368
|
+
// always returns the empty string.
|
|
7369
|
+
defineProperties(SharedError, {
|
|
7370
|
+
prepareStackTrace: {
|
|
7371
|
+
get() {
|
|
7372
|
+
return ()=> '';
|
|
7373
|
+
},
|
|
7374
|
+
set(_prepareFn) {
|
|
7375
|
+
// do nothing
|
|
7376
|
+
},
|
|
7377
|
+
enumerable: false,
|
|
7378
|
+
configurable: true},
|
|
7379
|
+
|
|
7380
|
+
captureStackTrace: {
|
|
7381
|
+
value: (errorish, _constructorOpt)=> {
|
|
7382
|
+
defineProperty(errorish, 'stack', {
|
|
7383
|
+
value: ''});
|
|
7384
|
+
|
|
7385
|
+
},
|
|
7386
|
+
writable: false,
|
|
7387
|
+
enumerable: false,
|
|
7388
|
+
configurable: true}});
|
|
7389
|
+
|
|
7390
|
+
|
|
7391
|
+
}
|
|
7392
|
+
|
|
7351
7393
|
let initialGetStackString= tamedMethods.getStackString;
|
|
7352
7394
|
if( platform=== 'v8') {
|
|
7353
7395
|
initialGetStackString= tameV8ErrorConstructor(
|