javascript - How to access variable from contentScript in firefox? -


i want open new tab contentscriptfile can't access tabs variable.

i used tabs in firefox high-level apis.

//index.js var self = require("sdk/self"); var cm = require("sdk/context-menu"); var tabs = require("sdk/tabs");  cm.item({     label: "test",     contentscriptfile : self.data.url("script.js")  });     //script.js self.on(     'click',     function (node, data) {         tabs.open('http://example.com/'); //not work :-(     } ); 

resolved problem 'onmessage'

//index.js var self = require("sdk/self"); var cm = require("sdk/context-menu"); var tabs = require("sdk/tabs");  var menuitem = cm.item({ label: "test", context: cm.selectioncontext(),     //we can use contentscript simple app     contentscriptfile: self.data.url("script.js"),     onmessage: function () {         tabs.open('http://example.com/');      } });   //script.js self.on("click", self.postmessage); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -