The add-on where ideas come to idea
Table of Contents generated with DocToc
- installation
- configuration
- development
- running once for testing
- packaging
- distributing
- Events
- Maintainers
- Attribution
npm install
prod: check the CONFIG
property in package.json
dev: dev-prefs.json
see ../docs/ADDON-ENVIRONMENT.md
to configure which server environment the addon connects to.
A relatively easy path for working on this addon involves the following steps:
-
Install Firefox Developer Edition.
-
Install the DevPrefs Add-on, which sets a number of preferences necessary for Add-on development, importantly
xpinstall.signatures.required
andxpinstall.whitelist.required
. -
Install the Extension Auto-Installer Add-on in Firefox Developer Edition.
-
Run
npm start
to fire up a watcher that will build the Test Pilot add-on whenever files change and auto-update the installed version in Firefox. -
Read all about setting up an extension development environment on MDN.
For UI hacking you can run npm run watch-ui
to easily debug lib/templates.js
and data/panel.css
Unit tests for the add-on are run via jpm
as an npm
script:
npm test -- --binary=/Applications/Nightly.app/Contents/MacOS/firefox-bin
Look in the test
directory for examples of tests.
-
Install Firefox Beta
-
npm run once
This should package the add-on and fire up Firefox Beta using a fresh profile with the add-on installed.
npm run sign
We serve the add-on from the /static/addon/
directory. We will need
to get the add-on signed via AMO and move
it into the correct directory. This is all packaged into a script,
npm run sign
in the package.json.
Accepted:
install-experiment
uninstall-experiment
uninstall-self
sync-installed
Emitted:
sync-installed-result
addon-install:install-started
addon-install:install-new
addon-install:install-cancelled
addon-install:install-ended
addon-install:install-failed
addon-install:download-started
addon-install:download-progress
addon-install:download-ended
addon-install:download-cancelled
addon-install:download-failed
addon-uninstall:uninstall-started
addon-uninstall:uninstall-ended
addon-manage:enabled
addon-manage:disabled
addon-self:installed
addon-self:enabled
addon-self:upgraded
addon-self:uninstalled
Any emitted events prefixed with addon-install:
will have an associated object
which will be structured as such:
{
"name": "Fox Splitter",
"error": 0,
"state": 6,
"version": "2.1.2012122901.1-signed",
"progress": 517308,
"maxProgress": 517308
}
The event addon-install:install-ended
will include some extra properties:
{
"id": "[email protected]",
"name": "Fox Splitter",
"error": 0,
"state": 6,
"version": "2.1.2012122901.1-signed",
"progress": 517308,
"maxProgress": 517308,
"description": "Splits browser window as you like.",
"homepageURL": "http://piro.sakura.ne.jp/xul/foxsplitter/index.html.en",
"iconURL": "file:///tmp/074a4b62-239e-49bb-b75a-4935c349855c/extensions/[email protected]/icon.png",
"size": 511221,
"signedState": 2,
"permissions": 13
}
You will need to setup the following function (or an equivalent) to send messages to the add-on.
function sendToAddon (data) {
document.documentElement.dispatchEvent(new CustomEvent(
'from-web-to-addon', { bubbles: true, detail: data }
));
}
Then you can use the sendToAddon
method to send messages.
sendToAddon({type: 'loaded'});
and to setup listeners.
window.addEventListener("from-addon-to-web", function (event) {
if (!event.detail || !event.detail.type) { return; }
statusUpdate(event.detail.type, event.detail);
switch (event.detail.type) {
case 'sync-installed':
syncInstalledAddons(event.detail);
break;
default:
console.log('WEB RECEIVED FROM ADDON', JSON.stringify(event.detail, null, ' '));
break;
}
}, false);
Submit updates:
sendToAddon({type: 'install-experiment', detail: {xpi_url: 'https://people.mozilla.com/~jhirsch/universal-search-addon/addon.xpi'}});
- Dave Justice [email protected]
- Les Orchard [email protected]
Arrow Icon made by Appzgear from www.flaticon.com is licensed by CC BY 3.0