mozilla
Your Search Results

    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

    Multi-browser compatibility

    To make an extension compatible with SeaMonkey as well as Firefox/Thunderbird, you may need to do different things depending on which application is running the extension.

    In JavaScript code

    You can use the following technique to detect the appliacation:

    const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
    const THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
    const SEAMONKEY_ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
    var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
                            .getService(Components.interfaces.nsIXULAppInfo);
    if(appInfo.ID == FIREFOX_ID) {
      // running under Firefox
    } else if(appInfo.ID == THUNDERBIRD_ID) {
      // running under Thunderbird
    } else if(appInfo.ID == SEAMONKEY_ID) {
      // running under SeaMonkey
    } else {
      // another app
    }

    See Using nsIXULAppInfo for more details.

    In manifest file

    SeaMonkey uses different overlays than other applications. You can use the application flag to select which overlay should be used with which application:

    overlay chrome://browser/content/browser.xul chrome://myaddon/content/ffOverlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
    overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/tbOverlay.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6}
    overlay chrome://navigator/content/navigator.xul chrome://myaddon/content/smOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}

    Document Tags and Contributors

    Last updated by: VeridianDynamics,
    Hide Sidebar