From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../index.html | 167 +++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 files/id/mozilla/add-ons/setting_up_extension_development_environment/index.html (limited to 'files/id/mozilla/add-ons/setting_up_extension_development_environment/index.html') diff --git a/files/id/mozilla/add-ons/setting_up_extension_development_environment/index.html b/files/id/mozilla/add-ons/setting_up_extension_development_environment/index.html new file mode 100644 index 0000000000..6519e6752d --- /dev/null +++ b/files/id/mozilla/add-ons/setting_up_extension_development_environment/index.html @@ -0,0 +1,167 @@ +--- +title: Setting up an extension development environment +slug: Mozilla/Add-ons/Setting_up_extension_development_environment +translation_of: Archive/Add-ons/Setting_up_extension_development_environment +--- +

This article gives suggestions on how to set up your Mozilla application for extension development. Unless otherwise specified, these suggestions apply to both Firefox and Thunderbird as well as SeaMonkey version 2.0 and above.

+ +

Overview

+ + + +

Development profile

+ +

To avoid performance degradation from development-related prefs and extensions, and to avoid losing your personal data, you can use a separate profile for development work.

+ +

You can run two instances of Thunderbird or Firefox at the same time by using separate profiles and starting the application with parameters -no-remote and -P ProfileName. For example, the following command will start Firefox with a profile called "dev" whether an instance of Firefox is already running or not. (If there is no "dev" user yet, you'll get the profile selection screen instead, where you can create one.)

+ +

On Ubuntu (and many other Linux distributions):

+ +
/usr/bin/firefox -no-remote -P dev
+ +

On some other distributions of Linux/Unix:

+ +
/usr/local/bin/firefox -no-remote -P dev
+
+ +

On Mac OS Snow Leopard (10.6) and newer:

+ +
/Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -P dev &
+
+ +

On Mac OS Leopard (10.5) and older, you must request the 32-bit portion of the Universal Binary (https://bugzilla.mozilla.org/show_bug.cgi?id=622970):

+ +
arch -arch i386 /Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -P dev &
+
+ +

On Windows:

+ +
Start -> Run "%ProgramFiles%\Mozilla Firefox\firefox.exe" -no-remote -P dev
+
+ +

On Windows 64 bit:

+ +
Start -> Run "%ProgramFiles(x86)%\Mozilla Firefox\firefox.exe" -no-remote -P dev
+ +

To start Thunderbird or SeaMonkey instead of Firefox, substitute "thunderbird" or "seamonkey" for "firefox" in the examples above.

+ +

Note that you can run Firefox using your regular profile while developing.

+ +

Parameter -P ProfileName doesn't imply -no-remote, therefore use them together. Otherwise, if you already run a Firefox instance without -no-remote, and you attempt to start another instance with -P ProfileName but again without -no-remote, that second invocation would ignore its -P ProfileName parameter, but instead it would open a new blank window for the already running instance (sharing its profile, sessions etc.).

+ +

(There is a thread in the Mozillazine forums that explains how to use both stable and development versions of Firefox to check extension compatibility. See Installing Firefox 3 or Minefield while keeping Firefox 2.)

+ +

Development command flags

+ +

As of Gecko 2 (Firefox 4), JavaScript files are cached ("fastload"). The -purgecaches command-line flag disables this behavior. Alternatively, you can set the MOZ_PURGE_CACHES environment variable. See this bug for more information.

+ +

Development preferences

+ +

There is a set of development preferences that, when enabled, allows you to view more information about application activity, thus making debugging easier. However,  these preferences can degrade performance, so you may want to use a separate development profile when you enable these preferences.

+ +

Accessing Firefox development preferences

+ +

To change preference settings in Firefox or SeaMonkey, type about:config in the Location Bar. You can also use the Extension Developer's Extension, which provides a menu interface for Firefox settings. Alternatively, install the Developer Profile to set the preferences listed below and skip the rest of this section.

+ +

Accessing Thunderbird development preferences

+ +

To change preference settings in Thunderbird, open the "Preferences" (Unix) or "Options" (Windows) interface. On the "Advanced" page, select the "General" tab then click the "Config Editor" button.

+ + + +

Not all preferences are defined by default, and are therefore not listed by default. You will have to create new (boolean) entries for them. For more information about Mozilla preferences, refer to the mozillaZine article on "about:config". (Tip: Download addon DevPrefs, it will automatically handle this)

+ + + +

Never set {{pref("nglayout.debug.disable_xul_fastload")}} to true in a production environment; it exists solely to aid in debugging. In particular, add-ons should never change this preference.
.

+ +
+

Note:The Error Console is disabled by default starting in {{Gecko("2.0")}}. You can re-enable it by changing the devtools.errorconsole.enabled preference to true and restarting the browser. With this, javascript.options.showInConsole is also set to true by default.

+
+ +
+

Tip: Download the addon DevPrefs from AMO to automatically configure the preferences.

+
+ +

Development extensions

+ +

These extensions may help you with your development.

+ + + +

Firefox extension proxy file

+ +

Extension files are normally installed in the user profile. However, it is usually easier to place extension files in a temporary location, which also protects source files from accidental deletion. This section explains how to create a proxy file that points to an extension that is installed in a location other than the user profile.

+ +
    +
  1. Get the extension ID from the extension's install.rdf file.
  2. +
  3. Create a file in the "extensions" directory under your profile directory with the extension's ID as the file name (for example "your_profile_directory/extensions/{46D1B3C0-DB7A-4b1a-863A-6EE6F77ECB58}"). (How to find your profile directory) Alternatively, rather than using a GUID, create a unique ID using the format "name@yourdomain" (for example chromebug@mydomain.com) - then the proxy filename will be same as that ID, with no curly brackets {}.
  4. +
  5. +

    The contents of this file should be the path to the directory that contains your install.rdf file, for example /full/path/to/yourExtension/ on Mac and Linux, and C:\full\path\to\yourExtension\ on Windows. Remember to include the closing slash and remove any trailing whitespace.

    + +
      +
    • Note: If you already installed the extension via XPI, you should uninstall it first before creating the pointer file.
    • +
    • Also note that the use of proxy files requires that the extension's chrome.manifest defines its chrome urls using traditional directories, rather than a JARed structure. See below.
    • +
    +
  6. +
  7. Place the file in the extensions folder of your profile and restart the application.
  8. +
+ +

Using directories rather than JARs

+ +

Regardless of whether you choose to eventually package your extension's chrome in a JAR or in directories, developing in directories is simpler. If you choose a JARed structure for releasing, you can still develop with a directory structure by editing your chrome.manifest. For example, rather than having

+ +
content	myExtension	jar:chrome/myExtension.jar!/content/
+
+ +

use

+ +
content	myExtension	chrome/content/
+
+ +

{{ h1_gecko_minversion("Preventing the first launch extension selector", "8.0") }}

+ +

Starting in Firefox 8, on the first launch of a new version of Firefox, it presents user interface letting users select which third party add-ons to keep. This lets them weed out add-ons that were installed without their knowledge, or that are no longer needed.

+ +

However, this interface can be disruptive when debugging add-ons. You can avoid this by setting the preference extensions.autoDisableScopes to 14.

+ +

{{ languages( { "de": "de/Einrichten_einer_Entwicklungsumgebung_für_Erweiterungen", "fr": "fr/Configuration_d'un_environnement_de_développement_d'extensions", "ja": "ja/Setting_up_extension_development_environment", "zh-cn": "cn/Setting_up_extension_development_environment", "pl": "pl/Przygotowanie_środowiska_programowania_rozszerzenia", "ru": "ru/Настройка_среды_разработки_расширений" } ) }}

-- cgit v1.2.3-54-g00ecf