调试 Thunderbird 扩展

Debugging a Thunderbird extension

我正在开发 Thunderbird 扩展,不幸的是,我无法区分哪些仍然有效,哪些无效。网上有很多东西,但是,大部分都不再适用于最近的 Thunderbird。

  1. 至少,我需要一种查看来自扩展程序的日志消息的方法,这样我才能知道哪些有效,哪些无效。理想情况下,我想要一个完整的调试控制台。 Whosebug 上有对 Thunderbird 开发人员工具的引用,但似乎没有办法下载它们。

  2. 我还希望能够执行 Javascript,它可以通过控制台引用我的扩展程序。当我通过 Thunderbird 的控制台尝试此操作时,我收到错误消息。即使在使用其他人的扩展时我也会得到这个,所以我必须假设扩展超出了控制台的范围

如何获得新 Thunderbird 扩展的可见性和交互?

2020 年更新:

如果您正在编写 MailExtension(这就是 Thunderbird 调用 WebExtension 的方式),您应该查看 WebExtensions 中的一般调试,例如https://extensionworkshop.com/documentation/develop/debugging/

您可能还应该在 https://developer.thunderbird.net/add-ons/about-add-ons

查看有关 MailExtension 的一般开发人员文档

下面列出的想法是为 Legacy Overlay Extension 编写的,它在较新的 Thunderbird 版本中不起作用。


记录消息

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()所述。

另一种方法是登录到启动 Thunderbird 的(本机)控制台。这是通过 dump().

完成的

记录消息的最新方法是使用 Log.jsm 模块。它是不同日志记录方法的一个非常好的包装器,也是我在 Thunderbird 中记录消息的首选方式。

Thunderbird 开发者工具

由于您没有链接到参考文献,我不能 100% 确定,但我认为您的意思是 remotely debug Thunderbird through Firefox 的可能性。你不需要下载任何东西来使用它,它已经集成在 Thunderbird 中。

执行可以引用我的扩展的Javascript

通过 Firefox 远程调试 Thunderbird 还可以访问控制台和开发人员工具中的 Scratchpad。两者都应该也可以访问附加组件。

您可能还想看看 Tiny JavaScript Debugger。它还允许在调试时执行任意代码。