PR: Resolve Firefox cross-origin object access issue in message port handling
Issue
Firefox was throwing the following error when attempting to send message from window context:
Error: Not allowed to define cross-origin object as property on [Object] or [Array] XrayWrapper
Solution
The fix involves modifying how we handle the message port in the getMessagePort function. Instead of directly accessing and modifying ports[0], we now store it in a local variable port. This approach avoids the cross-origin object access issue.
This change resolves the Firefox-specific error without affecting functionality on other browsers. It ensures consistent behavior across different browser environments when handling message ports in cross-origin contexts.
Testing
Verified that the error no longer occurs on Firefox.
Ensured that the functionality remains intact on other supported browsers.
Please review and test this change to confirm it resolves the issue without introducing any regressions.
PR: Resolve Firefox cross-origin object access issue in message port handling
Issue
Firefox was throwing the following error when attempting to send message from
window
context:Solution
The fix involves modifying how we handle the message port in the
getMessagePort
function. Instead of directly accessing and modifyingports[0]
, we now store it in a local variableport
. This approach avoids the cross-origin object access issue.Changes
In
src/internal/message-port.ts
:Impact
This change resolves the Firefox-specific error without affecting functionality on other browsers. It ensures consistent behavior across different browser environments when handling message ports in cross-origin contexts.
Testing
Please review and test this change to confirm it resolves the issue without introducing any regressions.