14
edits
(Formatting) |
(→adding a listener via tabs vs via windows: Answered the questions) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
==== Removing install.rdf? ==== | ==== Removing install.rdf? ==== | ||
'''Question''': "To use this overlay loader... extensions must replace <tt>install.rdf</tt> file with a ... <tt>manifest.json</tt>". <- isn't it enough to just ''add'' a <tt>manifest.json</tt> file? Or do I actually need to remove the <tt>install.rdf<tt> to prevent Thunderbird from mishandling my extension? | '''Question''': "To use this overlay loader... extensions must replace <tt>install.rdf</tt> file with a ... <tt>manifest.json</tt>". <- isn't it enough to just ''add'' a <tt>manifest.json</tt> file? Or do I actually need to remove the <tt>install.rdf</tt> to prevent Thunderbird from mishandling my extension? | ||
'''Answer''': | |||
==== Name confusion ==== | ==== Name confusion ==== | ||
Line 10: | Line 12: | ||
'''Question''': <tt>AddonManager.getAddonByID(...)</tt> used to be called asynchronously, it seems to not be called anymore? | '''Question''': <tt>AddonManager.getAddonByID(...)</tt> used to be called asynchronously, it seems to not be called anymore? | ||
'''Answer''': It is returning a promise now. | |||
==== A sample extension? ==== | ==== A sample extension? ==== | ||
Line 15: | Line 19: | ||
This sounds good. I'd like to create a WebExtensions addon... but I read [https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json this page] and it said that a <tt>manifest.json</tt> 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! | This sounds good. I'd like to create a WebExtensions addon... but I read [https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json this page] and it said that a <tt>manifest.json</tt> 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 <tt>https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension</tt> ? | '''Suggestion''': Could someone create a sample web extension, something like <tt>https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension</tt> ? 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 ==== | ==== Need to "create" APIs ==== | ||
Line 21: | Line 26: | ||
'''Question''': Can I write an addon and use the API that are already there... or do I have to create everything? | '''Question''': Can I write an addon and use the API that are already there... or do I have to create everything? | ||
'''Answer''': | '''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 ==== | ==== stringbundle removal and nsIStringBundleService ==== | ||
Line 29: | Line 34: | ||
let sb = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService); | let sb = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService); | ||
'''Answer''': <tt>nsIStringBundleService</tt> goes away as well. You need to use | '''Answer''': <tt>nsIStringBundleService</tt> goes away as well. You need to use | ||
Services.strings.createBundle(...) | Services.strings.createBundle(...) | ||
as suggested on the page. | as suggested on the page. | ||
====windows | ==== adding a listener via tabs vs via windows ==== | ||
I | '''Question:''' When I try | ||
browser.tabs.onCreated.addListener(newTab); | browser.tabs.onCreated.addListener(newTab); | ||
and | that works, and runs newTab. but if I try | ||
I | |||
browser.windows.onCreated.addListener(newWindow); | 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. |
edits