ses 0.15.22 → 0.16.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 +43 -0
- package/NEWS.md +31 -20
- package/README.md +22 -1
- package/dist/lockdown.cjs +117 -73
- package/dist/lockdown.mjs +117 -73
- package/dist/lockdown.umd.js +117 -73
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +117 -73
- package/dist/ses.mjs +117 -73
- package/dist/ses.umd.js +117 -73
- package/dist/ses.umd.min.js +1 -1
- package/package.json +5 -5
- package/src/commons.js +15 -25
- package/src/compartment-shim.js +5 -2
- package/src/enablements.js +14 -9
- package/src/error/console.js +1 -1
- package/src/error/stringify-utils.js +1 -1
- package/src/error/tame-error-constructor.js +34 -0
- package/src/error/unhandled-rejection.js +1 -1
- package/src/make-hardener.js +31 -19
package/dist/ses.cjs
CHANGED
|
@@ -69,8 +69,9 @@ const {
|
|
|
69
69
|
seal,
|
|
70
70
|
preventExtensions,
|
|
71
71
|
setPrototypeOf,
|
|
72
|
-
values
|
|
73
|
-
|
|
72
|
+
values,
|
|
73
|
+
fromEntries}=
|
|
74
|
+
Object;$h_once.assign(assign);$h_once.create(create);$h_once.defineProperties(defineProperties);$h_once.entries(entries);$h_once.freeze(freeze);$h_once.getOwnPropertyDescriptor(getOwnPropertyDescriptor);$h_once.getOwnPropertyDescriptors(getOwnPropertyDescriptors);$h_once.getOwnPropertyNames(getOwnPropertyNames);$h_once.getPrototypeOf(getPrototypeOf);$h_once.is(is);$h_once.isExtensible(isExtensible);$h_once.keys(keys);$h_once.objectPrototype(objectPrototype);$h_once.seal(seal);$h_once.preventExtensions(preventExtensions);$h_once.setPrototypeOf(setPrototypeOf);$h_once.values(values);$h_once.fromEntries(fromEntries);
|
|
74
75
|
|
|
75
76
|
const {
|
|
76
77
|
species: speciesSymbol,
|
|
@@ -85,24 +86,8 @@ const { isInteger}= Number;$h_once.isInteger(isInteger);
|
|
|
85
86
|
|
|
86
87
|
const { stringify: stringifyJson}= JSON;
|
|
87
88
|
|
|
88
|
-
// At time of this writing, we still support Node 10 which doesn't have
|
|
89
|
-
// `Object.fromEntries`. If it is absent, this should be an adequate
|
|
90
|
-
// replacement.
|
|
91
|
-
// By the terminology of https://ponyfoo.com/articles/polyfills-or-ponyfills
|
|
92
|
-
// it is a ponyfill rather than a polyfill or shim because we do not
|
|
93
|
-
// install it on `Object`.
|
|
94
|
-
$h_once.stringifyJson(stringifyJson);const objectFromEntries=(entryPairs)=>{
|
|
95
|
-
const result= {};
|
|
96
|
-
for( const [prop, val]of entryPairs) {
|
|
97
|
-
result[prop]= val;
|
|
98
|
-
}
|
|
99
|
-
return result;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const fromEntries= Object.fromEntries|| objectFromEntries;
|
|
103
|
-
|
|
104
89
|
// Needed only for the Safari bug workaround below
|
|
105
|
-
$h_once.
|
|
90
|
+
$h_once.stringifyJson(stringifyJson);const{defineProperty:originalDefineProperty}=Object;
|
|
106
91
|
|
|
107
92
|
const defineProperty= (object, prop, descriptor)=> {
|
|
108
93
|
// We used to do the following, until we had to reopen Safari bug
|
|
@@ -147,35 +132,32 @@ const { prototype: weaksetPrototype}= WeakSet;$h_once.weaksetPrototy
|
|
|
147
132
|
const { prototype: functionPrototype}= Function;$h_once.functionPrototype(functionPrototype);
|
|
148
133
|
const { prototype: promisePrototype}= Promise;$h_once.promisePrototype(promisePrototype);
|
|
149
134
|
|
|
150
|
-
const typedArrayPrototype= getPrototypeOf(Uint8Array.prototype);
|
|
135
|
+
const typedArrayPrototype= getPrototypeOf(Uint8Array.prototype);$h_once.typedArrayPrototype(typedArrayPrototype);
|
|
151
136
|
|
|
137
|
+
const { bind}= functionPrototype;
|
|
152
138
|
/**
|
|
153
139
|
* uncurryThis()
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* The original uncurry uses:
|
|
157
|
-
* const bind = Function.prototype.bind;
|
|
158
|
-
* const uncurryThis = bind.bind(bind.call);
|
|
140
|
+
* Equivalent of: fn => (thisArg, ...args) => apply(fn, thisArg, args)
|
|
159
141
|
*
|
|
160
142
|
* See those reference for a complete explanation:
|
|
161
143
|
* http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
|
|
162
144
|
* which only lives at
|
|
163
145
|
* http://web.archive.org/web/20160805225710/http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
|
|
164
146
|
*
|
|
165
|
-
* @
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const uncurryThis= (fn)=>(thisArg, ...args)=> apply(fn, thisArg, args);$h_once.uncurryThis(uncurryThis);
|
|
170
|
-
|
|
147
|
+
* @type {<F extends (this: any, ...args: any[]) => any>(fn: F) => ((thisArg: ThisParameterType<F>, ...args: Parameters<F>) => ReturnType<F>)}
|
|
148
|
+
*/
|
|
149
|
+
const uncurryThis= bind.bind(bind.call); // eslint-disable-line @endo/no-polymorphic-call
|
|
150
|
+
$h_once.uncurryThis(uncurryThis);
|
|
171
151
|
const objectHasOwnProperty= uncurryThis(objectPrototype.hasOwnProperty);
|
|
172
152
|
//
|
|
173
153
|
$h_once.objectHasOwnProperty(objectHasOwnProperty);const arrayFilter=uncurryThis(arrayPrototype.filter);$h_once.arrayFilter(arrayFilter);
|
|
174
154
|
const arrayForEach= uncurryThis(arrayPrototype.forEach);$h_once.arrayForEach(arrayForEach);
|
|
175
155
|
const arrayIncludes= uncurryThis(arrayPrototype.includes);$h_once.arrayIncludes(arrayIncludes);
|
|
176
|
-
const arrayJoin= uncurryThis(arrayPrototype.join)
|
|
156
|
+
const arrayJoin= uncurryThis(arrayPrototype.join);
|
|
157
|
+
/** @type {<T, U>(thisArg: readonly T[], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[]} */$h_once.arrayJoin(arrayJoin);
|
|
177
158
|
const arrayMap= uncurryThis(arrayPrototype.map);$h_once.arrayMap(arrayMap);
|
|
178
|
-
const arrayPop= uncurryThis(arrayPrototype.pop)
|
|
159
|
+
const arrayPop= uncurryThis(arrayPrototype.pop);
|
|
160
|
+
/** @type {<T>(thisArg: T[], ...items: T[]) => number} */$h_once.arrayPop(arrayPop);
|
|
179
161
|
const arrayPush= uncurryThis(arrayPrototype.push);$h_once.arrayPush(arrayPush);
|
|
180
162
|
const arraySlice= uncurryThis(arrayPrototype.slice);$h_once.arraySlice(arraySlice);
|
|
181
163
|
const arraySome= uncurryThis(arrayPrototype.some);$h_once.arraySome(arraySome);
|
|
@@ -202,10 +184,17 @@ const matchAllRegExp= uncurryThis(regexpPrototype[matchAllSymbol]);
|
|
|
202
184
|
$h_once.matchAllRegExp(matchAllRegExp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h_once.stringEndsWith(stringEndsWith);
|
|
203
185
|
const stringIncludes= uncurryThis(stringPrototype.includes);$h_once.stringIncludes(stringIncludes);
|
|
204
186
|
const stringIndexOf= uncurryThis(stringPrototype.indexOf);$h_once.stringIndexOf(stringIndexOf);
|
|
205
|
-
const stringMatch= uncurryThis(stringPrototype.match)
|
|
187
|
+
const stringMatch= uncurryThis(stringPrototype.match);
|
|
188
|
+
/**
|
|
189
|
+
* @type {
|
|
190
|
+
* ((thisArg: string, searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string) => string) |
|
|
191
|
+
* ((thisArg: string, searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string) => string)
|
|
192
|
+
* }
|
|
193
|
+
*/$h_once.stringMatch(stringMatch);
|
|
206
194
|
const stringReplace= uncurryThis(stringPrototype.replace);$h_once.stringReplace(stringReplace);
|
|
207
195
|
const stringSearch= uncurryThis(stringPrototype.search);$h_once.stringSearch(stringSearch);
|
|
208
|
-
const stringSlice= uncurryThis(stringPrototype.slice)
|
|
196
|
+
const stringSlice= uncurryThis(stringPrototype.slice);
|
|
197
|
+
/** @type {(thisArg: string, splitter: string | RegExp | { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number) => string[]} */$h_once.stringSlice(stringSlice);
|
|
209
198
|
const stringSplit= uncurryThis(stringPrototype.split);$h_once.stringSplit(stringSplit);
|
|
210
199
|
const stringStartsWith= uncurryThis(stringPrototype.startsWith);$h_once.stringStartsWith(stringStartsWith);
|
|
211
200
|
const iterateString= uncurryThis(stringPrototype[iteratorSymbol]);
|
|
@@ -224,7 +213,8 @@ $h_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPro
|
|
|
224
213
|
//
|
|
225
214
|
$h_once.functionToString(functionToString);const{all}=Promise;
|
|
226
215
|
const promiseAll= (promises)=>apply(all, Promise, [promises]);$h_once.promiseAll(promiseAll);
|
|
227
|
-
const promiseCatch= uncurryThis(promisePrototype.catch)
|
|
216
|
+
const promiseCatch= uncurryThis(promisePrototype.catch);
|
|
217
|
+
/** @type {<T, TResult1 = T, TResult2 = never>(thisArg: T, onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null) => Promise<TResult1 | TResult2>} */$h_once.promiseCatch(promiseCatch);
|
|
228
218
|
const promiseThen= uncurryThis(promisePrototype.then);
|
|
229
219
|
//
|
|
230
220
|
$h_once.promiseThen(promiseThen);const finalizationRegistryRegister=
|
|
@@ -412,7 +402,7 @@ const noEvalEvaluate= ()=> {
|
|
|
412
402
|
/**
|
|
413
403
|
* Joins English terms with commas and an optional conjunction.
|
|
414
404
|
*
|
|
415
|
-
* @param {string[]} terms
|
|
405
|
+
* @param {(string | StringablePayload)[]} terms
|
|
416
406
|
* @param {"and" | "or"} conjunction
|
|
417
407
|
*/
|
|
418
408
|
const enJoin= (terms, conjunction)=> {
|
|
@@ -5318,7 +5308,10 @@ const CompartmentPrototype= {
|
|
|
5318
5308
|
()=> {
|
|
5319
5309
|
// The namespace box is a contentious design and likely to be a breaking
|
|
5320
5310
|
// change in an appropriately numbered future version.
|
|
5321
|
-
const namespace= compartmentImportNow(
|
|
5311
|
+
const namespace= compartmentImportNow(
|
|
5312
|
+
/** @type {Compartment} */ this,
|
|
5313
|
+
specifier);
|
|
5314
|
+
|
|
5322
5315
|
return { namespace};
|
|
5323
5316
|
});
|
|
5324
5317
|
|
|
@@ -5341,7 +5334,7 @@ const CompartmentPrototype= {
|
|
|
5341
5334
|
|
|
5342
5335
|
assertModuleHooks(this);
|
|
5343
5336
|
|
|
5344
|
-
return compartmentImportNow(this,
|
|
5337
|
+
return compartmentImportNow(/** @type {Compartment} */ this, specifier);
|
|
5345
5338
|
}};$h_once.CompartmentPrototype(CompartmentPrototype);
|
|
5346
5339
|
|
|
5347
5340
|
|
|
@@ -5837,22 +5830,27 @@ const severeEnablements= {
|
|
|
5837
5830
|
...moderateEnablements,
|
|
5838
5831
|
|
|
5839
5832
|
/**
|
|
5840
|
-
* Rollup(as used at least by vega) and webpack
|
|
5833
|
+
* Rollup (as used at least by vega) and webpack
|
|
5841
5834
|
* (as used at least by regenerator) both turn exports into assignments
|
|
5842
5835
|
* to a big `exports` object that inherits directly from
|
|
5843
|
-
* `Object.prototype`.Some of the exported names we've seen include
|
|
5836
|
+
* `Object.prototype`. Some of the exported names we've seen include
|
|
5844
5837
|
* `hasOwnProperty`, `constructor`, and `toString`. But the strategy used
|
|
5845
|
-
* by rollup and webpack
|
|
5846
|
-
* into an assignment rejected by the override mistake.That's why
|
|
5847
|
-
*
|
|
5838
|
+
* by rollup and webpack potentionally turns any exported name
|
|
5839
|
+
* into an assignment rejected by the override mistake. That's why
|
|
5840
|
+
* the `severe` enablements takes the extreme step of enabling
|
|
5841
|
+
* everything on `Object.prototype`.
|
|
5848
5842
|
*
|
|
5849
5843
|
* In addition, code doing inheritance manually will often override
|
|
5850
5844
|
* the `constructor` property on the new prototype by assignment. We've
|
|
5851
5845
|
* seen this several times.
|
|
5852
5846
|
*
|
|
5853
5847
|
* The cost of enabling all these is that they create a miserable debugging
|
|
5854
|
-
* experience
|
|
5855
|
-
*
|
|
5848
|
+
* experience specifically on Node.
|
|
5849
|
+
* https://github.com/Agoric/agoric-sdk/issues/2324
|
|
5850
|
+
* explains how it confused the Node console.
|
|
5851
|
+
*
|
|
5852
|
+
* (TODO Reexamine the vscode situation. I think it may have improved
|
|
5853
|
+
* since the following paragraph was written.)
|
|
5856
5854
|
*
|
|
5857
5855
|
* The vscode debugger's object inspector shows the own data properties of
|
|
5858
5856
|
* an object, which is typically what you want, but also shows both getter
|
|
@@ -5869,8 +5867,8 @@ const severeEnablements= {
|
|
|
5869
5867
|
* The widely used Buffer defined at https://github.com/feross/buffer
|
|
5870
5868
|
* on initialization, manually creates the equivalent of a subclass of
|
|
5871
5869
|
* `TypedArray`, which it then initializes by assignment. These assignments
|
|
5872
|
-
* include enough of the `TypeArray` methods that here,
|
|
5873
|
-
* them all.
|
|
5870
|
+
* include enough of the `TypeArray` methods that here, the `severe`
|
|
5871
|
+
* enablements just enable them all.
|
|
5874
5872
|
*/
|
|
5875
5873
|
'%TypedArrayPrototype%': '*'};$h_once.severeEnablements(severeEnablements);
|
|
5876
5874
|
})
|
|
@@ -6539,9 +6537,9 @@ const makeCausalConsole= (baseConsole, loggedErrorHandler)=> {
|
|
|
6539
6537
|
const levelMethod= (...logArgs)=> {
|
|
6540
6538
|
const subErrors= [];
|
|
6541
6539
|
const argTags= extractErrorArgs(logArgs, subErrors);
|
|
6542
|
-
// @ts-ignore
|
|
6543
6540
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
6544
6541
|
baseConsole[level](...argTags);
|
|
6542
|
+
// @ts-expect-error ConsoleProp vs LogSeverity mismatch
|
|
6545
6543
|
logSubErrors(level, subErrors);
|
|
6546
6544
|
};
|
|
6547
6545
|
defineProperty(levelMethod, 'name', { value: level});
|
|
@@ -6666,7 +6664,7 @@ const makeRejectionHandlers= (reportReason)=>{
|
|
|
6666
6664
|
* @param {ReasonId} heldReasonId
|
|
6667
6665
|
*/
|
|
6668
6666
|
const finalizeDroppedPromise= (heldReasonId)=>{
|
|
6669
|
-
if( mapHas(idToReason)) {
|
|
6667
|
+
if( mapHas(idToReason, heldReasonId)) {
|
|
6670
6668
|
const reason= mapGet(idToReason, heldReasonId);
|
|
6671
6669
|
removeReasonId(heldReasonId);
|
|
6672
6670
|
reportReason(reason);
|
|
@@ -7209,7 +7207,8 @@ const tameV8ErrorConstructor= (
|
|
|
7209
7207
|
})
|
|
7210
7208
|
,
|
|
7211
7209
|
// === functors[29] ===
|
|
7212
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => { let FERAL_ERROR,TypeError,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,NativeErrors,tameV8ErrorConstructor;$h_imports([["../commons.js", [["FERAL_ERROR", [$h_a => (FERAL_ERROR = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["apply", [$h_a => (apply = $h_a)]],["construct", [$h_a => (construct = $h_a)]],["defineProperties", [$h_a => (defineProperties = $h_a)]],["setPrototypeOf", [$h_a => (setPrototypeOf = $h_a)]],["getOwnPropertyDescriptor", [$h_a => (getOwnPropertyDescriptor = $h_a)]]]],["../whitelist.js", [["NativeErrors", [$h_a => (NativeErrors = $h_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor", [$h_a => (tameV8ErrorConstructor = $h_a)]]]]]);
|
|
7210
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, importMeta: $h____meta, }) => { let FERAL_ERROR,TypeError,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,defineProperty,NativeErrors,tameV8ErrorConstructor;$h_imports([["../commons.js", [["FERAL_ERROR", [$h_a => (FERAL_ERROR = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["apply", [$h_a => (apply = $h_a)]],["construct", [$h_a => (construct = $h_a)]],["defineProperties", [$h_a => (defineProperties = $h_a)]],["setPrototypeOf", [$h_a => (setPrototypeOf = $h_a)]],["getOwnPropertyDescriptor", [$h_a => (getOwnPropertyDescriptor = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]]]],["../whitelist.js", [["NativeErrors", [$h_a => (NativeErrors = $h_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor", [$h_a => (tameV8ErrorConstructor = $h_a)]]]]]);
|
|
7211
|
+
|
|
7213
7212
|
|
|
7214
7213
|
|
|
7215
7214
|
|
|
@@ -7348,6 +7347,39 @@ function tameErrorConstructor(
|
|
|
7348
7347
|
|
|
7349
7348
|
|
|
7350
7349
|
|
|
7350
|
+
if( platform=== 'v8') {
|
|
7351
|
+
// `SharedError.prepareStackTrace`, if it exists, must also be
|
|
7352
|
+
// powerless. However, from what we've heard, depd expects to be able to
|
|
7353
|
+
// assign to it without the assignment throwing. It is normally a function
|
|
7354
|
+
// that returns a stack string to be magically added to error objects.
|
|
7355
|
+
// However, as long as we're adding a lenient standin, we may as well
|
|
7356
|
+
// accommodate any who expect to get a function they can call and get
|
|
7357
|
+
// a string back. This prepareStackTrace is a do-nothing function that
|
|
7358
|
+
// always returns the empty string.
|
|
7359
|
+
defineProperties(SharedError, {
|
|
7360
|
+
prepareStackTrace: {
|
|
7361
|
+
get() {
|
|
7362
|
+
return ()=> '';
|
|
7363
|
+
},
|
|
7364
|
+
set(_prepareFn) {
|
|
7365
|
+
// do nothing
|
|
7366
|
+
},
|
|
7367
|
+
enumerable: false,
|
|
7368
|
+
configurable: true},
|
|
7369
|
+
|
|
7370
|
+
captureStackTrace: {
|
|
7371
|
+
value: (errorish, _constructorOpt)=> {
|
|
7372
|
+
defineProperty(errorish, 'stack', {
|
|
7373
|
+
value: ''});
|
|
7374
|
+
|
|
7375
|
+
},
|
|
7376
|
+
writable: false,
|
|
7377
|
+
enumerable: false,
|
|
7378
|
+
configurable: true}});
|
|
7379
|
+
|
|
7380
|
+
|
|
7381
|
+
}
|
|
7382
|
+
|
|
7351
7383
|
let initialGetStackString= tamedMethods.getStackString;
|
|
7352
7384
|
if( platform=== 'v8') {
|
|
7353
7385
|
initialGetStackString= tameV8ErrorConstructor(
|
|
@@ -7638,40 +7670,52 @@ const getTypedArrayToStringTag= typedArrayToStringTag.get;
|
|
|
7638
7670
|
assert(getTypedArrayToStringTag);
|
|
7639
7671
|
|
|
7640
7672
|
// Exported for tests.
|
|
7641
|
-
/**
|
|
7673
|
+
/**
|
|
7674
|
+
* Duplicates packages/marshal/src/helpers/passStyle-helpers.js to avoid a dependency.
|
|
7675
|
+
*
|
|
7676
|
+
* @param {unknown} object
|
|
7677
|
+
*/
|
|
7642
7678
|
const isTypedArray= (object)=>{
|
|
7643
7679
|
// The object must pass a brand check or toStringTag will return undefined.
|
|
7644
7680
|
const tag= apply(getTypedArrayToStringTag, object, []);
|
|
7645
7681
|
return tag!== undefined;
|
|
7646
7682
|
};
|
|
7647
7683
|
|
|
7684
|
+
/**
|
|
7685
|
+
* Tests if a property key is an integer-valued canonical numeric index.
|
|
7686
|
+
* https://tc39.es/ecma262/#sec-canonicalnumericindexstring
|
|
7687
|
+
*
|
|
7688
|
+
* @param {string | symbol} propertyKey
|
|
7689
|
+
*/$h_once.isTypedArray(isTypedArray);
|
|
7690
|
+
const isCanonicalIntegerIndexString= (propertyKey)=>{
|
|
7691
|
+
const n= +String(propertyKey);
|
|
7692
|
+
return isInteger(n)&& String(n)=== propertyKey;
|
|
7693
|
+
};
|
|
7694
|
+
|
|
7648
7695
|
/**
|
|
7649
7696
|
* @template T
|
|
7650
7697
|
* @param {ArrayLike<T>} array
|
|
7651
|
-
|
|
7698
|
+
*/
|
|
7652
7699
|
const freezeTypedArray= (array)=>{
|
|
7653
|
-
const descs= getOwnPropertyDescriptors(array);
|
|
7654
|
-
|
|
7655
7700
|
preventExtensions(array);
|
|
7656
7701
|
|
|
7657
7702
|
// Downgrade writable expandos to readonly, even if non-configurable.
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
//
|
|
7666
|
-
//
|
|
7667
|
-
//
|
|
7668
|
-
// Assignment to these indexes silently fails and defining an indexed
|
|
7669
|
-
// property throws an error.
|
|
7670
|
-
// So, we only need to make non-index properties non-writable and
|
|
7671
|
-
// non-configurable.
|
|
7703
|
+
// We get each descriptor individually rather than using
|
|
7704
|
+
// getOwnPropertyDescriptors in order to fail safe when encountering
|
|
7705
|
+
// an obscure GraalJS issue where getOwnPropertyDescriptor returns
|
|
7706
|
+
// undefined for a property that does exist.
|
|
7707
|
+
arrayForEach(ownKeys(array), (/** @type {string | symbol} */ name)=> {
|
|
7708
|
+
const desc= getOwnPropertyDescriptor(array, name);
|
|
7709
|
+
assert(desc);
|
|
7710
|
+
// TypedArrays are integer-indexed exotic objects, which define special
|
|
7711
|
+
// treatment for property names in canonical numeric form:
|
|
7712
|
+
// integers in range are permanently writable and non-configurable.
|
|
7672
7713
|
// https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects
|
|
7673
|
-
|
|
7674
|
-
|
|
7714
|
+
//
|
|
7715
|
+
// This is analogous to the data of a hardened Map or Set,
|
|
7716
|
+
// so we carve out this exceptional behavior but make all other
|
|
7717
|
+
// properties non-configurable.
|
|
7718
|
+
if( !isCanonicalIntegerIndexString(name)) {
|
|
7675
7719
|
defineProperty(array, name, {
|
|
7676
7720
|
...desc,
|
|
7677
7721
|
writable: false,
|
|
@@ -9167,6 +9211,7 @@ assign(globalThis, {
|
|
|
9167
9211
|
preventExtensions: cell("preventExtensions"),
|
|
9168
9212
|
setPrototypeOf: cell("setPrototypeOf"),
|
|
9169
9213
|
values: cell("values"),
|
|
9214
|
+
fromEntries: cell("fromEntries"),
|
|
9170
9215
|
speciesSymbol: cell("speciesSymbol"),
|
|
9171
9216
|
toStringTagSymbol: cell("toStringTagSymbol"),
|
|
9172
9217
|
iteratorSymbol: cell("iteratorSymbol"),
|
|
@@ -9175,7 +9220,6 @@ assign(globalThis, {
|
|
|
9175
9220
|
symbolFor: cell("symbolFor"),
|
|
9176
9221
|
isInteger: cell("isInteger"),
|
|
9177
9222
|
stringifyJson: cell("stringifyJson"),
|
|
9178
|
-
fromEntries: cell("fromEntries"),
|
|
9179
9223
|
defineProperty: cell("defineProperty"),
|
|
9180
9224
|
apply: cell("apply"),
|
|
9181
9225
|
construct: cell("construct"),
|
|
@@ -9483,6 +9527,7 @@ assign(globalThis, {
|
|
|
9483
9527
|
preventExtensions: cells[0].preventExtensions.set,
|
|
9484
9528
|
setPrototypeOf: cells[0].setPrototypeOf.set,
|
|
9485
9529
|
values: cells[0].values.set,
|
|
9530
|
+
fromEntries: cells[0].fromEntries.set,
|
|
9486
9531
|
speciesSymbol: cells[0].speciesSymbol.set,
|
|
9487
9532
|
toStringTagSymbol: cells[0].toStringTagSymbol.set,
|
|
9488
9533
|
iteratorSymbol: cells[0].iteratorSymbol.set,
|
|
@@ -9491,7 +9536,6 @@ assign(globalThis, {
|
|
|
9491
9536
|
symbolFor: cells[0].symbolFor.set,
|
|
9492
9537
|
isInteger: cells[0].isInteger.set,
|
|
9493
9538
|
stringifyJson: cells[0].stringifyJson.set,
|
|
9494
|
-
fromEntries: cells[0].fromEntries.set,
|
|
9495
9539
|
defineProperty: cells[0].defineProperty.set,
|
|
9496
9540
|
apply: cells[0].apply.set,
|
|
9497
9541
|
construct: cells[0].construct.set,
|