Migrating raw components to add-ons

  • Revision slug: Migrating_raw_components_to_add-ons
  • Revision title: Migrating raw components to add-ons
  • Revision id: 128399
  • Created:
  • Creator: Johnath
  • Is current revision? No
  • Comment no wording changes

Revision Content

Historically, Firefox has allowed third party contributions to be added to the application's components/ directory, but beginning with Firefox 3.6, this is no longer permitted. Components added in this way are invisible to users and cannot be managed through the Firefox add-ons manager. What's worse, though, is that these components don't have a mechanism for specifying the versions of Firefox with which they are compatible, leading to poor integration and instability as users upgrade their Firefox installations.

The Firefox extension mechanism allows you to do everything that you could do through direct component drops, but also gives you and your users extra flexibility and more sophisticated versioning support.

Simple Migration

If your goal is just to get your raw component working properly as an extension, you can do this in three steps:

  1. Create a new add-on using the instructions here. As you'll see, add-ons give you much more flexibility than simply loading a component, but in order to get started, all you'll need is your directory structure and install manifest.
  2. Create a components/ directory in the root of your add-on's directory.
  3. Add your JS and binary components within that directory. They will be registered the first time Firefox is run once your add-on is installed.

JS C-Types

Some add-on authors create binary components not because they want to interact with Firefox at the C++ level, but strictly so that they can make use of third party DLLs. If this is the only reason you are using a binary component instead of JavaScript, take a look at the new JavaScript C-Types support introduced in Firefox 3.6. It allows JavaScript code to load functions from DLLs on windows, and should allow you to eliminate your dependence on binary components entirely. This leads to a better compatibility path as new versions of Firefox are released.

Revision Source

<p>Historically, Firefox has allowed third party contributions to be added to the application's <code>components/</code> directory, but beginning with <a href="/en/Firefox_3.6_for_developers" title="en/Firefox 3.6 for developers">Firefox 3.6</a>, this is no longer permitted. Components added in this way are invisible to users and cannot be managed through the Firefox add-ons manager. What's worse, though, is that these components don't have a mechanism for specifying the versions of Firefox with which they are compatible, leading to poor integration and instability as users upgrade their Firefox installations.</p>
<p>The Firefox extension mechanism allows you to do everything that you could do through direct component drops, but also gives you and your users extra flexibility and more sophisticated versioning support.</p>
<h3>Simple Migration</h3>
<p>If your goal is just to get your raw component working properly as an extension, you can do this in three steps:</p>
<ol> <li>Create a new add-on using the instructions <a href="/en/Building_an_Extension" title="en/Building an Extension">here</a>. As you'll see, add-ons give you much more flexibility than simply loading a component, but in order to get started, all you'll need is your directory structure and install manifest.</li> <li>Create a <code>components/</code> directory in the root of your add-on's directory.</li> <li>Add your JS and binary components <a href="/en/Building_an_Extension#XPCOM_Components" title="https://developer.mozilla.org/en/Building_an_Extension#XPCOM_Components">within that directory</a>. They will be registered the first time Firefox is run once your add-on is installed.</li>
</ol>
<h3>JS C-Types</h3>
<p>Some add-on authors create binary components not because they want to interact with Firefox at the C++ level, but strictly so that they can make use of third party DLLs. If this is the only reason you are using a binary component instead of JavaScript, take a look at the new <a href="/en/JavaScript_code_modules/ctypes.jsm" title="https://developer.mozilla.org/en/JavaScript_code_modules/ctypes.jsm">JavaScript C-Types</a> support introduced in Firefox 3.6. It allows JavaScript code to load functions from DLLs on windows, and should allow you to eliminate your dependence on binary components entirely. This leads to a better compatibility path as new versions of Firefox are released.</p>
Revert to this revision