diff --git a/extension/bridge.js b/extension/bridge.js index e0491f3..94045e6 100644 --- a/extension/bridge.js +++ b/extension/bridge.js @@ -22,12 +22,15 @@ window.addEventListener('KOALASYNC_JOIN_REQUEST', (e) => { // 3. Listen for Status Updates from the Extension and relay to Website chrome.runtime.onMessage.addListener((msg) => { if (msg.type === 'JOIN_STATUS') { - const event = new CustomEvent('KOALASYNC_STATUS', { - detail: { - success: msg.success, - message: msg.message - } - }); - window.dispatchEvent(event); + const detail = { success: msg.success, message: msg.message }; + // Firefox MV3 content scripts run in an isolated world. When dispatching + // a CustomEvent with a detail object, Firefox wraps it in an XrayWrapper + // that the page's JavaScript cannot destructure (Permission denied). + // cloneInto() exposes the object to the page's context correctly. + // Chrome doesn't have this issue — cloneInto() is undefined there. + const safeDetail = typeof cloneInto === 'function' + ? cloneInto(detail, document.defaultView) + : detail; + window.dispatchEvent(new CustomEvent('KOALASYNC_STATUS', { detail: safeDetail })); } }); diff --git a/package.json b/package.json index 7061f80..322a490 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "koalasync", - "version": "1.8.7", + "version": "1.8.8", "description": "KoalaSync Build Scripts", "private": true, "scripts": {