Closed eyalroz closed 4 months ago
This would lead to "Betterbird-only" extensions. We don't think anyone wants this.
The WL is way overloaded to cater for all that former XUL overlay extensions might want to do. We suggest not to use it, but instead pick the required bits and reduce the experiment part of the extension to a minimum, see for example here:
https://github.com/Betterbird/quick-folder-move-extension-classic/blob/Classic/src/api/quickmove.js
This would lead to "Betterbird-only" extensions. We don't think anyone wants this.
Actually, it won't. It will have, rather, an opposite effect. You see, everyone wants their extension to be loaded into TB. But - this mechanism will reduce the amount of extensions-specific content to a minimum, that's declarative. The rest will be built-in in BB, but added as a souped-up WindowListener, for TB.
That will make writing and loading a regular extension simpler for both BB and TB.
We suggest not to use it, but instead pick the required bits and reduce the experiment part of the extension to a minimum
A poor suggestion for two reasons:
@Betterbird : I am slowly implementing my end of this approach. So far I've gotten to this point:
(async function () {
messenger.WindowListener.registerChromeUrls(); // no need for arguments, takes a list of locale specs from the manifest
registerChromeInjectors([
["messenger.xhtml", "messenger.js"],
["about:3pane", "3pane.js"],
["customizeToolbar.xhtml", "customizeToolbar.js"]
]);
registerDefaultPrefs(); // no need for arguments, uses the extension's short name
// from the manifest to generate a default location: `default/preferences/${shortname}.js`
registerOptionsPage(); // no need for arguments, uses the extension's short name
// from the manifest to generate a default URI
messenger.WindowListener.startListening();
})();
I'm now mulling over whether to put the overlay injector scripts in the manifest, or already go another step further and try to get rid of them altogether. With that done, I will have reached a completely extension-neutral background.js
, so that extension authors have nothing to do other than specify a few details in the manifest.json
.
As we all know, TB has dropped the regular extension/chrome loading mechanism which had been used for years. Instead, to load an extension, one must use a sort of a "loophole", a WebExtension "Experiment" which asks for some specific privileges, and can then load chrome by using those privileges. This is John Bieling's
WindowListener
mechanism.It would be nice if BetterBird could support loading extensions without each extension having to explicitly include the WindowListener, and some boilerplate imperative code which uses it. Instead, BB could arrange it so that an extension could be declarative in describing its content, the way things used to be in the past, and BB would hold the imperative code to parse the declarations and load what's necessary.
Note that this is not far from where extensions already are right now. To use mine as an example: Look at my BiDiMailUI's
background.js
script (the basic imperative code which gets run for an extension:The main parts of this code are actually two tables and two individual URIs:
Now, an extension could provide the first two items in the manifest, and the tables in some separate file-per-table (e.g. a JSON file or whatever is convenient). Then BB could do the work that my background.js does now. And the extension could (if it were to forego TB support) shed:
manifest.json
background.js
(43 lines)schema.json
: 108 lineswhich is a nice win. Again, most of the implementation would simply be the current code of WindowListener.