Implement default preferences

This commit is contained in:
Jonas Jenwald 2013-11-18 23:51:06 +01:00
parent 29ee96cc67
commit 60610cd625
8 changed files with 278 additions and 8 deletions

View file

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Preferences, PDFJS */
'use strict';
@ -102,3 +103,14 @@ var DownloadManager = (function DownloadManagerClosure() {
return DownloadManager;
})();
Preferences.prototype.writeToStorage = function(prefObj) {
FirefoxCom.requestSync('setPreferences', prefObj);
};
Preferences.prototype.readFromStorage = function() {
var readFromStoragePromise = new PDFJS.Promise();
var readPrefs = JSON.parse(FirefoxCom.requestSync('getPreferences'));
readFromStoragePromise.resolve(readPrefs);
return readFromStoragePromise;
};