endo icon indicating copy to clipboard operation
endo copied to clipboard

feat(ses): fix conflicting definitions of %InertAsyncFunction% on Hermes

Open leotm opened this issue 2 years ago • 1 comments

closes: #XXXX refs: https://github.com/endojs/endo/issues/1891

Description

Context: Running SES on React Native on Android (Hermes)

Follow-up to

  • https://github.com/endojs/endo/pull/2220

When calling addIntrinsics(getAnonymousIntrinsics())

The way we define AsyncFunctionInstance async function AsyncFunctionInstance() {}

is throwing TypeError: Conflicting definitions of %InertAsyncFunction% at https://github.com/endojs/endo/blob/master/packages/ses/src/intrinsics.js#L46

which doesn't match what's returned from (0,eval)('(async function () { })'); which is ok in repro https://github.com/leotm/RN07117SES/commit/cb44efd88ebbc9cea5450cf114ef1e93ee2996ff

Security Considerations

Likely since calling eval

Scaling Considerations

Documentation Considerations

Testing Considerations

Compatibility Considerations

Upgrade Considerations

  • [ ] Includes *BREAKING*: in the commit message with migration instructions for any breaking change.
  • [ ] Updates NEWS.md for user-facing changes.

leotm avatar Apr 17 '24 17:04 leotm

Because of other use cases (like extensions) we can't rely on eval to get the intrinsics. There is an open issue about verifying that the ses shim wasn't transpiled, which seems to be what's happening here.

See https://github.com/endojs/endo/issues/902

mhofman avatar Apr 18 '24 20:04 mhofman

closing as no longer needed after prev conclusion Babel was transpiling as Mat mentioned

addIntrinsics(getAnonymousIntrinsics()) for React Native on Android (Hermes) is now fixed in WIP Hermes-specific SES shim variant (async generators and iterators stripped, tests updated and protection remaining intact)

branch: https://github.com/leotm/endo commit: https://github.com/leotm/endo/commit/0421ca7eaf4c69c2343637f495c5e5738230cb8f

repro: https://github.com/leotm/RN07117SES commit: https://github.com/leotm/RN07117SES/commit/8a64849a8bdba01369015bfe18d0d4a96b833e80

nb: smaller XS-specific SES shim variant also coming soon

leotm avatar May 28 '24 19:05 leotm