Talk:Thunderbird/Add-ons Guide 63

From MozillaWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

(Please place your question in a separate section, with a relevant heading.)

Removing install.rdf?

Question: "To use this overlay loader... extensions must replace install.rdf file with a ... manifest.json". <- isn't it enough to just add a manifest.json file? Or do I actually need to remove the install.rdf to prevent Thunderbird from mishandling my extension?

Answer:

Name confusion

Suggestion: It seems to me that it would be good to make clear somehow that bootstrapped and restartless are the same things - especially as we talk about overlay legacy addons and bootstrapped legacy addons.

Question: AddonManager.getAddonByID(...) used to be called asynchronously, it seems to not be called anymore?

Answer: It is returning a promise now.

A sample extension?

This sounds good. I'd like to create a WebExtensions addon... but I read this page and it said that a manifest.json file is all that's required. I tried that, did a VERY basic manifest.json and zipped it and tried loading it in TB and was told it looked corrupted!

Suggestion: Could someone create a sample web extension, something like https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension ? Thanks! There are a number of helpful extensions here : https://github.com/thundernest/sample-extensions/tree/master/addressBooks Also if you donwload the extension: Owl for exchange - you need to have a beta version of TB, you'll have a good example of many things.

Need to "create" APIs

Question: Can I write an addon and use the API that are already there... or do I have to create everything?

Answer: You can use the API at https://thunderbird-webextensions.readthedocs.io/en/latest/. That page also provides a link to a document on Web Extensions Experiment with good explanations of details. Under the Address book API there is an example addon.

stringbundle removal and nsIStringBundleService

Question: Thunderbird 63 - does removing XUL stringbundleset/stringbundle, also effect nsIStringBundleService?
Or can this still be used - e.g.:

 let sb = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);

Answer: nsIStringBundleService goes away as well. You need to use

 Services.strings.createBundle(...)

as suggested on the page.

adding a listener via tabs vs via windows

Question: When I try

 browser.tabs.onCreated.addListener(newTab);

that works, and runs newTab. but if I try

 browser.windows.onCreated.addListener(newWindow);

this doesn't work, although these events look exactly the same. What is the difference?

Answer: the windows API is different from the tabs API and so this doesn't work. You can add a listener to a new window with a WebExtensions Experiments addon.