1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 function getPreferenceName(hud
, suffix
) {
9 console
.error("Suffix shouldn't be falsy", { suffix
});
14 console
.error("hud shouldn't be falsy", { hud
});
18 if (suffix
.startsWith("devtools.")) {
19 // We don't have a suffix but a full pref name. Let's return it.
23 const component
= hud
.isBrowserConsole
? "browserconsole" : "webconsole";
24 return `devtools.${component}.${suffix}`;
27 function getPrefsService(hud
) {
28 const getPrefName
= pref
=> getPreferenceName(hud
, pref
);
31 getBoolPref
: (pref
, deflt
) =>
32 Services
.prefs
.getBoolPref(getPrefName(pref
), deflt
),
33 getIntPref
: (pref
, deflt
) =>
34 Services
.prefs
.getIntPref(getPrefName(pref
), deflt
),
35 setBoolPref
: (pref
, value
) =>
36 Services
.prefs
.setBoolPref(getPrefName(pref
), value
),
37 setIntPref
: (pref
, value
) =>
38 Services
.prefs
.setIntPref(getPrefName(pref
), value
),
39 clearUserPref
: pref
=> Services
.prefs
.clearUserPref(getPrefName(pref
)),