ses 1.5.0 → 1.7.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.
@@ -1,39 +1,32 @@
1
- // For brevity, in this file, as in module-link.js, the term "moduleRecord"
2
- // without qualification means "module compartment record".
3
- // This is a super-set of the "static module record", that is reusable between
4
- // compartments with different hooks.
5
- // The "module compartment record" captures the compartment and overlays the
6
- // module's "imports" with the more specific "resolvedImports" as inferred from
7
- // the particular compartment's "resolveHook".
8
-
9
1
  import { getEnvironmentOption as getenv } from '@endo/env-options';
10
2
  import {
11
- ReferenceError,
12
- TypeError,
13
3
  Map,
14
4
  Set,
5
+ TypeError,
15
6
  arrayJoin,
16
7
  arrayMap,
17
8
  arrayPush,
18
9
  create,
19
10
  freeze,
11
+ generatorNext,
12
+ generatorThrow,
13
+ getOwnPropertyNames,
14
+ isObject,
20
15
  mapGet,
21
16
  mapHas,
22
17
  mapSet,
23
- setAdd,
24
18
  promiseThen,
19
+ setAdd,
25
20
  values,
26
21
  weakmapGet,
27
- generatorNext,
28
- generatorThrow,
22
+ weakmapHas,
29
23
  } from './commons.js';
30
- import { assert } from './error/assert.js';
31
-
32
- const { Fail, details: d, quote: q } = assert;
24
+ import { makeError, annotateError, q, b, X } from './error/assert.js';
33
25
 
34
26
  const noop = () => {};
35
27
 
36
- async function asyncTrampoline(generatorFunc, args, errorWrapper) {
28
+ const asyncTrampoline = async (generatorFunc, args, errorWrapper) => {
29
+ await null;
37
30
  const iterator = generatorFunc(...args);
38
31
  let result = generatorNext(iterator);
39
32
  while (!result.done) {
@@ -46,9 +39,9 @@ async function asyncTrampoline(generatorFunc, args, errorWrapper) {
46
39
  }
47
40
  }
48
41
  return result.value;
49
- }
42
+ };
50
43
 
51
- function syncTrampoline(generatorFunc, args) {
44
+ const syncTrampoline = (generatorFunc, args) => {
52
45
  const iterator = generatorFunc(...args);
53
46
  let result = generatorNext(iterator);
54
47
  while (!result.done) {
@@ -59,7 +52,8 @@ function syncTrampoline(generatorFunc, args) {
59
52
  }
60
53
  }
61
54
  return result.value;
62
- }
55
+ };
56
+
63
57
  // `makeAlias` constructs compartment specifier tuples for the `aliases`
64
58
  // private field of compartments.
65
59
  // These aliases allow a compartment to alias an internal module specifier to a
@@ -67,10 +61,7 @@ function syncTrampoline(generatorFunc, args) {
67
61
  // aliases.
68
62
  // Both are facilitated by the moduleMap Compartment constructor option.
69
63
  export const makeAlias = (compartment, specifier) =>
70
- freeze({
71
- compartment,
72
- specifier,
73
- });
64
+ freeze({ compartment, specifier });
74
65
 
75
66
  // `resolveAll` pre-computes resolutions of all imports within the compartment
76
67
  // in which a module was loaded.
@@ -83,31 +74,28 @@ const resolveAll = (imports, resolveHook, fullReferrerSpecifier) => {
83
74
  return freeze(resolvedImports);
84
75
  };
85
76
 
86
- const loadRecord = (
77
+ const loadModuleSource = (
87
78
  compartmentPrivateFields,
88
79
  moduleAliases,
89
80
  compartment,
90
81
  moduleSpecifier,
91
- staticModuleRecord,
82
+ moduleSource,
92
83
  enqueueJob,
93
84
  selectImplementation,
94
85
  moduleLoads,
95
86
  importMeta,
96
87
  ) => {
97
- const { resolveHook, moduleRecords } = weakmapGet(
98
- compartmentPrivateFields,
99
- compartment,
100
- );
88
+ const { resolveHook } = weakmapGet(compartmentPrivateFields, compartment);
101
89
 
102
90
  // resolve all imports relative to this referrer module.
103
91
  const resolvedImports = resolveAll(
104
- staticModuleRecord.imports,
92
+ moduleSource.imports,
105
93
  resolveHook,
106
94
  moduleSpecifier,
107
95
  );
108
96
  const moduleRecord = freeze({
109
97
  compartment,
110
- staticModuleRecord,
98
+ moduleSource,
111
99
  moduleSpecifier,
112
100
  resolvedImports,
113
101
  importMeta,
@@ -128,8 +116,6 @@ const loadRecord = (
128
116
  ]);
129
117
  }
130
118
 
131
- // Memoize.
132
- mapSet(moduleRecords, moduleSpecifier, moduleRecord);
133
119
  return moduleRecord;
134
120
  };
135
121
 
@@ -142,101 +128,279 @@ function* loadWithoutErrorAnnotation(
142
128
  selectImplementation,
143
129
  moduleLoads,
144
130
  ) {
145
- const { importHook, importNowHook, moduleMap, moduleMapHook, moduleRecords } =
146
- weakmapGet(compartmentPrivateFields, compartment);
131
+ const {
132
+ importHook,
133
+ importNowHook,
134
+ moduleMap,
135
+ moduleMapHook,
136
+ moduleRecords,
137
+ parentCompartment,
138
+ } = weakmapGet(compartmentPrivateFields, compartment);
139
+
140
+ if (mapHas(moduleRecords, moduleSpecifier)) {
141
+ return mapGet(moduleRecords, moduleSpecifier);
142
+ }
147
143
 
148
144
  // Follow moduleMap, or moduleMapHook if present.
149
- let aliasNamespace = moduleMap[moduleSpecifier];
150
- if (aliasNamespace === undefined && moduleMapHook !== undefined) {
151
- aliasNamespace = moduleMapHook(moduleSpecifier);
145
+ let moduleDescriptor = moduleMap[moduleSpecifier];
146
+ if (moduleDescriptor === undefined && moduleMapHook !== undefined) {
147
+ moduleDescriptor = moduleMapHook(moduleSpecifier);
152
148
  }
153
- if (typeof aliasNamespace === 'string') {
154
- // eslint-disable-next-line @endo/no-polymorphic-call
155
- assert.fail(
156
- d`Cannot map module ${q(moduleSpecifier)} to ${q(
157
- aliasNamespace,
158
- )} in parent compartment, not yet implemented`,
159
- TypeError,
160
- );
161
- } else if (aliasNamespace !== undefined) {
162
- const alias = weakmapGet(moduleAliases, aliasNamespace);
163
- if (alias === undefined) {
164
- // eslint-disable-next-line @endo/no-polymorphic-call
165
- assert.fail(
166
- d`Cannot map module ${q(
149
+ if (moduleDescriptor === undefined) {
150
+ const moduleHook = selectImplementation(importHook, importNowHook);
151
+ if (moduleHook === undefined) {
152
+ const moduleHookName = selectImplementation(
153
+ 'importHook',
154
+ 'importNowHook',
155
+ );
156
+ throw makeError(
157
+ X`${b(moduleHookName)} needed to load module ${q(
167
158
  moduleSpecifier,
168
- )} because the value is not a module exports namespace, or is from another realm`,
169
- ReferenceError,
159
+ )} in compartment ${q(compartment.name)}`,
170
160
  );
171
161
  }
172
- // Behold: recursion.
173
- // eslint-disable-next-line no-use-before-define
174
- const aliasRecord = yield memoizedLoadWithErrorAnnotation(
175
- compartmentPrivateFields,
176
- moduleAliases,
177
- alias.compartment,
178
- alias.specifier,
179
- enqueueJob,
180
- selectImplementation,
181
- moduleLoads,
182
- );
183
- mapSet(moduleRecords, moduleSpecifier, aliasRecord);
184
- return aliasRecord;
162
+ moduleDescriptor = moduleHook(moduleSpecifier);
163
+ // Uninitialized module namespaces throw if we attempt to coerce them into
164
+ // promises.
165
+ if (!weakmapHas(moduleAliases, moduleDescriptor)) {
166
+ moduleDescriptor = yield moduleDescriptor;
167
+ }
185
168
  }
186
169
 
187
- if (mapHas(moduleRecords, moduleSpecifier)) {
188
- return mapGet(moduleRecords, moduleSpecifier);
189
- }
170
+ if (typeof moduleDescriptor === 'string') {
171
+ // eslint-disable-next-line @endo/no-polymorphic-call
172
+ throw makeError(
173
+ X`Cannot map module ${q(moduleSpecifier)} to ${q(
174
+ moduleDescriptor,
175
+ )} in parent compartment, use {source} module descriptor`,
176
+ TypeError,
177
+ );
178
+ } else if (isObject(moduleDescriptor)) {
179
+ // In this shim (and not in XS, and not in the standard we imagine), we
180
+ // allow a module namespace object to stand in for a module descriptor that
181
+ // describes its original {compartment, specifier} so that it can be used
182
+ // to create a link.
183
+ let aliasDescriptor = weakmapGet(moduleAliases, moduleDescriptor);
184
+ if (aliasDescriptor !== undefined) {
185
+ moduleDescriptor = aliasDescriptor;
186
+ }
190
187
 
191
- const staticModuleRecord = yield selectImplementation(
192
- importHook,
193
- importNowHook,
194
- )(moduleSpecifier);
188
+ if (moduleDescriptor.namespace !== undefined) {
189
+ // { namespace: string, compartment?: Compartment }
190
+ // Namespace module descriptors link to a module instance.
191
+
192
+ if (typeof moduleDescriptor.namespace === 'string') {
193
+ // The default compartment is the *parent*, not this child compartment.
194
+ // This is a difference from the legacy {specifier, compartment} module
195
+ // descriptor.
196
+ const {
197
+ compartment: aliasCompartment = parentCompartment,
198
+ namespace: aliasSpecifier,
199
+ } = moduleDescriptor;
200
+ if (
201
+ !isObject(aliasCompartment) ||
202
+ !weakmapHas(compartmentPrivateFields, aliasCompartment)
203
+ ) {
204
+ throw makeError(
205
+ X`Invalid compartment in module descriptor for specifier ${q(moduleSpecifier)} in compartment ${q(compartment.name)}`,
206
+ );
207
+ }
208
+ // Behold: recursion.
209
+ // eslint-disable-next-line no-use-before-define
210
+ const aliasRecord = yield memoizedLoadWithErrorAnnotation(
211
+ compartmentPrivateFields,
212
+ moduleAliases,
213
+ aliasCompartment,
214
+ aliasSpecifier,
215
+ enqueueJob,
216
+ selectImplementation,
217
+ moduleLoads,
218
+ );
219
+ mapSet(moduleRecords, moduleSpecifier, aliasRecord);
220
+ return aliasRecord;
221
+ }
195
222
 
196
- if (staticModuleRecord === null || typeof staticModuleRecord !== 'object') {
197
- Fail`importHook must return a promise for an object, for module ${q(
198
- moduleSpecifier,
199
- )} in compartment ${q(compartment.name)}`;
200
- }
223
+ // All remaining objects must either be a module namespace, or be
224
+ // promoted into a module namespace with a virtual module source.
225
+ if (isObject(moduleDescriptor.namespace)) {
226
+ const { namespace } = moduleDescriptor;
227
+ // Brand-check SES shim module exports namespaces:
228
+ aliasDescriptor = weakmapGet(moduleAliases, namespace);
229
+ if (aliasDescriptor !== undefined) {
230
+ moduleDescriptor = aliasDescriptor;
231
+ // Fall through to processing the resulting {compartment, specifier}
232
+ // alias.
233
+ } else {
234
+ // Promote an arbitrary object to a module namespace with a virtual
235
+ // module source.
236
+ // { namespace: Object }
237
+ const exports = getOwnPropertyNames(namespace);
238
+ /** @type {import('../types.js').VirtualModuleSource} */
239
+ const moduleSource = {
240
+ imports: [],
241
+ exports,
242
+ execute(env) {
243
+ for (const name of exports) {
244
+ env[name] = namespace[name];
245
+ }
246
+ },
247
+ };
248
+ const importMeta = undefined;
249
+ const moduleRecord = loadModuleSource(
250
+ compartmentPrivateFields,
251
+ moduleAliases,
252
+ compartment,
253
+ moduleSpecifier,
254
+ moduleSource,
255
+ enqueueJob,
256
+ selectImplementation,
257
+ moduleLoads,
258
+ importMeta,
259
+ );
260
+ mapSet(moduleRecords, moduleSpecifier, moduleRecord);
261
+ return moduleRecord;
262
+ }
263
+ } else {
264
+ throw makeError(
265
+ X`Invalid compartment in module descriptor for specifier ${q(moduleSpecifier)} in compartment ${q(compartment.name)}`,
266
+ );
267
+ }
268
+ }
269
+
270
+ if (moduleDescriptor.source !== undefined) {
271
+ // Module source descriptors create an instance from a module source.
272
+ // The descriptor may contain the module source, or refer to a source
273
+ // loaded in a particular compartment.
274
+
275
+ if (typeof moduleDescriptor.source === 'string') {
276
+ // { source: string, importMeta?, specifier?: string, compartment? }
277
+ // A string source is the specifier for a different module source.
278
+ // That source may come from this compartment's parent (default), or
279
+ // from a specified compartment, and the specified compartment may be
280
+ // this compartment to make a duplicate.
281
+
282
+ const {
283
+ source: loaderSpecifier,
284
+ specifier: instanceSpecifier = moduleSpecifier,
285
+ compartment: loaderCompartment = parentCompartment,
286
+ importMeta = undefined,
287
+ } = moduleDescriptor;
288
+
289
+ // Induce the compartment, possibly a different compartment
290
+ // to load a module source.
291
+
292
+ // Behold: recursion.
293
+ // eslint-disable-next-line no-use-before-define
294
+ const loaderRecord = yield memoizedLoadWithErrorAnnotation(
295
+ compartmentPrivateFields,
296
+ moduleAliases,
297
+ loaderCompartment,
298
+ loaderSpecifier,
299
+ enqueueJob,
300
+ selectImplementation,
301
+ moduleLoads,
302
+ );
201
303
 
202
- // check if record is a RedirectStaticModuleInterface
203
- if (staticModuleRecord.specifier !== undefined) {
204
- // check if this redirect with an explicit record
205
- if (staticModuleRecord.record !== undefined) {
206
- // ensure expected record shape
207
- if (staticModuleRecord.compartment !== undefined) {
208
- throw TypeError(
209
- 'Cannot redirect to an explicit record with a specified compartment',
304
+ // Extract the source of the module from the loader compartment's
305
+ // record.
306
+ const { moduleSource } = loaderRecord;
307
+
308
+ // Instantiate that source in our own compartment, possibly with a
309
+ // different specifier for resolving its own imports.
310
+ const moduleRecord = loadModuleSource(
311
+ compartmentPrivateFields,
312
+ moduleAliases,
313
+ compartment,
314
+ instanceSpecifier,
315
+ moduleSource,
316
+ enqueueJob,
317
+ selectImplementation,
318
+ moduleLoads,
319
+ importMeta,
320
+ );
321
+ mapSet(moduleRecords, moduleSpecifier, moduleRecord);
322
+ return moduleRecord;
323
+ } else {
324
+ // { source: ModuleSource, importMeta?, specifier?: string }
325
+ // We assume all non-string module sources are any of the supported
326
+ // kinds of module source: PrecompiledModuleSource,
327
+ // VirtualModuleSource, or a native ModuleSource.
328
+
329
+ const {
330
+ source: moduleSource,
331
+ specifier: aliasSpecifier = moduleSpecifier,
332
+ importMeta,
333
+ } = moduleDescriptor;
334
+
335
+ const aliasRecord = loadModuleSource(
336
+ compartmentPrivateFields,
337
+ moduleAliases,
338
+ compartment,
339
+ aliasSpecifier,
340
+ moduleSource,
341
+ enqueueJob,
342
+ selectImplementation,
343
+ moduleLoads,
344
+ importMeta,
210
345
  );
346
+ mapSet(moduleRecords, moduleSpecifier, aliasRecord);
347
+ return aliasRecord;
211
348
  }
349
+ }
350
+
351
+ if (moduleDescriptor.archive !== undefined) {
352
+ // { archive: Archive, path: string }
353
+ // We do not support this XS-native module descriptor.
354
+ throw makeError(
355
+ X`Unsupported archive module descriptor for specifier ${q(moduleSpecifier)} in compartment ${q(compartment.name)}`,
356
+ );
357
+ }
358
+
359
+ // { record, specifier?, compartment?, importMeta? }
360
+ // A (legacy) module descriptor for when we find the module source (record)
361
+ // but at a different specifier than requested.
362
+ // Providing this {specifier, record} descriptor serves as an ergonomic
363
+ // short-hand for stashing the record, returning a {compartment, specifier}
364
+ // reference, bouncing the module hook, then producing the source (record)
365
+ // when module hook receives the response specifier.
366
+ if (moduleDescriptor.record !== undefined) {
212
367
  const {
213
368
  compartment: aliasCompartment = compartment,
214
369
  specifier: aliasSpecifier = moduleSpecifier,
215
- record: aliasModuleRecord,
370
+ record: moduleSource,
216
371
  importMeta,
217
- } = staticModuleRecord;
372
+ } = moduleDescriptor;
218
373
 
219
- const aliasRecord = loadRecord(
374
+ const aliasRecord = loadModuleSource(
220
375
  compartmentPrivateFields,
221
376
  moduleAliases,
222
377
  aliasCompartment,
223
378
  aliasSpecifier,
224
- aliasModuleRecord,
379
+ moduleSource,
225
380
  enqueueJob,
226
381
  selectImplementation,
227
382
  moduleLoads,
228
383
  importMeta,
229
384
  );
230
385
  mapSet(moduleRecords, moduleSpecifier, aliasRecord);
386
+ mapSet(moduleRecords, aliasSpecifier, aliasRecord);
231
387
  return aliasRecord;
232
388
  }
233
389
 
234
- // check if this redirect with an explicit compartment
235
- if (staticModuleRecord.compartment !== undefined) {
236
- // ensure expected record shape
237
- if (staticModuleRecord.importMeta !== undefined) {
238
- throw TypeError(
239
- 'Cannot redirect to an implicit record with a specified importMeta',
390
+ // { specifier: string, compartment: Compartment }
391
+ // A (legacy) module descriptor that describes a link to a module instance
392
+ // in a specified compartment.
393
+ if (
394
+ moduleDescriptor.compartment !== undefined &&
395
+ moduleDescriptor.specifier !== undefined
396
+ ) {
397
+ if (
398
+ !isObject(moduleDescriptor.compartment) ||
399
+ !weakmapHas(compartmentPrivateFields, moduleDescriptor.compartment) ||
400
+ typeof moduleDescriptor.specifier !== 'string'
401
+ ) {
402
+ throw makeError(
403
+ X`Invalid compartment in module descriptor for specifier ${q(moduleSpecifier)} in compartment ${q(compartment.name)}`,
240
404
  );
241
405
  }
242
406
  // Behold: recursion.
@@ -244,8 +408,8 @@ function* loadWithoutErrorAnnotation(
244
408
  const aliasRecord = yield memoizedLoadWithErrorAnnotation(
245
409
  compartmentPrivateFields,
246
410
  moduleAliases,
247
- staticModuleRecord.compartment,
248
- staticModuleRecord.specifier,
411
+ moduleDescriptor.compartment,
412
+ moduleDescriptor.specifier,
249
413
  enqueueJob,
250
414
  selectImplementation,
251
415
  moduleLoads,
@@ -254,19 +418,29 @@ function* loadWithoutErrorAnnotation(
254
418
  return aliasRecord;
255
419
  }
256
420
 
257
- throw TypeError('Unnexpected RedirectStaticModuleInterface record shape');
421
+ // A (legacy) behavior: If we do not recognize the module descriptor as a
422
+ // module descriptor, we assume that it is a module source (record):
423
+ const moduleSource = moduleDescriptor;
424
+ const moduleRecord = loadModuleSource(
425
+ compartmentPrivateFields,
426
+ moduleAliases,
427
+ compartment,
428
+ moduleSpecifier,
429
+ moduleSource,
430
+ enqueueJob,
431
+ selectImplementation,
432
+ moduleLoads,
433
+ );
434
+ // Memoize.
435
+ mapSet(moduleRecords, moduleSpecifier, moduleRecord);
436
+ return moduleRecord;
437
+ } else {
438
+ throw makeError(
439
+ X`module descriptor must be a string or object for specifier ${q(
440
+ moduleSpecifier,
441
+ )} in compartment ${q(compartment.name)}`,
442
+ );
258
443
  }
259
-
260
- return loadRecord(
261
- compartmentPrivateFields,
262
- moduleAliases,
263
- compartment,
264
- moduleSpecifier,
265
- staticModuleRecord,
266
- enqueueJob,
267
- selectImplementation,
268
- moduleLoads,
269
- );
270
444
  }
271
445
 
272
446
  const memoizedLoadWithErrorAnnotation = (
@@ -307,9 +481,9 @@ const memoizedLoadWithErrorAnnotation = (
307
481
  ],
308
482
  error => {
309
483
  // eslint-disable-next-line @endo/no-polymorphic-call
310
- assert.note(
484
+ annotateError(
311
485
  error,
312
- d`${error.message}, loading ${q(moduleSpecifier)} in compartment ${q(
486
+ X`${error.message}, loading ${q(moduleSpecifier)} in compartment ${q(
313
487
  compartmentName,
314
488
  )}`,
315
489
  );
@@ -322,7 +496,7 @@ const memoizedLoadWithErrorAnnotation = (
322
496
  return moduleLoading;
323
497
  };
324
498
 
325
- function asyncJobQueue() {
499
+ const asyncJobQueue = () => {
326
500
  /** @type {Set<Promise<undefined>>} */
327
501
  const pendingJobs = new Set();
328
502
  /** @type {Array<Error>} */
@@ -349,6 +523,7 @@ function asyncJobQueue() {
349
523
  * @returns {Promise<Array<Error>>}
350
524
  */
351
525
  const drainQueue = async () => {
526
+ await null;
352
527
  for (const job of pendingJobs) {
353
528
  // eslint-disable-next-line no-await-in-loop
354
529
  await job;
@@ -356,14 +531,14 @@ function asyncJobQueue() {
356
531
  return errors;
357
532
  };
358
533
  return { enqueueJob, drainQueue };
359
- }
534
+ };
360
535
 
361
536
  /**
362
537
  * @param {object} options
363
538
  * @param {Array<Error>} options.errors
364
539
  * @param {string} options.errorPrefix
365
540
  */
366
- function throwAggregateError({ errors, errorPrefix }) {
541
+ const throwAggregateError = ({ errors, errorPrefix }) => {
367
542
  // Throw an aggregate error if there were any errors.
368
543
  if (errors.length > 0) {
369
544
  const verbose =
@@ -375,13 +550,13 @@ function throwAggregateError({ errors, errorPrefix }) {
375
550
  )}`,
376
551
  );
377
552
  }
378
- }
553
+ };
379
554
 
380
555
  const preferSync = (_asyncImpl, syncImpl) => syncImpl;
381
556
  const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
382
557
 
383
558
  /*
384
- * `load` asynchronously gathers the `StaticModuleRecord`s for a module and its
559
+ * `load` asynchronously gathers the module records for a module and its
385
560
  * transitive dependencies.
386
561
  * The module records refer to each other by a reference to the dependency's
387
562
  * compartment and the specifier of the module within its own compartment.
@@ -425,8 +600,8 @@ export const load = async (
425
600
  };
426
601
 
427
602
  /*
428
- * `loadNow` synchronously gathers the `StaticModuleRecord`s for a module and its
429
- * transitive dependencies.
603
+ * `loadNow` synchronously gathers the module records for a specified module
604
+ * and its transitive dependencies.
430
605
  * The module records refer to each other by a reference to the dependency's
431
606
  * compartment and the specifier of the module within its own compartment.
432
607
  * This graph is then ready to be synchronously linked and executed.
package/src/permits.js CHANGED
@@ -1113,8 +1113,14 @@ export const permitted = {
1113
1113
  Int8Array: TypedArray('%Int8ArrayPrototype%'),
1114
1114
  Uint16Array: TypedArray('%Uint16ArrayPrototype%'),
1115
1115
  Uint32Array: TypedArray('%Uint32ArrayPrototype%'),
1116
- Uint8Array: TypedArray('%Uint8ArrayPrototype%'),
1117
1116
  Uint8ClampedArray: TypedArray('%Uint8ClampedArrayPrototype%'),
1117
+ Uint8Array: {
1118
+ ...TypedArray('%Uint8ArrayPrototype%'),
1119
+ // https://github.com/tc39/proposal-arraybuffer-base64
1120
+ fromBase64: fn,
1121
+ // https://github.com/tc39/proposal-arraybuffer-base64
1122
+ fromHex: fn,
1123
+ },
1118
1124
 
1119
1125
  '%BigInt64ArrayPrototype%': TypedArrayPrototype('BigInt64Array'),
1120
1126
  '%BigUint64ArrayPrototype%': TypedArrayPrototype('BigUint64Array'),
@@ -1127,8 +1133,18 @@ export const permitted = {
1127
1133
  '%Int8ArrayPrototype%': TypedArrayPrototype('Int8Array'),
1128
1134
  '%Uint16ArrayPrototype%': TypedArrayPrototype('Uint16Array'),
1129
1135
  '%Uint32ArrayPrototype%': TypedArrayPrototype('Uint32Array'),
1130
- '%Uint8ArrayPrototype%': TypedArrayPrototype('Uint8Array'),
1131
1136
  '%Uint8ClampedArrayPrototype%': TypedArrayPrototype('Uint8ClampedArray'),
1137
+ '%Uint8ArrayPrototype%': {
1138
+ ...TypedArrayPrototype('Uint8Array'),
1139
+ // https://github.com/tc39/proposal-arraybuffer-base64
1140
+ setFromBase64: fn,
1141
+ // https://github.com/tc39/proposal-arraybuffer-base64
1142
+ setFromHex: fn,
1143
+ // https://github.com/tc39/proposal-arraybuffer-base64
1144
+ toBase64: fn,
1145
+ // https://github.com/tc39/proposal-arraybuffer-base64
1146
+ toHex: fn,
1147
+ },
1132
1148
 
1133
1149
  // *** Keyed Collections
1134
1150