Firefox Extension File Structure

I am working on updating the Greasemonkey compiler for Firefox batch extensions. I think the source version was for Firefox version 3.6 and Greasemonkey version 0.7.20070607.0, and the source code is on GitHub here . I will work on my update here .

I am trying to figure out what are the current requirements for Firefox 9/10 extensions so that I can make sure that I am creating the appropriate file structure.

Does anyone know if the following file structure is current:

MyExt/ chrome/ chrome/chromeFiles/ chrome/chromeFiles/content/ MyExt.js defaults/ defaults/preferences/ prefs.js chrome.manifest install.rdf 

The original compiler outputs this for a Greasemonkey script that does not modify the Chrome browser:

 MyExt/ chrome/ content/ MyExt.js prefs.js compiler.js xmlhttprequester.js chrome.manifest install.rdf 

The next step is to make sure that the Greasemonkey code that the compiler uses is current, but I want my output goals to be cleared first.

+4
source share
1 answer

This is a typical / acceptable structure (although most people are not in the content nest in chromeFiles ; chrome/content enough). A typical structure can be found here :

 my_extension.xpi: //Equal to a folder named my_extension/ /install.rdf //General information about your extension /chrome.manifest //Registers you content with the Chrome engine /chrome/ /chrome/content/ //Contents of your extension such as XUL and JavaScript files /chrome/icons/default/* //Default Icons of the extension /chrome/locale/* //Building an Extension# Localization /defaults/preferences/*.js //Building an Extension# Defaults Files /plugins/* /components/* /components/cmdline.js 

However, pay attention to the following:

  • Files under chrome can be placed anywhere if you correctly register these places in chrome.manifest

  • Components can also be located anywhere. As with chrome files, the location must be registered in the manifest.

  • On the other hand, the default values should be in the defaults folder :

    The default files that you use to populate the user profile must be placed by default / under the root of your extension hierarchy folder. Default settings .js files should be stored in defaults / preferences / - when you place them here, they will be automatically loaded by the Firefox preferences system when it starts so that you can access them using the settings API.

  • Both install.rdf and chrome.manifest must be in the top level directory of the extension

+3
source

Source: https://habr.com/ru/post/1389316/


All Articles