I am using the mozilla-addon-sdk and the cfx tool to build a firefox extension.
The extension is only showing a toggle button, which usually appear in the toolbar menu.
Everything is working well when I launch the extension with this command:
$ cfx run
But if I generate an xpi file like this:
$ cfx xpi
and try to install my extension manually from this file, even if firefox tells me the installation is ok, I cannot see it in any toolbar/menu. However, the extension is reported in the firefox modules list.
I published it on the store, and the issue persists, no way to access to it from any menu.
I'm thinking of something going wrong in the xpi generation, but I can't find what.
I also thought maybe I should add some code to automatically put the toggle button somewhere in the toolbar, but I couldn't find anything solving my issue. And even if I the extension should put itself in the toolbar with some extra code, why is it working when running from cfx then ?
Any idea ?
[update] here is the code I use.
manifest.json :
{
"name": "firefox-extension",
"title": "...",
"id": "...",
"description": "...",
"icon": "data/my-icon.png",
"author": "...",
"license": "MPL 2.0",
"version": "0.1"
}
main.js:
var { ToggleButton } = require('sdk/ui/button/toggle');
var panels = require("sdk/panel");
var self = require("sdk/self");
var tabs = require("sdk/tabs");
var button = ToggleButton({
id: "extension-button",
label: "extension",
icon: {
"48": "./my-icon.png"
},
onChange: handleChange
});
function handleChange(state) {
if (state.checked) {
var panel = panels.Panel({
contentURL: self.data.url("http://my_url"),
onHide: handleHide,
width: 600,
height: 600
});
panel.show({
position: button
});
}
}
function handleHide() {
button.state('window', {checked: false});
}