Comparing version 0.15.11 to 0.15.12
@@ -6,2 +6,24 @@ # Change Log | ||
### [0.15.12](https://github.com/endojs/endo/compare/ses@0.15.11...ses@0.15.12) (2022-04-12) | ||
### Features | ||
* 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)) | ||
* **compartment-mapper:** proper default export implementation for cjs with import and require compatibility ([30cbaa8](https://github.com/endojs/endo/commit/30cbaa8cb79b906742a9f5c1854b22fe506b0575)) | ||
* **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)) | ||
### Bug Fixes | ||
* **ses:** avoid cache corruption when execute() throws ([1d9c17b](https://github.com/endojs/endo/commit/1d9c17b4c4a5ed1450cddd996bd948dd59c80bf6)) | ||
* some tests sensitive to errorTaming ([#1135](https://github.com/endojs/endo/issues/1135)) ([0c22364](https://github.com/endojs/endo/commit/0c22364104fb8b2528cd5437accda09a045a6ff0)) | ||
* **endo:** Ensure conditions include default, import, and endo ([1361abd](https://github.com/endojs/endo/commit/1361abd8c732596d192ecef6a039eda98b4ee563)) | ||
* **ses:** Do not bundle modules for use as modules ([7d27020](https://github.com/endojs/endo/commit/7d2702037295211d8d3f08431a4d4de0a4e3ffd7)) | ||
* **ses:** Do not get confused by well-known look-alikes ([5139dad](https://github.com/endojs/endo/commit/5139dad7719d7a32360e2daf8a37b9ab3f2cd94a)) | ||
* **ses:** Ignore Array unscopable findLast{,Index} ([#1129](https://github.com/endojs/endo/issues/1129)) ([bbf7e7d](https://github.com/endojs/endo/commit/bbf7e7dd0ba19349120d4913016c62b9f8dc4995)) | ||
* **ses:** make import * and default from cjs wire up correctly ([33cbd27](https://github.com/endojs/endo/commit/33cbd2776f9d47e6e8438650565155e4185d9373)) | ||
### [0.15.11](https://github.com/endojs/endo/compare/ses@0.15.10...ses@0.15.11) (2022-03-07) | ||
@@ -8,0 +30,0 @@ |
@@ -0,1 +1,5 @@ | ||
/** | ||
* @file Types of the SES environment | ||
*/ | ||
/* eslint-disable no-restricted-globals, vars-on-top, no-var */ | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "ses", | ||
"version": "0.15.11", | ||
"version": "0.15.12", | ||
"description": "Hardened JavaScript for Fearless Cooperation", | ||
@@ -38,7 +38,7 @@ "keywords": [ | ||
".": { | ||
"import": "./dist/ses.umd.js", | ||
"import": "./index.js", | ||
"require": "./dist/ses.cjs" | ||
}, | ||
"./lockdown": { | ||
"import": "./dist/ses.umd.js", | ||
"import": "./index.js", | ||
"require": "./dist/ses.cjs" | ||
@@ -56,13 +56,13 @@ }, | ||
"lint:js": "eslint .", | ||
"lint:types": "tsc -p jsconfig.json", | ||
"lint:types": "tsc", | ||
"prepublish": "yarn run clean && yarn build", | ||
"qt": "ava", | ||
"test": "yarn build && ava", | ||
"test": "tsd && ava", | ||
"test:platform-compatability": "node test/package/test.cjs" | ||
}, | ||
"devDependencies": { | ||
"@endo/compartment-mapper": "^0.7.1", | ||
"@endo/eslint-config": "^0.4.6", | ||
"@endo/static-module-record": "^0.7.0", | ||
"@endo/test262-runner": "^0.1.22", | ||
"@endo/compartment-mapper": "^0.7.2", | ||
"@endo/eslint-config": "^0.4.7", | ||
"@endo/static-module-record": "^0.7.1", | ||
"@endo/test262-runner": "^0.1.23", | ||
"ava": "^3.12.1", | ||
@@ -80,3 +80,4 @@ "babel-eslint": "^10.0.3", | ||
"terser": "^4.8.0", | ||
"typescript": "~4.5.5" | ||
"tsd": "^0.19.1", | ||
"typescript": "~4.6.2" | ||
}, | ||
@@ -184,3 +185,3 @@ "files": [ | ||
}, | ||
"gitHead": "9ddd58b4a26755cdba9403b0cb042b2067c69832" | ||
"gitHead": "59e511891ab67f4fa52d67141510974e22362134" | ||
} |
@@ -75,2 +75,4 @@ /* global globalThis */ | ||
matchAll: matchAllSymbol, | ||
keyFor: symbolKeyFor, | ||
for: symbolFor, | ||
} = Symbol; | ||
@@ -77,0 +79,0 @@ |
@@ -20,2 +20,3 @@ import { assert } from './error/assert.js'; | ||
weakmapGet, | ||
reflectHas, | ||
} from './commons.js'; | ||
@@ -77,5 +78,11 @@ import { compartmentEvaluate } from './compartment-evaluate.js'; | ||
}); | ||
// 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 | ||
notifiers['*'] = update => { | ||
update(proxiedExports); | ||
}; | ||
} | ||
let activated = false; | ||
const localState = { | ||
activated: false, | ||
}; | ||
return freeze({ | ||
@@ -85,11 +92,19 @@ notifiers, | ||
execute() { | ||
if (!activated) { | ||
if (reflectHas(localState, 'errorFromExecute')) { | ||
throw localState.errorFromExecute; | ||
} | ||
if (!localState.activated) { | ||
activate(); | ||
activated = true; | ||
// eslint-disable-next-line @endo/no-polymorphic-call | ||
staticModuleRecord.execute( | ||
proxiedExports, | ||
compartment, | ||
resolvedImports, | ||
); | ||
localState.activated = true; | ||
try { | ||
// eslint-disable-next-line @endo/no-polymorphic-call | ||
staticModuleRecord.execute( | ||
proxiedExports, | ||
compartment, | ||
resolvedImports, | ||
); | ||
} catch (err) { | ||
localState.errorFromExecute = err; | ||
throw err; | ||
} | ||
} | ||
@@ -96,0 +111,0 @@ }, |
@@ -48,32 +48,19 @@ // Copyright (C) 2011 Google Inc. | ||
import { | ||
Map, | ||
String, | ||
TypeError, | ||
arrayFilter, | ||
arrayIncludes, | ||
arrayMap, | ||
entries, | ||
getOwnPropertyDescriptor, | ||
getPrototypeOf, | ||
isObject, | ||
mapGet, | ||
objectHasOwnProperty, | ||
ownKeys, | ||
stringSlice, | ||
symbolKeyFor, | ||
} from './commons.js'; | ||
/** | ||
* asStringPropertyName() | ||
* | ||
* @param {string} path | ||
* @param {string | symbol} prop | ||
*/ | ||
function asStringPropertyName(path, prop) { | ||
if (typeof prop === 'string') { | ||
return prop; | ||
} | ||
if (typeof prop === 'symbol') { | ||
return `@@${stringSlice(String(prop), 14, -1)}`; | ||
} | ||
throw new TypeError(`Unexpected property name type ${path} ${prop}`); | ||
} | ||
/** | ||
* whitelistIntrinsics() | ||
@@ -90,5 +77,49 @@ * Removes all non-allowed properties found by recursively and | ||
) { | ||
// These primities are allowed allowed for permits. | ||
// These primitives are allowed allowed for permits. | ||
const primitives = ['undefined', 'boolean', 'number', 'string', 'symbol']; | ||
// These symbols are allowed as well-known symbols | ||
const wellKnownSymbolNames = new Map( | ||
intrinsics.Symbol | ||
? arrayMap( | ||
arrayFilter( | ||
entries(whitelist.Symbol), | ||
([name, permit]) => | ||
permit === 'symbol' && | ||
typeof intrinsics.Symbol[name] === 'symbol', | ||
), | ||
([name]) => [intrinsics.Symbol[name], `@@${name}`], | ||
) | ||
: [], | ||
); | ||
/** | ||
* asStringPropertyName() | ||
* | ||
* @param {string} path | ||
* @param {string | symbol} prop | ||
*/ | ||
function asStringPropertyName(path, prop) { | ||
if (typeof prop === 'string') { | ||
return prop; | ||
} | ||
const wellKnownSymbol = mapGet(wellKnownSymbolNames, prop); | ||
if (typeof prop === 'symbol') { | ||
if (wellKnownSymbol) { | ||
return wellKnownSymbol; | ||
} else { | ||
const registeredKey = symbolKeyFor(prop); | ||
if (registeredKey !== undefined) { | ||
return `RegisteredSymbol(${registeredKey})`; | ||
} else { | ||
return `Unique${String(prop)}`; | ||
} | ||
} | ||
} | ||
throw new TypeError(`Unexpected property name type ${path} ${prop}`); | ||
} | ||
/* | ||
@@ -95,0 +126,0 @@ * visitPrototype() |
@@ -227,3 +227,6 @@ /* eslint-disable no-restricted-globals */ | ||
* <li>Constants "fn" and "getter" are used to keep the structure DRY. | ||
* <li>Symbol properties are listed using the "@@name" form. | ||
* <li>Symbol properties are listed as follow: | ||
* <li>Well-known symbols use the "@@name" form. | ||
* <li>Registered symbols use the "RegisteredSymbol(key)" form. | ||
* <li>Unique symbols use the "UniqueSymbol(description)" form. | ||
*/ | ||
@@ -422,2 +425,3 @@ | ||
getPrototypeOf: fn, | ||
hasOwn: fn, | ||
is: fn, | ||
@@ -433,4 +437,2 @@ isExtensible: fn, | ||
values: fn, | ||
// See https://github.com/tc39/proposal-accessible-object-hasownproperty | ||
hasOwn: fn, | ||
}, | ||
@@ -730,2 +732,3 @@ | ||
length: 'number', | ||
at: fn, | ||
charAt: fn, | ||
@@ -784,6 +787,2 @@ charCodeAt: fn, | ||
compare: false, | ||
// Stage 3: | ||
// https://tc39.es/proposal-relative-indexing-method/ | ||
at: fn, | ||
}, | ||
@@ -885,2 +884,3 @@ | ||
// Properties of the Array Prototype Object | ||
at: fn, | ||
length: 'number', | ||
@@ -935,6 +935,6 @@ concat: fn, | ||
at: false, | ||
// See https://github.com/tc39/proposal-array-find-from-last | ||
findLast: 'boolean', | ||
findLastIndex: 'boolean', | ||
}, | ||
// Failed tc39 proposal | ||
// Seen on FF Nightly 88.0a1 | ||
at: false, | ||
// See https://github.com/tc39/proposal-array-find-from-last | ||
@@ -964,2 +964,3 @@ findLast: fn, | ||
'%TypedArrayPrototype%': { | ||
at: fn, | ||
buffer: getter, | ||
@@ -997,5 +998,2 @@ byteLength: getter, | ||
'@@toStringTag': getter, | ||
// Failed tc39 proposal | ||
// Seen on FF Nightly 88.0a1 | ||
at: false, | ||
// See https://github.com/tc39/proposal-array-find-from-last | ||
@@ -1301,2 +1299,6 @@ findLast: fn, | ||
'@@toStringTag': 'string', | ||
// Non-standard, used in node to prevent async_hooks from breaking | ||
'UniqueSymbol(async_id_symbol)': accessor, | ||
'UniqueSymbol(trigger_async_id_symbol)': accessor, | ||
'UniqueSymbol(destroyed)': accessor, | ||
}, | ||
@@ -1303,0 +1305,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2711704
57204
18