User:Clarkbw/Bugzilla Link Grabber Extension

From MozillaWiki
Jump to: navigation, search

What is This?

This is an extension I wrote on Thursday April 3rd 2008 for Thunderbird. The extension looks at the mail in thunderbird's message pane munging bugzilla links and references.

The extension converts in two ways:

  • converting long bugzilla links to short form
  • converting bug shorthand notation into links
    • e.g. bug XXX into <a>bug XXX</a>
    • these bug links use the default bugzilla urls and can sometimes be incorrect

The extension has 2 bugzilla system urls included by default

STOP!! This extension requires the STEEL Extension be installed, go grab it from bug 408370 before you wonder why it doesn't work. Also it currently only runs on the 3.0.* nightly builds of Thunderbird. Oh and I love pizza, yummm.



Where can I get it?

github thunderbird-bugzilla-link-grabber

How to Install an Extension in Thunderbird

  1. Install the STEEL Extension from bug 408370
  2. Right-click the link below and choose "Save Link As..." to download and save the file to your hard disk.
  3. In Mozilla Thunderbird, open Add-ons from the Tools menu.
  4. Click the Install button, and locate/select the file you downloaded and click "OK".
Extension (for now) 

Will you be adding this Feature?

Right now this works just about as well as I'd like it to. The source code is completely available and I'd love to see people try out different things. Don't ask me if you can do something, just go try it. If you want to try something but aren't sure what to do, see the TODO below or ask me for some ideas.

Can you package this up for AMO?

I have no idea how to do that. If you do then I'd love to see you take over that part of the project, just send me an email or write in the Talk for this page.


The different bugzillas are stored in the extension preferences. You'll notice the format in the defaults/preferences/bugzillalinkgrabber.js file.

The top level list of bugzillas is at this preference branch id


Such that any bugzilla will show up with the name that proceeds that id. This name is seen in the context menu of the user interface.


And that name will be assigned the value of the URL it's equal to


So if you wanted to add a new default bugzilla in the preferences you could add a line like this.


And in the context menu people would see' and bug URLs would link to


There are lots of things to get done, these are the ones that are on my radar.


This needs some work and I didn't get a chance to figure out how to fix it. If you know what you're doing with that then grab the source, fix it, and send patches.

Make Preferences Window useful

Right now the preferences window is just junk that came with the extension. The purpose of the options is to allow people to add and remove bugzilla URLs to help customize the plugin to their needs.

Here's some simple ASCII art of how it could look.

|   +--------------------------------------------------------------------------------+   |
|   | name                     | url                                                 |   |
|   |     |     |   |
|   |       |        |   |
|   | |  |   |
|   |                          |                                                     |   |
|   +--------------------------------------------------------------------------------+   |
|   [ add ]  [ edit ]  [ remove ]                                          [ close ]     |

There should also be a way to set the default bugzilla

Get the Context Link Menu Working

The point of the right click context menu is that every "bug ###" text gets linkified to your default bugzilla URL. However sometimes the bugzilla you want is actually another one. We can list the alternate bugzillas in the context menu allowing you to choose the correct one apart from the default.

| Copy Link Location
| Save Link Target       |
| Open Bug in Bugzilla > | +--------------------------+
+------------------------+ |     |
                           |       |
                           | |

mockup of auto-link context menu

Known Issues

I found the following issues when using the preview version of STEEL and the just-released AJAX version of Bugzilla Link Grabber.

  • "undefined"
    • Sometimes comments that get appended by the AJAX version show up as "undefined".
  • "An error occurred executing the cmd_copy command"
    • Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIController.doCommand]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: chrome://global/content/globalOverlay.js :: goDoCommand :: line 81" data: no
    • Occurs when you highlight some comments in the AJAX-appended words and attempt to copy.
  • Leaks in
    • nsDocument
    • nsGlobalWindow

by nth10sd 22:48, 7 April 2008 (PDT)


The bugzilla regex was grabbed from the bugzilla munger for chatzilla. I'm glad they did the work to make that regex because I definitely couldn't have.