Bug 1299254 - avoid recursion in Services.prefs shim initialization; r?bgrins
MozReview-Commit-ID: CuLgSaEtpgi
--- a/devtools/client/shared/shim/Services.js
+++ b/devtools/client/shared/shim/Services.js
@@ -36,20 +36,16 @@ function PrefBranch(parent, name, fullNa
this._observers = {};
this._children = {};
// Properties used when this branch has a value as well.
this._defaultValue = null;
this._hasUserValue = false;
this._userValue = null;
this._type = PREF_INVALID;
-
- if (!parent) {
- this._initializeRoot();
- }
}
PrefBranch.prototype = {
PREF_INVALID: PREF_INVALID,
PREF_STRING: PREF_STRING,
PREF_INT: PREF_INT,
PREF_BOOL: PREF_BOOL,
@@ -464,16 +460,17 @@ const Services = {
* storage. Only the subset of nsIPrefService that is actually used
* by devtools is implemented here. This is lazily instantiated so
* that the tests have a chance to disable the loading of default
* prefs.
*/
get prefs() {
if (!this._prefs) {
this._prefs = new PrefBranch(null, "", "");
+ this._prefs._initializeRoot();
}
return this._prefs;
},
/**
* An implementation of Services.appinfo that holds just the
* properties needed by devtools.
*/