Cannot dynamically change PageMod ContentScriptOptions since Firefox 30 -
Cannot dynamically change PageMod ContentScriptOptions since Firefox 30 -
the code below working firefox 30. now, cannot alter options attached pagemod calling function newoptions()
.
is known bug? suggestions create work firefox >= 30?
class="lang-js prettyprint-override">var pagemod = require('sdk/page-mod'); exports.main = function(type) { var mod = pagemod.pagemod({ include: ['http://example.com/*'], contentscriptwhen: 'ready', attachto: ['existing', 'top'], contentscriptfile: data.url('js/file.js'), contentscriptoptions: { options: ... }, onattach: function(opt) { // save user preferences opt.port.on('save', function(o) { newoptions(); // works ok }); } }); function newoptions(){ // alter contentscriptoptions [this not work anymore] mod.contentscriptoptions = { options:... }; // cause page-mod re-evaluate require("tabs").activetab.reload(); } };
see https://bugzilla.mozilla.org/show_bug.cgi?id=1027605:
changing contentscriptoptions after pagemod instance created unsupported, undocumented feature. fact ever worked side-effect of implementation detail, apparently changed between fx29 , 30.
if preferences can alter during running of addon, should switch keeping them in global variable , using messages send info content script.
in other words, wontfix.
firefox-addon firefox-addon-sdk
Comments
Post a Comment