ses 0.18.3 → 0.18.4

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/dist/ses.cjs CHANGED
@@ -139,6 +139,7 @@ const { prototype: promisePrototype}= Promise;$h‍_once.promisePrototy
139
139
  const typedArrayPrototype= getPrototypeOf(Uint8Array.prototype);$h‍_once.typedArrayPrototype(typedArrayPrototype);
140
140
 
141
141
  const { bind}= functionPrototype;
142
+
142
143
  /**
143
144
  * uncurryThis()
144
145
  * Equivalent of: fn => (thisArg, ...args) => apply(fn, thisArg, args)
@@ -158,8 +159,8 @@ $h‍_once.objectHasOwnProperty(objectHasOwnProperty);const arrayFilter=uncurryT
158
159
  const arrayForEach= uncurryThis(arrayPrototype.forEach);$h‍_once.arrayForEach(arrayForEach);
159
160
  const arrayIncludes= uncurryThis(arrayPrototype.includes);$h‍_once.arrayIncludes(arrayIncludes);
160
161
  const arrayJoin= uncurryThis(arrayPrototype.join);
161
- /** @type {<T, U>(thisArg: readonly T[], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[]} */$h‍_once.arrayJoin(arrayJoin);
162
- const arrayMap= uncurryThis(arrayPrototype.map);$h‍_once.arrayMap(arrayMap);
162
+ /** @type {<T, U>(thisArg: readonly T[], callbackfn: (value: T, index: number, array: T[]) => U, cbThisArg?: any) => U[]} */$h‍_once.arrayJoin(arrayJoin);
163
+ const arrayMap= /** @type {any} */ uncurryThis(arrayPrototype.map);$h‍_once.arrayMap(arrayMap);
163
164
  const arrayPop= uncurryThis(arrayPrototype.pop);
164
165
  /** @type {<T>(thisArg: T[], ...items: T[]) => number} */$h‍_once.arrayPop(arrayPop);
165
166
  const arrayPush= uncurryThis(arrayPrototype.push);$h‍_once.arrayPush(arrayPush);
@@ -190,12 +191,14 @@ const stringIncludes= uncurryThis(stringPrototype.includes);$h‍_once.s
190
191
  const stringIndexOf= uncurryThis(stringPrototype.indexOf);$h‍_once.stringIndexOf(stringIndexOf);
191
192
  const stringMatch= uncurryThis(stringPrototype.match);
192
193
  /**
193
- * @type {
194
- * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string) => string) |
194
+ * @type { &
195
+ * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string) => string) &
195
196
  * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string) => string)
196
197
  * }
197
198
  */$h‍_once.stringMatch(stringMatch);
198
- const stringReplace= uncurryThis(stringPrototype.replace);$h‍_once.stringReplace(stringReplace);
199
+ const stringReplace= /** @type {any} */
200
+ uncurryThis(stringPrototype.replace);$h‍_once.stringReplace(stringReplace);
201
+
199
202
  const stringSearch= uncurryThis(stringPrototype.search);$h‍_once.stringSearch(stringSearch);
200
203
  const stringSlice= uncurryThis(stringPrototype.slice);
201
204
  /** @type {(thisArg: string, splitter: string | RegExp | { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number) => string[]} */$h‍_once.stringSlice(stringSlice);
@@ -204,13 +207,12 @@ const stringStartsWith= uncurryThis(stringPrototype.startsWith);$h‍_on
204
207
  const iterateString= uncurryThis(stringPrototype[iteratorSymbol]);
205
208
  //
206
209
  $h‍_once.iterateString(iterateString);const weakmapDelete=uncurryThis(weakmapPrototype.delete);
207
- /** @type {<K, V>(thisArg: WeakMap<K, V>, ...args: Parameters<WeakMap<K,V>['get']>) => ReturnType<WeakMap<K,V>['get']>} */$h‍_once.weakmapDelete(weakmapDelete);
210
+ /** @type {<K extends {}, V>(thisArg: WeakMap<K, V>, ...args: Parameters<WeakMap<K,V>['get']>) => ReturnType<WeakMap<K,V>['get']>} */$h‍_once.weakmapDelete(weakmapDelete);
208
211
  const weakmapGet= uncurryThis(weakmapPrototype.get);$h‍_once.weakmapGet(weakmapGet);
209
212
  const weakmapHas= uncurryThis(weakmapPrototype.has);$h‍_once.weakmapHas(weakmapHas);
210
213
  const weakmapSet= uncurryThis(weakmapPrototype.set);
211
214
  //
212
215
  $h‍_once.weakmapSet(weakmapSet);const weaksetAdd=uncurryThis(weaksetPrototype.add);$h‍_once.weaksetAdd(weaksetAdd);
213
- const weaksetGet= uncurryThis(weaksetPrototype.get);$h‍_once.weaksetGet(weaksetGet);
214
216
  const weaksetHas= uncurryThis(weaksetPrototype.has);
215
217
  //
216
218
  $h‍_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPrototype.toString);
@@ -219,7 +221,9 @@ $h‍_once.functionToString(functionToString);const{all}=Promise;
219
221
  const promiseAll= (promises)=>apply(all, Promise, [promises]);$h‍_once.promiseAll(promiseAll);
220
222
  const promiseCatch= uncurryThis(promisePrototype.catch);
221
223
  /** @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);
222
- const promiseThen= uncurryThis(promisePrototype.then);
224
+ const promiseThen= /** @type {any} */
225
+ uncurryThis(promisePrototype.then);
226
+
223
227
  //
224
228
  $h‍_once.promiseThen(promiseThen);const finalizationRegistryRegister=
225
229
  FinalizationRegistry&& uncurryThis(FinalizationRegistry.prototype.register);$h‍_once.finalizationRegistryRegister(finalizationRegistryRegister);
@@ -1766,14 +1770,16 @@ const makeEvalScopeKit= ()=> {
1766
1770
  const evalScopeKit= {
1767
1771
  evalScope,
1768
1772
  allowNextEvalToBeUnsafe() {
1769
- if( evalScopeKit.revoked!== null) {
1770
- Fail `a handler did not reset allowNextEvalToBeUnsafe ${this.revoked.err}`;
1773
+ const { revoked}= evalScopeKit;
1774
+ if( revoked!== null) {
1775
+ Fail `a handler did not reset allowNextEvalToBeUnsafe ${revoked.err}`;
1771
1776
  }
1772
1777
  // Allow next reference to eval produce the unsafe FERAL_EVAL.
1773
1778
  // We avoid defineProperty because it consumes an extra stack frame taming
1774
1779
  // its return value.
1775
1780
  defineProperties(evalScope, oneTimeEvalProperties);
1776
1781
  },
1782
+ /** @type {null | { err: any }} */
1777
1783
  revoked: null};
1778
1784
 
1779
1785
 
@@ -1899,6 +1905,7 @@ const isValidIdentifierName= (name)=>{
1899
1905
  function isImmutableDataProperty(obj, name) {
1900
1906
  const desc= getOwnPropertyDescriptor(obj, name);
1901
1907
  return(
1908
+ desc&&
1902
1909
  //
1903
1910
  // The getters will not have .writable, don't let the falsyness of
1904
1911
  // 'undefined' trick us: test with === false, not ! . However descriptors
@@ -2565,15 +2572,15 @@ const { Fail}= assert;
2565
2572
  * @param {object} options
2566
2573
  * @param {object} options.globalObject
2567
2574
  * @param {object} [options.moduleLexicals]
2568
- * @param {Array<Transform>} [options.globalTransforms]
2569
- * @param {bool} [options.sloppyGlobalsMode]
2575
+ * @param {Array<import('./lockdown-shim.js').Transform>} [options.globalTransforms]
2576
+ * @param {boolean} [options.sloppyGlobalsMode]
2570
2577
  */
2571
2578
  const makeSafeEvaluator= ({
2572
2579
  globalObject,
2573
2580
  moduleLexicals= {},
2574
2581
  globalTransforms= [],
2575
- sloppyGlobalsMode= false}=
2576
- {})=> {
2582
+ sloppyGlobalsMode= false})=>
2583
+ {
2577
2584
  const scopeTerminator= sloppyGlobalsMode?
2578
2585
  createSloppyGlobalsScopeTerminator(globalObject):
2579
2586
  strictScopeTerminator;
@@ -2600,9 +2607,10 @@ const makeSafeEvaluator= ({
2600
2607
  /**
2601
2608
  * @param {string} source
2602
2609
  * @param {object} [options]
2603
- * @param {Array<Transform>} [options.localTransforms]
2610
+ * @param {Array<import('./lockdown-shim.js').Transform>} [options.localTransforms]
2604
2611
  */
2605
- const safeEvaluate= (source, { localTransforms= []}= {})=> {
2612
+ const safeEvaluate= (source, options)=> {
2613
+ const { localTransforms= []}= options|| {};
2606
2614
  provideEvaluate();
2607
2615
 
2608
2616
  // Execute the mandatory transforms last to ensure that any rewritten code
@@ -4738,7 +4746,7 @@ const load= async(
4738
4746
 
4739
4747
  /** @type {Set<Promise<undefined>>} */
4740
4748
  const pendingJobs= new Set();
4741
- /** @type {Map<object, Map<string, Promise<Record>>} */
4749
+ /** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
4742
4750
  const moduleLoads= new Map();
4743
4751
  /** @type {Array<Error>} */
4744
4752
  const errors= [];
@@ -5149,6 +5157,7 @@ $h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const make
5149
5157
  // fixed binding state
5150
5158
  let value;
5151
5159
  let tdz= true;
5160
+ /** @type {null | Array<(value: any) => void>} */
5152
5161
  let optUpdaters= [];
5153
5162
 
5154
5163
  // tdz sensitive getter
@@ -5174,7 +5183,7 @@ $h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const make
5174
5183
  const updaters= optUpdaters;
5175
5184
  optUpdaters= null;
5176
5185
  tdz= false;
5177
- for( const updater of updaters) {
5186
+ for( const updater of updaters|| []) {
5178
5187
  updater(initValue);
5179
5188
  }
5180
5189
  return initValue;
@@ -5188,7 +5197,7 @@ $h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const make
5188
5197
  return;
5189
5198
  }
5190
5199
  if( tdz) {
5191
- arrayPush(optUpdaters, updater);
5200
+ arrayPush(optUpdaters|| [], updater);
5192
5201
  }else {
5193
5202
  updater(value);
5194
5203
  }
@@ -5675,10 +5684,6 @@ const moduleAliases= new WeakMap();
5675
5684
  // privateFields captures the private state for each compartment.
5676
5685
  const privateFields= new WeakMap();
5677
5686
 
5678
- /**
5679
- * @typedef {(source: string) => string} Transform
5680
- */
5681
-
5682
5687
  // Compartments do not need an importHook or resolveHook to be useful
5683
5688
  // as a vessel for evaluating programs.
5684
5689
  // However, any method that operates the module system will throw an exception
@@ -5731,7 +5736,7 @@ const CompartmentPrototype= {
5731
5736
  /**
5732
5737
  * @param {string} source is a JavaScript program grammar construction.
5733
5738
  * @param {object} [options]
5734
- * @param {Array<Transform>} [options.transforms]
5739
+ * @param {Array<import('./lockdown-shim').Transform>} [options.transforms]
5735
5740
  * @param {boolean} [options.sloppyGlobalsMode]
5736
5741
  * @param {object} [options.__moduleShimLexicals__]
5737
5742
  * @param {boolean} [options.__evadeHtmlCommentTest__]
@@ -5931,7 +5936,8 @@ const makeCompartmentConstructor= (
5931
5936
  })
5932
5937
  ,
5933
5938
  // === functors[24] ===
5934
- (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => { let TypeError,WeakSet,arrayFilter,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isObject,objectHasOwnProperty,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,whitelist;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./whitelist.js", [["constantProperties", [$h‍_a => (constantProperties = $h‍_a)]],["sharedGlobalPropertyNames", [$h‍_a => (sharedGlobalPropertyNames = $h‍_a)]],["universalPropertyNames", [$h‍_a => (universalPropertyNames = $h‍_a)]],["whitelist", [$h‍_a => (whitelist = $h‍_a)]]]]]);
5939
+ (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => { let TypeError,WeakSet,arrayFilter,create,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isObject,objectHasOwnProperty,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,whitelist;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $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)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./whitelist.js", [["constantProperties", [$h‍_a => (constantProperties = $h‍_a)]],["sharedGlobalPropertyNames", [$h‍_a => (sharedGlobalPropertyNames = $h‍_a)]],["universalPropertyNames", [$h‍_a => (universalPropertyNames = $h‍_a)]],["whitelist", [$h‍_a => (whitelist = $h‍_a)]]]]]);
5940
+
5935
5941
 
5936
5942
 
5937
5943
 
@@ -5967,6 +5973,7 @@ function initProperty(obj, name, desc) {
5967
5973
  if( objectHasOwnProperty(obj, name)) {
5968
5974
  const preDesc= getOwnPropertyDescriptor(obj, name);
5969
5975
  if(
5976
+ !preDesc||
5970
5977
  !is(preDesc.value, desc.value)||
5971
5978
  preDesc.get!== desc.get||
5972
5979
  preDesc.set!== desc.set||
@@ -6003,7 +6010,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
6003
6010
  }
6004
6011
 
6005
6012
  const makeIntrinsicsCollector= ()=> {
6006
- const intrinsics= { __proto__: null};
6013
+ /** @type {Record<any, any>} */
6014
+ const intrinsics= create(null);
6007
6015
  let pseudoNatives;
6008
6016
 
6009
6017
  const addIntrinsics= (newIntrinsics)=>{
@@ -7514,7 +7522,7 @@ const tameV8ErrorConstructor= (
7514
7522
  // Mapping from error instance to the stack for that instance.
7515
7523
  // The stack info is either the structured stack trace
7516
7524
  // or the generated tamed stack string
7517
- /** @type {WeakMap<Error, ParsedStackInfo | StructuredStackInfo} */
7525
+ /** @type {WeakMap<Error, ParsedStackInfo | StructuredStackInfo>} */
7518
7526
  const stackInfos= new WeakMap();
7519
7527
 
7520
7528
  // Use concise methods to obtain named functions without constructors.
@@ -7946,10 +7954,8 @@ const getAnonymousIntrinsics= ()=> {
7946
7954
 
7947
7955
  // 9.2.4.1 %ThrowTypeError%
7948
7956
 
7949
- const ThrowTypeError= getOwnPropertyDescriptor(
7950
- makeArguments(),
7951
- 'callee').
7952
- get;
7957
+ const argsCalleeDesc= getOwnPropertyDescriptor(makeArguments(), 'callee');
7958
+ const ThrowTypeError= argsCalleeDesc&& argsCalleeDesc.get;
7953
7959
 
7954
7960
  // 21.1.5.2 The %StringIteratorPrototype% Object
7955
7961
 
@@ -8042,7 +8048,8 @@ const getAnonymousIntrinsics= ()=> {
8042
8048
  })
8043
8049
  ,
8044
8050
  // === functors[34] ===
8045
- (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => { let Set,String,TypeError,WeakMap,WeakSet,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,isObject,objectHasOwnProperty,ownKeys,preventExtensions,setAdd,setForEach,setHas,toStringTagSymbol,typedArrayPrototype,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,assert;$h‍_imports([["./commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isInteger", [$h‍_a => (isInteger = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["preventExtensions", [$h‍_a => (preventExtensions = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["setForEach", [$h‍_a => (setForEach = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]],["typedArrayPrototype", [$h‍_a => (typedArrayPrototype = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]);
8051
+ (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => { let Set,String,TypeError,WeakMap,WeakSet,globalThis,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,isObject,objectHasOwnProperty,ownKeys,preventExtensions,setAdd,setForEach,setHas,toStringTagSymbol,typedArrayPrototype,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,assert;$h‍_imports([["./commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isInteger", [$h‍_a => (isInteger = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["preventExtensions", [$h‍_a => (preventExtensions = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["setForEach", [$h‍_a => (setForEach = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]],["typedArrayPrototype", [$h‍_a => (typedArrayPrototype = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]);
8052
+
8046
8053
 
8047
8054
 
8048
8055
 
@@ -8171,6 +8178,12 @@ const freezeTypedArray= (array)=>{
8171
8178
  * @returns {Harden}
8172
8179
  */
8173
8180
  const makeHardener= ()=> {
8181
+ // Use a native hardener if possible.
8182
+ if( typeof globalThis.harden=== 'function') {
8183
+ const safeHarden= globalThis.harden;
8184
+ return safeHarden;
8185
+ }
8186
+
8174
8187
  const hardened= new WeakSet();
8175
8188
 
8176
8189
  const { harden}= {
@@ -8620,7 +8633,7 @@ const tameFunctionToString= ()=> {
8620
8633
 
8621
8634
  const tamingMethods= {
8622
8635
  toString() {
8623
- const str= functionToString(this, []);
8636
+ const str= functionToString(this);
8624
8637
  if(
8625
8638
  stringEndsWith(str, nativeSuffix)||
8626
8639
  !weaksetHas(virtualizedNativeFunctions, this))
@@ -8662,6 +8675,12 @@ const tameHarden= (safeHarden, hardenTaming)=> {
8662
8675
  Object.isSealed= ()=> true;
8663
8676
  Reflect.isExtensible= ()=> false;
8664
8677
 
8678
+ if( safeHarden.isFake) {
8679
+ // The "safe" hardener is already a fake hardener.
8680
+ // Just use it.
8681
+ return safeHarden;
8682
+ }
8683
+
8665
8684
  const fakeHarden= (arg)=>arg;
8666
8685
  fakeHarden.isFake= true;
8667
8686
  return freeze(fakeHarden);
@@ -8799,6 +8818,9 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
8799
8818
 
8800
8819
  const makeRegExpConstructor= (_= {})=> {
8801
8820
  // RegExp has non-writable static properties we need to omit.
8821
+ /**
8822
+ * @param {Parameters<typeof FERAL_REG_EXP>} rest
8823
+ */
8802
8824
  const ResultRegExp= function RegExp(...rest) {
8803
8825
  if( new.target=== undefined) {
8804
8826
  return FERAL_REG_EXP(...rest);
@@ -8806,6 +8828,11 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
8806
8828
  return construct(FERAL_REG_EXP, rest, new.target);
8807
8829
  };
8808
8830
 
8831
+ const speciesDesc= getOwnPropertyDescriptor(FERAL_REG_EXP, speciesSymbol);
8832
+ if( !speciesDesc) {
8833
+ throw new TypeError('no RegExp[Symbol.species] descriptor');
8834
+ }
8835
+
8809
8836
  defineProperties(ResultRegExp, {
8810
8837
  length: { value: 2},
8811
8838
  prototype: {
@@ -8814,7 +8841,7 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
8814
8841
  enumerable: false,
8815
8842
  configurable: false},
8816
8843
 
8817
- [speciesSymbol]: getOwnPropertyDescriptor(FERAL_REG_EXP, speciesSymbol)});
8844
+ [speciesSymbol]: speciesDesc});
8818
8845
 
8819
8846
  return ResultRegExp;
8820
8847
  };
@@ -8823,6 +8850,7 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
8823
8850
  const SharedRegExp= makeRegExpConstructor();
8824
8851
 
8825
8852
  if( regExpTaming!== 'unsafe') {
8853
+ // @ts-expect-error Deleted properties must be optional
8826
8854
  delete RegExpPrototype.compile;
8827
8855
  }
8828
8856
  defineProperties(RegExpPrototype, {
@@ -9051,6 +9079,9 @@ function whitelistIntrinsics(
9051
9079
  */
9052
9080
  function isAllowedProperty(path, obj, prop, permit) {
9053
9081
  const desc= getOwnPropertyDescriptor(obj, prop);
9082
+ if( !desc) {
9083
+ throw new TypeError( `Property ${prop} not found at ${path}`);
9084
+ }
9054
9085
 
9055
9086
  // Is this a value property?
9056
9087
  if( objectHasOwnProperty(desc, 'value')) {
@@ -9749,7 +9780,6 @@ assign(globalThis, {
9749
9780
  weakmapHas: cell("weakmapHas"),
9750
9781
  weakmapSet: cell("weakmapSet"),
9751
9782
  weaksetAdd: cell("weaksetAdd"),
9752
- weaksetGet: cell("weaksetGet"),
9753
9783
  weaksetHas: cell("weaksetHas"),
9754
9784
  functionToString: cell("functionToString"),
9755
9785
  promiseAll: cell("promiseAll"),
@@ -10086,7 +10116,6 @@ function observeImports(map, importName, importIndex) {
10086
10116
  weakmapHas: cells[0].weakmapHas.set,
10087
10117
  weakmapSet: cells[0].weakmapSet.set,
10088
10118
  weaksetAdd: cells[0].weaksetAdd.set,
10089
- weaksetGet: cells[0].weaksetGet.set,
10090
10119
  weaksetHas: cells[0].weaksetHas.set,
10091
10120
  functionToString: cells[0].functionToString.set,
10092
10121
  promiseAll: cells[0].promiseAll.set,