Developer Mode

Warning: Developer Mode basically removes most of the security checks associated with using sensitive APIs on Firefox OS; it is a useful testing tool, but it is not recommended to have it activated on your everyday device for any period of time.

The current Firefox OS permissions model precludes modification and installation of certified/internal apps, which makes some device APIs completely unavailable to Marketplace and web apps. Developer Mode (DM) allows the user to indicate that they would like to relax the permissions model and expose all device APIs to content, as well as setting a group of related preferences. This article provides a high-level overview.

Note: Developer Mode is only supported on Firefox OS 3.0+, including Spark.

Features

Once DM has been enabled on a device, the user receives the following benefits:

  • Certified/internal apps can be installed from anywhere.
  • All developer-related prefs and settings are enabled, such as certified app debugging, web components, etc.
  • Apps can install add-ons for themselves using the "import-app" activity.

Certified apps can be installed

Normally, certified/internal apps must be shipped with a Firefox OS distribution. With DM enabled, any app with the certified type can be installed, and can request any certified permissions. Thus, all device API's are unlocked with DM enabled.

Developer prefs and settings enabled

As of this writing, the following preferences are set when DM is enabled:

  • dom.apps.developer_mode: true
  • devtools.debugger.forbid-certified-apps: false
  • network.disable.ipc.security: true
  • dom.webcomponents.enabled: true

This also sets the following settings:

  • developer.menu.enabled: true

Add-on import activity

Apps can normally not install apps or add-ons without requesting the webapps-manage permission, which is available to certified/internal apps only. With DM enabled, apps can create add-ons for themselves using the "import-app" activity. The imported app must meet the following criteria:

  • It must be an add-on.
  • Its filter(s) must only match the app initiating the activity.

The following example demonstrates this:

var activity = new MozActivity({
  name: 'import-app',
  data: {
    blob: blob /* app blob */
  }
});
activity.onsuccess = function() {
  // The Settings app has imported the app blob.
};
activity.onerror = function(e) {
  // The Settings app failed to import the app for some reason.
};

Enabling and disabling

DM can be toggled using the Settings app, WebIDE, or an activity. All have the same net effect, but enabling it through WebIDE is the only method that doesn't require a factory reset.

Settings app

Note: Enabling DM via the Settings app or activity will factory reset your device. Use the WebIDE method if you'd like to avoid this.

To enable or disable DM via the Settings app:

  1. Open the Settings app.
  2. If you see a "Developer" panel near the end, skip to #6.
  3. Tap on the "Device Information" panel near the end.
  4. Tap on the "More Information" panel.
  5. Enable "Developer Menu."
  6. Tap on "Factory Reset and Enable Full DevTools" near the end to toggle it.
  7. Your device will reboot and go into recovery mode. It'll reboot again in a minute or so into Firefox OS with developer mode toggled.

WebIDE

Note: DM cannot currently be disabled via WebIDE.

To enable DM via WebIDE:

  1. Open WebIDE.
  2. Connect to your device using the "Select Runtime" menu.
  3. Open "Runtime Info" from the device menu.
  4. Look at "ADB is root." If there's a button next to it, press it. If it says "maybe", or "no", or anything like that, there's a problem. If it says "yes," it's already set, and you can skip to step 5.
    1. When WebIDE is disconnected from the device, reconnect it.
    2. Re-open the "Runtime Info" menu.
  5. Look at "Unrestricted DevTools privileges." If there's a button next to it, press it. If not, it should say "yes." If it says "maybe", or "no", or anything like that, there's a problem.
  6. Developer mode is now enabled.

Activity

Note: Enabling DM via the Settings app or activity will factory reset your device. Use the WebIDE method if you'd like to avoid this.

Note: The user's Developer Menu must already be enabled for this to work.

The activity to dispatch to enable or disable developer mode is "full-developer-mode". Here is an example:

var activity = new MozActivity({
  name: 'configure',
  data: {
    target: 'device',
    section: 'full-developer-mode'
  }
});

This will take the user to the Settings app, where they will be prompted to toggle developer mode, with a lot of warnings about the consequences.

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, mikehenrty, dsherk, wilsonpage
 Last updated by: chrisdavidmills,