The Content Preferences extension version 0.3 is now available from the AMO sandbox.
I added these user-facing enhancements:
- a site-specific Page Style setting for sites like dbaron.org that provide alternate stylesheets;
- a site-specific Character Encoding setting for when Firefox incorrectly guesses the encoding on a site;
- a Reset All button at the bottom of the sidebar that lets you reset all settings to their default values for the current site;
- a Global tab that lets you set preferences that apply to all sites;
- a yellow background color behind modified settings that helps you identify the settings you’ve twiddled;
- a Reset button () next to modified settings for setting them back to their default values (thanks to Mark James for the icon, which comes from his Silk icon set).
Props to Alex Faaborg for his feedback on and assistance with several of these enhancements and to Dan Mosedale for pointing out the spiffy way OmniWeb lets you reset modified settings.
I should note that while I implemented site-specific Page Style (primarily to exercise the back-end code) in a way that could be integrated into the Firefox core, I think it would make more sense to move the entire Page Style feature out of the core and make it available only as an extension, given how rarely the feature is used.
But, as Mike Connor pointed out to me recently, UI for selecting an alternate stylesheet is actually mandated by the CSS 2 spec (section 3.2, point 5), and if we have to include it, we might as well make it work better.
On the back-end, the extension sports the following enhancements:
- a declarative syntax (modeled after the one used by the Preferences dialog) for describing widgets in the sidebar, which the sidebar controller uses to auto-update prefs when users twiddle widgets (and vice-versa);
- nsIObserver-style notifications from the service and the controller;
- DOMContentLoaded notifications from the controller, in addition to the location change notifications, to support settings like Page Style that need to do their thing after the page has loaded;
- nsIVariant pref values stored as blobs in the database, for theoretical round-trip integrity to the database and beyond, err, back;
- auto-derivation of sites from URIs inside all service methods, so instead of calling getSiteForURI to derive the site and then a second method like getPref to do some actual work, you just call the second method, passing it the URI, and let the service do the deriving.
I also fixed a number of miscellaneous bugs (and undoubtedly introduced new ones) and worked around a few bugs in Firefox. Many thanks to John P. Baker for spotting some of the problems and providing useful feedback on the API.
Per the Firefox 3 product plan, my next step will be to integrate the core service and site-specific text zoom into the browser core, for which I’ve filed bugs 378547 and 378549, respectively.
The sidebar, on the other hand, and the other two settings it exposes will remain an extension for now.