Development
Mozilla testing new Places API
Mozilla's Jordan Santell has posted a proposal for a new API slated to arrive in Firefox, through which extensions can query and manipulate the browser history and bookmarks. Bookmark management is already a popular target for extension authors, of course, but it has not had a formal API. This proposal changes that situation, and also rolls in access to the Firefox History system, which could eventually offer users new functionality.
The new API is called Places, which is the name for Firefox's unified bookmark and history service. The Places feature is perhaps best known as the underpinnings of the Firefox "Awesome Bar", which can provide both history and bookmark URL pattern matching as the user types in the location bar. In January of 2013, developers began replacing synchronous Places methods with asynchronous ones, which is a precursor to exposing the services to arbitrary extensions. The initial implementation of the new API is scheduled to arrive in Firefox 24, due in the "Aurora" testing channel in late June. Santell asked readers for feedback on the proposal, which should land in the Firefox Add-on SDK around the same time. Based on the Mozilla rapid release schedule, both the updated SDK and the new feature would be available to end users about twelve weeks later.
Santell's post deals strictly with the bookmarks side of the Places API, with the history functionality due to arrive later. However, the full API is described in the GitHub documentation. The history functionality seems to be limited to querying the browser history; options are available to sort the returned list of history items by title, URL, date, visit-count, modification date, and keyword, and to limit the number of results to return.
Bookmarks are a bit more complicated; while there is no method to (for example) remove a history entry, bookmarks can be created, deleted, modified, rearranged, grouped, and searched. There are three primitives: Bookmark, Group (i.e., folder), and Separator. A separator is simply a marker (displayed as a horizontal line in Firefox's user interface). A bookmark's properties include the title and URL, plus the group it belongs to, its integer position in the group, and a list of any attached tags. Groups have a name and an optional parent group, plus an index indicating their position in the parent group.
Are you save()d?
Both creating a new bookmark and simply updating a bookmark's properties are done with the save() function, for example:
let thebookmark = {
type: 'bookmark',
title: 'LWN',
tags: new Set(['news', 'mustread']),
url: 'http://lwn.net'
}
save(thebookmark);
The trick is that Firefox does not track state for the user's bookmarks; there is no overseer that watches the set of bookmarks to monitor for changes coming from other extensions or direct user input. Providing this type of oversight would have required observers caching and synchronizing changes to items coming from other add-ons (or even, speaking of synchronization, the Firefox Sync service). That means a lot of additional overhead; consequently, Santell notes, bookmark items in the Places API are "snapshots" of an item's state at a particular point in time. One can manipulate them, but there is no guarantee that they will not change between the initial read and any save operation the extension wishes to perform.
Extensions that decide to run roughshod over changes from outside can simply so do, but the API also provides an optional resolve() callback function with mine and theirs objects that can be called by save() and used to politely handle disagreements. The mine argument is the item (e.g., bookmark or group) attempting to be saved, while theirs is the current version of the same item saved on disk. The resolve() function is only called when the version of the object on disk has a more recent modification date than the one being held by the extension. The theory is that the extension can use resolve() to either ask for the user's help or fail non-destructively to modify the bookmark item, but that is ultimately up to the extension author. The extension can return mine to override everyone else, or return theirs to back down.
The save() function returns an EventEmitter that pushes the save or update onto the stack for the browser to handle—again, because there is no guarantee that the item will be updated, since another extension or the user could delete it first. In fact, bookmark deletion is performed by an extensions setting the removed property on the bookmark to "true" and saving it. The deletion happens when the queued save() is handled by the browser.
The save() function also helps out by implicitly saving larger structures. For example, if an extension tries to save bookmarks with parent groups that do not yet exist, Firefox will create (and save) the missing groups first. It is also important to note that a save() can be called on a single bookmark, an array of bookmarks, a group, or an array of groups. Santell also points out that bookmark and group objects passed to save() as arguments are new objects, not what is returned from the original constructors. This, again, goes back to the notion that each Places object is a snapshot at a particular point in time, not the canonical object itself.
Data everywhere
Bookmarks can be searched using the same query types as history items, plus the addition of tags. Firefox's bookmark tagging feature may be the least-used option of the service (at least, compared to simply dumping bookmarks into folders). As Santell points out, the tag database is internally a separate data source, nsITaggingService. That, together with nsINavBookmarksService and nsINavHistoryService, make up the three services that extension authors have had access to in the past. Unifying them with a single API ought to result in less messy bookmark and history functionality.
At first glance, it is easy to think of bookmarks as trivial objects. They are URLs that sit in a menu, waiting to be clicked. But as Firefox has evolved, bookmarks have added more and more functionality. As I found last week when looking at extension-based RSS readers, we increasingly count on our bookmarks to store "to read later" information and we expect them to be available and up to date from multiple machines.
To my dismay during the RSS extension search, I discovered that Firefox Sync had been regularly duplicating several dozen of my bookmarks for reasons I can still only guess at, evidently for quite some time. The upshot is that many bookmarks were repeated 154 times (and one, for some reason, 484 times), which adds up to a lot of hassle to sort through and to clean up. Evidently bookmark de-duplication is a popular subject for extension authors, but the options were discouraging. Some did not find every copy of a duplicate, others did not allow you to see which duplicate lived where.
Attempting to move RSS feed subscriptions into the bookmark system only adds more responsibility to this portion of Firefox; it is, in a very real sense, a "cloud service" in the most buzzword-compliant sense of the term. The current version of the Places API, while it does not address Live Bookmarks explicitly, will hopefully bring some more sanity to handling these important bits of data. And, by doing so, open up bookmarking to a wide array of new possibilities—annotation, sharing, temporary bookmarking; who knows?
Brief items
Quotes of the week
Identi.ca is converting to pump.io June 8.
Identi.ca is converting to pump.io June 15.
Identi.ca is converting to pump.io sometime this week.
<dizzylizzy> http://cdn.mactrast.com/wp-content/uploads/2011/12/Apple-Spaceship-Render.jpg
<Tekk_> I never knew that the apple higher-ups were such big fans of tron
cypherpunk anthrax John Kerry rail gun security plutonium Guantanamo wire transfer JPL number key military MD5 SRI FIPS140 Uzbekistan
Subversion 1.8.0 released
The Apache Software Foundation has announced a new release of "the most popular and widely-used Open Source version control system" — Subversion 1.8.0. "
Since their introduction in prior releases, Subversion’s merge tracking and tree conflict detection features have been critical to its ability to serve projects where branching and merging happens often. The 1.8.0 version improves these features, further automating the client-side merge functionality and improving both tree conflict detection during merge operations and tree conflict resolution during update operations. Additionally, the Subversion client now tracks moves of working copy items as first-class operations, which brings immediate benefit to users today and is a key step toward more thorough system-wide support for moved and renamed objects in a future release."
LLVM 3.3 released
Version 3.3 of the LLVM compiler suite is out. It adds support for a number of new architectures, features a number of performance improvements, and more. "3.3 is also a major milestone for the Clang frontend: it is now fully C++'11 feature complete. At this point, Clang is the only compiler to support the full C++'11 standard, including important C++'11 library features like std::regex. Clang now supports Unicode characters in identifiers, the Clang Static Analyzer supports several new checkers and can perform interprocedural analysis across C++ constructor/destructor boundaries, and Clang even has a nice 'C++'11 Migrator' tool to help upgrade code to use C++'11 features and a 'Clang Format' tool that plugs into vim and emacs (among others) to auto-format your code." See the release notes for details.
Zato 1.1 available
Dariusz Suchojad has released version 1.1 of Zato, the LGPL-licensed Enterprise Service Bus (ESB). It provides a framework for writing loosely-coupled software services running on the same network, and is one of the few such projects written in Python. This release adds a unified installer for OS X, Ubuntu, Linux Mint, and Fedora. RHEL and SLES are expected to follow.
WebRTC Test Day, June 21
Mozilla's Aaron Train announces a "test day" for Firefox's WebRTC implementation, scheduled for Friday, June 21. "We would like for you to use the new version of Firefox on your Android phone and desktop or laptop machine, and take a close look at the latest Nightly builds in order to assist us in identifying any noticeably major issues found with our WebRTC implementation, and ensure that all feature functionality that is included in this upcoming release is on its way to a feature and testing complete state.
" More details are available at the post, along with a link to specific instructions on getting started.
Newsletters and articles
Development newsletters from the past week
- Caml Weekly News (June 18)
- CloudStack Weekly News (June 17)
- What's cooking in git.git (June 15)
- What's cooking in git.git (June 18)
- Haskell Weekly News (June 12)
- OpenStack Community Weekly Newsletter (June 14)
- Perl Weekly (June 17)
- PostgreSQL Weekly News (June 16)
- Ruby Weekly (June 13)
Meeks: LibreOffice's under-the-hood progress in 4.1.0 (beta)
On his blog, Michael Meeks has a look at some of the less visible (to the user) changes to LibreOffice for 4.1. He describes changes like the completion of the switch to GNU make, code cleanup (including more German comment translation), eliminating bugs that result in crashes, refactoring the Calc spreadsheet core, and more. "One of the tasks that most irritates and has distracted new developers from doing interesting feature work on the code-base over many years has been our build system. At the start of LibreOffice, there was an incomplete transition to using GNU make, which required us to use both the horrible old dmake tool as well as gnumake, with configure using a Perl script to generate a shell script configuring a set of environment variables that had to be sourced into your shell in order to compile (making it impossible to re-configure from that shell), with a Perl build script that batched compilation with two layers of parallelism, forcing you to over- or undercommit on any modern builder."
Ardour 3.2 adds video support (The H)
The H looks at the recent 3.2 release of the Ardour digital audio workstation, highlighting the addition of video support. Specifically, Ardour does not edit video, but allows users to import it for synchronizing with audio content. "The new video feature can display imported video tracks with frame-by-frame granularity in a timeline and allows users to lock audio tracks to individual video frames. After the editing work is done, users can then export the mixed audio track into a new video file.
"
Castro: The Watercooler Reboot, progress report
Canonical's Jorge Castro has written an update on his quest to revamp the Ubuntu project's online discussion forums into something that developers do not loathe to use. The setup is based on Discourse, which as Castro points out, allows discussion threads to be integrated with WordPress blogs, in addition to connecting the main Ubuntu site itself.
Page editor: Nathan Willis
Next page:
Announcements>>
