following the Tutorials i made an addon which is working with "jpm run" but not after installing the xpi file. I read the issue197 but thats for "icons". The AddOn is shown correctly both ways.
But the clickEvent only works with "jpm run".
Function of the AddOn: clicking in the frame.html runs the javascript
function FrameClick(){
window.parent.postMessage("Frame is clicked","*");
}
The index.js should then open a Panel.
My code in index.js:
var data = require("sdk/self").data;
var mypanel = require("sdk/panel").Panel({
contentURL: data.url("panel.html"),
contentScriptFile: data.url("panel.js")
});
var { Frame } = require("sdk/ui/frame");
var frame = new Frame({
url: "./frame.html"}
);
var { Toolbar } = require("sdk/ui/toolbar");
var toolbar = Toolbar({
name: "toolbar",
title: "Toolbar",
items: [frame]
});
frame.on("message",MessageFromFrame)
function MessageFromFrame(e){
console.log("MessageFromFrame: "+e);
mypanel.show({position: {top:10,left:10}});
}
mypanel.on("show", function() {
mypanel.port.emit("show",ShowFromMyPanel);
});
function ShowFromMyPanel(e){
console.log("ShowFromMyPanel: "+e);
}
The data structure is:
myaddon
index.js
package.json
myaddon/data
frame.html
frame.js
panel.html
Any suggestions where to look for the error? Thanks for reading :)