Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging a Thunderbird extension

I'm working on a Thunderbird extension, and, unfortunately, can't sort out what's still valid from what's not. There's lots of stuff online, but, most of it is no longer applicable to recent Thunderbird.

  1. At a minimum, I need a way of seeing log messages from the extension, so I can see what's working and what's not. Ideally, I'd like a full debug console. There is a reference on Stackoverflow to Thunderbird Developer Tools, but there doesn't seem to be a way to download them.

  2. I'd also like to be able to execute Javascript that can reference my extension via the console. When I try this via Thunderbird's console, I get error messages. I get this even when using other people's extensions, so I have to assume that extensions are outside the scope of the console

How can I get visibility and interaction to a new Thunderbird extension?

like image 360
SRobertJames Avatar asked Feb 22 '16 19:02

SRobertJames


1 Answers

2020 Update:

If you are writing a MailExtension (this is how WebExtension are called for Thunderbird) you should have a look at general debugging in WebExtensions, e.g. https://extensionworkshop.com/documentation/develop/debugging/

You should probably also take a look at the general developer documentation on MailExtension at https://developer.thunderbird.net/add-ons/about-add-ons

The thinks listed below there written for the Legacy Overlay Extension, which do not work in newer Thunderbird versions.


logging messages

As described in https://developer.mozilla.org/en-US/docs/Debugging_JavaScript, there exist 3 different consoles in Gecko. The one best accessible in Thunderbird is the Error Console. You can write messages to it through the nsIConsoleService. If you don't mind that the log messages show up as an error, you can also simply use Components.utils.reportError().

Another way is to log to the (native) console from which Thunderbird is started. This is done through dump().

The newest way to log messages is using the Log.jsm module. It is a very nice wrapper around the different logging methods, and my preferred way to log messages in Thunderbird.

Thunderbird Developer Tools

As you haven't linked to the reference, I'm not 100% sure, but I think you mean the possibility to remotely debug Thunderbird through Firefox. You don't need to download anything to use this, it is already integrated in Thunderbird.

execute Javascript that can reference my extension

Debugging Thunderbird remotely through Firefox gives also access to the console and Scratchpad in the Developer Tools. Both should have also access to the add-on.

You may also want to look at the Tiny JavaScript Debugger. It also allows the execution of arbitrary code while debugging.

like image 84
user228011 Avatar answered Sep 17 '22 13:09

user228011