I finished the webextension version of my Jolla Askbot Unseen Posts addon - it’s described in the OP - a month ago (v2.0.0). I tested it with Fx 53 developer edition. (I don’t intend to release it until it works with Android which needs the options_ui API.) I didn’t try it with the then-current Fx 51.
Since then I updated the existing SDK version to include an embedded webextension to handle the eventual transfer of prefs from simple-prefs to browser.storage.local (v1.1.6). That works in Fx 51 and now in Fx 52.
I just tried the webextension version (v2.0.0) in Fx 52 and it doesn’t work. On the console I get:
Error: prefs is undefined (unknown)
It still works in Fx 53 - and now Fx 54 - but not Fx 52.
‘prefs’ is the name of the object I write to browser.storage.local which contains the options, migrated from simple-prefs. The background script starts with this:
// Start: retrieve the stored prefs
var prefs = new Object() ;
var gettingItem = browser.storage.local.get('prefs') ;
gettingItem.then(onGot, onError) ;
function onGot(item) {
if (item['prefs']!=undefined) {
prefs = item['prefs'] ;
}
else {
prefs['colorS'] = "green" ;
prefs['colorU'] = "red" ;
// ... more like that ...
// Store default prefs
setting = browser.storage.local.set({prefs}) ;
setting.then(null, onError);
}
mainScript() ;
}
The storage object is also saved in the options.js script but it fails without going there. And as I said, it all works in Fx53/54.
I mentioned the transition version v1.1.6 earlier in case the fact that its embedded webextension will have created the ‘prefs’ object in storage.local in the first place, to be be picked up by the webextension version 2.0.0. I don’t think that causes the problem - the transition from v1.1.6 to v2.0.0 works fine in Fx 53 - and AFAICS v2.0.0 fails without being installed over v1.1.6.
Where it this ‘prefs is undefined’ message from? What does ‘unknown’ instead of a js file/line mean?
I’m guessing that something is wrong with storage.local, or my use of it.
The webextension (v2.0.0) is here:
https://dl.dropboxusercontent.com/u/862480/temp/jolla_together_unseen_posts_2.0.0.xpi