Search code examples
firefox-addonfirefox-addon-webextensionsace-editor

Can't load ACE editor in a firefox addon, but can in chrome


I am using ACE editor in my browser extension. It all works fine in a Chrome/Chromium browser, but when I try the extension in Firefox (latest version), only ace.define and ace.require are available (ace.edit is needed, at least, to initialize).

Here is the part of the manifest (MV2) file involved:

"content_scripts" : 
    [
        {
            "matches": ["*://example.com/*"],
            "all_frames": true,
            "js": [
                "ace-min/ace.js",
                "myscript.js"
                ],
            "run_at": "document_end"
        },
    ]

What could be done wrong? Both files are being read, but only a part of ace.js seems to be executed. Imagine that myscript.js contains a console.log(ace), to see which functions can I use.

Thanks in advance!


Solution

  • I posted an issue on the ACE's GitHub repository. The response was very quick and polite.

    All is explained in this comment: https://github.com/ajaxorg/ace/issues/4898#issuecomment-1217887526

    Just a side note, use noconflict ace instead of normal ace. The function you need to change is at the bottom.