Skip to content

Commit

Permalink
feat(ses): fix undefined AsyncGenerator prototype on Hermes
Browse files Browse the repository at this point in the history
- define async iterable
- define async iterator
- redefine async iterator prototype

Or keep the original and fallback to this if undefined
  • Loading branch information
leotm committed Apr 17, 2024
1 parent d521532 commit 4308b5d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/ses/src/get-anonymous-intrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,18 @@ export const getAnonymousIntrinsics = () => {

// 25.3.2.2 AsyncGeneratorFunction.prototype
const AsyncGenerator = AsyncGeneratorFunction.prototype;

const asyncIterable = {
// eslint-disable-next-line no-restricted-globals, no-empty-function
async *[Symbol.asyncIterator]() {},
};

// eslint-disable-next-line @endo/no-polymorphic-call, no-restricted-globals
const asyncIterator = asyncIterable[Symbol.asyncIterator]();

// 25.5.1 Properties of the AsyncGenerator Prototype Object
const AsyncGeneratorPrototype = AsyncGenerator.prototype;
const AsyncIteratorPrototype = getPrototypeOf(AsyncGeneratorPrototype);
const AsyncGeneratorPrototype = AsyncGenerator.prototype; // undefined on Hermes
const AsyncIteratorPrototype= getPrototypeOf(asyncIterator);

// 25.7.1 The AsyncFunction Constructor

Expand Down

0 comments on commit 4308b5d

Please sign in to comment.