MDN wants to learn about developers like you:



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.


Building blocks for composing lists.



List(element1, element2, ...)

Constructor can takes any number of elements and creates an instance of List populated with the specified elements.


element1 : Object|String|Number

element2 : Object|String|Number

... : Object|String|Number


addListItem(list, item)

Function adds a item to a List.

removeListItem(list, item)

Function removes an item from a List


An ordered collection (also known as a sequence) disallowing duplicate elements. List is composed out of Iterable, therefore it provides custom enumeration behavior that is similar to array (enumerates only on the elements of the list).

List is a base trait and is meant to be part of a composition, since all of its API is private except for the length property.


var { List } = require("sdk/util/list");
var MyList = List.compose({
  add: function add(item1, item2, /*item3...*/) {
  remove: function remove(item1, item2, /*item3...*/) {
MyList('foo', 'bar', 'baz').length == 3;        // true
new MyList('new', 'keyword').length == 2;       // true
MyList.apply(null, [1, 2, 3]).length == 3;      // true
let list = MyList();
list.length == 0;                               // true
list.add(1, 2, 3) == 3;                         // true



Number of elements in this list.

Document Tags and Contributors

 Contributors to this page: wbamberg, evold, jsantell
 Last updated by: wbamberg,