Places:Design Overview

From MozillaWiki
Jump to: navigation, search

Design Overview

Places is designed to be a robust back-end for Bookmarks, History and related components using the mozStorage wrapper for SQLite. It is intended to provide useful APIs for a more usable front-end, emphasizing simple search and categorization.

Generally, you'll want to look at the documentation on MDC instead of what is here. The documentation here is only internal API documentation that isn't generally exposed to add-on authors.

Related Documents:

Objectives

The primary objectives:

  • Improve access to History and Bookmarks
  • Make it easier for people to Bookmark pages

Secondary objectives:

  • Consolidating user data formats
  • Providing a platform for using interesting per-URL metadata
  • Improving the capabilities of Live Bookmarks
  • Providing a solid architecture for bookmark sync and remote storage
  • Extensible Bookmark Providers for customization
  • Flexible Query System
  • Clean Architecture for ease of code reuse and maintainability


Background

Studies from the late 1990s show that while revisitations of pages previously seen counted for roughly 39% of all page navigations (see Google Scholar), Bookmarks and History usage was low (1-3%), despite the fact that roughly 20% of those revisitations were to pages seen > 10 URLs ago (and thus outside the usefulness range of the Back button or menu).

Autocomplete in the URL bar is a useful tool but fails to address some common desires when looking up visited pages. There is a gulf between the capabilities of that tool, the capabilities of the Bookmarks and History systems today, and the desired capabilities of those systems.

Use Cases


Details

Models

Data storage is implemented via a collection of SQLite tables:

places-erd.png

A detailed database schema complete with associations between the various tables within places.sqlite: https://wiki.mozilla.org/images/d/d5/Places.sqlite.schema3.pdf

Source code:

  • Browser front-end: mozilla/browser/components/places
  • Toolkit Services: mozilla/toolkit/components/places

Views

The MDC page has the most up-to-date information on how to use views to display information from places.

Source code: mozilla/browser/components/places/content/tree|menu|toolbar.xml

Controller

The Controller connects the Views to the Model. It is responsible for telling the UI what commands are available, enabled and executing them on the back end services.

Source code: mozilla/browser/components/places/content/controller.js

Querying History

See the MDC page for details on history querying.

Other Components

Dynamic Containers

The following are some example dynamic containers:

  • Feed Container - ping and parse RSS/Atom feeds and fill containers with their posts
  • File System Container - show folders and files from the local hard disk
  • Bonjour Container - fill a container with available network resources discovered by Bonjour Zero-Configuration Networking.
  • Address Book URLs Container - fill a container with URLs mentioned in the system address book

Data Migration

Migrating data from Netscape-bookmarks-file-1, Mork, etc, to the storage format.

Observer API

Observer APIs for extensions and other components that want to listen to backend activity:


Historical Documents

This documents are kept around for historical purposes only.