Difference between revisions of "Development:Porting or Using Firefox Extensions with Camino"

From Camino Wiki
Jump to navigation Jump to search
(→‎Non-exhaustive list of extensions known to work in Camino 2.1: Add JSONView, which provides inline, syntax-hightlighted display of .json files)
 
(4 intermediate revisions by the same user not shown)
Line 10: Line 10:
  
 
* No XUL
 
* No XUL
*: Camino is an embedding application; it embeds the Gecko rendering engine,  and a certain amount of the Mozilla platform relevant to core web browser features, inside a native Cocoa application.  Camino does not use XUL for the browser’s user interface, and XUL in the content area does not work.  Any extension that relies on overlaying <code>browser.xul</code> will not work (or will require changes).
+
*: Camino is an embedding application; it embeds the Gecko rendering engine,  and a certain amount of the Mozilla platform relevant to core web browser features, inside a native Cocoa application.  Camino does not use XUL for the browser’s user interface, and XUL in the content area does not work.  Any extension that relies on overlaying <code>browser.xul</code> will not work (or will require changes, e.g., to have an XPCOM component load ancillary scripts).
 
*: Extensions that require UI for configuration will need a [[Development:Third-Party_Preference_Panes|Camino preference pane]] to allow the user to change Gecko preferences from Camino, or the user will have to edit the Gecko preference files directly.
 
*: Extensions that require UI for configuration will need a [[Development:Third-Party_Preference_Panes|Camino preference pane]] to allow the user to change Gecko preferences from Camino, or the user will have to edit the Gecko preference files directly.
*: The supported mechanism for adding a toolbar button is an AppleScript [[Development:Camino_AppleScript_Guide#Implementing_Toolbar_Script_Items|toolbar script item]].  However, AppleScripts currently have limited access to Camino’s internals, and no AppleScript<->XPCOM bridge is known to exist.
+
*: The supported mechanism for adding a toolbar button is an AppleScript [[Development:Camino_AppleScript_Guide#Implementing_Toolbar_Script_Items|toolbar script item]].  However, AppleScripts currently have limited access to Camino’s internals, and no AppleScript<->XPCOM or AppleScript<->XPConnect bridge is known to exist ({{bug|61356}}).
 
* No Firefox-specific functions and libraries
 
* No Firefox-specific functions and libraries
*: Camino does not have a <code>browser.js</code>, [https://developer.mozilla.org/en/FUEL FUEL], or any other Firefox-specific code or code wrappers/shortcuts.  If an extension talks to Gecko using Gecko APIs, there is a decent chance it will work, but anything that relies on Firefox code (e.g., finding the XUL <code>&lt;browser&gt;</code> element or talking to the <code>tabbrowser</code> JavaScript object) will not work (or will have to be rewritten).
+
*: Camino does not have a <code>browser.js</code>, [https://developer.mozilla.org/en/FUEL FUEL], [https://developer.mozilla.org/en/Jetpack Jetpack], or any other Firefox-specific code or code wrappers/shortcuts.  If an extension talks to Gecko using Gecko APIs, there is a decent chance it will work, but anything that relies on Firefox code (e.g., finding the XUL <code>&lt;browser&gt;</code> element or talking to the <code>tabbrowser</code> JavaScript object) will not work (or will have to be rewritten).
 
* No Extension Manager or extensions system
 
* No Extension Manager or extensions system
 
*: Camino does not include the Extensions Manager or a formal extensions system.  Camino 2.1 does register (JavaScript) XPCOM components from the profile’s <code>components</code> folder at startup, and it also registers chrome from the profile’s <code>chrome</code> folder at startup.  (In addition, Camino 2.1 will load NPAPI plug-ins from the profile’s <code>Internet Plug-Ins</code> folder, allowing for the installation of plug-ins that only Camino will use.)  As a consequence, many Firefox extensions that do work in Camino must be unpacked and manually installed, and any updates must also be manually downloaded and installed.
 
*: Camino does not include the Extensions Manager or a formal extensions system.  Camino 2.1 does register (JavaScript) XPCOM components from the profile’s <code>components</code> folder at startup, and it also registers chrome from the profile’s <code>chrome</code> folder at startup.  (In addition, Camino 2.1 will load NPAPI plug-ins from the profile’s <code>Internet Plug-Ins</code> folder, allowing for the installation of plug-ins that only Camino will use.)  As a consequence, many Firefox extensions that do work in Camino must be unpacked and manually installed, and any updates must also be manually downloaded and installed.
Line 35: Line 35:
 
** Installation instructions: Unpack the extension and install the <code>inlinedisposition.js</code> file in your Camino profile’s <code>components</code> folder, then launch Camino.
 
** Installation instructions: Unpack the extension and install the <code>inlinedisposition.js</code> file in your Camino profile’s <code>components</code> folder, then launch Camino.
 
** [http://code.kliu.org/misc/inlinedisposition/attachtest.pl Test page]
 
** [http://code.kliu.org/misc/inlinedisposition/attachtest.pl Test page]
 +
 +
* [https://addons.mozilla.org/en-US/firefox/addon/jsonview/ JSONView], v0.7
 +
*: Displays JSON files inline with syntax highlighting
 +
** Installation instructions: Unpack the extension. Install the <code>components/jsonview.js</code> file in your Camino profile’s <code>components</code> folder, then copy the <code>content</code> and <code>locale</code> folders and the <code>chrome.manifest</code> file into your Camino profile’s <code>chrome</code> folder.  Then launch Camino.
 +
**: Note: If you have other installed extensions that install chrome, you should rename <code>chrome.manifest</code> to <code>jsonview.manifest</code>, add a <code>jsonview</code> folder to your Camino profile’s <code>chrome</code> folder and move JSONView’s <code>content</code> and <code>locale</code> folders there instead.  You will then need to modify the paths in the <code>jsonview.manifest</code> file to point to the correct locations, e.g. <code>content/</code> becomes <code>jsonview/content/</code> and <code>locale/en/</code> becomes <code>jsonview/locale/en/</code>.
 +
** [http://jsonview.com/example.json Test page]
  
 
* Certain content-blocking tools
 
* Certain content-blocking tools
 
** [https://bugzilla.mozilla.org/attachment.cgi?id=573330 Attachment 573330] on {{bug|656584}} illustrates how to convert a simple [https://addons.mozilla.org/en-US/firefox/addon/blocksite/ BlockSite] script into a JavaScript XPCOM component that Camino 2.1 can use.
 
** [https://bugzilla.mozilla.org/attachment.cgi?id=573330 Attachment 573330] on {{bug|656584}} illustrates how to convert a simple [https://addons.mozilla.org/en-US/firefox/addon/blocksite/ BlockSite] script into a JavaScript XPCOM component that Camino 2.1 can use.

Latest revision as of 14:10, 27 April 2012

DRAFT
This page is not complete.

Camino has had limited support for UI-less Gecko platform (“Firefox”) extensions for some time; for instance, in the Camino 0.x era, the third-party preference pane “CamiFlash” offered a Flash-blocking feature that used the Flashblock extension.

Camino 2.1 added new features that may allow more extensions to work with Camino; however, as before, several caveats apply.

As a general rule, extensions that interact primarily with web content, have no UI (other than perhaps a toolbar button to toggle behavior on or off) and are implemented largely as JavaScript XPCOM components or XBL bindings to web content, or extensions that have already been ported to Safari or Google Chrome, are most likely to work, or easily be made to work, in Camino 2.1.

Non-exhaustive list of extension-related differences between Camino and Firefox

  • No XUL
    Camino is an embedding application; it embeds the Gecko rendering engine, and a certain amount of the Mozilla platform relevant to core web browser features, inside a native Cocoa application. Camino does not use XUL for the browser’s user interface, and XUL in the content area does not work. Any extension that relies on overlaying browser.xul will not work (or will require changes, e.g., to have an XPCOM component load ancillary scripts).
    Extensions that require UI for configuration will need a Camino preference pane to allow the user to change Gecko preferences from Camino, or the user will have to edit the Gecko preference files directly.
    The supported mechanism for adding a toolbar button is an AppleScript toolbar script item. However, AppleScripts currently have limited access to Camino’s internals, and no AppleScript<->XPCOM or AppleScript<->XPConnect bridge is known to exist (Bug 61356).
  • No Firefox-specific functions and libraries
    Camino does not have a browser.js, FUEL, Jetpack, or any other Firefox-specific code or code wrappers/shortcuts. If an extension talks to Gecko using Gecko APIs, there is a decent chance it will work, but anything that relies on Firefox code (e.g., finding the XUL <browser> element or talking to the tabbrowser JavaScript object) will not work (or will have to be rewritten).
  • No Extension Manager or extensions system
    Camino does not include the Extensions Manager or a formal extensions system. Camino 2.1 does register (JavaScript) XPCOM components from the profile’s components folder at startup, and it also registers chrome from the profile’s chrome folder at startup. (In addition, Camino 2.1 will load NPAPI plug-ins from the profile’s Internet Plug-Ins folder, allowing for the installation of plug-ins that only Camino will use.) As a consequence, many Firefox extensions that do work in Camino must be unpacked and manually installed, and any updates must also be manually downloaded and installed.
    Since the chrome folder is shared, renaming chrome.manifest to extension.manifest will prevent multiple extensions from clobbering each other’s chrome registration directives.
  • Camino 2.1 uses Gecko 1.9.2
    Camino 2.1 uses Gecko 1.9.2, the same version of Gecko used by Firefox 3.6.x, with all of the same Gecko requirements and limitations (e.g., old-style XPCOM registration boilerplate).

Non-exhaustive list of extensions known to work in Camino 2.1

  • Universal Behavioral Advertising Opt-out, v1.0
    Sends the “Do Not Track” HTTP header to websites
    • Installation instructions: Unpack the extension and install the universal.js file in your Camino profile’s components folder, then launch Camino.
    • Test page
  • InlineDispositon, v1.0.2.4
    Prevents sites from using HTTP content-disposition: attachment headers to force files to be downloaded
    • Installation instructions: Unpack the extension and install the inlinedisposition.js file in your Camino profile’s components folder, then launch Camino.
    • Test page
  • JSONView, v0.7
    Displays JSON files inline with syntax highlighting
    • Installation instructions: Unpack the extension. Install the components/jsonview.js file in your Camino profile’s components folder, then copy the content and locale folders and the chrome.manifest file into your Camino profile’s chrome folder. Then launch Camino.
      Note: If you have other installed extensions that install chrome, you should rename chrome.manifest to jsonview.manifest, add a jsonview folder to your Camino profile’s chrome folder and move JSONView’s content and locale folders there instead. You will then need to modify the paths in the jsonview.manifest file to point to the correct locations, e.g. content/ becomes jsonview/content/ and locale/en/ becomes jsonview/locale/en/.
    • Test page