Menu

ADIC_jsm

Kevin Cox

Enabling ADIC for your Addon

Basic Usage

All addons can already use ADIC with limited functionality. Simply put your addon id in the id field and the value that would make the following code return your addon's preference prefix into the "code" field.

"extensions."+code+"."

With that information ADIC will return the value of all your preferences, OS and system information as well as a list of installed addons and their versions.

Advanced Usage

If you want to personalize the information returned by ADIC and provide an easier interface for your users you can include an adic.json file in the root for your extension (not chrome:// but the extension package). This way users only need to enter your extension ID and everything else is handled automatically. This file also offers you more control over what information ADIC gathers.

Intro to adic.jsm

adic.json is imported as a JavaScript module and exports one object with all of the info ADIC needs. It is important to note that it is not strictly JSON so the language is more flexible. You can include comments as well as commas after the last element. A template file is shown here.

var EXPORTED_SYMBOLS = ["ADIC_info"];

var ADIC_info = {
    /* Include prefrences from here down. */
    prefs: ["extensions.adic."],

    /* true for system info */
    system: true,

    /* Should we include a list of installed extensions? */
    extensions: true,

    /* A list of file names to include. */
    files: [],

    /* A list of things to include in the output */
    constants: {
        key: "value",
    },
};

This is actually the adic.jsm that ADIC uses. It is fairly straight forward. The name ADIC_info is important and must not be changed or else ADIC will not be able to find your settings.

prefs

ADIC_info.prefs is an array of prefixes to be included. If you want every preference you can put [""] or [] for none. This value defaults to "extensions."+code+"." if the code is given (it isn't asked for if adic.jsm exists) otherwise [].

system

ADIC_info.system is a boolean value specifying whether or not system info should be included. This is a dump of Services.appinfo.

files

ADIC_info.files is a list of files to include verbatim into the output. The file name will be provided then the contents in a delimited section. The user will be prompted for conformation if you ask for strange files (like file:///etc/shadow) that aren't in the users firefox profile.

constants

ADIC_info.constants is an object of key/value pairs to spit out. While these could be constant like secretNumber: 42, they could also be generated. Remember that this module is a script and all the code in it is run. So you could have something like: ADIC_info.constants.randomNumber = Math.random(); While neither of these examples are terribly useful I feel that some authors will find a need for the constants field.


Related

Wiki: AddonDevs

MongoDB Logo MongoDB