Limit extension to HTML?

It seems my Webextension messes up the pretty-printing of XML that Firefox offers. The reason seems to be in one of the third-party libraries I use. If I remove all of them from manifest.json, it works again. But I don’t get an error message in the console or in the debugging log. So is there a way to simply turn off my extension for XML files (for which it wouldn’t do anything useful anyway)?

1 Like

I have the same issue with askblok :frowning:

iirc this is caused by your extension injecting those as content scripts for xml files. The solution is not to inject there, resp. make the content script not load the libs there.

Can you say more about this? I don’t load the scripts explicitly, but from the manifest.json. It looks like this:

  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*", "file:///*"],
      "js": [
        "vendors/jquery.min.js",
        "vendors/purify.js",
        "vendors/ally.js",
        "vendors/most.js",
        "vendors/featherlight/featherlight.js",
        "share/helpers.js",
        "share/tools.js",
        "share/markup.js",
        "cs/contentscript.js",
        "cs/textarea.js"
      ],
      "css": [
        "vendors/featherlight/featherlight.css",
        "css/lt-marker-style.css"
      ]
    }
  ],

(full file here)

Optimally you’d only execute your code when you detect that you’re not on an XML document. Which may require some lazy-loading of some libs if they break stuff just by being loaded. See also https://github.com/vuejs/vue-devtools/issues/438