(() => { const SOURCE = "peach-firefox-sender-probe"; document.documentElement.dataset.peachFirefoxSenderProbe = "ready"; // Proves Firefox injected this content script before the page probe runs. const ALLOWED_TYPES = new Set(["GET_ENTRIES", "GET_RECOVERY_WORDS", "GET_SETTINGS"]); window.addEventListener("message", async (event) => { let request; try { request = JSON.parse(event.data); } catch { return; } const { id, message } = request ?? {}; if (request?.source !== SOURCE || typeof id !== "string" || !message || !ALLOWED_TYPES.has(message.type)) return; let response; try { response = await chrome.runtime.sendMessage(message); } catch (error) { response = { ok: false, error: String(error) }; } window.postMessage(JSON.stringify({ source: `${SOURCE}:response`, id, response }), "*"); }); })();