mozilla/pdf.js — pull request #3255 by Snuffleupagus (2013-05-15 11:05:44+00:00)
Title: Implement default preferences in Firefox

This PR contains a suggested approach for implementing default preferences in the Firefox version of pdf.js. This uses `about:config` to store the preferences, hence this will only work in the Firefox add-on and should also work in the version of pdf.js that is included in Firefox.

This PR implements a framework for reading/writing of default preferences, hence it should be easy to add more preferences if needed. (Since most preferences that I can think of only matters when a document is loaded, I haven't bothered adding any preference observers.)
Currently this PR adds the following three preferences (default values in bold):

`PREF_PREFX.showPreviousViewOnLoad` = __true__ | false.
Setting this preference to false will always load the document at the first page.
Related issue: #2568.

`PREF_PREFIX.defaultZoomValue` = __{empty string}__
Setting this preference to either a numerical value, or one of the predefined zoom values, will load all documents at the user defined zoom level. To avoid issues if the user sets this to an non-existent value, part of PR #2970 is needed.
Related issue: #1624.

`PREF_PREFIX.ifAvailableShowOutlineOnLoad` = __false__ | true
Setting this to true will automatically display the outline when the document, but *only if* the document actually contains an outline. Setting this to true would save the user opening the sidebar just to see if an outline is available. This is a much impreved version of #2691.

As a follow-up to this PR, I've got a prototype UI for displaying and changing these preferences in the viewer.

/cc @brendandahl, @yurydelendik: What are your opinions about this approach?