Browse Source

Bug 1725024 - Add information about extension writing to website. r=frg

Ian Neal 3 years ago
parent
commit
9179daa169
2 changed files with 304 additions and 0 deletions
  1. 1 0
      lib/sitemap.xml
  2. 303 0
      src/dev/extensions.en.html

+ 1 - 0
lib/sitemap.xml

@@ -885,6 +885,7 @@ http://www.damowmow.com/portal/ (use the "Indentify" field)
     <page url="dev/get-involved" title="Get Involved" id="get-involved" />
     <page url="dev/qa-verification" title="QA Verification" id="qa-verification"/>
     <page url="dev/code-development" title="Building &amp; Source Code" id="code-development"/>
+    <page url="dev/extensions" title="Extensions" id="extensions"/>
     <page url="dev/useful-sites" title="Useful Sites" id="useful-sites"/>
     <page url="dev/nightly" title="Nightly Builds" id="nightly" />
     <page url="dev/project-areas" title="Project Areas" id="project-areas" />

+ 303 - 0
src/dev/extensions.en.html

@@ -0,0 +1,303 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<meta http-equiv="Content-Language" content="en">
+<meta http-equiv="Content-Style-Type" content="text/css">
+<meta http-equiv="Content-Script-Type" content="text/javascript">
+
+<link rel="top" href="../" title="SeaMonkey Project">
+<link rel="up" href="./" title="Development">
+
+<title>Extensions</title>
+</head>
+<body>
+<h1>SeaMonkey Extensions</h1>
+
+<p>
+SeaMonkey supports toolkit/-style extensions.
+</p>
+
+<h2 id="The_Basics">The Basics</h2>
+
+<p>
+To support SeaMonkey 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:
+</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.*&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>
+
+<h2 id="Differences">Differences as compared to other toolkit/-based
+applications</h2>
+
+<ul>
+  <li>
+    <p>
+    You need to overlay/open different chrome URLs as compared to Firefox. Some
+    URLs are listed below:
+    </p>
+
+    <table style="height: 69px; width: 100%;">
+      <tbody>
+        <tr style="background-color: rgb(204, 255, 204);">
+          <td>URL in Firefox</td>
+          <td>URL in SeaMonkey</td>
+          <td>Overlays</td>
+        </tr>
+        <tr>
+          <td><a class="external" rel="freelink">chrome://browser/content/browser.xul</a></td>
+          <td><a class="external" rel="freelink">chrome://navigator/content/navigator.xul</a></td>
+          <td>Main browser window</td>
+        </tr>
+        <tr>
+          <td><a class="external" rel="freelink">chrome://browser/content/pageinfo/pageInfo.xul</a></td>
+         <td><a class="external" rel="freelink">chrome://navigator/content/pageinfo/pageInfo.xul</a></td>
+         <td>Page Info window</td>
+        </tr>
+        <tr>
+          <td><a class="external" rel="freelink">chrome://browser/content/bookmarks/bookmarksPanel.xul</a></td>
+          <td><a class="external" rel="freelink">chrome://communicator/content/bookmarks/bookmarksPanel.xul</a></td>
+        </tr>
+        <tr>
+          <td><a class="external" rel="freelink">chrome://browser/content/places/places.xul</a></td>
+          <td><a class="external" rel="freelink">chrome://communicator/content/places/places.xul</a></td>
+        </tr>
+      </tbody>
+    </table>
+    Old versions of <strong>Thunderbird</strong> use mostly the same chrome URLs
+    for overlaying as SeaMonkey. There are exceptions, but these are few and far
+    between.
+  </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 style="height: 223px; width: 800px;">
+      <tbody>
+        <tr style="background-color: rgb(204, 255, 255);">
+          <td><strong>Menu id in Firefox</strong></td>
+          <td><strong>Menu id in SeaMonkey</strong></td>
+          <td><strong>Overlays</strong></td>
+        </tr>
+        <tr>
+          <td>menu_FilePopup</td>
+          <td>menu_FilePopup</td>
+          <td>File menu popup</td>
+        </tr>
+        <tr>
+          <td>menu_EditPopup</td>
+          <td>menu_EditPopup</td>
+          <td>Edit menu popup</td>
+        </tr>
+        <tr>
+          <td>menu_viewPopup</td>
+          <td>menu_View_Popup</td>
+          <td>View menu popup</td>
+        </tr>
+        <tr>
+          <td>goPopup</td>
+          <td>goPopup</td>
+          <td>Go menu popup</td>
+        </tr>
+        <tr>
+          <td>placesPopupset</td>
+          <td>placesPopupset</td>
+          <td>History menu popup</td>
+        </tr>
+        <tr>
+          <td>bookmarksMenuPopup</td>
+          <td>bookmarksMenuPopup</td>
+          <td>Bookmarks menu popup</td>
+        </tr>
+        <tr>
+          <td>menu_ToolsPopup</td>
+          <td>taskPopup</td>
+          <td>Tools menu popup</td>
+        </tr>
+        <tr>
+          <td>windowPopup</td>
+          <td>windowPopup</td>
+          <td>Window menu popup</td>
+        </tr>
+        <tr>
+          <td>-</td>
+          <td>helpPopup</td>
+          <td>Help menu popup</td>
+        </tr>
+      </tbody>
+    </table>
+  </li>
+</ul>
+
+<h2 id="URLbar_Icons">URLbar Icons</h2>
+
+<p>
+To display a button with a menupopup in the urlbar-icons for both Firefox and
+SeaMonkey, use this code:
+</p>
+
+<p>
+  <code>
+&lt;hbox id="urlbar-icons"&gt;<br>
+  &lt;image popup="myExt-menu"/&gt;<br>
+&lt;/hbox&gt;<br>
+&lt;window id="main-window"&gt;<br>
+  &lt;menupopup id="myExt-menu"&gt;<br>
+    &lt;menuitem label="menuitem"/&gt;<br>
+    &lt;menuitem label="menuitem"/&gt;<br>
+    &lt;menuitem label="menuitem"/&gt;<br>
+  &lt;/menupopup&gt;<br>
+&lt;/window&gt;
+  </code>
+</p>
+
+<p>Instead of</p>
+
+<p>
+  <code>
+&lt;hbox id="urlbar-icons"&gt;<br>
+  &lt;button type="menu"&gt;<br>
+    &lt;menupopup&gt;<br>
+      &lt;menuitem label="menuitem"/&gt;<br>
+      &lt;menuitem label="menuitem"/&gt;<br>
+      &lt;menuitem label="menuitem"/&gt;<br>
+    &lt;/menupopup&gt;<br>
+  &lt;/button&gt;<br>
+&lt;/hbox&gt;
+  </code>
+</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>
+
+<h2 id="The_Statusbar">The Statusbar</h2>
+
+<p>
+In Firefox a 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 and
+Firefox (pre-57):
+</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>
+
+<h2 id="Thunderbird_3">Thunderbird 3</h2>
+
+<h3 id="gFolderDisplay_API">gFolderDisplay API</h3>
+
+<p>SeaMonkey only supports a reduced set of methods:</p>
+
+<ul>
+ <li>selectedCount</li>
+ <li>selectedMessage</li>
+ <li>selectedMessageUri</li>
+ <li>selectedMessageIsFeed</li>
+ <li>selectedMessageIsImap</li>
+ <li>selectedMessageIsNews</li>
+ <li>selectedMessageIsExternal</li>
+ <li>selectedIndices</li>
+ <li>selectedMessages</li>
+ <li>selectedMessageUris</li>
+ <li>canArchiveSelectedMessages</li>
+ <li>displayFolder</li>
+ <li>focusedPane</li>
+ <li>messageDisplay</li>
+</ul>
+
+<h3 id="gMessageDisplay_API">gMessageDisplay API</h3>
+
+<p>SeaMonkey only supports a reduced set of methods:</p>
+
+<ul>
+ <li>displayedMessage</li>
+ <li>isDummy</li>
+ <li>visible</li>
+</ul>
+
+<h2 id="Multi-browser_compatibility">Multi-browser compatibility</h2>
+
+<p>
+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.
+</p>
+
+<h3 id="In_JavaScript_code">In JavaScript code</h3>
+
+<p>
+You can use the following technique to detect the application:
+</p>
+
+<pre>
+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
+}
+</pre>
+
+<h3 id="In_manifest_file">In manifest file</h3>
+
+<p>
+SeaMonkey uses different overlays than other applications. You can use the
+application flag to select which overlay should be used with which application:
+</p>
+
+<pre>
+<code>
+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}
+</code>
+</pre>
+
+</body>
+</html>