Extensions support in SeaMonkey 2

Starting with SeaMonkey 2 Alpha 1 SeaMonkey supports toolkit/-style extensions. These type of extensions have many advantages for both users and developers compared to the old xpinstall/-style extensions.

The Basics

To support SeaMonkey 2 as a target application, you need to add it to the list of target applications in the extension's install.rdf file. The code for that will look something like this:

<em:targetApplication>
  <!-- SeaMonkey -->
  <Description>
    <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
    <em:minVersion>2.0</em:minVersion>
    <em:maxVersion>2.*</em:maxVersion>
  </Description>
</em:targetApplication>

The install.js is not supported any more and should be removed.

Differences as compared to other toolkit/-based applications

URLbar Icons

To display a button with a menupopup in the urlbar-icons for both Firefox and SeaMonkey 2.0, use this code:

    <hbox id="urlbar-icons">
        <image popup="myExt-menu"/>
    </hbox>
     <window id="main-window">
        <menupopup id="myExt-menu">
            <menuitem label="menuitem"/>
            <menuitem label="menuitem"/>
        </menupopup>
    </window>

Instead of

    <hbox id="urlbar-icons">
        <button type="menu">
            <menupopup>
                <menuitem label="menuitem"/>
                <menuitem label="menuitem"/>
                <menuitem label="menuitem"/>
            </menupopup>
        </button>
   </hbox>

Technical Note: The code that opens the URL history popup just looks for any menupopup, so it goes wrong if you add your own. Ordinary popups are fine of course.

The Statusbar

In Firefox 3 a new vbox has been added, called "browser-bottombox", which encloses the find bar and status bar at the bottom of the browser window. Although this doesn't affect the appearance of the display, it may affect your extension if it overlays chrome relative to these elements.

For example, if you overlay some chrome before the status bar, like this:

<vbox id="browser-bottombox">
  <something insertbefore="status-bar" />
</vbox>

Use the following technique to make your overlay work on both SeaMonkey 2 and Firefox 3:

<window id="main-window">
  <vbox id="browser-bottombox" insertbefore="status-bar">
    <something insertbefore="status-bar" />
  </vbox>
</window>

Thunderbird 3

gFolderDisplay API

SeaMonkey 2.0 only supports a reduced set of methods:

  • selectedCount
  • selectedMessage
  • selectedMessageIsFeed
  • selectedMessageIsImap
  • selectedMessageIsNews
  • selectedMessageIsExternal
  • selectedIndices
  • selectedMessages
  • selectedMessageUris
  • messageDisplay

gMessageDisplay API

SeaMonkey 2.0 only supports a reduced set of methods:

  • displayedMessage
  • visible

JavaScript Tweaks

Firefox supports some shorthand in various places. These are so commonly available that developers often forget that they are not built-ins. SeaMonkey on the other hand defaults to not support them so they either need to be expanded to their proper forms or matching constants/variables need to be defined in custom code.

Shorthand Expansion
Cc Components.classes
Ci Components.interfaces
Cr Components.results
Cu Components.utils

 

Document Tags and Contributors

Contributors to this page: wbamberg
Last updated by: wbamberg,