Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug a Thunderbird addon/extension's JavaScript

I want to develop a Thunderbird 12 addon. I have written a simple JS function. (File: "chrome\content\myApp.js"). This file is called by a xul-'onclick'-event. I have packed my addon as a .xpi file and then I have installed it. (All ok, it's working!)

Now I'd like to debug my JS functions. But I can't find a working JS Debugger. I have tried this addons:

  • "Javascript Debugger"(0.9.89). Not working: The thread doesn't stop at my breakpoints.
  • Firebug(1.7.2) + Chromebug(1.7.2). Not working: I can't enable the JS debug tab. (Update: I also can't set/change a "context")
like image 777
Mimefilt Avatar asked May 25 '12 10:05

Mimefilt


People also ask

How do I debug HTML in Firefox?

There are three ways to open the debugger: Select the Debugger panel in the Web Developer Tools, accessible from the Browser Tools submenu. Press Ctrl + Shift + Z on Windows and Linux, or Cmd + Opt + Z on macOS (starting in Firefox 71; prior to Firefox 66, the letter in this shortcut was S ). Press the menu button.


2 Answers

Happily we once again have a debugger for Thunderbird! You need a newer/nightly version, but hanks to Philipp Kewisch's summer of code project we can use the Firefox debugger to remotely debug Thunderbird. More details at the following links: http://kewisch.wordpress.com/2013/09/22/thunderbird-developer-tools-wrapup/ http://kewisch.wordpress.com/2013/06/13/the-thunderbird-remote-debugger-is-alive/ https://bugzilla.mozilla.org/show_bug.cgi?id=876636

If you are really committed to TB12, you can debug on the nightly then test on TB12.

like image 103
studgeek Avatar answered Sep 21 '22 01:09

studgeek


Unfortunately there's no such thing as a decent debugger for chrome (addons) javascript. Chromebug has been long abandoned, venkman doesn't work, addon authors are a little bit stranded there. A new debugging API called JSD2 is in the works at Mozilla, but it looks from the wiki that it's mostly targeted at content (webpage) javascript, not chrome (addons) javascript, at least not in the short term.

Fortunately, a very recent effort seems to have paid off: there's now a way to execute easily small snippets of javascript in a decent console-like window. See http://mikeconley.ca/blog/2012/05/11/scratchpad-ported-to-thunderbird-kinda/ for the details :).

like image 44
Jonathan Protzenko Avatar answered Sep 22 '22 01:09

Jonathan Protzenko