Name Description Size
BookmarkHTMLUtils.jsm This file works on the old-style "bookmarks.html" file. It includes functions to import and export existing bookmarks to this file format. Format ------ Primary heading := h1 Old version used this to set attributes on the bookmarks RDF root, such as the last modified date. We only use H1 to check for the attribute PLACES_ROOT, which tells us that this hierarchy root is the places root. For backwards compatibility, if we don't find this, we assume that the hierarchy is rooted at the bookmarks menu. Heading := any heading other than h1 Old version used this to set attributes on the current container. We only care about the content of the heading container, which contains the title of the bookmark container. Bookmark := a HREF is the destination of the bookmark FEEDURL is the URI of the RSS feed. This is deprecated and no more supported, but some old files may still contain it. LAST_CHARSET is stored as an annotation so that the next time we go to that page we remember the user's preference. ICON will be stored in the favicon service ICON_URI is new for places bookmarks.html, it refers to the original URI of the favicon so we don't have to make up favicon URLs. Text of the <a> container is the name of the bookmark Ignored: LAST_VISIT, ID (writing out non-RDF IDs can confuse Firefox 2) Bookmark comment := dd This affects the previosly added bookmark Separator := hr Insert a separator into the current container The folder hierarchy is defined by <dl>/<ul>/<menu> (the old importing code handles all these cases, when we write, use <dl>). Overall design -------------- We need to emulate a recursive parser. A "Bookmark import frame" is created corresponding to each folder we encounter. These are arranged in a stack, and contain all the state we need to keep track of. A frame is created when we find a heading, which defines a new container. The frame also keeps track of the nesting of <DL>s, (in well-formed bookmarks files, these will have a 1-1 correspondence with frames, but we try to be a little more flexible here). When the nesting count decreases to 0, then we know a frame is complete and to pop back to the previous frame. Note that a lot of things happen when tags are CLOSED because we need to get the text from the content of the tag. For example, link and heading tags both require the content (= title) before actually creating it. 35051
BookmarkJSONUtils.jsm Generates an hash for the given string. @note The generated hash is returned in base64 form. Mind the fact base64 is case-sensitive if you are going to reuse this code. 18185
Bookmarks.jsm This module provides an asynchronous API for managing bookmarks. Bookmarks are organized in a tree structure, and include URLs, folders and separators. Multiple bookmarks for the same URL are allowed. Note that if you are handling bookmarks operations in the UI, you should not use this API directly, but rather use PlacesTransactions.jsm, so that any operation is undo/redo-able. Each bookmark-item is represented by an object having the following properties: - guid (string) The globally unique identifier of the item. - parentGuid (string) The globally unique identifier of the folder containing the item. This will be an empty string for the Places root folder. - index (number) The 0-based position of the item in the parent folder. - dateAdded (Date) The time at which the item was added. - lastModified (Date) The time at which the item was last modified. - type (number) The item's type, either TYPE_BOOKMARK, TYPE_FOLDER or TYPE_SEPARATOR. The following properties are only valid for URLs or folders. - title (string) The item's title, if any. Empty titles and null titles are considered the same. Titles longer than DB_TITLE_LENGTH_MAX will be truncated. The following properties are only valid for URLs: - url (URL, href or nsIURI) The item's URL. Note that while input objects can contains either an URL object, an href string, or an nsIURI, output objects will always contain an URL object. An URL cannot be longer than DB_URL_LENGTH_MAX, methods will throw if a longer value is provided. Each successful operation notifies through the nsINavBookmarksObserver interface. To listen to such notifications you must register using nsINavBookmarksService addObserver and removeObserver methods. Note that bookmark addition or order changes won't notify onItemMoved for items that have their indexes changed. Similarly, lastModified changes not done explicitly (like changing another property) won't fire an onItemChanged notification for the lastModified property. @see nsINavBookmarkObserver 117345
Database.cpp Get the filename for a corrupt database. 90154
Database.h Initializes the database connection and the schema. In case of corruption the database is copied to a backup file and replaced. 11734
ExtensionSearchHandler.jsm Registers a keyword. @param {string} keyword The keyword to register. @param {Extension} extension The extension registering the keyword. 10763
FaviconHelpers.cpp Fetches information about a page from the database. @param aDB Database connection to history tables. @param _page Page that should be fetched. 44856
FaviconHelpers.h Indicates when a icon should be fetched from network. 9088
Helpers.cpp 12371
Helpers.h This file contains helper classes used by various bits of Places code. 9031
History.cpp Sets the transition type of the visit, as well as if it was typed. @param aTransitionType The transition type constant to set. Must be one of the TRANSITION_ constants on nsINavHistoryService. 69192
History.h Adds an entry in moz_places with the data in aVisitData. @param aVisitData The visit data to use to populate a new row in moz_places. 6420
History.jsm Asynchronous API for managing history. The API makes use of `PageInfo` and `VisitInfo` objects, defined as follows. A `PageInfo` object is any object that contains A SUBSET of the following properties: - guid: (string) The globally unique id of the page. - url: (URL) or (nsIURI) or (string) The full URI of the page. Note that `PageInfo` values passed as argument may hold `nsIURI` or `string` values for property `url`, but `PageInfo` objects returned by this module always hold `URL` values. - title: (string) The title associated with the page, if any. - description: (string) The description of the page, if any. - previewImageURL: (URL) or (nsIURI) or (string) The preview image URL of the page, if any. - frecency: (number) The frecency of the page, if any. See Note that this property may not be used to change the actualy frecency score of a page, only to retrieve it. In other words, any `frecency` field passed as argument to a function of this API will be ignored. - visits: (Array<VisitInfo>) All the visits for this page, if any. - annotations: (Map) A map containing key/value pairs of the annotations for this page, if any. See the documentation of individual methods to find out which properties are required for `PageInfo` arguments or returned for `PageInfo` results. A `VisitInfo` object is any object that contains A SUBSET of the following properties: - date: (Date) The time the visit occurred. - transition: (number) How the user reached the page. See constants `TRANSITIONS.*` for the possible transition types. - referrer: (URL) or (nsIURI) or (string) The referring URI of this visit. Note that `VisitInfo` passed as argument may hold `nsIURI` or `string` values for property `referrer`, but `VisitInfo` objects returned by this module always hold `URL` values. See the documentation of individual methods to find out which properties are required for `VisitInfo` arguments or returned for `VisitInfo` results. Each successful operation notifies through the nsINavHistoryObserver interface. To listen to such notifications you must register using nsINavHistoryService `addObserver` and `removeObserver` methods. @see nsINavHistoryObserver 58413
INativePlacesEventCallback.h 989
NotifyRankingChanged.h 1331
PageIconProtocolHandler.cpp 7925
PageIconProtocolHandler.h 1242
PlaceInfo.cpp 3390
PlaceInfo.h 1243
PlacesBackups.jsm Appends meta-data information to a given filename. 15583
PlacesDBUtils.jsm Executes integrity check and common maintenance tasks. @return a Map[taskName(String) -> Object]. The Object has the following properties: - succeeded: boolean - logs: an array of strings containing the messages logged by the task. 51072
PlacesExpiration.jsm This component handles history and orphans expiration. Expiration runs: - At idle, but just once, we stop any other kind of expiration during idle to preserve batteries in portable devices. - At shutdown, only if the database is dirty, we should still avoid to expire too heavily on shutdown. - On a repeating timer we expire in small chunks. Expiration algorithm will adapt itself based on: - Memory size of the device. - Status of the database (clean or dirty). 33237
PlacesRemoteTabsAutocompleteProvider.jsm Provides functions to handle remote tabs (ie, tabs known by Sync) in the awesomebar. 5083
PlacesSyncUtils.jsm This module exports functions for Sync to use when applying remote records. The calls are similar to those in `Bookmarks.jsm` and `nsINavBookmarksService`, with special handling for tags, keywords, synced annotations, and missing parents. 69478
PlacesTransactions.jsm 56739
PlacesUtils.jsm -*- indent-tabs-mode: nil; js-indent-level: 2 -*- 96725
SQLFunctions.cpp Scan forward through UTF-8 text until the next potential character that could match a given codepoint when lower-cased (false positives are okay). This avoids having to actually parse the UTF-8 text, which is slow. @param aStart An iterator pointing to the first character position considered. It will be updated by this function. @param aEnd An interator pointing to past-the-end of the string. 40893
SQLFunctions.h This file contains functions that Places adds to the database handle that can be accessed by SQL queries. Keep the GUID-related parts of this file in sync with toolkit/downloads/SQLFunctions.[h|cpp]! 16937
Shutdown.cpp 6743
Shutdown.h This is most of the code responsible for Places shutdown. PHASE 1 (Legacy clients shutdown) The shutdown procedure begins when the Database singleton receives profile-change-teardown (note that tests will instead notify nsNavHistory, that forwards the notification to the Database instance). Database::Observe first of all checks if initialization was completed properly, to avoid race conditions, then it notifies "places-shutdown" to legacy clients. Legacy clients are supposed to start and complete any shutdown critical work in the same tick, since we won't wait for them. PHASE 2 (Modern clients shutdown) Modern clients should instead register as a blocker by passing a promise to nsINavHistoryService::shutdownClient (for example see Sanitizer.jsm), so they block Places shutdown until the promise is resolved. When profile-change-teardown is observed by async shutdown, it calls ClientsShutdownBlocker::BlockShutdown. This class is registered as a teardown phase blocker in Database::Init (see Database::mClientsShutdown). ClientsShutdownBlocker::BlockShudown waits for all the clients registered through nsINavHistoryService::shutdownClient. When all the clients are done, its `Done` method is invoked, and it stops blocking the shutdown phase, so that it can continue. PHASE 3 (Connection shutdown) ConnectionBlocker is registered as a profile-before-change blocker in Database::Init (see Database::mConnectionShutdown). When profile-before-change is observer by async shutdown, it calls ConnectionShutdownBlocker::BlockShutdown. Then the control is passed to Database::Shutdown, that executes some sanity checks, clears cached statements and proceeds with asyncClose. Once the connection is definitely closed, Database will call back ConnectionBlocker::Complete. At this point a final places-connection-closed notification is sent, for testing purposes. 5940
SyncedBookmarksMirror.h 865
SyncedBookmarksMirror.jsm This file implements a mirror and two-way merger for synced bookmarks. The mirror matches the complete tree stored on the Sync server, and stages new bookmarks changed on the server since the last sync. The merger walks the local tree in Places and the mirrored remote tree, produces a new merged tree, then updates the local tree to reflect the merged tree. Let's start with an overview of the different classes, and how they fit together. - `SyncedBookmarksMirror` sets up the database, validates and upserts new incoming records, attaches to Places, and applies the changed records. During application, we fetch the local and remote bookmark trees, merge them, and update Places to match. Merging and application happen in a single transaction, so applying the merged tree won't collide with local changes. A failure at this point aborts the merge and leaves Places unchanged. - A `BookmarkTree` is a fully rooted tree that also notes deletions. A `BookmarkNode` represents a local item in Places, or a remote item in the mirror. - A `MergedBookmarkNode` holds a local node, a remote node, and a `MergeState` that indicates which node to prefer when updating Places and the server to match the merged tree. - `BookmarkObserverRecorder` records all changes made to Places during the merge, then dispatches `nsINavBookmarkObserver` notifications. Places uses these notifications to update the UI and internal caches. We can't dispatch during the merge because observers won't see the changes until the merge transaction commits and the database is consistent again. - After application, we flag all applied incoming items as merged, create Sync records for the locally new and updated items in Places, and upload the records to the server. At this point, all outgoing items are flagged as changed in Places, so the next sync can resume cleanly if the upload is interrupted or fails. - Once upload succeeds, we update the mirror with the uploaded records, so that the mirror matches the server again. An interruption or error here will leave the uploaded items flagged as changed in Places, so we'll merge them again on the next sync. This is redundant work, but shouldn't cause issues. 87637
TaggingService.jsm The Places Tagging Service 17818
UnifiedComplete.jsm eslint complexity: ["error", 53] 70401
VisitInfo.cpp 1461
VisitInfo.h 860
bookmark_sync 2
components.conf 4002 60 2324
mozIAsyncHistory.idl The machine-local (internal) id of the visit. 5097
mozIPlacesAutoComplete.idl This interface provides some constants used by the Places AutoComplete search provider as well as methods to track opened pages for AutoComplete purposes. 3048
mozIPlacesPendingOperation.idl Cancels a pending operation, if possible. This will only fail if you try to cancel more than once. 487
mozISyncedBookmarksMirror.idl 4129
nsAnnoProtocolHandler.cpp Implementation of moz-anno: URLs for accessing favicons. The urls are sent to the favicon service. If the favicon service doesn't have the data, a stream containing the default favicon will be returned. The reference to annotations ("moz-anno") is a leftover from previous iterations of this component. As of now the moz-anno protocol is independent of annotations. 10439
nsAnnoProtocolHandler.h Obtains a new channel to be used to get a favicon from the database. This method is asynchronous. @param aURI The URI the channel will be created for. This is the URI that is set as the original URI on the channel. @param aAnnotationURI The URI that holds the data needed to get the favicon from the database. @param aLoadInfo The loadinfo that requested the resource load. @returns (via _channel) the channel that will obtain the favicon data. 1949
nsFaviconService.cpp This is the favicon service, which stores favicons for web pages with your history as you browse. It is also used to save the favicons for bookmarks. DANGER: The history query system makes assumptions about the favicon storage so that icons can be quickly generated for history/bookmark result sets. If you change the database layout at all, you will have to update both services. 28656
nsFaviconService.h Obtains the service's object. 4597
nsIFaviconService.idl The limit in bytes of the size of favicons in memory and passed via the favicon protocol. 14762
nsINavBookmarksService.idl Observer for bookmarks changes. 15028
nsINavHistoryService.idl Using Places services after quit-application is not reliable, so make sure to do any shutdown work on quit-application, or history synchronization could fail, losing latest changes. 43734
nsITaggingService.idl Tags a URL with the given set of tags. Current tags set for the URL persist. Tags in aTags which are already set for the given URL are ignored. @param aURI the URL to tag. @param aTags Array of tags to set for the given URL. Each element within the array can be either a tag name (non-empty string) or a concrete itemId of a tag container. @param [optional] aSource A change source constant from nsINavBookmarksService::SOURCE_*. Defaults to SOURCE_DEFAULT if omitted. 2135
nsNavBookmarks.cpp 60495
nsNavBookmarks.h Obtains the service's object. 11795
nsNavHistory.cpp 119480
nsNavHistory.h Obtains the nsNavHistory object. 17764
nsNavHistoryQuery.cpp This file contains the definitions of nsNavHistoryQuery, nsNavHistoryQueryOptions, and those functions in nsINavHistory that directly support queries (specifically QueryStringToQuery and QueryToQueryString). 39701
nsNavHistoryQuery.h The definitions of nsNavHistoryQuery and nsNavHistoryQueryOptions. This header file should only be included from nsNavHistory.h, include that if you want these classes. 4885
nsNavHistoryResult.cpp Returns conditions for query update. QUERYUPDATE_TIME: This query is only limited by an inclusive time range on the first query object. The caller can quickly evaluate the time itself if it chooses. This is even simpler than "simple" below. QUERYUPDATE_SIMPLE: This query is evaluatable using evaluateQueryForNode to do live updating. QUERYUPDATE_COMPLEX: This query is not evaluatable using evaluateQueryForNode. When something happens that this query updates, you will need to re-run the query. QUERYUPDATE_COMPLEX_WITH_BOOKMARKS: A complex query that additionally has dependence on bookmarks. All bookmark-dependent queries fall under this category. QUERYUPDATE_MOBILEPREF: A complex query but only updates when the mobile preference changes. QUERYUPDATE_NONE: A query that never updates, e.g. the left-pane root query. aHasSearchTerms will be set to true if the query has any dependence on keywords. When there is no dependence on keywords, we can handle title change operations as simple instead of complex. 155537
nsNavHistoryResult.h The definitions of objects that make up a history query result set. This file should only be included by nsNavHistory.h, include that if you want these classes. 35856
nsPlacesIndexes.h moz_places 3469
nsPlacesMacros.h Null out ret before _sInstance so the destructor doesn't assert 2870
nsPlacesTables.h place_id 14047
nsPlacesTriggers.h Exclude these visit types: 0 - invalid 4 - EMBED 7 - DOWNLOAD 8 - FRAMED_LINK 9 - RELOAD 19211
tests 18
unifiedcomplete-top-urls.json 866