PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.29k stars 356 forks source link

[BUG] Compatibility issue with Firefox's Xray wrapper #1045

Open Anshtripathi079 opened 1 month ago

Anshtripathi079 commented 1 month ago

What happened?

I'm encountering an error when trying to make my Chrome extension support Firefox. The extension is built using Plasmo and works fine in Chromium-based browsers, but not in Firefox. The error seems to be related to Firefox's X-ray vision mechanism. Below are the details of the error and the context in which it occurs.

Untitled

Relevant Code snippet in which I am getting the error:


export function renderWriterModalContainerToDocBody() {
    try {
        const { reactContainer, shadowRoot } = createReactModalContainer(cgw_main_containerCls);
        initStyles(shadowRoot);
        globals.writerModalEl = reactContainer;
        // Insert the new element at body
        document.body.appendChild(reactContainer);

        const root = createRoot(shadowRoot);
        root.render(
            <StrictMode>
                <ModalContainer />
                <PopupAfterTextSelectionFeature />
            </StrictMode>,
        );
    } catch (e: any) {
        console.error('Error: ', e);
    }
}

It appears that the issue might be related to how Plasmo handles DOM interactions in Firefox. Any guidance on how to resolve this or adjustments needed to make the extension compatible with Firefox would be greatly appreciated.

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Firefox

Relevant log output

No response

(OPTIONAL) Contribution

Code of Conduct