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.
From Firefox 53 onwards, no new legacy add-ons will be accepted on addons.mozilla.org (AMO).
From Firefox 57 onwards, WebExtensions will be the only supported extension type, and Firefox will not load other types.
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 WebExtensions if they can. See the "Compatibility Milestones" document for more.
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
error events that contain information about the state of the operation.
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
Object representing a query, or an
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
The number of bookmark items to return. If left undefined, no limit is set.
A string specifying how the results should be sorted. Possible options are
A boolean specifying whether the results should be in descending order. By default, results are in ascending order.
PlacesEmitter is not exposed in the module, but returned from the
search functions. The
PlacesEmitter inherits from
event/target, and emits
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.
data event is emitted for every item returned from a search.
Object : This is an object representing a history entry. Contains
title of the entry.
error event is emitted whenever a search could not be completed.
string : A string indicating the error that occurred.
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