ses 0.15.11 → 0.15.12
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 +22 -0
- package/dist/lockdown.cjs +99 -45
- package/dist/lockdown.mjs +99 -45
- package/dist/lockdown.umd.js +99 -45
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +99 -45
- package/dist/ses.mjs +99 -45
- package/dist/ses.umd.js +99 -45
- package/dist/ses.umd.min.js +1 -1
- package/index.d.ts +4 -0
- package/package.json +12 -11
- package/src/commons.js +2 -0
- package/src/module-instance.js +24 -9
- package/src/whitelist-intrinsics.js +51 -20
- package/src/whitelist.js +15 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [0.15.12](https://github.com/endojs/endo/compare/ses@0.15.11...ses@0.15.12) (2022-04-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add Array#at close [#1139](https://github.com/endojs/endo/issues/1139) ([#1146](https://github.com/endojs/endo/issues/1146)) ([43494c8](https://github.com/endojs/endo/commit/43494c8d0c50cba205050fcf472fda4aed03d6ca))
|
|
12
|
+
* **compartment-mapper:** proper default export implementation for cjs with import and require compatibility ([30cbaa8](https://github.com/endojs/endo/commit/30cbaa8cb79b906742a9f5c1854b22fe506b0575))
|
|
13
|
+
* **init:** Handle symbols installed on Promise by Node's `async_hooks` ([#1115](https://github.com/endojs/endo/issues/1115)) ([06827b9](https://github.com/endojs/endo/commit/06827b982c0450bae53b5ff0c410745678168c88))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **ses:** avoid cache corruption when execute() throws ([1d9c17b](https://github.com/endojs/endo/commit/1d9c17b4c4a5ed1450cddd996bd948dd59c80bf6))
|
|
19
|
+
* some tests sensitive to errorTaming ([#1135](https://github.com/endojs/endo/issues/1135)) ([0c22364](https://github.com/endojs/endo/commit/0c22364104fb8b2528cd5437accda09a045a6ff0))
|
|
20
|
+
* **endo:** Ensure conditions include default, import, and endo ([1361abd](https://github.com/endojs/endo/commit/1361abd8c732596d192ecef6a039eda98b4ee563))
|
|
21
|
+
* **ses:** Do not bundle modules for use as modules ([7d27020](https://github.com/endojs/endo/commit/7d2702037295211d8d3f08431a4d4de0a4e3ffd7))
|
|
22
|
+
* **ses:** Do not get confused by well-known look-alikes ([5139dad](https://github.com/endojs/endo/commit/5139dad7719d7a32360e2daf8a37b9ab3f2cd94a))
|
|
23
|
+
* **ses:** Ignore Array unscopable findLast{,Index} ([#1129](https://github.com/endojs/endo/issues/1129)) ([bbf7e7d](https://github.com/endojs/endo/commit/bbf7e7dd0ba19349120d4913016c62b9f8dc4995))
|
|
24
|
+
* **ses:** make import * and default from cjs wire up correctly ([33cbd27](https://github.com/endojs/endo/commit/33cbd2776f9d47e6e8438650565155e4185d9373))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
### [0.15.11](https://github.com/endojs/endo/compare/ses@0.15.10...ses@0.15.11) (2022-03-07)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package ses
|
package/dist/lockdown.cjs
CHANGED
|
@@ -75,8 +75,10 @@ const {
|
|
|
75
75
|
species: speciesSymbol,
|
|
76
76
|
toStringTag: toStringTagSymbol,
|
|
77
77
|
iterator: iteratorSymbol,
|
|
78
|
-
matchAll: matchAllSymbol
|
|
79
|
-
|
|
78
|
+
matchAll: matchAllSymbol,
|
|
79
|
+
keyFor: symbolKeyFor,
|
|
80
|
+
for: symbolFor}=
|
|
81
|
+
Symbol;$h_once.speciesSymbol(speciesSymbol);$h_once.toStringTagSymbol(toStringTagSymbol);$h_once.iteratorSymbol(iteratorSymbol);$h_once.matchAllSymbol(matchAllSymbol);$h_once.symbolKeyFor(symbolKeyFor);$h_once.symbolFor(symbolFor);
|
|
80
82
|
|
|
81
83
|
const { isInteger}= Number;$h_once.isInteger(isInteger);
|
|
82
84
|
|
|
@@ -2685,7 +2687,10 @@ $h_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);const NativeErro
|
|
|
2685
2687
|
* property definition.
|
|
2686
2688
|
* <li>"ObjectPrototype" is the default "[[Proto]]" (when not specified).
|
|
2687
2689
|
* <li>Constants "fn" and "getter" are used to keep the structure DRY.
|
|
2688
|
-
* <li>Symbol properties are listed
|
|
2690
|
+
* <li>Symbol properties are listed as follow:
|
|
2691
|
+
* <li>Well-known symbols use the "@@name" form.
|
|
2692
|
+
* <li>Registered symbols use the "RegisteredSymbol(key)" form.
|
|
2693
|
+
* <li>Unique symbols use the "UniqueSymbol(description)" form.
|
|
2689
2694
|
*/
|
|
2690
2695
|
|
|
2691
2696
|
// Function Instances
|
|
@@ -2879,6 +2884,7 @@ const whitelist= {
|
|
|
2879
2884
|
getOwnPropertyNames: fn,
|
|
2880
2885
|
getOwnPropertySymbols: fn,
|
|
2881
2886
|
getPrototypeOf: fn,
|
|
2887
|
+
hasOwn: fn,
|
|
2882
2888
|
is: fn,
|
|
2883
2889
|
isExtensible: fn,
|
|
2884
2890
|
isFrozen: fn,
|
|
@@ -2888,9 +2894,7 @@ const whitelist= {
|
|
|
2888
2894
|
prototype: '%ObjectPrototype%',
|
|
2889
2895
|
seal: fn,
|
|
2890
2896
|
setPrototypeOf: fn,
|
|
2891
|
-
values: fn,
|
|
2892
|
-
// See https://github.com/tc39/proposal-accessible-object-hasownproperty
|
|
2893
|
-
hasOwn: fn},
|
|
2897
|
+
values: fn},
|
|
2894
2898
|
|
|
2895
2899
|
|
|
2896
2900
|
'%ObjectPrototype%': {
|
|
@@ -3185,6 +3189,7 @@ const whitelist= {
|
|
|
3185
3189
|
'%StringPrototype%': {
|
|
3186
3190
|
// Properties of the String Prototype Object
|
|
3187
3191
|
length: 'number',
|
|
3192
|
+
at: fn,
|
|
3188
3193
|
charAt: fn,
|
|
3189
3194
|
charCodeAt: fn,
|
|
3190
3195
|
codePointAt: fn,
|
|
@@ -3237,11 +3242,7 @@ const whitelist= {
|
|
|
3237
3242
|
trimLeft: fn,
|
|
3238
3243
|
trimRight: fn,
|
|
3239
3244
|
// See https://github.com/Moddable-OpenSource/moddable/issues/523
|
|
3240
|
-
compare: false,
|
|
3241
|
-
|
|
3242
|
-
// Stage 3:
|
|
3243
|
-
// https://tc39.es/proposal-relative-indexing-method/
|
|
3244
|
-
at: fn},
|
|
3245
|
+
compare: false},
|
|
3245
3246
|
|
|
3246
3247
|
|
|
3247
3248
|
'%StringIteratorPrototype%': {
|
|
@@ -3338,6 +3339,7 @@ const whitelist= {
|
|
|
3338
3339
|
|
|
3339
3340
|
'%ArrayPrototype%': {
|
|
3340
3341
|
// Properties of the Array Prototype Object
|
|
3342
|
+
at: fn,
|
|
3341
3343
|
length: 'number',
|
|
3342
3344
|
concat: fn,
|
|
3343
3345
|
constructor: 'Array',
|
|
@@ -3386,11 +3388,11 @@ const whitelist= {
|
|
|
3386
3388
|
values: 'boolean',
|
|
3387
3389
|
// Failed tc39 proposal
|
|
3388
3390
|
// Seen on FF Nightly 88.0a1
|
|
3389
|
-
at: false
|
|
3391
|
+
at: false,
|
|
3392
|
+
// See https://github.com/tc39/proposal-array-find-from-last
|
|
3393
|
+
findLast: 'boolean',
|
|
3394
|
+
findLastIndex: 'boolean'},
|
|
3390
3395
|
|
|
3391
|
-
// Failed tc39 proposal
|
|
3392
|
-
// Seen on FF Nightly 88.0a1
|
|
3393
|
-
at: false,
|
|
3394
3396
|
// See https://github.com/tc39/proposal-array-find-from-last
|
|
3395
3397
|
findLast: fn,
|
|
3396
3398
|
findLastIndex: fn},
|
|
@@ -3415,6 +3417,7 @@ const whitelist= {
|
|
|
3415
3417
|
|
|
3416
3418
|
|
|
3417
3419
|
'%TypedArrayPrototype%': {
|
|
3420
|
+
at: fn,
|
|
3418
3421
|
buffer: getter,
|
|
3419
3422
|
byteLength: getter,
|
|
3420
3423
|
byteOffset: getter,
|
|
@@ -3447,9 +3450,6 @@ const whitelist= {
|
|
|
3447
3450
|
values: fn,
|
|
3448
3451
|
'@@iterator': fn,
|
|
3449
3452
|
'@@toStringTag': getter,
|
|
3450
|
-
// Failed tc39 proposal
|
|
3451
|
-
// Seen on FF Nightly 88.0a1
|
|
3452
|
-
at: false,
|
|
3453
3453
|
// See https://github.com/tc39/proposal-array-find-from-last
|
|
3454
3454
|
findLast: fn,
|
|
3455
3455
|
findLastIndex: fn},
|
|
@@ -3749,7 +3749,11 @@ const whitelist= {
|
|
|
3749
3749
|
constructor: 'Promise',
|
|
3750
3750
|
finally: fn,
|
|
3751
3751
|
then: fn,
|
|
3752
|
-
'@@toStringTag': 'string'
|
|
3752
|
+
'@@toStringTag': 'string',
|
|
3753
|
+
// Non-standard, used in node to prevent async_hooks from breaking
|
|
3754
|
+
'UniqueSymbol(async_id_symbol)': accessor,
|
|
3755
|
+
'UniqueSymbol(trigger_async_id_symbol)': accessor,
|
|
3756
|
+
'UniqueSymbol(destroyed)': accessor},
|
|
3753
3757
|
|
|
3754
3758
|
|
|
3755
3759
|
'%InertAsyncFunction%': {
|
|
@@ -4468,7 +4472,8 @@ $h_once.deferExports(deferExports);const getDeferredExports=(
|
|
|
4468
4472
|
})
|
|
4469
4473
|
,
|
|
4470
4474
|
// === functors[18] ===
|
|
4471
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,compartmentEvaluate;$h_imports([["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h_a => (getDeferredExports = $h_a)]]]],["./commons.js", [["ReferenceError", [$h_a => (ReferenceError = $h_a)]],["SyntaxError", [$h_a => (SyntaxError = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["arrayForEach", [$h_a => (arrayForEach = $h_a)]],["arrayIncludes", [$h_a => (arrayIncludes = $h_a)]],["arrayPush", [$h_a => (arrayPush = $h_a)]],["arraySome", [$h_a => (arraySome = $h_a)]],["arraySort", [$h_a => (arraySort = $h_a)]],["create", [$h_a => (create = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["entries", [$h_a => (entries = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["isArray", [$h_a => (isArray = $h_a)]],["keys", [$h_a => (keys = $h_a)]],["mapGet", [$h_a => (mapGet = $h_a)]],["weakmapGet", [$h_a => (weakmapGet = $h_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h_a => (compartmentEvaluate = $h_a)]]]]]);
|
|
4475
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,reflectHas,compartmentEvaluate;$h_imports([["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h_a => (getDeferredExports = $h_a)]]]],["./commons.js", [["ReferenceError", [$h_a => (ReferenceError = $h_a)]],["SyntaxError", [$h_a => (SyntaxError = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["arrayForEach", [$h_a => (arrayForEach = $h_a)]],["arrayIncludes", [$h_a => (arrayIncludes = $h_a)]],["arrayPush", [$h_a => (arrayPush = $h_a)]],["arraySome", [$h_a => (arraySome = $h_a)]],["arraySort", [$h_a => (arraySort = $h_a)]],["create", [$h_a => (create = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["entries", [$h_a => (entries = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["isArray", [$h_a => (isArray = $h_a)]],["keys", [$h_a => (keys = $h_a)]],["mapGet", [$h_a => (mapGet = $h_a)]],["weakmapGet", [$h_a => (weakmapGet = $h_a)]],["reflectHas", [$h_a => (reflectHas = $h_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h_a => (compartmentEvaluate = $h_a)]]]]]);
|
|
4476
|
+
|
|
4472
4477
|
|
|
4473
4478
|
|
|
4474
4479
|
|
|
@@ -4543,22 +4548,36 @@ const makeThirdPartyModuleInstance= (
|
|
|
4543
4548
|
update(value);
|
|
4544
4549
|
};
|
|
4545
4550
|
});
|
|
4551
|
+
// This is enough to support import * from cjs - the '*' field doesn't need to be in exports nor proxiedExports because import will only ever access it via notifiers
|
|
4552
|
+
notifiers['*']= (update)=>{
|
|
4553
|
+
update(proxiedExports);
|
|
4554
|
+
};
|
|
4546
4555
|
}
|
|
4547
4556
|
|
|
4548
|
-
|
|
4557
|
+
const localState= {
|
|
4558
|
+
activated: false};
|
|
4559
|
+
|
|
4549
4560
|
return freeze({
|
|
4550
4561
|
notifiers,
|
|
4551
4562
|
exportsProxy,
|
|
4552
4563
|
execute() {
|
|
4553
|
-
if(
|
|
4564
|
+
if( reflectHas(localState, 'errorFromExecute')) {
|
|
4565
|
+
throw localState.errorFromExecute;
|
|
4566
|
+
}
|
|
4567
|
+
if( !localState.activated) {
|
|
4554
4568
|
activate();
|
|
4555
|
-
activated= true;
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4569
|
+
localState.activated= true;
|
|
4570
|
+
try {
|
|
4571
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
4572
|
+
staticModuleRecord.execute(
|
|
4573
|
+
proxiedExports,
|
|
4574
|
+
compartment,
|
|
4575
|
+
resolvedImports);
|
|
4561
4576
|
|
|
4577
|
+
}catch( err) {
|
|
4578
|
+
localState.errorFromExecute= err;
|
|
4579
|
+
throw err;
|
|
4580
|
+
}
|
|
4562
4581
|
}
|
|
4563
4582
|
}});
|
|
4564
4583
|
|
|
@@ -8011,7 +8030,9 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
|
|
|
8011
8030
|
})
|
|
8012
8031
|
,
|
|
8013
8032
|
// === functors[38] ===
|
|
8014
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let whitelist,FunctionInstance,isAccessorPermit,String,TypeError,arrayIncludes,getOwnPropertyDescriptor,getPrototypeOf,isObject,objectHasOwnProperty,ownKeys,
|
|
8033
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let whitelist,FunctionInstance,isAccessorPermit,Map,String,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isObject,mapGet,objectHasOwnProperty,ownKeys,symbolKeyFor;$h_imports([["./whitelist.js", [["whitelist", [$h_a => (whitelist = $h_a)]],["FunctionInstance", [$h_a => (FunctionInstance = $h_a)]],["isAccessorPermit", [$h_a => (isAccessorPermit = $h_a)]]]],["./commons.js", [["Map", [$h_a => (Map = $h_a)]],["String", [$h_a => (String = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["arrayIncludes", [$h_a => (arrayIncludes = $h_a)]],["arrayMap", [$h_a => (arrayMap = $h_a)]],["entries", [$h_a => (entries = $h_a)]],["getOwnPropertyDescriptor", [$h_a => (getOwnPropertyDescriptor = $h_a)]],["getPrototypeOf", [$h_a => (getPrototypeOf = $h_a)]],["isObject", [$h_a => (isObject = $h_a)]],["mapGet", [$h_a => (mapGet = $h_a)]],["objectHasOwnProperty", [$h_a => (objectHasOwnProperty = $h_a)]],["ownKeys", [$h_a => (ownKeys = $h_a)]],["symbolKeyFor", [$h_a => (symbolKeyFor = $h_a)]]]]]);
|
|
8034
|
+
|
|
8035
|
+
|
|
8015
8036
|
|
|
8016
8037
|
|
|
8017
8038
|
|
|
@@ -8069,23 +8090,8 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
|
|
|
8069
8090
|
|
|
8070
8091
|
|
|
8071
8092
|
|
|
8072
|
-
/**
|
|
8073
|
-
* asStringPropertyName()
|
|
8074
|
-
*
|
|
8075
|
-
* @param {string} path
|
|
8076
|
-
* @param {string | symbol} prop
|
|
8077
|
-
*/
|
|
8078
|
-
function asStringPropertyName(path, prop) {
|
|
8079
|
-
if( typeof prop=== 'string') {
|
|
8080
|
-
return prop;
|
|
8081
|
-
}
|
|
8082
8093
|
|
|
8083
|
-
if( typeof prop=== 'symbol') {
|
|
8084
|
-
return `@@${stringSlice(String(prop),14, -1) }`;
|
|
8085
|
-
}
|
|
8086
8094
|
|
|
8087
|
-
throw new TypeError( `Unexpected property name type ${path} ${prop}`);
|
|
8088
|
-
}
|
|
8089
8095
|
|
|
8090
8096
|
/**
|
|
8091
8097
|
* whitelistIntrinsics()
|
|
@@ -8099,9 +8105,53 @@ function whitelistIntrinsics(
|
|
|
8099
8105
|
intrinsics,
|
|
8100
8106
|
markVirtualizedNativeFunction)
|
|
8101
8107
|
{
|
|
8102
|
-
// These
|
|
8108
|
+
// These primitives are allowed allowed for permits.
|
|
8103
8109
|
const primitives= ['undefined', 'boolean', 'number', 'string', 'symbol'];
|
|
8104
8110
|
|
|
8111
|
+
// These symbols are allowed as well-known symbols
|
|
8112
|
+
const wellKnownSymbolNames= new Map(
|
|
8113
|
+
intrinsics.Symbol?
|
|
8114
|
+
arrayMap(
|
|
8115
|
+
arrayFilter(
|
|
8116
|
+
entries(whitelist.Symbol),
|
|
8117
|
+
([name, permit])=>
|
|
8118
|
+
permit=== 'symbol'&&
|
|
8119
|
+
typeof intrinsics.Symbol[name]=== 'symbol'),
|
|
8120
|
+
|
|
8121
|
+
([name])=> [intrinsics.Symbol[name], `@@${name}`]):
|
|
8122
|
+
|
|
8123
|
+
[]);
|
|
8124
|
+
|
|
8125
|
+
|
|
8126
|
+
/**
|
|
8127
|
+
* asStringPropertyName()
|
|
8128
|
+
*
|
|
8129
|
+
* @param {string} path
|
|
8130
|
+
* @param {string | symbol} prop
|
|
8131
|
+
*/
|
|
8132
|
+
function asStringPropertyName(path, prop) {
|
|
8133
|
+
if( typeof prop=== 'string') {
|
|
8134
|
+
return prop;
|
|
8135
|
+
}
|
|
8136
|
+
|
|
8137
|
+
const wellKnownSymbol= mapGet(wellKnownSymbolNames, prop);
|
|
8138
|
+
|
|
8139
|
+
if( typeof prop=== 'symbol') {
|
|
8140
|
+
if( wellKnownSymbol) {
|
|
8141
|
+
return wellKnownSymbol;
|
|
8142
|
+
}else {
|
|
8143
|
+
const registeredKey= symbolKeyFor(prop);
|
|
8144
|
+
if( registeredKey!== undefined) {
|
|
8145
|
+
return `RegisteredSymbol(${registeredKey})`;
|
|
8146
|
+
}else {
|
|
8147
|
+
return `Unique${String(prop)}`;
|
|
8148
|
+
}
|
|
8149
|
+
}
|
|
8150
|
+
}
|
|
8151
|
+
|
|
8152
|
+
throw new TypeError( `Unexpected property name type ${path} ${prop}`);
|
|
8153
|
+
}
|
|
8154
|
+
|
|
8105
8155
|
/*
|
|
8106
8156
|
* visitPrototype()
|
|
8107
8157
|
* Validate the object's [[prototype]] against a permit.
|
|
@@ -8808,6 +8858,8 @@ assign(globalThis, {
|
|
|
8808
8858
|
toStringTagSymbol: cell("toStringTagSymbol"),
|
|
8809
8859
|
iteratorSymbol: cell("iteratorSymbol"),
|
|
8810
8860
|
matchAllSymbol: cell("matchAllSymbol"),
|
|
8861
|
+
symbolKeyFor: cell("symbolKeyFor"),
|
|
8862
|
+
symbolFor: cell("symbolFor"),
|
|
8811
8863
|
isInteger: cell("isInteger"),
|
|
8812
8864
|
stringifyJson: cell("stringifyJson"),
|
|
8813
8865
|
fromEntries: cell("fromEntries"),
|
|
@@ -9115,6 +9167,8 @@ assign(globalThis, {
|
|
|
9115
9167
|
toStringTagSymbol: cells[0].toStringTagSymbol.set,
|
|
9116
9168
|
iteratorSymbol: cells[0].iteratorSymbol.set,
|
|
9117
9169
|
matchAllSymbol: cells[0].matchAllSymbol.set,
|
|
9170
|
+
symbolKeyFor: cells[0].symbolKeyFor.set,
|
|
9171
|
+
symbolFor: cells[0].symbolFor.set,
|
|
9118
9172
|
isInteger: cells[0].isInteger.set,
|
|
9119
9173
|
stringifyJson: cells[0].stringifyJson.set,
|
|
9120
9174
|
fromEntries: cells[0].fromEntries.set,
|
package/dist/lockdown.mjs
CHANGED
|
@@ -75,8 +75,10 @@ const {
|
|
|
75
75
|
species: speciesSymbol,
|
|
76
76
|
toStringTag: toStringTagSymbol,
|
|
77
77
|
iterator: iteratorSymbol,
|
|
78
|
-
matchAll: matchAllSymbol
|
|
79
|
-
|
|
78
|
+
matchAll: matchAllSymbol,
|
|
79
|
+
keyFor: symbolKeyFor,
|
|
80
|
+
for: symbolFor}=
|
|
81
|
+
Symbol;$h_once.speciesSymbol(speciesSymbol);$h_once.toStringTagSymbol(toStringTagSymbol);$h_once.iteratorSymbol(iteratorSymbol);$h_once.matchAllSymbol(matchAllSymbol);$h_once.symbolKeyFor(symbolKeyFor);$h_once.symbolFor(symbolFor);
|
|
80
82
|
|
|
81
83
|
const { isInteger}= Number;$h_once.isInteger(isInteger);
|
|
82
84
|
|
|
@@ -2685,7 +2687,10 @@ $h_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);const NativeErro
|
|
|
2685
2687
|
* property definition.
|
|
2686
2688
|
* <li>"ObjectPrototype" is the default "[[Proto]]" (when not specified).
|
|
2687
2689
|
* <li>Constants "fn" and "getter" are used to keep the structure DRY.
|
|
2688
|
-
* <li>Symbol properties are listed
|
|
2690
|
+
* <li>Symbol properties are listed as follow:
|
|
2691
|
+
* <li>Well-known symbols use the "@@name" form.
|
|
2692
|
+
* <li>Registered symbols use the "RegisteredSymbol(key)" form.
|
|
2693
|
+
* <li>Unique symbols use the "UniqueSymbol(description)" form.
|
|
2689
2694
|
*/
|
|
2690
2695
|
|
|
2691
2696
|
// Function Instances
|
|
@@ -2879,6 +2884,7 @@ const whitelist= {
|
|
|
2879
2884
|
getOwnPropertyNames: fn,
|
|
2880
2885
|
getOwnPropertySymbols: fn,
|
|
2881
2886
|
getPrototypeOf: fn,
|
|
2887
|
+
hasOwn: fn,
|
|
2882
2888
|
is: fn,
|
|
2883
2889
|
isExtensible: fn,
|
|
2884
2890
|
isFrozen: fn,
|
|
@@ -2888,9 +2894,7 @@ const whitelist= {
|
|
|
2888
2894
|
prototype: '%ObjectPrototype%',
|
|
2889
2895
|
seal: fn,
|
|
2890
2896
|
setPrototypeOf: fn,
|
|
2891
|
-
values: fn,
|
|
2892
|
-
// See https://github.com/tc39/proposal-accessible-object-hasownproperty
|
|
2893
|
-
hasOwn: fn},
|
|
2897
|
+
values: fn},
|
|
2894
2898
|
|
|
2895
2899
|
|
|
2896
2900
|
'%ObjectPrototype%': {
|
|
@@ -3185,6 +3189,7 @@ const whitelist= {
|
|
|
3185
3189
|
'%StringPrototype%': {
|
|
3186
3190
|
// Properties of the String Prototype Object
|
|
3187
3191
|
length: 'number',
|
|
3192
|
+
at: fn,
|
|
3188
3193
|
charAt: fn,
|
|
3189
3194
|
charCodeAt: fn,
|
|
3190
3195
|
codePointAt: fn,
|
|
@@ -3237,11 +3242,7 @@ const whitelist= {
|
|
|
3237
3242
|
trimLeft: fn,
|
|
3238
3243
|
trimRight: fn,
|
|
3239
3244
|
// See https://github.com/Moddable-OpenSource/moddable/issues/523
|
|
3240
|
-
compare: false,
|
|
3241
|
-
|
|
3242
|
-
// Stage 3:
|
|
3243
|
-
// https://tc39.es/proposal-relative-indexing-method/
|
|
3244
|
-
at: fn},
|
|
3245
|
+
compare: false},
|
|
3245
3246
|
|
|
3246
3247
|
|
|
3247
3248
|
'%StringIteratorPrototype%': {
|
|
@@ -3338,6 +3339,7 @@ const whitelist= {
|
|
|
3338
3339
|
|
|
3339
3340
|
'%ArrayPrototype%': {
|
|
3340
3341
|
// Properties of the Array Prototype Object
|
|
3342
|
+
at: fn,
|
|
3341
3343
|
length: 'number',
|
|
3342
3344
|
concat: fn,
|
|
3343
3345
|
constructor: 'Array',
|
|
@@ -3386,11 +3388,11 @@ const whitelist= {
|
|
|
3386
3388
|
values: 'boolean',
|
|
3387
3389
|
// Failed tc39 proposal
|
|
3388
3390
|
// Seen on FF Nightly 88.0a1
|
|
3389
|
-
at: false
|
|
3391
|
+
at: false,
|
|
3392
|
+
// See https://github.com/tc39/proposal-array-find-from-last
|
|
3393
|
+
findLast: 'boolean',
|
|
3394
|
+
findLastIndex: 'boolean'},
|
|
3390
3395
|
|
|
3391
|
-
// Failed tc39 proposal
|
|
3392
|
-
// Seen on FF Nightly 88.0a1
|
|
3393
|
-
at: false,
|
|
3394
3396
|
// See https://github.com/tc39/proposal-array-find-from-last
|
|
3395
3397
|
findLast: fn,
|
|
3396
3398
|
findLastIndex: fn},
|
|
@@ -3415,6 +3417,7 @@ const whitelist= {
|
|
|
3415
3417
|
|
|
3416
3418
|
|
|
3417
3419
|
'%TypedArrayPrototype%': {
|
|
3420
|
+
at: fn,
|
|
3418
3421
|
buffer: getter,
|
|
3419
3422
|
byteLength: getter,
|
|
3420
3423
|
byteOffset: getter,
|
|
@@ -3447,9 +3450,6 @@ const whitelist= {
|
|
|
3447
3450
|
values: fn,
|
|
3448
3451
|
'@@iterator': fn,
|
|
3449
3452
|
'@@toStringTag': getter,
|
|
3450
|
-
// Failed tc39 proposal
|
|
3451
|
-
// Seen on FF Nightly 88.0a1
|
|
3452
|
-
at: false,
|
|
3453
3453
|
// See https://github.com/tc39/proposal-array-find-from-last
|
|
3454
3454
|
findLast: fn,
|
|
3455
3455
|
findLastIndex: fn},
|
|
@@ -3749,7 +3749,11 @@ const whitelist= {
|
|
|
3749
3749
|
constructor: 'Promise',
|
|
3750
3750
|
finally: fn,
|
|
3751
3751
|
then: fn,
|
|
3752
|
-
'@@toStringTag': 'string'
|
|
3752
|
+
'@@toStringTag': 'string',
|
|
3753
|
+
// Non-standard, used in node to prevent async_hooks from breaking
|
|
3754
|
+
'UniqueSymbol(async_id_symbol)': accessor,
|
|
3755
|
+
'UniqueSymbol(trigger_async_id_symbol)': accessor,
|
|
3756
|
+
'UniqueSymbol(destroyed)': accessor},
|
|
3753
3757
|
|
|
3754
3758
|
|
|
3755
3759
|
'%InertAsyncFunction%': {
|
|
@@ -4468,7 +4472,8 @@ $h_once.deferExports(deferExports);const getDeferredExports=(
|
|
|
4468
4472
|
})
|
|
4469
4473
|
,
|
|
4470
4474
|
// === functors[18] ===
|
|
4471
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,compartmentEvaluate;$h_imports([["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h_a => (getDeferredExports = $h_a)]]]],["./commons.js", [["ReferenceError", [$h_a => (ReferenceError = $h_a)]],["SyntaxError", [$h_a => (SyntaxError = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["arrayForEach", [$h_a => (arrayForEach = $h_a)]],["arrayIncludes", [$h_a => (arrayIncludes = $h_a)]],["arrayPush", [$h_a => (arrayPush = $h_a)]],["arraySome", [$h_a => (arraySome = $h_a)]],["arraySort", [$h_a => (arraySort = $h_a)]],["create", [$h_a => (create = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["entries", [$h_a => (entries = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["isArray", [$h_a => (isArray = $h_a)]],["keys", [$h_a => (keys = $h_a)]],["mapGet", [$h_a => (mapGet = $h_a)]],["weakmapGet", [$h_a => (weakmapGet = $h_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h_a => (compartmentEvaluate = $h_a)]]]]]);
|
|
4475
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,reflectHas,compartmentEvaluate;$h_imports([["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h_a => (getDeferredExports = $h_a)]]]],["./commons.js", [["ReferenceError", [$h_a => (ReferenceError = $h_a)]],["SyntaxError", [$h_a => (SyntaxError = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["arrayForEach", [$h_a => (arrayForEach = $h_a)]],["arrayIncludes", [$h_a => (arrayIncludes = $h_a)]],["arrayPush", [$h_a => (arrayPush = $h_a)]],["arraySome", [$h_a => (arraySome = $h_a)]],["arraySort", [$h_a => (arraySort = $h_a)]],["create", [$h_a => (create = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["entries", [$h_a => (entries = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["isArray", [$h_a => (isArray = $h_a)]],["keys", [$h_a => (keys = $h_a)]],["mapGet", [$h_a => (mapGet = $h_a)]],["weakmapGet", [$h_a => (weakmapGet = $h_a)]],["reflectHas", [$h_a => (reflectHas = $h_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h_a => (compartmentEvaluate = $h_a)]]]]]);
|
|
4476
|
+
|
|
4472
4477
|
|
|
4473
4478
|
|
|
4474
4479
|
|
|
@@ -4543,22 +4548,36 @@ const makeThirdPartyModuleInstance= (
|
|
|
4543
4548
|
update(value);
|
|
4544
4549
|
};
|
|
4545
4550
|
});
|
|
4551
|
+
// This is enough to support import * from cjs - the '*' field doesn't need to be in exports nor proxiedExports because import will only ever access it via notifiers
|
|
4552
|
+
notifiers['*']= (update)=>{
|
|
4553
|
+
update(proxiedExports);
|
|
4554
|
+
};
|
|
4546
4555
|
}
|
|
4547
4556
|
|
|
4548
|
-
|
|
4557
|
+
const localState= {
|
|
4558
|
+
activated: false};
|
|
4559
|
+
|
|
4549
4560
|
return freeze({
|
|
4550
4561
|
notifiers,
|
|
4551
4562
|
exportsProxy,
|
|
4552
4563
|
execute() {
|
|
4553
|
-
if(
|
|
4564
|
+
if( reflectHas(localState, 'errorFromExecute')) {
|
|
4565
|
+
throw localState.errorFromExecute;
|
|
4566
|
+
}
|
|
4567
|
+
if( !localState.activated) {
|
|
4554
4568
|
activate();
|
|
4555
|
-
activated= true;
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4569
|
+
localState.activated= true;
|
|
4570
|
+
try {
|
|
4571
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
4572
|
+
staticModuleRecord.execute(
|
|
4573
|
+
proxiedExports,
|
|
4574
|
+
compartment,
|
|
4575
|
+
resolvedImports);
|
|
4561
4576
|
|
|
4577
|
+
}catch( err) {
|
|
4578
|
+
localState.errorFromExecute= err;
|
|
4579
|
+
throw err;
|
|
4580
|
+
}
|
|
4562
4581
|
}
|
|
4563
4582
|
}});
|
|
4564
4583
|
|
|
@@ -8011,7 +8030,9 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
|
|
|
8011
8030
|
})
|
|
8012
8031
|
,
|
|
8013
8032
|
// === functors[38] ===
|
|
8014
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let whitelist,FunctionInstance,isAccessorPermit,String,TypeError,arrayIncludes,getOwnPropertyDescriptor,getPrototypeOf,isObject,objectHasOwnProperty,ownKeys,
|
|
8033
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let whitelist,FunctionInstance,isAccessorPermit,Map,String,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isObject,mapGet,objectHasOwnProperty,ownKeys,symbolKeyFor;$h_imports([["./whitelist.js", [["whitelist", [$h_a => (whitelist = $h_a)]],["FunctionInstance", [$h_a => (FunctionInstance = $h_a)]],["isAccessorPermit", [$h_a => (isAccessorPermit = $h_a)]]]],["./commons.js", [["Map", [$h_a => (Map = $h_a)]],["String", [$h_a => (String = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["arrayIncludes", [$h_a => (arrayIncludes = $h_a)]],["arrayMap", [$h_a => (arrayMap = $h_a)]],["entries", [$h_a => (entries = $h_a)]],["getOwnPropertyDescriptor", [$h_a => (getOwnPropertyDescriptor = $h_a)]],["getPrototypeOf", [$h_a => (getPrototypeOf = $h_a)]],["isObject", [$h_a => (isObject = $h_a)]],["mapGet", [$h_a => (mapGet = $h_a)]],["objectHasOwnProperty", [$h_a => (objectHasOwnProperty = $h_a)]],["ownKeys", [$h_a => (ownKeys = $h_a)]],["symbolKeyFor", [$h_a => (symbolKeyFor = $h_a)]]]]]);
|
|
8034
|
+
|
|
8035
|
+
|
|
8015
8036
|
|
|
8016
8037
|
|
|
8017
8038
|
|
|
@@ -8069,23 +8090,8 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
|
|
|
8069
8090
|
|
|
8070
8091
|
|
|
8071
8092
|
|
|
8072
|
-
/**
|
|
8073
|
-
* asStringPropertyName()
|
|
8074
|
-
*
|
|
8075
|
-
* @param {string} path
|
|
8076
|
-
* @param {string | symbol} prop
|
|
8077
|
-
*/
|
|
8078
|
-
function asStringPropertyName(path, prop) {
|
|
8079
|
-
if( typeof prop=== 'string') {
|
|
8080
|
-
return prop;
|
|
8081
|
-
}
|
|
8082
8093
|
|
|
8083
|
-
if( typeof prop=== 'symbol') {
|
|
8084
|
-
return `@@${stringSlice(String(prop),14, -1) }`;
|
|
8085
|
-
}
|
|
8086
8094
|
|
|
8087
|
-
throw new TypeError( `Unexpected property name type ${path} ${prop}`);
|
|
8088
|
-
}
|
|
8089
8095
|
|
|
8090
8096
|
/**
|
|
8091
8097
|
* whitelistIntrinsics()
|
|
@@ -8099,9 +8105,53 @@ function whitelistIntrinsics(
|
|
|
8099
8105
|
intrinsics,
|
|
8100
8106
|
markVirtualizedNativeFunction)
|
|
8101
8107
|
{
|
|
8102
|
-
// These
|
|
8108
|
+
// These primitives are allowed allowed for permits.
|
|
8103
8109
|
const primitives= ['undefined', 'boolean', 'number', 'string', 'symbol'];
|
|
8104
8110
|
|
|
8111
|
+
// These symbols are allowed as well-known symbols
|
|
8112
|
+
const wellKnownSymbolNames= new Map(
|
|
8113
|
+
intrinsics.Symbol?
|
|
8114
|
+
arrayMap(
|
|
8115
|
+
arrayFilter(
|
|
8116
|
+
entries(whitelist.Symbol),
|
|
8117
|
+
([name, permit])=>
|
|
8118
|
+
permit=== 'symbol'&&
|
|
8119
|
+
typeof intrinsics.Symbol[name]=== 'symbol'),
|
|
8120
|
+
|
|
8121
|
+
([name])=> [intrinsics.Symbol[name], `@@${name}`]):
|
|
8122
|
+
|
|
8123
|
+
[]);
|
|
8124
|
+
|
|
8125
|
+
|
|
8126
|
+
/**
|
|
8127
|
+
* asStringPropertyName()
|
|
8128
|
+
*
|
|
8129
|
+
* @param {string} path
|
|
8130
|
+
* @param {string | symbol} prop
|
|
8131
|
+
*/
|
|
8132
|
+
function asStringPropertyName(path, prop) {
|
|
8133
|
+
if( typeof prop=== 'string') {
|
|
8134
|
+
return prop;
|
|
8135
|
+
}
|
|
8136
|
+
|
|
8137
|
+
const wellKnownSymbol= mapGet(wellKnownSymbolNames, prop);
|
|
8138
|
+
|
|
8139
|
+
if( typeof prop=== 'symbol') {
|
|
8140
|
+
if( wellKnownSymbol) {
|
|
8141
|
+
return wellKnownSymbol;
|
|
8142
|
+
}else {
|
|
8143
|
+
const registeredKey= symbolKeyFor(prop);
|
|
8144
|
+
if( registeredKey!== undefined) {
|
|
8145
|
+
return `RegisteredSymbol(${registeredKey})`;
|
|
8146
|
+
}else {
|
|
8147
|
+
return `Unique${String(prop)}`;
|
|
8148
|
+
}
|
|
8149
|
+
}
|
|
8150
|
+
}
|
|
8151
|
+
|
|
8152
|
+
throw new TypeError( `Unexpected property name type ${path} ${prop}`);
|
|
8153
|
+
}
|
|
8154
|
+
|
|
8105
8155
|
/*
|
|
8106
8156
|
* visitPrototype()
|
|
8107
8157
|
* Validate the object's [[prototype]] against a permit.
|
|
@@ -8808,6 +8858,8 @@ assign(globalThis, {
|
|
|
8808
8858
|
toStringTagSymbol: cell("toStringTagSymbol"),
|
|
8809
8859
|
iteratorSymbol: cell("iteratorSymbol"),
|
|
8810
8860
|
matchAllSymbol: cell("matchAllSymbol"),
|
|
8861
|
+
symbolKeyFor: cell("symbolKeyFor"),
|
|
8862
|
+
symbolFor: cell("symbolFor"),
|
|
8811
8863
|
isInteger: cell("isInteger"),
|
|
8812
8864
|
stringifyJson: cell("stringifyJson"),
|
|
8813
8865
|
fromEntries: cell("fromEntries"),
|
|
@@ -9115,6 +9167,8 @@ assign(globalThis, {
|
|
|
9115
9167
|
toStringTagSymbol: cells[0].toStringTagSymbol.set,
|
|
9116
9168
|
iteratorSymbol: cells[0].iteratorSymbol.set,
|
|
9117
9169
|
matchAllSymbol: cells[0].matchAllSymbol.set,
|
|
9170
|
+
symbolKeyFor: cells[0].symbolKeyFor.set,
|
|
9171
|
+
symbolFor: cells[0].symbolFor.set,
|
|
9118
9172
|
isInteger: cells[0].isInteger.set,
|
|
9119
9173
|
stringifyJson: cells[0].stringifyJson.set,
|
|
9120
9174
|
fromEntries: cells[0].fromEntries.set,
|