Support for extensions using XUL/XPCOM or the Add-on SDK was removed in Firefox 57, released November 2017. As there is no supported version of Firefox enabling these technologies, this page will be removed by December 2020.

Add-ons using the techniques described in this document are considered a legacy technology in Firefox. Don't use these techniques to develop new add-ons. Use WebExtensions instead. If you maintain an add-on which uses the techniques described here, consider migrating it to use WebExtensions.

Starting from Firefox 53, no new legacy add-ons will be accepted on (AMO) for desktop Firefox and Firefox for Android.

Starting from Firefox 57, only extensions developed using WebExtensions APIs will be supported on Desktop Firefox and Firefox for Android.

Even before Firefox 57, changes coming up in the Firefox platform will break many legacy extensions. These changes include multiprocess Firefox (e10s), sandboxing, and multiple content processes. Legacy extensions that are affected by these changes should migrate to use WebExtensions APIs if they can. See the "Compatibility Milestones" document for more information.

A wiki page containing resources, migration paths, office hours, and more, is available to help developers transition to the new technologies.


The NativeWindow object is only available to privileged code running on Firefox for Android, and is intended for use by Firefox for Android add-ons.

The NativeWindow object enables Firefox for Android add-ons to create user interface components.

NativeWindow is available as a property of the chrome window object. For example, if you use this template for initializing your extension, you can access it from the window argument passed into loadIntoWindow():

function loadIntoWindow(window) {"I'm starting!", "short");

You can also access the chrome window using nsIWindowMediator:

let window = Services.wm.getMostRecentWindow("navigator:browser");"Here's another toast message!", "short");

Obtain NativeWindow object with add-on SDK:

// Obtain commonly used services : Services.jsm
const { Services } = require("resource://gre/modules/Services.jsm");

function getNativeWindow() {

	let window = Services.wm.getMostRecentWindow("navigator:browser");
	return window.NativeWindow;


The NativeWindow object enables developers of Firefox for Android add-ons to create UI components.

It supports the following components:

Add items to the main menu in Firefox for Android. See the menu API documentation.

label: menu label
icon: file:// or data: URI for an icon
callback: JS function called when menu is tapped
returns a menu ID that can be used to remove the menu
let id =, icon, callback);;


Show and hide doorhanger notifications. See the doorhanger API documentation.

message: displayed text
value: string based tag
buttons: array of JS objects used to create buttons in the notification
tabId: tab associated with this notification
options: JS object that has 'persistence' and 'timeout' options
*/, value, buttons, tabId, options);
NativeWindow.doorhanger.hide(value, tabId);


Add and remove context menu items. See the contextmenus API documentation.

label: menu label
selector: JS object that has a 'matches(element)' function. Used to show the menu.
callback: JS function called when menu is tapped
returns a menu ID that can be used to remove the menu
let id = NativeWindow.contextmenu.add(label, selector, callback);


Show Android toast notifications. See the toast API documentation.

NativeWindow.toast will be deprecated in Firefox 45.

New code should use Snackbars.jsm to display notifications. To maintain backward compatibility NativeWindow.toast will still work, by delegating calls to Snackbars.jsm.

message: displayed text
duration: "short" or "long"; Used for alert timeout
*/, duration);



Add and remove pageactions, i.e. clickable indicators in the URL bar. See the pageactions API documentation.

NativeWindow.pageactions was deprecated in Firefox 34. Use the new PageActions.jsm instead.

title: Pageaction title
icon: Icon image for the pageaction
clickCallback: Callback called when pageaction is clicked
longClickCallback: Callback called when pageaction is long pressed
let options = {
  title: "title",
  icon: "chrome://myaddon/skin/image.png",
  clickCallback: function() { },
  longClickCallback: function() { } (optional)

//Adding pageaction
let id = NativeWindow.pageactions.add(options);

//Remove pageaction