Index: lib/prefs.js |
diff --git a/lib/prefs.js b/lib/prefs.js |
index 15b4efd174ae7e678013414be03fb7b8f64cf659..b9ac2c460c92bbb07b6f3803352c019810f38849 100644 |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -84,24 +84,27 @@ function defineProperty(key) |
function load() |
{ |
- _fileSystem.read(prefsFileName, result => |
+ new Promise((resolve, reject) => |
{ |
- // prefs.json is expected to be missing, ignore errors reading file |
- if (!result.error) |
+ _fileSystem.read(prefsFileName, resolve, reject); |
+ }).then((result) => |
+ { |
+ try |
{ |
- try |
- { |
- let data = JSON.parse(result.content); |
- for (let key in data) |
- if (key in defaults) |
- values[key] = data[key]; |
- } |
- catch (e) |
- { |
- Cu.reportError(e); |
- } |
+ let data = JSON.parse(result.content); |
+ for (let key in data) |
+ if (key in defaults) |
+ values[key] = data[key]; |
} |
- |
+ catch (e) |
+ { |
+ Cu.reportError(e); |
+ } |
+ }).catch(() => |
+ { |
+ // prefs.json is expected to be missing, ignore file reading errors |
+ }).then(() => |
+ { |
Prefs.initialized = true; |
if (typeof Prefs._initListener == "function") |
Prefs._initListener(); |