ses 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1454 -0
- package/README.md +4 -0
- package/dist/lockdown.cjs +672 -339
- package/dist/lockdown.mjs +672 -339
- package/dist/lockdown.umd.js +672 -339
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses-hermes.cjs +672 -339
- package/dist/ses.cjs +672 -339
- package/dist/ses.mjs +672 -339
- package/dist/ses.umd.js +672 -339
- package/dist/ses.umd.min.js +1 -1
- package/dist/types.d.cts +31 -2
- package/package.json +38 -9
- package/src/commons.js +0 -1
- package/src/compartment.js +5 -1
- package/src/enablements.js +48 -57
- package/src/error/assert.js +59 -14
- package/src/error/console.js +201 -30
- package/src/error/fatal-assert.js +2 -2
- package/src/error/stringify-utils.js +2 -4
- package/src/error/tame-console.js +0 -2
- package/src/error/tame-error-constructor.js +1 -1
- package/src/get-anonymous-intrinsics.js +0 -12
- package/src/module-load.js +0 -2
- package/src/permits.js +55 -31
- package/src/tame-faux-data-properties.js +1 -1
- package/src/tame-function-constructors.js +1 -1
- package/types.d.ts +31 -2
package/dist/ses.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ses@2.
|
|
1
|
+
// ses@2.3.0
|
|
2
2
|
(functors => options => {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -218,6 +218,8 @@
|
|
|
218
218
|
{
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
|
+
_amplifyArrayBufferForTests: cell("_amplifyArrayBufferForTests"),
|
|
222
|
+
immutableArrayBufferLibProperties: cell("immutableArrayBufferLibProperties"),
|
|
221
223
|
isBufferImmutable: cell("isBufferImmutable"),
|
|
222
224
|
sliceBufferToImmutable: cell("sliceBufferToImmutable"),
|
|
223
225
|
optTransferBufferToImmutable: cell("optTransferBufferToImmutable"),
|
|
@@ -227,9 +229,9 @@
|
|
|
227
229
|
{
|
|
228
230
|
},
|
|
229
231
|
{
|
|
232
|
+
enJoin: cell("enJoin"),
|
|
230
233
|
an: cell("an"),
|
|
231
234
|
bestEffortStringify: cell("bestEffortStringify"),
|
|
232
|
-
enJoin: cell("enJoin"),
|
|
233
235
|
},
|
|
234
236
|
{
|
|
235
237
|
},
|
|
@@ -369,7 +371,9 @@
|
|
|
369
371
|
},
|
|
370
372
|
{
|
|
371
373
|
consoleLevelMethods: cell("consoleLevelMethods"),
|
|
374
|
+
consoleSpecialMethods: cell("consoleSpecialMethods"),
|
|
372
375
|
consoleOtherMethods: cell("consoleOtherMethods"),
|
|
376
|
+
sanitizeFormatData: cell("sanitizeFormatData"),
|
|
373
377
|
makeLoggingConsoleKit: cell("makeLoggingConsoleKit"),
|
|
374
378
|
pumpLogToConsole: cell("pumpLogToConsole"),
|
|
375
379
|
makeCausalConsole: cell("makeCausalConsole"),
|
|
@@ -697,6 +701,8 @@ function observeImports(map, importName, importIndex) {
|
|
|
697
701
|
liveVar: {
|
|
698
702
|
},
|
|
699
703
|
onceVar: {
|
|
704
|
+
amplifyArrayBuffer: cells[4]._amplifyArrayBufferForTests.set,
|
|
705
|
+
immutableArrayBufferLibProperties: cells[4].immutableArrayBufferLibProperties.set,
|
|
700
706
|
isBufferImmutable: cells[4].isBufferImmutable.set,
|
|
701
707
|
sliceBufferToImmutable: cells[4].sliceBufferToImmutable.set,
|
|
702
708
|
optTransferBufferToImmutable: cells[4].optTransferBufferToImmutable.set,
|
|
@@ -706,7 +712,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
706
712
|
functors[5]({
|
|
707
713
|
imports(entries) {
|
|
708
714
|
const map = new Map(entries);
|
|
709
|
-
observeImports(map, "./
|
|
715
|
+
observeImports(map, "./lib.js", 4);
|
|
710
716
|
},
|
|
711
717
|
liveVar: {
|
|
712
718
|
},
|
|
@@ -717,7 +723,7 @@ function observeImports(map, importName, importIndex) {
|
|
|
717
723
|
functors[6]({
|
|
718
724
|
imports(entries) {
|
|
719
725
|
const map = new Map(entries);
|
|
720
|
-
observeImports(map, "./src/
|
|
726
|
+
observeImports(map, "./src/shim.js", 5);
|
|
721
727
|
},
|
|
722
728
|
liveVar: {
|
|
723
729
|
},
|
|
@@ -733,9 +739,9 @@ function observeImports(map, importName, importIndex) {
|
|
|
733
739
|
liveVar: {
|
|
734
740
|
},
|
|
735
741
|
onceVar: {
|
|
742
|
+
enJoin: cells[7].enJoin.set,
|
|
736
743
|
an: cells[7].an.set,
|
|
737
744
|
bestEffortStringify: cells[7].bestEffortStringify.set,
|
|
738
|
-
enJoin: cells[7].enJoin.set,
|
|
739
745
|
},
|
|
740
746
|
importMeta: {},
|
|
741
747
|
});
|
|
@@ -1212,7 +1218,9 @@ function observeImports(map, importName, importIndex) {
|
|
|
1212
1218
|
},
|
|
1213
1219
|
onceVar: {
|
|
1214
1220
|
consoleLevelMethods: cells[42].consoleLevelMethods.set,
|
|
1221
|
+
consoleSpecialMethods: cells[42].consoleSpecialMethods.set,
|
|
1215
1222
|
consoleOtherMethods: cells[42].consoleOtherMethods.set,
|
|
1223
|
+
sanitizeFormatData: cells[42].sanitizeFormatData.set,
|
|
1216
1224
|
makeLoggingConsoleKit: cells[42].makeLoggingConsoleKit.set,
|
|
1217
1225
|
pumpLogToConsole: cells[42].pumpLogToConsole.set,
|
|
1218
1226
|
makeCausalConsole: cells[42].makeCausalConsole.set,
|
|
@@ -1592,7 +1600,6 @@ function observeImports(map, importName, importIndex) {
|
|
|
1592
1600
|
* @module
|
|
1593
1601
|
*/
|
|
1594
1602
|
|
|
1595
|
-
/* global globalThis */
|
|
1596
1603
|
/* eslint-disable no-restricted-globals */
|
|
1597
1604
|
|
|
1598
1605
|
// We cannot use globalThis as the local name since it would capture the
|
|
@@ -2136,8 +2143,7 @@ if (getThis()) {
|
|
|
2136
2143
|
})()
|
|
2137
2144
|
,
|
|
2138
2145
|
// === 2. env-options ./src/env-options.js ===
|
|
2139
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([])
|
|
2140
|
-
// @ts-check
|
|
2146
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
|
|
2141
2147
|
|
|
2142
2148
|
// `@endo/env-options` needs to be imported quite early, and so should
|
|
2143
2149
|
// avoid importing from ses or anything that depends on ses.
|
|
@@ -2222,7 +2228,7 @@ const Fail = (literals, ...args) => {
|
|
|
2222
2228
|
arrayPush(capturedEnvironmentOptionNames, optionName);
|
|
2223
2229
|
}
|
|
2224
2230
|
const optionValue = globalEnv[optionName];
|
|
2225
|
-
|
|
2231
|
+
|
|
2226
2232
|
typeof optionValue === 'string' ||
|
|
2227
2233
|
Fail`Environment option named ${q(
|
|
2228
2234
|
optionName,
|
|
@@ -2291,10 +2297,8 @@ freeze(makeEnvironmentCaptor);
|
|
|
2291
2297
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/env-options.js", []]]);
|
|
2292
2298
|
})()
|
|
2293
2299
|
,
|
|
2294
|
-
// === 4. immutable-arraybuffer ./src/
|
|
2295
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([])
|
|
2296
|
-
|
|
2297
|
-
const {
|
|
2300
|
+
// === 4. immutable-arraybuffer ./src/lib.js ===
|
|
2301
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);const {
|
|
2298
2302
|
ArrayBuffer,
|
|
2299
2303
|
Object,
|
|
2300
2304
|
Reflect,
|
|
@@ -2307,19 +2311,47 @@ const {
|
|
|
2307
2311
|
// eslint-disable-next-line no-restricted-globals
|
|
2308
2312
|
} = globalThis;
|
|
2309
2313
|
|
|
2310
|
-
const { freeze, defineProperty,
|
|
2314
|
+
const { freeze, defineProperty, getOwnPropertyDescriptor, getPrototypeOf } =
|
|
2311
2315
|
Object;
|
|
2312
2316
|
const { apply, ownKeys } = Reflect;
|
|
2313
|
-
|
|
2317
|
+
|
|
2318
|
+
// Capture the WeakMap prototype methods up front so we can use them with
|
|
2319
|
+
// `apply` below, without exposing the `buffers` WeakMap to post-hoc
|
|
2320
|
+
// prototype lookups or polymorphic dispatch.
|
|
2321
|
+
const { get: weakmapGet, set: weakmapSet, has: weakmapHas } = WeakMap.prototype;
|
|
2314
2322
|
|
|
2315
2323
|
const { prototype: arrayBufferPrototype } = ArrayBuffer;
|
|
2316
|
-
const {
|
|
2324
|
+
const {
|
|
2325
|
+
slice,
|
|
2326
|
+
transfer: optTransfer,
|
|
2327
|
+
resize: optResize,
|
|
2328
|
+
transferToFixedLength: optTransferToFixedLength,
|
|
2329
|
+
} = arrayBufferPrototype;
|
|
2317
2330
|
// @ts-expect-error TS doesn't know it'll be there
|
|
2318
2331
|
const { get: arrayBufferByteLength } = getOwnPropertyDescriptor(
|
|
2319
2332
|
arrayBufferPrototype,
|
|
2320
2333
|
'byteLength',
|
|
2321
2334
|
);
|
|
2322
2335
|
|
|
2336
|
+
// Capture the resizable-ArrayBuffer proposal's accessors when present. On
|
|
2337
|
+
// platforms without that proposal (Node <= 18, Hermes), these are absent;
|
|
2338
|
+
// the fallthrough branches in the lib property record short-circuit on
|
|
2339
|
+
// brand membership and never reach the captured accessor in that case
|
|
2340
|
+
// (an emulated immutable always has `detached === false`, `resizable ===
|
|
2341
|
+
// false`, and `maxByteLength === byteLength`).
|
|
2342
|
+
const optArrayBufferDetached = getOwnPropertyDescriptor(
|
|
2343
|
+
arrayBufferPrototype,
|
|
2344
|
+
'detached',
|
|
2345
|
+
)?.get;
|
|
2346
|
+
const optArrayBufferResizable = getOwnPropertyDescriptor(
|
|
2347
|
+
arrayBufferPrototype,
|
|
2348
|
+
'resizable',
|
|
2349
|
+
)?.get;
|
|
2350
|
+
const optArrayBufferMaxByteLength = getOwnPropertyDescriptor(
|
|
2351
|
+
arrayBufferPrototype,
|
|
2352
|
+
'maxByteLength',
|
|
2353
|
+
)?.get;
|
|
2354
|
+
|
|
2323
2355
|
const typedArrayPrototype = getPrototypeOf(Uint8Array.prototype);
|
|
2324
2356
|
const { set: uint8ArraySet } = typedArrayPrototype;
|
|
2325
2357
|
// @ts-expect-error TS doesn't know it'll be there
|
|
@@ -2348,10 +2380,8 @@ const arrayBufferSlice = (realBuffer, start = undefined, end = undefined) =>
|
|
|
2348
2380
|
* On other platforms, we can still emulate
|
|
2349
2381
|
* `ArrayBuffer.prototoype.sliceToImmutable`, but not
|
|
2350
2382
|
* `ArrayBuffer.prototype.transferToImmutable`.
|
|
2351
|
-
*
|
|
2352
|
-
* -
|
|
2353
|
-
* - Node.js <= 16
|
|
2354
|
-
* - Apparently some versions of JavaScriptCore that are still of concern.
|
|
2383
|
+
* See the package README section "Platform support for `transferToImmutable`"
|
|
2384
|
+
* for the per-engine version thresholds and feature-testing guidance.
|
|
2355
2385
|
*
|
|
2356
2386
|
* @param {ArrayBuffer} arrayBuffer
|
|
2357
2387
|
* @returns {ArrayBuffer}
|
|
@@ -2381,80 +2411,198 @@ if (optTransfer) {
|
|
|
2381
2411
|
* emulate the `this.#buffer` private field, including its use as a brand check.
|
|
2382
2412
|
* Maps from all and only emulated Immutable ArrayBuffers to real ArrayBuffers.
|
|
2383
2413
|
*
|
|
2384
|
-
* @type {
|
|
2414
|
+
* @type {WeakMap<ArrayBuffer, ArrayBuffer>}
|
|
2385
2415
|
*/
|
|
2386
2416
|
const buffers = new WeakMap();
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2417
|
+
const isEmulatedImmutable = buf => apply(weakmapHas, buffers, [buf]);
|
|
2418
|
+
|
|
2419
|
+
/**
|
|
2420
|
+
* Amplifier-with-this-fallthrough: returns the underlying genuine
|
|
2421
|
+
* `ArrayBuffer` when `arrayBuffer` is an emulated immutable buffer (in the
|
|
2422
|
+
* brand WeakMap), and returns `arrayBuffer` itself otherwise. This lets the
|
|
2423
|
+
* methods on the shared `ArrayBuffer.prototype` (after the shim install)
|
|
2424
|
+
* work as drop-in replacements for the genuine methods when invoked on a
|
|
2425
|
+
* genuine `ArrayBuffer`, while transparently reaching the underlying buffer
|
|
2426
|
+
* for the emulated-immutable case. The name aligns with the analogous
|
|
2427
|
+
* `amplifyTypedArray` on the freezable-TypedArray experiment branch.
|
|
2428
|
+
*
|
|
2429
|
+
* @param {ArrayBuffer} arrayBuffer
|
|
2430
|
+
* @returns {ArrayBuffer}
|
|
2431
|
+
*/
|
|
2432
|
+
const amplifyArrayBuffer = arrayBuffer => {
|
|
2433
|
+
const result = apply(weakmapGet, buffers, [arrayBuffer]);
|
|
2434
|
+
if (result !== undefined) {
|
|
2396
2435
|
return result;
|
|
2397
2436
|
}
|
|
2398
|
-
|
|
2437
|
+
return arrayBuffer;
|
|
2399
2438
|
};
|
|
2400
2439
|
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2440
|
+
/**
|
|
2441
|
+
* A plain record of the properties the shim copies onto
|
|
2442
|
+
* `ArrayBuffer.prototype` to install immutable-ArrayBuffer support. This is
|
|
2443
|
+
* not a prototype of any object: emulated immutable buffers directly inherit
|
|
2444
|
+
* from `ArrayBuffer.prototype`, and the methods here become the ones the
|
|
2445
|
+
* (now shared) prototype dispatches to. Each method either calls
|
|
2446
|
+
* `amplifyArrayBuffer(this)` to reach the underlying buffer (read accessors,
|
|
2447
|
+
* `slice`, `sliceToImmutable`) or discriminates on brand WeakMap membership
|
|
2448
|
+
* and delegates to the captured genuine method on fallthrough (the mutators
|
|
2449
|
+
* `resize`, `transfer`, `transferToFixedLength`, `transferToImmutable`).
|
|
2450
|
+
*
|
|
2451
|
+
* Omits `constructor` so the original `ArrayBuffer.prototype.constructor` is unchanged.
|
|
2452
|
+
*/$h͏_once.amplifyArrayBuffer(amplifyArrayBuffer);
|
|
2453
|
+
const immutableArrayBufferLibProperties = {
|
|
2454
|
+
__proto__: null,
|
|
2455
|
+
/**
|
|
2456
|
+
* @this {ArrayBuffer}
|
|
2457
|
+
*/
|
|
2404
2458
|
get byteLength() {
|
|
2405
|
-
return apply(arrayBufferByteLength,
|
|
2459
|
+
return apply(arrayBufferByteLength, amplifyArrayBuffer(this), []);
|
|
2406
2460
|
},
|
|
2461
|
+
/**
|
|
2462
|
+
* @this {ArrayBuffer}
|
|
2463
|
+
*/
|
|
2407
2464
|
get detached() {
|
|
2408
|
-
|
|
2409
|
-
|
|
2465
|
+
if (isEmulatedImmutable(this)) {
|
|
2466
|
+
return false;
|
|
2467
|
+
}
|
|
2468
|
+
// Genuine `ArrayBuffer.prototype.detached` is a stage-finished accessor
|
|
2469
|
+
// on platforms with the resizable-ArrayBuffer proposal. On older
|
|
2470
|
+
// platforms (Node <= 18, Hermes) it does not exist; the conservative
|
|
2471
|
+
// answer for a non-detached genuine buffer in that case is false.
|
|
2472
|
+
if (optArrayBufferDetached === undefined) {
|
|
2473
|
+
return false;
|
|
2474
|
+
}
|
|
2475
|
+
return apply(optArrayBufferDetached, this, []);
|
|
2410
2476
|
},
|
|
2477
|
+
/**
|
|
2478
|
+
* @this {ArrayBuffer}
|
|
2479
|
+
*/
|
|
2411
2480
|
get maxByteLength() {
|
|
2412
|
-
|
|
2413
|
-
|
|
2481
|
+
if (isEmulatedImmutable(this)) {
|
|
2482
|
+
// For an emulated immutable buffer, maxByteLength is byteLength: it
|
|
2483
|
+
// cannot grow.
|
|
2484
|
+
return apply(arrayBufferByteLength, amplifyArrayBuffer(this), []);
|
|
2485
|
+
}
|
|
2486
|
+
if (optArrayBufferMaxByteLength === undefined) {
|
|
2487
|
+
return apply(arrayBufferByteLength, this, []);
|
|
2488
|
+
}
|
|
2489
|
+
return apply(optArrayBufferMaxByteLength, this, []);
|
|
2414
2490
|
},
|
|
2491
|
+
/**
|
|
2492
|
+
* @this {ArrayBuffer}
|
|
2493
|
+
*/
|
|
2415
2494
|
get resizable() {
|
|
2416
|
-
|
|
2417
|
-
|
|
2495
|
+
if (isEmulatedImmutable(this)) {
|
|
2496
|
+
return false;
|
|
2497
|
+
}
|
|
2498
|
+
if (optArrayBufferResizable === undefined) {
|
|
2499
|
+
return false;
|
|
2500
|
+
}
|
|
2501
|
+
return apply(optArrayBufferResizable, this, []);
|
|
2418
2502
|
},
|
|
2503
|
+
/**
|
|
2504
|
+
* @this {ArrayBuffer}
|
|
2505
|
+
*/
|
|
2419
2506
|
get immutable() {
|
|
2420
|
-
|
|
2421
|
-
return true;
|
|
2507
|
+
return isEmulatedImmutable(this);
|
|
2422
2508
|
},
|
|
2509
|
+
/**
|
|
2510
|
+
* @this {ArrayBuffer}
|
|
2511
|
+
* @param {number} [start]
|
|
2512
|
+
* @param {number} [end]
|
|
2513
|
+
*/
|
|
2423
2514
|
slice(start = undefined, end = undefined) {
|
|
2424
|
-
return arrayBufferSlice(
|
|
2515
|
+
return arrayBufferSlice(amplifyArrayBuffer(this), start, end);
|
|
2425
2516
|
},
|
|
2517
|
+
/**
|
|
2518
|
+
* @this {ArrayBuffer}
|
|
2519
|
+
* @param {number} [start]
|
|
2520
|
+
* @param {number} [end]
|
|
2521
|
+
*/
|
|
2426
2522
|
sliceToImmutable(start = undefined, end = undefined) {
|
|
2427
2523
|
// eslint-disable-next-line no-use-before-define
|
|
2428
|
-
return sliceBufferToImmutable(
|
|
2524
|
+
return sliceBufferToImmutable(amplifyArrayBuffer(this), start, end);
|
|
2429
2525
|
},
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2526
|
+
/**
|
|
2527
|
+
* @this {ArrayBuffer}
|
|
2528
|
+
* @param {number} [newByteLength]
|
|
2529
|
+
*/
|
|
2530
|
+
resize(newByteLength = undefined) {
|
|
2531
|
+
if (isEmulatedImmutable(this)) {
|
|
2532
|
+
throw TypeError('Cannot resize an immutable ArrayBuffer');
|
|
2533
|
+
}
|
|
2534
|
+
if (optResize === undefined) {
|
|
2535
|
+
throw TypeError(
|
|
2536
|
+
'Cannot resize ArrayBuffer: underlying platform lacks ArrayBuffer.prototype.resize',
|
|
2537
|
+
);
|
|
2538
|
+
}
|
|
2539
|
+
return apply(optResize, this, [newByteLength]);
|
|
2437
2540
|
},
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2541
|
+
/**
|
|
2542
|
+
* @this {ArrayBuffer}
|
|
2543
|
+
* @param {number} [newLength]
|
|
2544
|
+
*/
|
|
2545
|
+
transfer(newLength = undefined) {
|
|
2546
|
+
if (isEmulatedImmutable(this)) {
|
|
2547
|
+
throw TypeError('Cannot detach an immutable ArrayBuffer');
|
|
2548
|
+
}
|
|
2549
|
+
if (optTransfer === undefined) {
|
|
2550
|
+
throw TypeError(
|
|
2551
|
+
'Cannot transfer ArrayBuffer: underlying platform lacks ArrayBuffer.prototype.transfer',
|
|
2552
|
+
);
|
|
2553
|
+
}
|
|
2554
|
+
return apply(optTransfer, this, [newLength]);
|
|
2441
2555
|
},
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2556
|
+
/**
|
|
2557
|
+
* @this {ArrayBuffer}
|
|
2558
|
+
* @param {number} [newLength]
|
|
2559
|
+
*/
|
|
2560
|
+
transferToFixedLength(newLength = undefined) {
|
|
2561
|
+
if (isEmulatedImmutable(this)) {
|
|
2562
|
+
throw TypeError('Cannot detach an immutable ArrayBuffer');
|
|
2563
|
+
}
|
|
2564
|
+
if (optTransferToFixedLength === undefined) {
|
|
2565
|
+
throw TypeError(
|
|
2566
|
+
'Cannot transferToFixedLength ArrayBuffer: underlying platform lacks ArrayBuffer.prototype.transferToFixedLength',
|
|
2567
|
+
);
|
|
2568
|
+
}
|
|
2569
|
+
return apply(optTransferToFixedLength, this, [newLength]);
|
|
2445
2570
|
},
|
|
2446
2571
|
/**
|
|
2447
|
-
*
|
|
2572
|
+
* @this {ArrayBuffer}
|
|
2573
|
+
* @param {number} [newLength]
|
|
2448
2574
|
*/
|
|
2449
|
-
|
|
2575
|
+
transferToImmutable(newLength = undefined) {
|
|
2576
|
+
if (isEmulatedImmutable(this)) {
|
|
2577
|
+
throw TypeError('Cannot detach an immutable ArrayBuffer');
|
|
2578
|
+
}
|
|
2579
|
+
// eslint-disable-next-line no-use-before-define
|
|
2580
|
+
if (optTransferBufferToImmutable === undefined) {
|
|
2581
|
+
throw TypeError(
|
|
2582
|
+
'Cannot transfer to immutable: underlying platform lacks transfer or structuredClone',
|
|
2583
|
+
);
|
|
2584
|
+
}
|
|
2585
|
+
// eslint-disable-next-line no-use-before-define
|
|
2586
|
+
return optTransferBufferToImmutable(this, newLength);
|
|
2587
|
+
},
|
|
2450
2588
|
};
|
|
2451
2589
|
|
|
2452
|
-
// Better fidelity emulation of a class prototype
|
|
2453
|
-
|
|
2454
|
-
|
|
2590
|
+
// Better fidelity emulation of a class prototype: each property is
|
|
2591
|
+
// non-enumerable, matching the shape `ArrayBuffer.prototype` itself uses.
|
|
2592
|
+
$h͏_once.immutableArrayBufferLibProperties(immutableArrayBufferLibProperties);for(const key of ownKeys(immutableArrayBufferLibProperties)){
|
|
2593
|
+
defineProperty(immutableArrayBufferLibProperties, key, {
|
|
2455
2594
|
enumerable: false,
|
|
2456
2595
|
});
|
|
2457
2596
|
}
|
|
2597
|
+
freeze(immutableArrayBufferLibProperties);
|
|
2598
|
+
|
|
2599
|
+
// Internal-test export. The helper itself is load-bearing for every
|
|
2600
|
+
// method on `immutableArrayBufferLibProperties`, but the package's
|
|
2601
|
+
// public export surface intentionally keeps it private (callers either
|
|
2602
|
+
// touch the helper indirectly through `ArrayBuffer.prototype` methods
|
|
2603
|
+
// or rely on `isBufferImmutable`). The export exists so the
|
|
2604
|
+
// adversarial-tests skill can exercise the helper in isolation.
|
|
2605
|
+
|
|
2458
2606
|
|
|
2459
2607
|
/**
|
|
2460
2608
|
* Emulates what would have been the encapsulated `ImmutableArrayBufferInternal`
|
|
@@ -2462,18 +2610,39 @@ for (const key of ownKeys(ImmutableArrayBufferInternalPrototype)) {
|
|
|
2462
2610
|
* result encapsulates. Security demands that this result has exclusive access
|
|
2463
2611
|
* to the `realBuffer` it is given, which its callers must ensure.
|
|
2464
2612
|
*
|
|
2613
|
+
* The emulated immutable buffer directly inherits from `ArrayBuffer.prototype`.
|
|
2614
|
+
* The brand WeakMap is the sole discriminator: `ArrayBuffer.prototype`'s
|
|
2615
|
+
* methods (after the shim installs the lib properties) check brand membership
|
|
2616
|
+
* to decide whether to treat the receiver as immutable.
|
|
2617
|
+
*
|
|
2465
2618
|
* @param {ArrayBuffer} realBuffer
|
|
2466
2619
|
* @returns {ArrayBuffer}
|
|
2467
2620
|
*/
|
|
2468
2621
|
const makeImmutableArrayBufferInternal = realBuffer => {
|
|
2469
2622
|
const result = /** @type {ArrayBuffer} */ (
|
|
2470
2623
|
/** @type {unknown} */ ({
|
|
2471
|
-
__proto__:
|
|
2624
|
+
__proto__: arrayBufferPrototype,
|
|
2472
2625
|
})
|
|
2473
2626
|
);
|
|
2474
|
-
//
|
|
2475
|
-
//
|
|
2476
|
-
|
|
2627
|
+
// Install `[Symbol.toStringTag] = 'ImmutableArrayBuffer'` as an own
|
|
2628
|
+
// property of each emulated immutable buffer (not on the shared prototype,
|
|
2629
|
+
// which must retain the genuine `'ArrayBuffer'` tag so genuine instances
|
|
2630
|
+
// continue to read as `[object ArrayBuffer]`). This is the minimum
|
|
2631
|
+
// departure from DESIGN.md Move 2 paragraph 7 needed to keep
|
|
2632
|
+
// `concordance` (and any downstream consumer that sniffs the toStringTag)
|
|
2633
|
+
// from misrouting an emulated immutable through `Buffer.from`, which
|
|
2634
|
+
// throws because the emulated immutable is not a genuine exotic. With the
|
|
2635
|
+
// own-property slot in place, `Object.prototype.toString.call(immuAB)`
|
|
2636
|
+
// returns `'[object ImmutableArrayBuffer]'` and concordance routes the
|
|
2637
|
+
// value through its unrenderable-value path. Genuine ArrayBuffers
|
|
2638
|
+
// continue to inherit `'ArrayBuffer'` from the prototype.
|
|
2639
|
+
defineProperty(result, Symbol.toStringTag, {
|
|
2640
|
+
value: 'ImmutableArrayBuffer',
|
|
2641
|
+
writable: false,
|
|
2642
|
+
enumerable: false,
|
|
2643
|
+
configurable: false,
|
|
2644
|
+
});
|
|
2645
|
+
apply(weakmapSet, buffers, [result, realBuffer]);
|
|
2477
2646
|
return result;
|
|
2478
2647
|
};
|
|
2479
2648
|
// Since `makeImmutableArrayBufferInternal` MUST not escape,
|
|
@@ -2481,14 +2650,27 @@ const makeImmutableArrayBufferInternal = realBuffer => {
|
|
|
2481
2650
|
freeze(makeImmutableArrayBufferInternal);
|
|
2482
2651
|
|
|
2483
2652
|
/**
|
|
2653
|
+
* Internal brand check. Returns `true` when `buffer` is an emulated
|
|
2654
|
+
* immutable buffer (in the lib's brand WeakMap), `false` otherwise. After
|
|
2655
|
+
* the premise-2 fold-in the package no longer exports this from a public
|
|
2656
|
+
* entry point; callers use `buffer.immutable` (the accessor installed by
|
|
2657
|
+
* the shim on `ArrayBuffer.prototype`) or `Object.prototype.toString
|
|
2658
|
+
* .call(buffer) === '[object ImmutableArrayBuffer]'`. The internal export
|
|
2659
|
+
* lets the in-package tests (`test/lib-*.test.js`) reach the helper
|
|
2660
|
+
* directly without round-tripping through the prototype.
|
|
2661
|
+
*
|
|
2484
2662
|
* @param {ArrayBuffer} buffer
|
|
2485
2663
|
* @returns {boolean}
|
|
2486
2664
|
*/
|
|
2487
|
-
|
|
2488
|
-
const isBufferImmutable = buffer => buffers.has(buffer);
|
|
2665
|
+
const isBufferImmutable = buffer => isEmulatedImmutable(buffer);
|
|
2489
2666
|
|
|
2490
2667
|
/**
|
|
2491
|
-
* Creates an immutable slice of the given buffer.
|
|
2668
|
+
* Creates an immutable slice of the given buffer. Internal helper used by
|
|
2669
|
+
* `immutableArrayBufferLibProperties.sliceToImmutable` and by the shim's
|
|
2670
|
+
* own install. After the premise-2 fold-in the package no longer exports
|
|
2671
|
+
* this from a public entry point; the internal export lets the in-package
|
|
2672
|
+
* tests reach it directly.
|
|
2673
|
+
*
|
|
2492
2674
|
* @param {ArrayBuffer} buffer The original buffer.
|
|
2493
2675
|
* @param {number} [start] The start index.
|
|
2494
2676
|
* @param {number} [end] The end index.
|
|
@@ -2499,9 +2681,7 @@ freeze(makeImmutableArrayBufferInternal);
|
|
|
2499
2681
|
start = undefined,
|
|
2500
2682
|
end = undefined,
|
|
2501
2683
|
) => {
|
|
2502
|
-
|
|
2503
|
-
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
2504
|
-
let realBuffer = buffers.get(buffer);
|
|
2684
|
+
let realBuffer = apply(weakmapGet, buffers, [buffer]);
|
|
2505
2685
|
if (realBuffer === undefined) {
|
|
2506
2686
|
realBuffer = buffer;
|
|
2507
2687
|
}
|
|
@@ -2513,7 +2693,9 @@ freeze(makeImmutableArrayBufferInternal);
|
|
|
2513
2693
|
let transferBufferToImmutable;
|
|
2514
2694
|
if (optArrayBufferTransfer) {
|
|
2515
2695
|
/**
|
|
2516
|
-
* Transfer the contents to a new Immutable ArrayBuffer
|
|
2696
|
+
* Transfer the contents to a new Immutable ArrayBuffer. Internal helper
|
|
2697
|
+
* used by `immutableArrayBufferLibProperties.transferToImmutable` and by
|
|
2698
|
+
* the shim's own install. Not part of the package's public export surface.
|
|
2517
2699
|
*
|
|
2518
2700
|
* @param {ArrayBuffer} buffer The original buffer.
|
|
2519
2701
|
* @param {number} [newLength] The start index.
|
|
@@ -2527,7 +2709,7 @@ if (optArrayBufferTransfer) {
|
|
|
2527
2709
|
} else {
|
|
2528
2710
|
buffer = optArrayBufferTransfer(buffer);
|
|
2529
2711
|
const oldLength = buffer.byteLength;
|
|
2530
|
-
|
|
2712
|
+
|
|
2531
2713
|
if (newLength <= oldLength) {
|
|
2532
2714
|
buffer = arrayBufferSlice(buffer, 0, newLength);
|
|
2533
2715
|
} else {
|
|
@@ -2547,108 +2729,45 @@ if (optArrayBufferTransfer) {
|
|
|
2547
2729
|
const optTransferBufferToImmutable = transferBufferToImmutable;$h͏_once.optTransferBufferToImmutable(optTransferBufferToImmutable);
|
|
2548
2730
|
})()
|
|
2549
2731
|
,
|
|
2550
|
-
// === 5. immutable-arraybuffer ./src/
|
|
2551
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2732
|
+
// === 5. immutable-arraybuffer ./src/shim.js ===
|
|
2733
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let immutableArrayBufferLibProperties;$h͏_imports([["./lib.js", [["immutableArrayBufferLibProperties",[$h͏_a => (immutableArrayBufferLibProperties = $h͏_a)]]]]]);
|
|
2557
2734
|
|
|
2735
|
+
// eslint-disable-next-line no-restricted-globals
|
|
2736
|
+
const { ArrayBuffer, Object } = globalThis;
|
|
2558
2737
|
|
|
2559
|
-
const {
|
|
2560
|
-
ArrayBuffer,
|
|
2561
|
-
JSON,
|
|
2562
|
-
Object,
|
|
2563
|
-
Reflect
|
|
2564
|
-
// eslint-disable-next-line no-restricted-globals
|
|
2565
|
-
} = globalThis;
|
|
2566
|
-
|
|
2567
|
-
// Even though the imported one is not exported by the pony as a live binding,
|
|
2568
|
-
// TS doesn't know that,
|
|
2569
|
-
// so it cannot do its normal flow-based inference. By making and using a local
|
|
2570
|
-
// copy, no problem.
|
|
2571
|
-
const optTransferBufferToImmutable = optXferBuf2Immu;
|
|
2572
|
-
|
|
2573
|
-
const { getOwnPropertyDescriptors, defineProperties, defineProperty } = Object;
|
|
2574
|
-
const { ownKeys } = Reflect;
|
|
2738
|
+
const { getOwnPropertyDescriptors, defineProperties } = Object;
|
|
2575
2739
|
const { prototype: arrayBufferPrototype } = ArrayBuffer;
|
|
2576
|
-
const { stringify } = JSON;
|
|
2577
|
-
|
|
2578
|
-
const arrayBufferMethods = {
|
|
2579
|
-
/**
|
|
2580
|
-
* Creates an immutable slice of the given buffer.
|
|
2581
|
-
*
|
|
2582
|
-
* @this {ArrayBuffer} buffer The original buffer.
|
|
2583
|
-
* @param {number} [start] The start index.
|
|
2584
|
-
* @param {number} [end] The end index.
|
|
2585
|
-
* @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
|
|
2586
|
-
*/
|
|
2587
|
-
sliceToImmutable(start = undefined, end = undefined) {
|
|
2588
|
-
return sliceBufferToImmutable(this, start, end);
|
|
2589
|
-
},
|
|
2590
|
-
|
|
2591
|
-
/**
|
|
2592
|
-
* @this {ArrayBuffer}
|
|
2593
|
-
*/
|
|
2594
|
-
get immutable() {
|
|
2595
|
-
return isBufferImmutable(this);
|
|
2596
|
-
},
|
|
2597
|
-
|
|
2598
|
-
...(optTransferBufferToImmutable
|
|
2599
|
-
? {
|
|
2600
|
-
/**
|
|
2601
|
-
* Transfer the contents to a new immutable ArrayBuffer
|
|
2602
|
-
*
|
|
2603
|
-
* @this {ArrayBuffer} buffer The original buffer.
|
|
2604
|
-
* @param {number} [newLength] The start index.
|
|
2605
|
-
* @returns {ArrayBuffer} The new immutable ArrayBuffer.
|
|
2606
|
-
*/
|
|
2607
|
-
transferToImmutable(newLength = undefined) {
|
|
2608
|
-
return optTransferBufferToImmutable(this, newLength);
|
|
2609
|
-
},
|
|
2610
|
-
}
|
|
2611
|
-
: {}),
|
|
2612
|
-
};
|
|
2613
2740
|
|
|
2614
|
-
//
|
|
2615
|
-
for (const key of ownKeys(arrayBufferMethods)) {
|
|
2616
|
-
defineProperty(arrayBufferMethods, key, {
|
|
2617
|
-
enumerable: false,
|
|
2618
|
-
});
|
|
2619
|
-
}
|
|
2620
|
-
|
|
2621
|
-
// Modern shim practice frowns on conditional installation, at least for
|
|
2622
|
-
// proposals prior to stage 3. This is so changes to the proposal since
|
|
2623
|
-
// an old shim was distributed don't need to worry about the proposal
|
|
2624
|
-
// breaking old code depending on the old shim. Thus, if we detect that
|
|
2625
|
-
// we're about to overwrite a prior installation, we simply issue this
|
|
2626
|
-
// warning and continue.
|
|
2741
|
+
// Stage-3 install policy: detect-then-skip.
|
|
2627
2742
|
//
|
|
2628
|
-
//
|
|
2629
|
-
//
|
|
2630
|
-
//
|
|
2743
|
+
// Both the Immutable ArrayBuffer proposal and the parallel Freezable
|
|
2744
|
+
// TypedArray proposal are part of the same TC39 proposal, which has
|
|
2745
|
+
// reached stage 3. At stage 3 or above our policy is detect-then-skip:
|
|
2746
|
+
// if a prior installation (a native implementation, or a previously
|
|
2747
|
+
// loaded shim) has already provided `sliceToImmutable` on
|
|
2748
|
+
// `ArrayBuffer.prototype`, we defer to that installation rather than
|
|
2749
|
+
// overwriting it. The native implementation always wins.
|
|
2631
2750
|
//
|
|
2632
|
-
//
|
|
2633
|
-
//
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2751
|
+
// `sliceToImmutable` is the load-bearing presence check: the proposal
|
|
2752
|
+
// adds `sliceToImmutable`, `transferToImmutable`, and the `immutable`
|
|
2753
|
+
// accessor as a unit, and any installer (native or shim) that provides
|
|
2754
|
+
// one provides all three. Checking only one keeps the detect-then-skip
|
|
2755
|
+
// branch deterministic.
|
|
2756
|
+
//
|
|
2757
|
+
// For proposals prior to stage 3 a warn-and-overwrite policy would be
|
|
2758
|
+
// appropriate so the shim stays authoritative across partial or
|
|
2759
|
+
// divergent platform implementations. The Immutable ArrayBuffer proposal
|
|
2760
|
+
// is past that threshold.
|
|
2761
|
+
if (!('sliceToImmutable' in arrayBufferPrototype)) {
|
|
2762
|
+
defineProperties(
|
|
2763
|
+
arrayBufferPrototype,
|
|
2764
|
+
getOwnPropertyDescriptors(immutableArrayBufferLibProperties),
|
|
2641
2765
|
);
|
|
2642
2766
|
}
|
|
2643
|
-
|
|
2644
|
-
defineProperties(
|
|
2645
|
-
arrayBufferPrototype,
|
|
2646
|
-
getOwnPropertyDescriptors(arrayBufferMethods),
|
|
2647
|
-
);
|
|
2648
2767
|
})()
|
|
2649
2768
|
,
|
|
2650
2769
|
// === 6. immutable-arraybuffer ./shim.js ===
|
|
2651
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/
|
|
2770
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/shim.js", []]]);
|
|
2652
2771
|
})()
|
|
2653
2772
|
,
|
|
2654
2773
|
// === 7. ses ./src/error/stringify-utils.js ===
|
|
@@ -2705,7 +2824,7 @@ defineProperties(
|
|
|
2705
2824
|
* @param {string} str The noun to prepend
|
|
2706
2825
|
* @returns {string} The noun prepended with a/an
|
|
2707
2826
|
*/$h͏_once.enJoin(enJoin);
|
|
2708
|
-
const an = str => {
|
|
2827
|
+
const an = str => {
|
|
2709
2828
|
str = `${str}`;
|
|
2710
2829
|
if (str.length >= 1 && stringIncludes('aeiouAEIOU', str[0])) {
|
|
2711
2830
|
return `an ${str}`;
|
|
@@ -2714,7 +2833,6 @@ const an = str => {
|
|
|
2714
2833
|
};$h͏_once.an(an);
|
|
2715
2834
|
freeze(an);
|
|
2716
2835
|
|
|
2717
|
-
|
|
2718
2836
|
/**
|
|
2719
2837
|
* Like `JSON.stringify` but does not blow up if given a cycle or a bigint.
|
|
2720
2838
|
* This is not
|
|
@@ -2742,7 +2860,7 @@ freeze(an);
|
|
|
2742
2860
|
* @param {(string|number)=} spaces
|
|
2743
2861
|
* @returns {string}
|
|
2744
2862
|
*/
|
|
2745
|
-
const bestEffortStringify = (payload, spaces = undefined) => {
|
|
2863
|
+
const bestEffortStringify = (payload, spaces = undefined) => {
|
|
2746
2864
|
const seenSet = new Set();
|
|
2747
2865
|
const replacer = (_, val) => {
|
|
2748
2866
|
switch (typeof val) {
|
|
@@ -3013,21 +3131,17 @@ freeze(bestEffortStringify);
|
|
|
3013
3131
|
,
|
|
3014
3132
|
// === 10. cache-map ./src/cachemap.js ===
|
|
3015
3133
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
|
|
3016
|
-
/* global globalThis */
|
|
3017
|
-
/* eslint-disable @endo/no-polymorphic-call */
|
|
3018
3134
|
|
|
3019
|
-
// eslint-disable-next-line no-restricted-globals
|
|
3020
3135
|
const { Error, TypeError, WeakMap } = globalThis;
|
|
3021
|
-
|
|
3136
|
+
|
|
3022
3137
|
const { parse, stringify } = JSON;
|
|
3023
|
-
|
|
3138
|
+
|
|
3024
3139
|
const { isSafeInteger } = Number;
|
|
3025
|
-
|
|
3140
|
+
|
|
3026
3141
|
const { freeze } = Object;
|
|
3027
|
-
|
|
3142
|
+
|
|
3028
3143
|
const { toStringTag: toStringTagSymbol } = Symbol;
|
|
3029
3144
|
|
|
3030
|
-
// eslint-disable-next-line no-restricted-globals
|
|
3031
3145
|
const UNKNOWN_KEY = Symbol('UNKNOWN_KEY');
|
|
3032
3146
|
|
|
3033
3147
|
/**
|
|
@@ -3206,7 +3320,7 @@ const zeroMetrics = freeze({
|
|
|
3206
3320
|
// @ts-expect-error
|
|
3207
3321
|
MaybeCtor();
|
|
3208
3322
|
return /** @type {any} */ (MaybeCtor);
|
|
3209
|
-
} catch (
|
|
3323
|
+
} catch (_err) {
|
|
3210
3324
|
// @ts-expect-error
|
|
3211
3325
|
const constructNewMap = () => new MaybeCtor();
|
|
3212
3326
|
return constructNewMap;
|
|
@@ -3466,7 +3580,17 @@ freeze(makeNoteLogArgsArrayKit);
|
|
|
3466
3580
|
|
|
3467
3581
|
|
|
3468
3582
|
/**
|
|
3469
|
-
* @import {BaseAssert,
|
|
3583
|
+
* @import {BaseAssert,
|
|
3584
|
+
* Assert,
|
|
3585
|
+
* AssertionFunctions,
|
|
3586
|
+
* AssertionUtilities,
|
|
3587
|
+
* DeprecatedAssertionUtilities,
|
|
3588
|
+
* Stringable,
|
|
3589
|
+
* DetailsToken,
|
|
3590
|
+
* MakeAssert,
|
|
3591
|
+
* Details,
|
|
3592
|
+
* GenericErrorConstructor,
|
|
3593
|
+
* AssertMakeErrorOptions} from '../../types.js';
|
|
3470
3594
|
* @import {LogArgs, NoteCallback, LoggedErrorHandler} from './internal-types.js';
|
|
3471
3595
|
*/
|
|
3472
3596
|
|
|
@@ -3703,7 +3827,7 @@ const tagError = (err, optErrorName = err.name) => {
|
|
|
3703
3827
|
* such as `stack` on v8 (Chrome, Brave, Edge?)
|
|
3704
3828
|
* - `sanitizeError` will freeze the error, preventing any correct engine from
|
|
3705
3829
|
* adding or
|
|
3706
|
-
* altering any of the error's own properties `sanitizeError` is done.
|
|
3830
|
+
* altering any of the error's own properties once `sanitizeError` is done.
|
|
3707
3831
|
*
|
|
3708
3832
|
* However, `sanitizeError` will not, for example, `harden`
|
|
3709
3833
|
* (i.e., deeply freeze)
|
|
@@ -3723,10 +3847,16 @@ const tagError = (err, optErrorName = err.name) => {
|
|
|
3723
3847
|
errors: _errorsDesc = undefined,
|
|
3724
3848
|
cause: _causeDesc = undefined,
|
|
3725
3849
|
stack: _stackDesc = undefined,
|
|
3850
|
+
code: codeDesc = undefined,
|
|
3726
3851
|
...restDescs
|
|
3727
3852
|
} = descs;
|
|
3728
3853
|
|
|
3729
3854
|
const restNames = ownKeys(restDescs);
|
|
3855
|
+
|
|
3856
|
+
// the spec allows any value, but we drop 'code' if it's not a string
|
|
3857
|
+
if (codeDesc?.value !== undefined && typeof codeDesc.value !== 'string') {
|
|
3858
|
+
arrayPush(restNames, 'code');
|
|
3859
|
+
}
|
|
3730
3860
|
if (restNames.length >= 1) {
|
|
3731
3861
|
for (const name of restNames) {
|
|
3732
3862
|
delete error[name];
|
|
@@ -3751,34 +3881,51 @@ const tagError = (err, optErrorName = err.name) => {
|
|
|
3751
3881
|
* @type {AssertionUtilities['makeError']}
|
|
3752
3882
|
*/$h͏_once.sanitizeError(sanitizeError);
|
|
3753
3883
|
const makeError = (
|
|
3754
|
-
optDetails
|
|
3755
|
-
errConstructor
|
|
3884
|
+
optDetails,
|
|
3885
|
+
errConstructor,
|
|
3756
3886
|
{
|
|
3757
3887
|
errorName = undefined,
|
|
3758
3888
|
cause = undefined,
|
|
3759
3889
|
errors = undefined,
|
|
3760
3890
|
sanitize = true,
|
|
3891
|
+
code = undefined,
|
|
3761
3892
|
} = {},
|
|
3762
3893
|
) => {
|
|
3894
|
+
// The first two parameters above cannot be inferred unless this is rewritten
|
|
3895
|
+
// as a function declaration using an @overload tag. This is a workaround so
|
|
3896
|
+
// that we at least have type-safety within the function body.
|
|
3897
|
+
//
|
|
3898
|
+
// Note that due to the overload of AssertionUtilities['makeError'], strict
|
|
3899
|
+
// Note that due to the overload of AssertionUtilities['makeError'], Typescript's so-called "strict
|
|
3900
|
+
// mode" will complain if default parameters are provided in the method
|
|
3901
|
+
// signature. The below workaround (optDetails -> details; errConstructor ->
|
|
3902
|
+
// errCtor) is functionally equivalent but allows us to use type assertions to
|
|
3903
|
+
// workaround the issue with TypeScript's so-called "strict mode".
|
|
3904
|
+
let details = /** @type {Details} */ (
|
|
3905
|
+
optDetails ?? redactedDetails`Assert failed`
|
|
3906
|
+
);
|
|
3907
|
+
|
|
3908
|
+
// Internally, this is a GenericErrorConstructor, but externally it can be
|
|
3909
|
+
// some T which extends GenericErrorConstructor.
|
|
3910
|
+
const errCtor = /** @type {GenericErrorConstructor} */ (
|
|
3911
|
+
errConstructor ?? globalThis.Error
|
|
3912
|
+
);
|
|
3763
3913
|
// Promote string-valued `optDetails` into a minimal DetailsParts
|
|
3764
3914
|
// consisting of that string as the sole literal part with no substitutions.
|
|
3765
|
-
if (typeof
|
|
3766
|
-
|
|
3915
|
+
if (typeof details === 'string') {
|
|
3916
|
+
details = redactedDetails([details]);
|
|
3767
3917
|
}
|
|
3768
|
-
const hiddenDetails = weakmapGet(hiddenDetailsMap,
|
|
3918
|
+
const hiddenDetails = weakmapGet(hiddenDetailsMap, details);
|
|
3769
3919
|
if (hiddenDetails === undefined) {
|
|
3770
|
-
throw TypeError(`unrecognized details ${quote(
|
|
3920
|
+
throw TypeError(`unrecognized details ${quote(details)}`);
|
|
3771
3921
|
}
|
|
3772
3922
|
const messageString = getMessageString(hiddenDetails);
|
|
3773
3923
|
const opts = cause && { cause };
|
|
3774
3924
|
let error;
|
|
3775
|
-
if (
|
|
3776
|
-
typeof AggregateError !== 'undefined' &&
|
|
3777
|
-
errConstructor === AggregateError
|
|
3778
|
-
) {
|
|
3925
|
+
if (typeof AggregateError !== 'undefined' && errCtor === AggregateError) {
|
|
3779
3926
|
error = AggregateError(errors || [], messageString, opts);
|
|
3780
3927
|
} else {
|
|
3781
|
-
const ErrorCtor = /** @type {ErrorConstructor} */ (
|
|
3928
|
+
const ErrorCtor = /** @type {ErrorConstructor} */ (errCtor);
|
|
3782
3929
|
error = ErrorCtor(messageString, opts);
|
|
3783
3930
|
// Since we need to tolerate `errors` on an AggregateError, we may as well
|
|
3784
3931
|
// tolerate it on all errors.
|
|
@@ -3791,6 +3938,14 @@ const makeError = (
|
|
|
3791
3938
|
});
|
|
3792
3939
|
}
|
|
3793
3940
|
}
|
|
3941
|
+
if (code !== undefined) {
|
|
3942
|
+
defineProperty(error, 'code', {
|
|
3943
|
+
value: code,
|
|
3944
|
+
writable: true,
|
|
3945
|
+
enumerable: false,
|
|
3946
|
+
configurable: true,
|
|
3947
|
+
});
|
|
3948
|
+
}
|
|
3794
3949
|
weakmapSet(hiddenMessageLogArgs, error, getLogArgs(hiddenDetails));
|
|
3795
3950
|
if (errorName !== undefined) {
|
|
3796
3951
|
tagError(error, errorName);
|
|
@@ -3798,7 +3953,11 @@ const makeError = (
|
|
|
3798
3953
|
if (sanitize) {
|
|
3799
3954
|
sanitizeError(error);
|
|
3800
3955
|
}
|
|
3801
|
-
//
|
|
3956
|
+
// Externally, the return type below is InstanceType<T> where T extends
|
|
3957
|
+
// GenericErrorConstructor. Internally, it's
|
|
3958
|
+
// InstanceType<GenericErrorConstructor> for simplicity of implementation.
|
|
3959
|
+
|
|
3960
|
+
// The next line is a particularly fruitful place to put a breakpoint.
|
|
3802
3961
|
return error;
|
|
3803
3962
|
};$h͏_once.makeError(makeError);
|
|
3804
3963
|
freeze(makeError);
|
|
@@ -4373,7 +4532,7 @@ const freezeTypedArray = array => {
|
|
|
4373
4532
|
/** @import {GenericErrorConstructor} from '../types.js' */
|
|
4374
4533
|
|
|
4375
4534
|
/**
|
|
4376
|
-
* Exports
|
|
4535
|
+
* Exports `permits`, a recursively defined
|
|
4377
4536
|
* JSON record enumerating all intrinsics and their properties
|
|
4378
4537
|
* according to ECMA specs.
|
|
4379
4538
|
*
|
|
@@ -4469,6 +4628,15 @@ const freezeTypedArray = array => {
|
|
|
4469
4628
|
JSON: 'JSON',
|
|
4470
4629
|
Reflect: 'Reflect',
|
|
4471
4630
|
|
|
4631
|
+
// WHATWG Encoding Standard
|
|
4632
|
+
// https://encoding.spec.whatwg.org/
|
|
4633
|
+
// TextEncoder and TextDecoder are pure transformations between string and
|
|
4634
|
+
// Uint8Array with no static side channels and no exposed iterator
|
|
4635
|
+
// prototype. They are permitted universally; on hosts that do not provide
|
|
4636
|
+
// them (XS), the sampling pass tolerates the absence.
|
|
4637
|
+
TextEncoder: 'TextEncoder',
|
|
4638
|
+
TextDecoder: 'TextDecoder',
|
|
4639
|
+
|
|
4472
4640
|
// *** Annex B
|
|
4473
4641
|
|
|
4474
4642
|
escape: 'escape',
|
|
@@ -4626,20 +4794,20 @@ if (typeof AggregateError !== 'undefined') {
|
|
|
4626
4794
|
* are also considered blacklisted and are removed.
|
|
4627
4795
|
* <li>A string value equal to a primitive ("number", "string", etc),
|
|
4628
4796
|
* in which case the property is permitted if its value property
|
|
4629
|
-
* is typeof the given type. For example,
|
|
4630
|
-
* "number" and property values that fail
|
|
4797
|
+
* is typeof the given type. For example, `Infinity` leads to
|
|
4798
|
+
* "number" and property values that fail `typeof "number`.
|
|
4631
4799
|
* are removed.
|
|
4632
4800
|
* <li>A string value equal to an intinsic name ("ObjectPrototype",
|
|
4633
4801
|
* "Array", etc), in which case the property permitted if its
|
|
4634
4802
|
* value property is equal to the value of the corresponfing
|
|
4635
|
-
* intrinsics. For example,
|
|
4803
|
+
* intrinsics. For example, `Map.prototype` leads to
|
|
4636
4804
|
* "MapPrototype" and the property is removed if its value is
|
|
4637
4805
|
* not equal to %MapPrototype%
|
|
4638
4806
|
* <li>Another record, in which case this property is simply
|
|
4639
4807
|
* permitted and that next record represents the disposition of
|
|
4640
|
-
* the object which is its value. For example,
|
|
4641
|
-
* leads to another record explaining what properties
|
|
4642
|
-
*
|
|
4808
|
+
* the object which is its value. For example, `Object`
|
|
4809
|
+
* leads to another record explaining what properties
|
|
4810
|
+
* `Object` may have and how each such property should be treated.
|
|
4643
4811
|
*
|
|
4644
4812
|
* <p>Notes:
|
|
4645
4813
|
* <li>"[[Proto]]" is used to refer to the "[[Prototype]]" internal
|
|
@@ -5754,30 +5922,6 @@ const CommonMath = {
|
|
|
5754
5922
|
immutable: getter,
|
|
5755
5923
|
},
|
|
5756
5924
|
|
|
5757
|
-
// If this exists, it is purely an artifact of how we currently shim
|
|
5758
|
-
// `transferToImmutable`. As natively implemented, there would be no
|
|
5759
|
-
// such extra prototype.
|
|
5760
|
-
'%ImmutableArrayBufferPrototype%': {
|
|
5761
|
-
'[[Proto]]': '%ArrayBufferPrototype%',
|
|
5762
|
-
byteLength: getter,
|
|
5763
|
-
slice: fn,
|
|
5764
|
-
// See https://github.com/endojs/endo/tree/master/packages/immutable-arraybuffer#purposeful-violation
|
|
5765
|
-
'@@toStringTag': 'string',
|
|
5766
|
-
// See https://github.com/tc39/proposal-resizablearraybuffer
|
|
5767
|
-
transfer: fn,
|
|
5768
|
-
resize: fn,
|
|
5769
|
-
resizable: getter,
|
|
5770
|
-
maxByteLength: getter,
|
|
5771
|
-
// https://github.com/tc39/proposal-arraybuffer-transfer
|
|
5772
|
-
transferToFixedLength: fn,
|
|
5773
|
-
detached: getter,
|
|
5774
|
-
// https://github.com/endojs/endo/pull/2309#issuecomment-2155513240
|
|
5775
|
-
// to be proposed
|
|
5776
|
-
transferToImmutable: fn,
|
|
5777
|
-
sliceToImmutable: fn,
|
|
5778
|
-
immutable: getter,
|
|
5779
|
-
},
|
|
5780
|
-
|
|
5781
5925
|
// SharedArrayBuffer Objects
|
|
5782
5926
|
SharedArrayBuffer: false, // UNSAFE and purposely suppressed.
|
|
5783
5927
|
'%SharedArrayBufferPrototype%': false, // UNSAFE and purposely suppressed.
|
|
@@ -6450,6 +6594,44 @@ const CommonMath = {
|
|
|
6450
6594
|
'@@toStringTag': 'string',
|
|
6451
6595
|
},
|
|
6452
6596
|
|
|
6597
|
+
// WHATWG Encoding Standard
|
|
6598
|
+
// https://encoding.spec.whatwg.org/
|
|
6599
|
+
|
|
6600
|
+
TextEncoder: {
|
|
6601
|
+
// Properties of the TextEncoder Constructor
|
|
6602
|
+
'[[Proto]]': '%FunctionPrototype%',
|
|
6603
|
+
prototype: '%TextEncoderPrototype%',
|
|
6604
|
+
},
|
|
6605
|
+
|
|
6606
|
+
'%TextEncoderPrototype%': {
|
|
6607
|
+
constructor: 'TextEncoder',
|
|
6608
|
+
encode: fn,
|
|
6609
|
+
encodeInto: fn,
|
|
6610
|
+
encoding: getter,
|
|
6611
|
+
'@@toStringTag': 'string',
|
|
6612
|
+
|
|
6613
|
+
// Non-standard property used by Node.js
|
|
6614
|
+
'RegisteredSymbol(nodejs.util.inspect.custom)': false,
|
|
6615
|
+
},
|
|
6616
|
+
|
|
6617
|
+
TextDecoder: {
|
|
6618
|
+
// Properties of the TextDecoder Constructor
|
|
6619
|
+
'[[Proto]]': '%FunctionPrototype%',
|
|
6620
|
+
prototype: '%TextDecoderPrototype%',
|
|
6621
|
+
},
|
|
6622
|
+
|
|
6623
|
+
'%TextDecoderPrototype%': {
|
|
6624
|
+
constructor: 'TextDecoder',
|
|
6625
|
+
decode: fn,
|
|
6626
|
+
encoding: getter,
|
|
6627
|
+
fatal: getter,
|
|
6628
|
+
ignoreBOM: getter,
|
|
6629
|
+
'@@toStringTag': 'string',
|
|
6630
|
+
|
|
6631
|
+
// Non-standard property used by Node.js
|
|
6632
|
+
'RegisteredSymbol(nodejs.util.inspect.custom)': false,
|
|
6633
|
+
},
|
|
6634
|
+
|
|
6453
6635
|
// Appendix B
|
|
6454
6636
|
|
|
6455
6637
|
// Annex B: Additional Properties of the Global Object
|
|
@@ -6480,6 +6662,7 @@ const CommonMath = {
|
|
|
6480
6662
|
load: asyncFn,
|
|
6481
6663
|
importNow: fn,
|
|
6482
6664
|
module: fn,
|
|
6665
|
+
__noNamespaceBox__: getter,
|
|
6483
6666
|
'@@toStringTag': 'string',
|
|
6484
6667
|
},
|
|
6485
6668
|
|
|
@@ -7023,7 +7206,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
|
|
|
7023
7206
|
// Verify that the method is not callable.
|
|
7024
7207
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
7025
7208
|
FERAL_FUNCTION.prototype.constructor('return 1');
|
|
7026
|
-
} catch (
|
|
7209
|
+
} catch (_err) {
|
|
7027
7210
|
// Throws, no need to patch.
|
|
7028
7211
|
return freeze({});
|
|
7029
7212
|
}
|
|
@@ -7693,71 +7876,62 @@ const methods = {
|
|
|
7693
7876
|
// === 25. ses ./src/enablements.js ===
|
|
7694
7877
|
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let toStringTagSymbol,iteratorSymbol;$h͏_imports([["./commons.js", [["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["iteratorSymbol",[$h͏_a => (iteratorSymbol = $h͏_a)]]]]]);
|
|
7695
7878
|
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7879
|
+
|
|
7880
|
+
|
|
7881
|
+
|
|
7882
|
+
|
|
7883
|
+
|
|
7884
|
+
|
|
7885
|
+
|
|
7886
|
+
|
|
7887
|
+
|
|
7888
|
+
|
|
7889
|
+
|
|
7890
|
+
|
|
7891
|
+
|
|
7892
|
+
|
|
7893
|
+
|
|
7894
|
+
|
|
7895
|
+
|
|
7896
|
+
|
|
7897
|
+
|
|
7898
|
+
|
|
7899
|
+
|
|
7900
|
+
|
|
7901
|
+
|
|
7902
|
+
|
|
7903
|
+
|
|
7904
|
+
|
|
7905
|
+
|
|
7906
|
+
|
|
7907
|
+
|
|
7908
|
+
|
|
7909
|
+
|
|
7910
|
+
|
|
7911
|
+
|
|
7912
|
+
|
|
7913
|
+
|
|
7914
|
+
|
|
7915
|
+
|
|
7916
|
+
|
|
7917
|
+
|
|
7918
|
+
|
|
7919
|
+
|
|
7920
|
+
|
|
7921
|
+
|
|
7922
|
+
|
|
7923
|
+
|
|
7924
|
+
|
|
7925
|
+
|
|
7926
|
+
|
|
7927
|
+
|
|
7928
|
+
|
|
7929
|
+
|
|
7930
|
+
|
|
7707
7931
|
|
|
7708
7932
|
/**
|
|
7709
|
-
*
|
|
7710
|
-
*
|
|
7711
|
-
* which degrades the runtime performance of all code executing in the
|
|
7712
|
-
* repaired enviromment, compared to the non-repaired case. In order
|
|
7713
|
-
* to maintain performance, we only repair the properties of objects
|
|
7714
|
-
* for which hardening causes a breakage of their normal intended usage.
|
|
7715
|
-
*
|
|
7716
|
-
* There are three unwanted cases:
|
|
7717
|
-
* <ul>
|
|
7718
|
-
* <li>Overriding properties on objects typically used as records,
|
|
7719
|
-
* namely {@code "Object"} and {@code "Array"}. In the case of arrays,
|
|
7720
|
-
* the situation is unintentional, a given program might not be aware
|
|
7721
|
-
* that non-numerical properties are stored on the underlying object
|
|
7722
|
-
* instance, not on the array. When an object is typically used as a
|
|
7723
|
-
* map, we repair all of its prototype properties.
|
|
7724
|
-
* <li>Overriding properties on objects that provide defaults on their
|
|
7725
|
-
* prototype and that programs typically set using an assignment, such as
|
|
7726
|
-
* {@code "Error.prototype.message"} and {@code "Function.prototype.name"}
|
|
7727
|
-
* (both default to "").
|
|
7728
|
-
* <li>Setting-up a prototype chain, where a constructor is set to extend
|
|
7729
|
-
* another one. This is typically set by assignment, for example
|
|
7730
|
-
* {@code "Child.prototype.constructor = Child"}, instead of invoking
|
|
7731
|
-
* Object.defineProperty();
|
|
7732
|
-
*
|
|
7733
|
-
* <p>Each JSON record enumerates the disposition of the properties on
|
|
7734
|
-
* some corresponding intrinsic object.
|
|
7735
|
-
*
|
|
7736
|
-
* <p>For each such record, the values associated with its property
|
|
7737
|
-
* names can be:
|
|
7738
|
-
* <ul>
|
|
7739
|
-
* <li>true, in which case this property is simply repaired. The
|
|
7740
|
-
* value associated with that property is not traversed. For
|
|
7741
|
-
* example, {@code "Function.prototype.name"} leads to true,
|
|
7742
|
-
* meaning that the {@code "name"} property of {@code
|
|
7743
|
-
* "Function.prototype"} should be repaired (which is needed
|
|
7744
|
-
* when inheriting from @code{Function} and setting the subclass's
|
|
7745
|
-
* {@code "prototype.name"} property). If the property is
|
|
7746
|
-
* already an accessor property, it is not repaired (because
|
|
7747
|
-
* accessors are not subject to the override mistake).
|
|
7748
|
-
* <li>"*", in which case this property is not repaired but the
|
|
7749
|
-
* value associated with that property are traversed and repaired.
|
|
7750
|
-
* <li>Another record, in which case this property is not repaired
|
|
7751
|
-
* and that next record represents the disposition of the object
|
|
7752
|
-
* which is its value. For example,{@code "FunctionPrototype"}
|
|
7753
|
-
* leads to another record explaining which properties {@code
|
|
7754
|
-
* Function.prototype} need to be repaired.
|
|
7755
|
-
*/
|
|
7756
|
-
|
|
7757
|
-
/**
|
|
7758
|
-
* Minimal enablements when all the code is modern and known not to
|
|
7759
|
-
* step into the override mistake, except for the following pervasive
|
|
7760
|
-
* cases.
|
|
7933
|
+
* Minimal enablements when all the code is modern and known not to step into
|
|
7934
|
+
* the override mistake, except for the following pervasive cases.
|
|
7761
7935
|
*/
|
|
7762
7936
|
const minEnablements = {
|
|
7763
7937
|
'%ObjectPrototype%': {
|
|
@@ -9672,7 +9846,10 @@ let markVirtualizedNativeFunction;
|
|
|
9672
9846
|
})()
|
|
9673
9847
|
,
|
|
9674
9848
|
// === 42. ses ./src/error/console.js ===
|
|
9675
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakSet,arrayFilter,arrayFlatMap,arrayMap,arrayPop,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,stringIncludes,stringSplit,weaksetAdd,weaksetHas;$h͏_imports([["../commons.js", [["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayFlatMap",[$h͏_a => (arrayFlatMap = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["stringEndsWith",[$h͏_a => (stringEndsWith = $h͏_a)]],["stringIncludes",[$h͏_a => (stringIncludes = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]]]]]);
|
|
9849
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakSet,arrayFilter,arrayFlatMap,arrayMap,arrayPop,arrayPush,defineProperty,freeze,fromEntries,globalThis,isError,stringEndsWith,stringIncludes,stringSplit,weaksetAdd,weaksetHas,stringIndexOf,stringSlice;$h͏_imports([["../commons.js", [["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayFlatMap",[$h͏_a => (arrayFlatMap = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["stringEndsWith",[$h͏_a => (stringEndsWith = $h͏_a)]],["stringIncludes",[$h͏_a => (stringIncludes = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]]]]]);
|
|
9850
|
+
|
|
9851
|
+
|
|
9852
|
+
|
|
9676
9853
|
|
|
9677
9854
|
|
|
9678
9855
|
|
|
@@ -9749,7 +9926,7 @@ const defineName = (name, fn) => defineProperty(fn, 'name', { value: name });
|
|
|
9749
9926
|
* This is the same as the log severity of these on other
|
|
9750
9927
|
* platform console implementations when they all agree.
|
|
9751
9928
|
*
|
|
9752
|
-
* @type {readonly [ConsoleProps, LogSeverity
|
|
9929
|
+
* @type {readonly [ConsoleProps, LogSeverity][]}
|
|
9753
9930
|
*/
|
|
9754
9931
|
const consoleLevelMethods = freeze([
|
|
9755
9932
|
['debug', 'debug'], // (fmt?, ...args) verbose level on Chrome
|
|
@@ -9764,25 +9941,35 @@ const defineName = (name, fn) => defineProperty(fn, 'name', { value: name });
|
|
|
9764
9941
|
['groupCollapsed', 'log'] // (fmt?, ...args) but TS typed (...label)
|
|
9765
9942
|
]);
|
|
9766
9943
|
|
|
9944
|
+
/**
|
|
9945
|
+
* We special case `console.assert` because it contains `fmt?, ...args` just
|
|
9946
|
+
* like the `consoleLevelMethods`, but not in the same place.
|
|
9947
|
+
* We special case `console.timeLog` because it contains the same kind of
|
|
9948
|
+
* `...args`, but with no format string.
|
|
9949
|
+
*
|
|
9950
|
+
* @type {readonly [ConsoleProps, LogSeverity][]}
|
|
9951
|
+
*/$h͏_once.consoleLevelMethods(consoleLevelMethods);
|
|
9952
|
+
const consoleSpecialMethods = freeze([
|
|
9953
|
+
['assert', 'error'], // (value, fmt?, ...args)
|
|
9954
|
+
['timeLog', 'log'] // (label?, ...args) no fmt string
|
|
9955
|
+
]);
|
|
9956
|
+
|
|
9767
9957
|
/**
|
|
9768
9958
|
* Those console methods other than those already enumerated by
|
|
9769
|
-
* `consoleLevelMethods`.
|
|
9959
|
+
* `consoleLevelMethods` and `consoleSpecialMethods`.
|
|
9770
9960
|
*
|
|
9771
9961
|
* Each is paired with what we consider to be their log severity level.
|
|
9772
9962
|
* This is the same as the log severity of these on other
|
|
9773
9963
|
* platform console implementations when they all agree.
|
|
9774
9964
|
*
|
|
9775
|
-
* @type {readonly [ConsoleProps, LogSeverity
|
|
9776
|
-
*/$h͏_once.
|
|
9965
|
+
* @type {readonly [ConsoleProps, LogSeverity][]}
|
|
9966
|
+
*/$h͏_once.consoleSpecialMethods(consoleSpecialMethods);
|
|
9777
9967
|
const consoleOtherMethods = freeze([
|
|
9778
|
-
['assert', 'error'], // (value, fmt?, ...args)
|
|
9779
|
-
['timeLog', 'log'], // (label?, ...args) no fmt string
|
|
9780
|
-
|
|
9781
9968
|
// Insensitive to whether any argument is an error. All arguments can pass
|
|
9782
9969
|
// thru to baseConsole as is.
|
|
9783
|
-
['clear',
|
|
9970
|
+
['clear', 'info'], // (), level is not well defined
|
|
9784
9971
|
['count', 'info'], // (label?)
|
|
9785
|
-
['countReset',
|
|
9972
|
+
['countReset', 'info'], // (label?), level is not well defined
|
|
9786
9973
|
['dir', 'log'], // (item, options?)
|
|
9787
9974
|
['groupEnd', 'log'], // ()
|
|
9788
9975
|
// In theory tabular data may be or contain an error. However, we currently
|
|
@@ -9792,14 +9979,15 @@ const defineName = (name, fn) => defineProperty(fn, 'name', { value: name });
|
|
|
9792
9979
|
['timeEnd', 'info'], // (label?)
|
|
9793
9980
|
|
|
9794
9981
|
// Node Inspector only, MDN, and TypeScript, but not whatwg
|
|
9795
|
-
['profile',
|
|
9796
|
-
['profileEnd',
|
|
9797
|
-
['timeStamp',
|
|
9982
|
+
['profile', 'info'], // (label?)
|
|
9983
|
+
['profileEnd', 'info'], // (label?)
|
|
9984
|
+
['timeStamp', 'info'] // (label?)
|
|
9798
9985
|
]);
|
|
9799
9986
|
|
|
9800
|
-
/** @type {readonly [ConsoleProps, LogSeverity
|
|
9987
|
+
/** @type {readonly [ConsoleProps, LogSeverity][]} */$h͏_once.consoleOtherMethods(consoleOtherMethods);
|
|
9801
9988
|
const consoleMethodPermits = freeze([
|
|
9802
9989
|
...consoleLevelMethods,
|
|
9990
|
+
...consoleSpecialMethods,
|
|
9803
9991
|
...consoleOtherMethods,
|
|
9804
9992
|
]);
|
|
9805
9993
|
|
|
@@ -9830,6 +10018,111 @@ const consoleMethodPermits = freeze([
|
|
|
9830
10018
|
* ]);
|
|
9831
10019
|
*/
|
|
9832
10020
|
|
|
10021
|
+
/**
|
|
10022
|
+
* If `formatData` consists of `[fmt, ...args]` and `fmt` is a string
|
|
10023
|
+
* containing a `%c` specifier that acts as an `%c` specifier
|
|
10024
|
+
* according to https://console.spec.whatwg.org/#formatting-specifiers
|
|
10025
|
+
* then omit it and its corresponding argument. For the rest of the `fmt`
|
|
10026
|
+
* string and its corresponding arguments, return them as a replacement
|
|
10027
|
+
* `formatData` to be fed to the underlying console log functions.
|
|
10028
|
+
*
|
|
10029
|
+
* The test takes into account the number of remaining `args`.
|
|
10030
|
+
* A `%c` beyond `args` does not act as a specifier.
|
|
10031
|
+
* The additional issue not mentioned at
|
|
10032
|
+
* https://console.spec.whatwg.org/#formatting-specifiers
|
|
10033
|
+
* is that `%%` is an escaped `%`, so the `%c` found within,
|
|
10034
|
+
* for example, `%%c` does not act as a specifier.
|
|
10035
|
+
* Instead, it gets rendered as `%c` without consuming an argument.
|
|
10036
|
+
*
|
|
10037
|
+
* Note terminology differences from the spec-internal `Logger` function
|
|
10038
|
+
* at https://console.spec.whatwg.org/#formatting-specifiers .
|
|
10039
|
+
*
|
|
10040
|
+
* | `Logger` terminology | `sanitizeFormatData` terminology |
|
|
10041
|
+
* | ---------------------|----------------------------------|
|
|
10042
|
+
* | `args` | `formatData` |
|
|
10043
|
+
* | `first` | `fmt` |
|
|
10044
|
+
* | `rest` | `args` |
|
|
10045
|
+
*
|
|
10046
|
+
* Exported only for testing.
|
|
10047
|
+
*
|
|
10048
|
+
* @param {any[]} formatData
|
|
10049
|
+
* @returns {any[]}
|
|
10050
|
+
*/
|
|
10051
|
+
const sanitizeFormatData = ([...formatData]) => {
|
|
10052
|
+
freeze(formatData);
|
|
10053
|
+
if (formatData.length <= 1) {
|
|
10054
|
+
return formatData;
|
|
10055
|
+
}
|
|
10056
|
+
const [fmt, ...args] = formatData;
|
|
10057
|
+
if (typeof fmt !== 'string' || !stringIncludes(fmt, '%')) {
|
|
10058
|
+
return formatData;
|
|
10059
|
+
}
|
|
10060
|
+
|
|
10061
|
+
let startPos = 0;
|
|
10062
|
+
let argI = 0;
|
|
10063
|
+
let newFmt = '';
|
|
10064
|
+
const newArgs = [];
|
|
10065
|
+
for (
|
|
10066
|
+
let percentPos = stringIndexOf(fmt, '%');
|
|
10067
|
+
// Notice the `- 1` below, which leaves room for one more character after
|
|
10068
|
+
// the `'%'`.
|
|
10069
|
+
percentPos >= startPos && percentPos < fmt.length - 1 && argI < args.length;
|
|
10070
|
+
percentPos = stringIndexOf(fmt, '%', startPos)
|
|
10071
|
+
) {
|
|
10072
|
+
// The four cases in the following switch are purposely partially
|
|
10073
|
+
// redundant. But the total code is small and our attempts at more
|
|
10074
|
+
// reuse made the code less clear. Clarity sometimes wins over DRY.
|
|
10075
|
+
const char = fmt[percentPos + 1];
|
|
10076
|
+
switch (char) {
|
|
10077
|
+
case 's':
|
|
10078
|
+
case 'd':
|
|
10079
|
+
case 'i':
|
|
10080
|
+
case 'f':
|
|
10081
|
+
case 'o':
|
|
10082
|
+
case 'O': {
|
|
10083
|
+
// transfer segment + % + char
|
|
10084
|
+
newFmt += stringSlice(fmt, startPos, percentPos + 2);
|
|
10085
|
+
startPos = percentPos + 2;
|
|
10086
|
+
// transfer 1 arg
|
|
10087
|
+
arrayPush(newArgs, args[argI]);
|
|
10088
|
+
argI += 1;
|
|
10089
|
+
break;
|
|
10090
|
+
}
|
|
10091
|
+
case 'c': {
|
|
10092
|
+
// transfer segment. Consume %c
|
|
10093
|
+
newFmt += stringSlice(fmt, startPos, percentPos);
|
|
10094
|
+
startPos = percentPos + 2;
|
|
10095
|
+
// consume 1 arg
|
|
10096
|
+
argI += 1;
|
|
10097
|
+
break;
|
|
10098
|
+
}
|
|
10099
|
+
case '%': {
|
|
10100
|
+
// transfer segment + % + char. Ignore args
|
|
10101
|
+
newFmt += stringSlice(fmt, startPos, percentPos + 2);
|
|
10102
|
+
startPos = percentPos + 2;
|
|
10103
|
+
break;
|
|
10104
|
+
}
|
|
10105
|
+
default: {
|
|
10106
|
+
// transfer segment + %% + char. Ignore args
|
|
10107
|
+
// So that %<unspecified> is treated as unknown even if
|
|
10108
|
+
// implemented by the local platform, such as %j on Node.
|
|
10109
|
+
newFmt += stringSlice(fmt, startPos, percentPos);
|
|
10110
|
+
newFmt += `%%${char}`;
|
|
10111
|
+
startPos = percentPos + 2;
|
|
10112
|
+
break;
|
|
10113
|
+
}
|
|
10114
|
+
}
|
|
10115
|
+
}
|
|
10116
|
+
if (startPos < fmt.length) {
|
|
10117
|
+
newFmt += stringSlice(fmt, startPos, fmt.length);
|
|
10118
|
+
}
|
|
10119
|
+
for (; argI < args.length; argI += 1) {
|
|
10120
|
+
arrayPush(newArgs, args[argI]);
|
|
10121
|
+
}
|
|
10122
|
+
return /** @type {any[]} */ (freeze([newFmt, ...newArgs]));
|
|
10123
|
+
};$h͏_once.sanitizeFormatData(sanitizeFormatData);
|
|
10124
|
+
freeze(sanitizeFormatData);
|
|
10125
|
+
|
|
9833
10126
|
// //////////////////////////// Logging Console ////////////////////////////////
|
|
9834
10127
|
|
|
9835
10128
|
/** @type {MakeLoggingConsoleKit} */
|
|
@@ -9898,11 +10191,32 @@ const ErrorInfo = {
|
|
|
9898
10191
|
freeze(ErrorInfo);
|
|
9899
10192
|
|
|
9900
10193
|
/** @type {MakeCausalConsole} */
|
|
9901
|
-
const makeCausalConsole = (
|
|
9902
|
-
if (!
|
|
10194
|
+
const makeCausalConsole = (feralConsole, loggedErrorHandler) => {
|
|
10195
|
+
if (!feralConsole) {
|
|
9903
10196
|
return undefined;
|
|
9904
10197
|
}
|
|
9905
10198
|
|
|
10199
|
+
// In Node.js, the global console does a deep scan of its inputs for methods
|
|
10200
|
+
// keyed by Symbol.for('nodejs.util.inspect.custom'), and invokes any that are
|
|
10201
|
+
// found with unhardened arguments as described at
|
|
10202
|
+
// https://nodejs.org/docs/latest/api/util.html#custom-inspection-functions-on-objects
|
|
10203
|
+
// To circumvent that problematic behavior, we use its
|
|
10204
|
+
// https://nodejs.org/docs/latest/api/console.html#class-console Console
|
|
10205
|
+
// constructor to build a replacement that explicitly opts out by setting the
|
|
10206
|
+
// `customInspect` option to false.
|
|
10207
|
+
// https://nodejs.org/docs/latest/api/util.html#utilinspectobject-options
|
|
10208
|
+
/** @type {new (options: any) => typeof console} */
|
|
10209
|
+
const Console = /** @type {any} */ (feralConsole).Console;
|
|
10210
|
+
const { stdout, stderr } = globalThis.process || { __proto__: null };
|
|
10211
|
+
const baseConsole =
|
|
10212
|
+
typeof Console === 'function' && (stdout || stderr)
|
|
10213
|
+
? new Console({
|
|
10214
|
+
stdout,
|
|
10215
|
+
stderr,
|
|
10216
|
+
inspectOptions: { colors: undefined, customInspect: false },
|
|
10217
|
+
})
|
|
10218
|
+
: feralConsole;
|
|
10219
|
+
|
|
9906
10220
|
const { getStackString, tagError, takeMessageLogArgs, takeNoteLogArgsArray } =
|
|
9907
10221
|
loggedErrorHandler;
|
|
9908
10222
|
|
|
@@ -10050,32 +10364,53 @@ freeze(ErrorInfo);
|
|
|
10050
10364
|
logSubErrors(severity, subErrors, errorTag);
|
|
10051
10365
|
};
|
|
10052
10366
|
|
|
10053
|
-
const levelMethods = arrayMap(consoleLevelMethods, ([
|
|
10367
|
+
const levelMethods = arrayMap(consoleLevelMethods, ([name, level]) => {
|
|
10054
10368
|
/**
|
|
10055
10369
|
* @param {...any} logArgs
|
|
10056
10370
|
*/
|
|
10057
|
-
const levelMethod = defineName(
|
|
10371
|
+
const levelMethod = defineName(name, (...logArgs) => {
|
|
10058
10372
|
const subErrors = [];
|
|
10059
|
-
const argTags = extractErrorArgs(logArgs, subErrors);
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
baseConsole[level](...argTags);
|
|
10063
|
-
}
|
|
10064
|
-
// @ts-expect-error ConsoleProp vs LogSeverity mismatch
|
|
10373
|
+
const argTags = extractErrorArgs(sanitizeFormatData(logArgs), subErrors);
|
|
10374
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
10375
|
+
baseConsole[name](...argTags);
|
|
10065
10376
|
logSubErrors(level, subErrors);
|
|
10066
10377
|
});
|
|
10067
|
-
return [
|
|
10378
|
+
return [name, freeze(levelMethod)];
|
|
10068
10379
|
});
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
(
|
|
10072
|
-
|
|
10073
|
-
|
|
10380
|
+
|
|
10381
|
+
const assertMethod = defineName('assert', (...assertArgs) => {
|
|
10382
|
+
if (assertArgs.length <= 1) {
|
|
10383
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
10384
|
+
baseConsole.assert(...assertArgs);
|
|
10385
|
+
} else {
|
|
10386
|
+
const [cond, ...logArgs] = assertArgs;
|
|
10387
|
+
const subErrors = [];
|
|
10388
|
+
const argTags = extractErrorArgs(sanitizeFormatData(logArgs), subErrors);
|
|
10389
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
10390
|
+
baseConsole.assert(cond, ...argTags);
|
|
10391
|
+
logSubErrors('error', subErrors);
|
|
10392
|
+
}
|
|
10393
|
+
});
|
|
10394
|
+
|
|
10395
|
+
const timeLogMethod = defineName('timeLog', (...timeLogArgs) => {
|
|
10396
|
+
if (timeLogArgs.length <= 1) {
|
|
10397
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
10398
|
+
baseConsole.timeLog(...timeLogArgs);
|
|
10399
|
+
} else {
|
|
10400
|
+
const [label, ...logArgs] = timeLogArgs;
|
|
10401
|
+
const subErrors = [];
|
|
10402
|
+
const argTags = extractErrorArgs(sanitizeFormatData(logArgs), subErrors);
|
|
10403
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
10404
|
+
baseConsole.timeLog(label, ...argTags);
|
|
10405
|
+
logSubErrors('log', subErrors);
|
|
10406
|
+
}
|
|
10407
|
+
});
|
|
10408
|
+
|
|
10409
|
+
const otherMethods = arrayMap(consoleOtherMethods, ([name, _level]) => {
|
|
10074
10410
|
/**
|
|
10075
10411
|
* @param {...any} args
|
|
10076
10412
|
*/
|
|
10077
10413
|
const otherMethod = defineName(name, (...args) => {
|
|
10078
|
-
// @ts-ignore
|
|
10079
10414
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
10080
10415
|
baseConsole[name](...args);
|
|
10081
10416
|
return undefined;
|
|
@@ -10083,7 +10418,17 @@ freeze(ErrorInfo);
|
|
|
10083
10418
|
return [name, freeze(otherMethod)];
|
|
10084
10419
|
});
|
|
10085
10420
|
|
|
10086
|
-
const
|
|
10421
|
+
const methodEntries = arrayFilter(
|
|
10422
|
+
[
|
|
10423
|
+
...levelMethods,
|
|
10424
|
+
['assert', assertMethod],
|
|
10425
|
+
['timeLog', timeLogMethod],
|
|
10426
|
+
...otherMethods,
|
|
10427
|
+
],
|
|
10428
|
+
([name, _]) => name in baseConsole,
|
|
10429
|
+
);
|
|
10430
|
+
|
|
10431
|
+
const causalConsole = fromEntries(methodEntries);
|
|
10087
10432
|
return /** @type {VirtualConsole} */ (freeze(causalConsole));
|
|
10088
10433
|
};$h͏_once.makeCausalConsole(makeCausalConsole);
|
|
10089
10434
|
freeze(makeCausalConsole);
|
|
@@ -10394,7 +10739,6 @@ const wrapLogger = (logger, thisArg) =>
|
|
|
10394
10739
|
};
|
|
10395
10740
|
}
|
|
10396
10741
|
|
|
10397
|
-
// eslint-disable-next-line no-restricted-globals
|
|
10398
10742
|
const originalConsole = /** @type {VirtualConsole} */ (
|
|
10399
10743
|
// eslint-disable-next-line no-nested-ternary
|
|
10400
10744
|
typeof globalThis.console !== 'undefined'
|
|
@@ -10404,7 +10748,6 @@ const wrapLogger = (logger, thisArg) =>
|
|
|
10404
10748
|
// log at a specific level with no special argument interpretation).
|
|
10405
10749
|
// https://console.spec.whatwg.org/#logging
|
|
10406
10750
|
(p => freeze({ debug: p, log: p, info: p, warn: p, error: p }))(
|
|
10407
|
-
// eslint-disable-next-line no-undef
|
|
10408
10751
|
wrapLogger(globalThis.print),
|
|
10409
10752
|
)
|
|
10410
10753
|
: undefined
|
|
@@ -10995,7 +11338,7 @@ let initialGetStackString = tamedMethods.getStackString;
|
|
|
10995
11338
|
* @this {ErrorConstructor}
|
|
10996
11339
|
* @param {...any} rest
|
|
10997
11340
|
*/
|
|
10998
|
-
|
|
11341
|
+
|
|
10999
11342
|
const ResultError = function Error(...rest) {
|
|
11000
11343
|
let error;
|
|
11001
11344
|
if (new.target === undefined) {
|
|
@@ -11421,7 +11764,6 @@ function* loadWithoutErrorAnnotation(
|
|
|
11421
11764
|
}
|
|
11422
11765
|
|
|
11423
11766
|
if (typeof moduleDescriptor === 'string') {
|
|
11424
|
-
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
11425
11767
|
throw makeError(
|
|
11426
11768
|
X`Cannot map module ${q(moduleSpecifier)} to ${q(
|
|
11427
11769
|
moduleDescriptor,
|
|
@@ -11733,7 +12075,6 @@ const memoizedLoadWithErrorAnnotation = (
|
|
|
11733
12075
|
moduleLoads,
|
|
11734
12076
|
],
|
|
11735
12077
|
error => {
|
|
11736
|
-
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
11737
12078
|
annotateError(
|
|
11738
12079
|
error,
|
|
11739
12080
|
X`${error.message}, loading ${q(moduleSpecifier)} in compartment ${q(
|
|
@@ -12993,7 +13334,6 @@ function validateModuleSource(moduleSource, moduleSpecifier) {
|
|
|
12993
13334
|
|
|
12994
13335
|
|
|
12995
13336
|
|
|
12996
|
-
|
|
12997
13337
|
|
|
12998
13338
|
|
|
12999
13339
|
/**
|
|
@@ -13082,6 +13422,11 @@ const compartmentImportNow = (compartment, specifier) => {
|
|
|
13082
13422
|
.name;
|
|
13083
13423
|
},
|
|
13084
13424
|
|
|
13425
|
+
get __noNamespaceBox__() {
|
|
13426
|
+
return /** @type {CompartmentFields} */ (weakmapGet(privateFields, this))
|
|
13427
|
+
.noNamespaceBox;
|
|
13428
|
+
},
|
|
13429
|
+
|
|
13085
13430
|
evaluate(source, options = {}) {
|
|
13086
13431
|
const compartmentFields = weakmapGet(privateFields, this);
|
|
13087
13432
|
return compartmentEvaluate(compartmentFields, source, options);
|
|
@@ -13409,8 +13754,7 @@ defineProperties(InertCompartment, {
|
|
|
13409
13754
|
})()
|
|
13410
13755
|
,
|
|
13411
13756
|
// === 53. ses ./src/get-anonymous-intrinsics.js ===
|
|
13412
|
-
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,FERAL_FLOAT64_ARRAY,Map,Set,String,getOwnPropertyDescriptor,getPrototypeOf,iterateArray,iterateMap,iterateSet,iterateString,matchAllRegExp,matchAllSymbol,regexpPrototype,globalThis,assign,AsyncGeneratorFunctionInstance,
|
|
13413
|
-
|
|
13757
|
+
({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,FERAL_FLOAT64_ARRAY,Map,Set,String,getOwnPropertyDescriptor,getPrototypeOf,iterateArray,iterateMap,iterateSet,iterateString,matchAllRegExp,matchAllSymbol,regexpPrototype,globalThis,assign,AsyncGeneratorFunctionInstance,InertCompartment;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["FERAL_FLOAT64_ARRAY",[$h͏_a => (FERAL_FLOAT64_ARRAY = $h͏_a)]],["Map",[$h͏_a => (Map = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["iterateArray",[$h͏_a => (iterateArray = $h͏_a)]],["iterateMap",[$h͏_a => (iterateMap = $h͏_a)]],["iterateSet",[$h͏_a => (iterateSet = $h͏_a)]],["iterateString",[$h͏_a => (iterateString = $h͏_a)]],["matchAllRegExp",[$h͏_a => (matchAllRegExp = $h͏_a)]],["matchAllSymbol",[$h͏_a => (matchAllSymbol = $h͏_a)]],["regexpPrototype",[$h͏_a => (regexpPrototype = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["AsyncGeneratorFunctionInstance",[$h͏_a => (AsyncGeneratorFunctionInstance = $h͏_a)]]]],["./compartment.js", [["InertCompartment",[$h͏_a => (InertCompartment = $h͏_a)]]]]]);
|
|
13414
13758
|
|
|
13415
13759
|
|
|
13416
13760
|
|
|
@@ -13465,7 +13809,6 @@ function makeArguments() {
|
|
|
13465
13809
|
|
|
13466
13810
|
// 21.1.5.2 The %StringIteratorPrototype% Object
|
|
13467
13811
|
|
|
13468
|
-
// eslint-disable-next-line no-new-wrappers
|
|
13469
13812
|
const StringIteratorObject = iterateString(new String());
|
|
13470
13813
|
const StringIteratorPrototype = getPrototypeOf(StringIteratorObject);
|
|
13471
13814
|
|
|
@@ -13477,7 +13820,6 @@ function makeArguments() {
|
|
|
13477
13820
|
|
|
13478
13821
|
// 22.1.5.2 The %ArrayIteratorPrototype% Object
|
|
13479
13822
|
|
|
13480
|
-
// eslint-disable-next-line no-array-constructor
|
|
13481
13823
|
const ArrayIteratorObject = iterateArray([]);
|
|
13482
13824
|
const ArrayIteratorPrototype = getPrototypeOf(ArrayIteratorObject);
|
|
13483
13825
|
|
|
@@ -13578,15 +13920,6 @@ function makeArguments() {
|
|
|
13578
13920
|
);
|
|
13579
13921
|
}
|
|
13580
13922
|
|
|
13581
|
-
const ab = new ArrayBuffer(0);
|
|
13582
|
-
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
13583
|
-
const iab = ab.sliceToImmutable();
|
|
13584
|
-
const iabProto = getPrototypeOf(iab);
|
|
13585
|
-
if (iabProto !== ArrayBuffer.prototype) {
|
|
13586
|
-
// In a native implementation, these will be the same prototype
|
|
13587
|
-
intrinsics['%ImmutableArrayBufferPrototype%'] = iabProto;
|
|
13588
|
-
}
|
|
13589
|
-
|
|
13590
13923
|
return intrinsics;
|
|
13591
13924
|
};$h͏_once.getAnonymousIntrinsics(getAnonymousIntrinsics);
|
|
13592
13925
|
})()
|
|
@@ -13702,7 +14035,7 @@ const throws = thunk => {
|
|
|
13702
14035
|
try {
|
|
13703
14036
|
thunk();
|
|
13704
14037
|
return false;
|
|
13705
|
-
} catch (
|
|
14038
|
+
} catch (_err) {
|
|
13706
14039
|
return true;
|
|
13707
14040
|
}
|
|
13708
14041
|
};
|