You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: fixes for sandbox communication (shared origins and permissions) (#36)
* fix: sandbox msging bugs (shared origin #29, isPermittedFrom #35)
Fixing issues for handling messages and errors when sandboxes use
the same origin. Namely, this approach defines and passes an id
that is passed to the sandbox, and provides a hook that allows
sandboxes to use this for messaging. This is to distinguish views
on the same origin that share the same runtime and globals.
This also addresses an issue there allowOrigin checks where checking
sender side allows rather than receiver side.
ref: #29
ref: #35
* fix: add iOS surface ID injection and rename delegateId to surfaceId
Adds __sandboxSurfaceId injection into iOS initialProperties for
per-surface message routing parity with Android. Renames the concept
from delegateId to surfaceId across both platforms and JS to align
with existing RN surface terminology (PR #36 feedback).
* fix(ios): unregister delegate from SandboxRegistry on immediate factory teardown
The TTL=0 path in releaseSharedFactory removed the factory from the pool
but left the stale delegate wrapper in the C++ registry. When another
sandbox then tried to route a message to the removed origin, it found
the dangling wrapper and crashed accessing a deallocated RCTInstance.
Verified fix in the p2p-chat app. Prior to this, the app would crash
on ios after removing a chat sandbox and trying to message it from
another chat.
* docs: add useSurfaceMessaging and origin-pooling documentation
Documents the per-surface messaging API for bundle authors sharing
an origin, with both hook and convention-based examples. Adds the
origin-pooling demo to the examples list and reorders sections for
better flow.
---------
Co-authored-by: Ryan Karn <rkarn@amazon.com>
0 commit comments