preferences workaround

Axel Grude axel.grude at gmail.com
Fri May 3 10:12:13 UTC 2019


Garrafrauns, 3/May/2019 11:12

Dear Christopher ,

looks interesting.

Services.scriptloader.loadSubScript

does this declare the Preferences variable within the scope of onLoad only? (I haven't 
used loadSubScript before) Or is it global.

let context = {};

Could you explain (and maybe add a comment, if you plan to incorporate into a 
ThunderStorm example) what this line does? (Is it necessary for loadSubScript?)

--------------------------------------------------------------------------------------

In the meantime, I was working on getting MenuOnTop compatible - what is difficult is 
to make it work and hoist up / style the Thunderbird Menu of Tb67 right on the start. 
It works well when installing the new version (attached). I am just not yet quite sure 
why this is the case.

on startup of Thunderbird (67):

when I install over the existing version (with all extension settings the same)

So what I still need to figure out is why the start method is not working when 
Thunderbird 67 loads - also my status bar icon / toolbar icons are not displayed. I 
wonder if there is a deficiency with loading legacy restartless Add-ons  with a 
chrome.manifest on Thunderbird startup.

Thunderbird 66 b3 has no such problems, and show this on startup, straight away:

In Thunderbird 67 I see /no debug error console outputs /on startup even though I have 
enabled  them on my options screen:

(and the error console output works fully on install) - startup problems in 
Thunderbird are hard to solve because I cannot start a debugger with Thunderbird. I 
will try converting to a manifest.json next to see whether that solves the problem.

Axel


*Axel Grude <mailto:axel.grude at gmail.com>*
Music Production and Composition
Thunderbird Add-ons Developer (QuickFolders 
<https://addons.thunderbird.net/thunderbird/addon/quickfolders-tabbed-folders/>, 
quickFilters <https://addons.thunderbird.net/thunderbird/addon/quickfilters/>, 
QuickPasswords <https://addons.mozilla.org/firefox/addon/quickpasswords/>, Zombie Keys 
<https://addons.thunderbird.net/thunderbird/addon/zombie-keys/>, SmartTemplate⁴ 
<https://addons.thunderbird.net/thunderbird/addon/smarttemplate4/>)
Visit my YouTube Channel <https://www.youtube.com/c/thunderbirddaily> for email 
productivity tips Get Thunderbird!
> *Subject:*preferences workaround
> *From:*Christopher Leidigh <cleidigh at gmail.com>
> *To:*Axel Grude <axel.grude at gmail.com>
> *Sent: *Friday, 5/3/2019, 01:59 01:59 GMT DT +0100 [Week 18]
> Axel
>
> I think I've come up with a pretty clean workaround to the preferencesBindings issue.
> Basically by changing execution order I eliminate the onDOMContentLoaded event before
> the preferences are set within the user script.
> I have this proposed solution out for comment, would be interested in your take.
>
> Basic approach:
>
> - Remove preferencesBindings.js <script> tag within the document
> - within the user script onLoad():
>
>
>
> function onLoad(e) {
>     Services.console.logStringMessage("Preferences 1: onload event function");
>
>     let context = {};
>
>     // Grab the dialog element so we can play with it
>     const dialog = document.getElementById("preferences1dialog");
>
>     // Load preferencesBindings script here, onDOMContentLoaded() has already fired
>     // therefore we will not get its errors
>
> Services.scriptloader.loadSubScript("chrome://global/content/preferencesBindings.js", 
> context, "UTF-8" /* The script's encoding */);
>     Services.console.logStringMessage("Preferences 1: onload loaded preferences 
> script");
>
>     // Now we load our preferences
>     Preferences.addAll([
>         { id: "extensions.preferences1.optionscolor", type: "unichar" },
>         { id: "extensions.preferences1.animationduration", type: "int" },
>         { id: "extensions.preferences1.animationenabled", type: "bool" },
>     ]);
>
>     // Force the element updates
>     Preferences.updateAllElements();
>
>     Services.console.logStringMessage("Preferences 1: onload loaded preferences ");
>
>     ... other user stuff...
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/tb-planning/attachments/20190503/766a146e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jnlcinjlchjefpma.png
Type: image/png
Size: 13280 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/tb-planning/attachments/20190503/766a146e/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dddklebbdecmamgj.png
Type: image/png
Size: 24780 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/tb-planning/attachments/20190503/766a146e/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kbllajlkgplgfiha.png
Type: image/png
Size: 40981 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/tb-planning/attachments/20190503/766a146e/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pjdmhdbifdclcpad.png
Type: image/png
Size: 84007 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/tb-planning/attachments/20190503/766a146e/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thunderbird_blog2.png
Type: image/png
Size: 846 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/tb-planning/attachments/20190503/766a146e/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: menuOnTop-1.14pre40.xpi
Type: application/x-xpinstall
Size: 98561 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/tb-planning/attachments/20190503/766a146e/attachment-0001.xpi>


More information about the tb-planning mailing list