This article needs a technical review. How you can help.

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.


Returns a reference to the object, which can be used to add items to the main Firefox for Android menu, and subsequently remove them. You can add a menu item to a browser window using and remove it using

A common pattern is for a restartless add-on to add and remove menu items in the add-on's bootstrap.js:

This ensures that the item is always present while the add-on is installed and enabled, and that it is cleaned up properly when the add-on is uninstalled or disabled. But note that bootstrap.js is not attached to a DOM window, so you need to get a window, for example using nsIWindowMediator, before you can use this pattern.


The following example adds a menu item with the label "Show Toast", which displays a toast notification when clicked:NativeWindow-menu.png

function showToast(window) {"Showing you a toast", "short");

var menuID;

function addMenuItem(window) {
  menuID ={
    name: "Show Toast",
    icon: null,
    callback: function(){

function removeMenuItem(window) {;


Add an item to the menu.
Remove an item from the menu.
Update an item in the menu.


Attribute Type Description
toolsMenuID int Use this as the parent ID to add your menu item to the Tools menu (only shown on Android 3.0+. On earlier versions your menu item will just be added to the base menu).

See also

Document Tags and Contributors

 Contributors to this page: wbamberg, paa, wesj, kscarfone, sriramramani, gregg.lind
 Last updated by: wbamberg,