Name Description Size Coverage
bookmark_sync -
BookmarkHTMLUtils.sys.mjs 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. 35185 -
BookmarkJSONUtils.sys.mjs An error that occurs due to a hash conflict. 18365 -
BookmarkList.sys.mjs A collection of bookmarks that internally stays up-to-date in order to efficiently query whether certain URLs are bookmarked. 7525 -
Bookmarks.sys.mjs @import {OpenedConnection} from "resource://gre/modules/Sqlite.sys.mjs" 117023 -
components.conf 5061 -
ConcurrentConnection.cpp 17854 -
ConcurrentConnection.h Tracks all the necessary information to asynchronously run a query, and call back once done. 6450 -
Database.cpp Get the filename for a corrupt database. 91425 -
Database.h Initializes the database connection and the schema. In case of corruption the database is copied to a backup file and replaced. 11769 -
ExtensionSearchHandler.sys.mjs Handles keeping track of information associated to the registered keyword. 11193 -
FaviconHelpers.cpp Fetches information about a page from the database. @param aDB Database connection to history tables. @param _page Page that should be fetched. 40372 -
FaviconHelpers.h Represents one of the payloads (frames) of an icon entry. 7729 -
Helpers.cpp 13254 -
Helpers.h This file contains helper classes used by various bits of Places code. 10279 -
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. 81425 -
History.h Adds an entry in moz_places with the data in aVisitData. @param aPlace The visit data to use to populate a new row in moz_places. 6649 -
History.sys.mjs Asynchronous API for managing history. The API makes use of `PageInfo` and `VisitInfo` objects. Each successful operation notifies through the PlacesObservers. To listen to such notifications, you must register using PlacesObservers `addListener` and `removeListener` methods. @see PlacesObservers 56984 -
INativePlacesEventCallback.h 989 -
metrics.yaml 18000 -
moz.build 2627 -
mozIAsyncHistory.idl The machine-local (internal) id of the visit. 5261 -
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. 2439 -
mozIPlacesPendingOperation.idl Cancels a pending operation, if possible. This will only fail if you try to cancel more than once. 487 -
mozISyncedBookmarksMirror.idl 3534 -
NotifyRankingChanged.h 1331 -
nsCachedFaviconProtocolHandler.cpp Implementation of cached-favicon: 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. 12061 -
nsCachedFaviconProtocolHandler.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 aCachedFaviconURI 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. 1807 -
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. 26911 -
nsFaviconService.h Obtains the service's object. 4667 -
nsIFaviconService.idl The limit in bytes of the size of favicons in memory and passed via the favicon protocol. 7281 -
nsINavBookmarksService.idl The BookmarksService interface provides methods for managing bookmarked history items. Bookmarks consist of a set of user-customizable folders. A URI in history can be contained in one or more such folders. 8814 -
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. 40982 -
nsIPlacesPreviewsHelperService.idl A service which returns information about file paths where the previews for URLs are stored. These previews are used by the moz-page-thumb protocol 649 -
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. 2054 -
nsNavBookmarks.cpp 53740 -
nsNavBookmarks.h Obtains the service's object. 8455 -
nsNavHistory.cpp 105521 -
nsNavHistory.h Obtains the nsNavHistory object. 16788 -
nsNavHistoryQuery.cpp This file contains the definitions of nsNavHistoryQuery, nsNavHistoryQueryOptions, and those functions in nsINavHistory that directly support queries (specifically QueryStringToQuery and QueryToQueryString). 37583 -
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. 4303 -
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. 161682 -
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. 36140 -
nsPlacesIndexes.h moz_places 4786 -
nsPlacesMacros.h Only create on main-thread. 2323 -
nsPlacesTables.h 18718 -
nsPlacesTriggers.h These visit types are excluded from visit_count: 0 - invalid 4 - EMBED 7 - DOWNLOAD 8 - FRAMED_LINK 9 - RELOAD 24803 -
PageIconProtocolHandler.cpp 12868 -
PageIconProtocolHandler.h To be called in the parent process to obtain an input stream for the given icon. @param aChildURI a page-icon URI sent from the child. @param aLoadInfo the nsILoadInfo for the load attempt from the child. @param aTerminateSender out param set to true when the params are invalid and indicate the child should be terminated. If |aChildURI| is not a page-icon URI, the child is in an invalid state and should be terminated. This outparam will be set synchronously. @return RemoteStreamPromise The RemoteStreamPromise will resolve with an RemoteStreamInfo on success, and reject with an nsresult on failure. 3398 -
PlaceInfo.cpp 3464 -
PlaceInfo.h 1236 -
PlacesBackups.sys.mjs Limits the number of backup files by deleting old backups. @param {number} aMaxBackups @param {string[]} backupFiles @returns {Promise<void>} Resolves when the oldest files have been deleted. 17376 -
PlacesDBUtils.sys.mjs Executes integrity check and common maintenance tasks. 52848 -
PlacesExpiration.sys.mjs 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: - Status of the database (clean or dirty). 33788 -
PlacesFrecencyRecalculator.sys.mjs This component handles frecency recalculations and decay on idle. 27877 -
PlacesPreviews.sys.mjs This extends Set to only keep the latest 100 entries. 13753 -
PlacesQuery.sys.mjs -*- indent-tabs-mode: nil; js-indent-level: 2 -*- 19819 -
PlacesSemanticHistoryDatabase.sys.mjs Handles the database connection, reading and writing for semantic history. 12953 -
PlacesSemanticHistoryManager.sys.mjs This module handles embeddings-based semantic search capabilities using the Places database and an ML engine for vector operations. 34956 -
PlacesSyncUtils.sys.mjs @import {OpenedConnection} from "resource://gre/modules/Sqlite.sys.mjs" 72316 -
PlacesTransactions.sys.mjs 56288 -
PlacesUtils.sys.mjs -*- indent-tabs-mode: nil; js-indent-level: 2 -*- 103302 -
Shutdown.cpp 6839 -
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.sys.mjs), 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. 5764 -
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. 56766 -
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]! 19051 -
SyncedBookmarksMirror.h 865 -
SyncedBookmarksMirror.sys.mjs 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 `PlacesObservers` 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. 89417 -
TaggingService.sys.mjs The Places Tagging Service 17402 -
tests -
tsconfig.json 283 -
types -
VisitInfo.cpp 1461 -
VisitInfo.h 847 -