We are planning to deprecate the use by Firefox add-ons of the techniques described in this document.
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 instead.
Add-ons developed using these techniques might not work with multiprocess Firefox (e10s), which is already the default in Firefox Nightly and Firefox Developer Edition, and will soon be the default in Beta and Release versions of Firefox. We have documentation on making your add-ons multiprocess-compatible, but it will be more future-proof for you to migrate to WebExtensions.
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