This is an archived page. It's not actively maintained.



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.



Access the user's browsing history.


This module exports a single function, search(), which synchronously returns a PlacesEmitter object which then asynchronously emits data and end or error events that contain information about the state of the operation.


let { search } = require("sdk/places/history");

// Simple query
  { url: "*" },
  { sort: "visitCount" }
).on("end", function (results) {
  // results is an array of objects containing
  // data about visits to any site on
  // ordered by visit count

// Complex query
// The query objects are OR'd together
// Let's say we want to retrieve all visits from before a week ago
// with the query of 'ruby', but from last week onwards, we want
// all results with 'javascript' in the URL or title.
// We'd compose the query with the following options
let lastWeek = - (1000*60*60*24*7);
  // First query looks for all entries before last week with 'ruby'
  [{ query: "ruby", to: lastWeek },
  // Second query searches all entries after last week with 'javascript'
   { query: "javascript", from: lastWeek }],
  // We want to order chronologically by visit date
  { sort: "date" }
).on("end", function (results) {
  // results is an array of objects containing visit data,
  // sorted by visit date, with all entries from more than a week ago
  // that contain 'ruby', *in addition to* entries from this last week
  // that contain 'javascript'



search(queries, options)

Queries can be performed on history entries by passing in one or more query options. Each query option can take several properties, which are AND'd together to make one complete query. For additional queries within the query, passing more query options in will OR the total results. An options object may be specified to determine overall settings, like sorting and how many objects should be returned.


queries : object|array
An Object representing a query, or an Array of Objects representing queries. Each query object can take several properties, which are queried against the history database. Each property is AND'd together, meaning that bookmarks must match each property within a query object. Multiple query objects are then OR'd together.

options : object
Optional options:

Name Type  
count number

The number of bookmark items to return. If left undefined, no limit is set.

sort string

A string specifying how the results should be sorted. Possible options are 'title', 'date', 'url', 'visitCount', 'keyword', 'dateAdded' and 'lastModified'.

descending boolean

A boolean specifying whether the results should be in descending order. By default, results are in ascending order.


The PlacesEmitter is not exposed in the module, but returned from the search functions. The PlacesEmitter inherits from event/target, and emits data, error, and end. data events are emitted for every individual search result found, whereas end events are emitted as an aggregate of an entire search, passing in an array of all results into the handler.



The data event is emitted for every item returned from a search.


Object : This is an object representing a history entry. Contains url, time, accessCount and title of the entry.


The error event is emitted whenever a search could not be completed.


string : A string indicating the error that occurred.


The end event is called when all search results have returned.


array : The value passed into the handler is an array of all entries found in the history search. Each entry is an object containing the properties url, time, accessCount and title.