Bug 1514724 - set default prefs in firefox.js instead of dynamically, r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D14804

--HG--
extra : rebase_source : 97626ea17b971705b493844e2f956f6c64a2214d
This commit is contained in:
Gijs Kruitbosch 2018-12-28 11:27:09 +00:00
Родитель b5785ef772
Коммит 40b32451fd
2 изменённых файлов: 2 добавлений и 29 удалений

Просмотреть файл

@ -1651,8 +1651,10 @@ pref("browser.migrate.chrome.history.maxAgeInDays", 180);
// Enable browser frames for use on desktop. Only exposed to chrome callers.
pref("dom.mozBrowserFramesEnabled", true);
pref("extensions.pocket.api", "api.getpocket.com");
pref("extensions.pocket.enabled", true);
pref("extensions.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
pref("extensions.pocket.site", "getpocket.com");
pref("signon.schemeUpgrades", true);

Просмотреть файл

@ -21,34 +21,6 @@ XPCOMUtils.defineLazyGetter(this, "gPocketBundle", function() {
var EXPORTED_SYMBOLS = ["SaveToPocket"];
const PREF_BRANCH = "extensions.pocket.";
const PREFS = {
enabled: true, // bug 1229937, figure out ui tour support
api: "api.getpocket.com",
site: "getpocket.com",
};
function setDefaultPrefs() {
let branch = Services.prefs.getDefaultBranch(PREF_BRANCH);
for (let [key, val] of Object.entries(PREFS)) {
// If someone beat us to setting a default, don't overwrite it. This can
// happen if distribution.ini sets the default first.
if (branch.getPrefType(key) != branch.PREF_INVALID)
continue;
switch (typeof val) {
case "boolean":
branch.setBoolPref(key, val);
break;
case "number":
branch.setIntPref(key, val);
break;
case "string":
branch.setCharPref(key, val);
break;
}
}
}
function createElementWithAttrs(document, type, attrs) {
let element = document.createXULElement(type);
Object.keys(attrs).forEach(function(attr) {
@ -442,7 +414,6 @@ function browserWindows() {
var SaveToPocket = {
init() {
setDefaultPrefs();
// migrate enabled pref
if (Services.prefs.prefHasUserValue("browser.pocket.enabled")) {
Services.prefs.setBoolPref("extensions.pocket.enabled", Services.prefs.getBoolPref("browser.pocket.enabled"));