Places:Live Bookmarks

From MozillaWiki
Jump to: navigation, search

Background

Live bookmarks are implemented through the nsILivemarkService class, which is a bookmark container. The livemarks service is a Singleton which keeps track of the livemarks and updates them regularly.

Keeping track of livemark data

The livemarks service uses the annotation system to store data about livemarks which needs to be persistent across browser sessions. It stores annotations specific to one livemark on the place: uri of the folder that represents the livemark in the bookmark service. These annotations include the feed uri and the site uri for the livemark. Annotations which are the same for all livemarks pointing to the same feed are stored on the feed url. The expiration date is an example of this type of annotation.

The livemarks service also has an internal array of information about each livemark. This array stores information like the livemark lock, which should not persist across browser sessions.

Updating livemarks

The livemarks service updates livemark feeds much like the old bookmarks system. It periodically runs a function which goes through the list of livemarks and checks if any have expired, and updates them if neccesary. It uses a stream listener called nsLivemarkLoadListener to do the update. Livemarks are locked while they update, so that two stream listeners will not accidentally load the same feed at once.