Extensions support in SeaMonkey 2

  • Revision slug: Extensions_support_in_SeaMonkey_2
  • Revision title: Extensions support in SeaMonkey 2
  • Revision id: 443097
  • Created:
  • Creator: Editmonkey
  • Is current revision? No
  • Comment Change tense, fix minor style mistake

Revision Content

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 extensions 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.0.*</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 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 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

Revision Source

<p>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.</p>
<h3 id="The_Basics">The Basics</h3>
<p>To support SeaMonkey 2 as a target application, you need to add it to the list of target applications in the extensions<a class="internal" href="/en/Install_Manifests" title="En/Install Manifests"> install.rdf</a> file. The code for that will look something like this:</p>
<pre>
&lt;em:targetApplication&gt;
  &lt;!-- SeaMonkey --&gt;
  &lt;Description&gt;
    &lt;em:id&gt;{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}&lt;/em:id&gt;
    &lt;em:minVersion&gt;2.0&lt;/em:minVersion&gt;
    &lt;em:maxVersion&gt;2.0.*&lt;/em:maxVersion&gt;
  &lt;/Description&gt;
&lt;/em:targetApplication&gt;</pre>
<p>The install.js is not supported any more and should be removed.</p>
<h3 id="Differences_as_compared_to_other_toolkit.2F-based_applications">Differences as compared to other toolkit/-based applications</h3>
<ul>
  <li>
    <p>You need to overlay/open different chrome URLs as compared to Firefox. Some URLs are listed below:</p>
    <table border="1" cellpadding="1" cellspacing="1" style="width: 100%; height: 69px;">
      <tbody>
        <tr>
          <td style="background-color: rgb(204, 255, 204);">URL&nbsp;in Firefox</td>
          <td style="background-color: rgb(204, 255, 204);">URL&nbsp;in SeaMonkey</td>
          <td style="background-color: rgb(204, 255, 204);">Overlays</td>
        </tr>
        <tr>
          <td><a class="external" href="chrome://browser/content/browser.xul" rel="freelink">chrome://browser/content/browser.xul</a></td>
          <td><a class="external" href="chrome://navigator/content/navigator.xul" rel="freelink">chrome://navigator/content/navigator.xul</a></td>
          <td>Main browser window</td>
        </tr>
        <tr>
          <td><a class="external" href="chrome://browser/content/pageinfo/pageInfo.xul" rel="freelink">chrome://browser/content/pageinfo/pageInfo.xul</a></td>
          <td><a class="external" href="chrome://navigator/content/pageinfo/pageInfo.xul" rel="freelink">chrome://navigator/content/pageinfo/pageInfo.xul</a></td>
          <td>Page Info window</td>
        </tr>
        <tr>
          <td><a class="external" href="chrome://browser/content/preferences/permissions.xul" rel="freelink">chrome://browser/content/preferences/permissions.xul</a></td>
          <td><a class="external" href="chrome://communicator/content/permissions/permissionsManager.xul" rel="freelink">chrome://communicator/content/permis...onsManager.xul</a></td>
          <td>Permissions Manager dialog</td>
        </tr>
      </tbody>
    </table>
    <table border="1" cellpadding="1" cellspacing="1" style="width: 100%;">
      <caption>
        <br />
        URLs added in 2.1</caption>
      <tbody>
        <tr style="background-color: rgb(204, 255, 204);">
          <td>URL in Firefox</td>
          <td>URL&nbsp;in Seamonkey</td>
        </tr>
        <tr>
          <td><a class="external" href="chrome://browser/content/bookmarks/bookmarksPanel.xul" rel="freelink">chrome://browser/content/bookmarks/bookmarksPanel.xul</a></td>
          <td><a class="external" href="chrome://communicator/content/bookmarks/bm-panel.xul" rel="freelink">chrome://communicator/content/bookmarks/bm-panel.xul</a></td>
        </tr>
        <tr>
          <td><a class="external" href="chrome://browser/content/places/places.xul" rel="freelink">chrome://browser/content/places/places.xul</a></td>
          <td><a class="external" href="chrome://communicator/content/bookmarks/bookmarksManager.xul" rel="freelink">chrome://communicator/content/bookma...rksManager.xul</a></td>
        </tr>
      </tbody>
    </table>
    <strong>Thunderbird</strong> uses mostly the same chrome URLs for overlaying as SeaMonkey. There are exceptions, but these are few and far between.</li>
  <li>&nbsp;</li>
  <li>
    <p>SeaMonkey also uses different ids for the menu items. Some important menu ids are listed below, menu ids are based on Firefox 3 source code:</p>
    <table border="1" cellpadding="1" cellspacing="1" style="width: 800px; height: 223px;">
      <tbody>
        <tr>
          <td style="background-color: rgb(204, 255, 255);"><strong>Menu id in Firefox</strong></td>
          <td style="background-color: rgb(204, 255, 255);"><strong>Menu id in SeaMonkey 1.x and 2.0</strong></td>
          <td style="background-color: rgb(204, 255, 255);"><strong>SeaMonkey 2.1</strong></td>
          <td style="background-color: rgb(204, 255, 255);"><strong>Overlays</strong></td>
        </tr>
        <tr>
          <td>menu_FilePopup</td>
          <td>menu_FilePopup</td>
          <td>menu_FilePopup</td>
          <td>File menu popup</td>
        </tr>
        <tr>
          <td>menu_EditPopup</td>
          <td>menu_Edit_Popup</td>
          <td>menu_EditPopup</td>
          <td>Edit menu popup</td>
        </tr>
        <tr>
          <td>menu_viewPopup</td>
          <td>menu_View_Popup</td>
          <td>menu_View_Popup</td>
          <td>View menu popup</td>
        </tr>
        <tr>
          <td>-</td>
          <td>goPopup</td>
          <td>goPopup</td>
          <td>Go menu popup</td>
        </tr>
        <tr>
          <td>placesPopup</td>
          <td>-</td>
          <td>-</td>
          <td>History menu popup</td>
        </tr>
        <tr>
          <td>bookmarksMenuPopup</td>
          <td>menu_BookmarksPopup</td>
          <td>menu_BookmarksPopup</td>
          <td>Bookmarks menu popup</td>
        </tr>
        <tr>
          <td>menu_ToolsPopup</td>
          <td>taskPopup</td>
          <td>taskPopup</td>
          <td>Tools menu popup</td>
        </tr>
        <tr>
          <td>-</td>
          <td>windowPopup</td>
          <td>windowPopup</td>
          <td>Window menu popup</td>
        </tr>
        <tr>
          <td>menu_HelpPopup</td>
          <td>helpPopup</td>
          <td>helpPopup</td>
          <td>Help menu popup</td>
        </tr>
      </tbody>
    </table>
  </li>
</ul>
<h3 id="URLbar_Icons">URLbar Icons</h3>
<p>To to display a button with a menupopup in the urlbar-icons for both Firefox and SeaMonkey 2.0, use this code:</p>
<p><code>&nbsp;&nbsp;&nbsp; &lt;hbox id="urlbar-icons"&gt;<br />
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;image popup="myExt-menu"/&gt;<br />
  &nbsp;&nbsp;&nbsp; &lt;/hbox&gt;<br />
  &nbsp;&nbsp;&nbsp; &nbsp;&lt;window id="main-window"&gt;<br />
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;menupopup id="myExt-menu"&gt;<br />
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;menuitem label="menuitem"/&gt;<br />
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;menuitem label="menuitem"/&gt;<br />
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/menupopup&gt;<br />
  &nbsp;&nbsp;&nbsp; &lt;/window&gt;</code></p>
<p>Instead of</p>
<p><span style="font-family: Helvetica;"><code>&nbsp;&nbsp;&nbsp; &lt;hbox id="urlbar-icons"&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;button type="menu"&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;menupopup&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;menuitem label="menuitem"/&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;menuitem label="menuitem"/&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;menuitem label="menuitem"/&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/menupopup&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/button&gt;<br />
  &nbsp;&nbsp; &lt;/hbox&gt;</code></span></p>
<p><strong>Technical Note:</strong> 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.</p>
<h3 id="The_Statusbar">The Statusbar</h3>
<p>In Firefox 3 new <code>vbox</code> 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.</p>
<p>For example, if you overlay some chrome before the status bar, like this:</p>
<pre>
&lt;vbox id="browser-bottombox"&gt;
  &lt;something insertbefore="status-bar" /&gt;
&lt;/vbox&gt;
</pre>
<p>Use the following technique to make your overlay work on both SeaMonkey 2 and Firefox 3:</p>
<pre>
&lt;window id="main-window"&gt;
  &lt;vbox id="browser-bottombox" insertbefore="status-bar"&gt;
    &lt;something insertbefore="status-bar" /&gt;
  &lt;/vbox&gt;
&lt;/window&gt;
</pre>
<h3 id="Thunderbird_3">Thunderbird 3</h3>
<h4 id="gFolderDisplay_API">gFolderDisplay API</h4>
<p>SeaMonkey 2.0 only supports a reduced set of methods:</p>
<ul>
  <li>selectedCount</li>
  <li>selectedMessage</li>
  <li>selectedMessageIsFeed</li>
  <li>selectedMessageIsImap</li>
  <li>selectedMessageIsNews</li>
  <li>selectedMessageIsExternal</li>
  <li>selectedIndices</li>
  <li>selectedMessages</li>
  <li>selectedMessageUris</li>
  <li>messageDisplay</li>
</ul>
<h4 id="gMessageDisplay_API">gMessageDisplay API</h4>
<p>SeaMonkey 2.0 only supports a reduced set of methods:</p>
<ul>
  <li>displayedMessage</li>
  <li>visible</li>
</ul>
Revert to this revision