mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-05 14:57:30 +09:00
Issue #991 Part 7: Toolkit Components
This commit is contained in:
parent
c54c6d3bd2
commit
e309515e66
18 changed files with 55 additions and 204 deletions
|
|
@ -79,12 +79,8 @@ const DELAY_WARNING_MS = 10 * 1000;
|
||||||
// Crash the process if shutdown is really too long
|
// Crash the process if shutdown is really too long
|
||||||
// (allowing for sleep).
|
// (allowing for sleep).
|
||||||
const PREF_DELAY_CRASH_MS = "toolkit.asyncshutdown.crash_timeout";
|
const PREF_DELAY_CRASH_MS = "toolkit.asyncshutdown.crash_timeout";
|
||||||
var DELAY_CRASH_MS = 60 * 1000; // One minute
|
var DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS,
|
||||||
try {
|
60 * 1000); // One minute
|
||||||
DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS);
|
|
||||||
} catch (ex) {
|
|
||||||
// Ignore errors
|
|
||||||
}
|
|
||||||
Services.prefs.addObserver(PREF_DELAY_CRASH_MS, function() {
|
Services.prefs.addObserver(PREF_DELAY_CRASH_MS, function() {
|
||||||
DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS);
|
DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
@ -207,12 +203,7 @@ function log(msg, prefix = "", error = null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const PREF_DEBUG_LOG = "toolkit.asyncshutdown.log";
|
const PREF_DEBUG_LOG = "toolkit.asyncshutdown.log";
|
||||||
var DEBUG_LOG = false;
|
var DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG, false);
|
||||||
try {
|
|
||||||
DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG);
|
|
||||||
} catch (ex) {
|
|
||||||
// Ignore errors
|
|
||||||
}
|
|
||||||
Services.prefs.addObserver(PREF_DEBUG_LOG, function() {
|
Services.prefs.addObserver(PREF_DEBUG_LOG, function() {
|
||||||
DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG);
|
DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
@ -360,12 +351,7 @@ this.AsyncShutdown = {
|
||||||
* Access function getPhase. For testing purposes only.
|
* Access function getPhase. For testing purposes only.
|
||||||
*/
|
*/
|
||||||
get _getPhase() {
|
get _getPhase() {
|
||||||
let accepted = false;
|
let accepted = Services.prefs.getBoolPref("toolkit.asyncshutdown.testing", false);
|
||||||
try {
|
|
||||||
accepted = Services.prefs.getBoolPref("toolkit.asyncshutdown.testing");
|
|
||||||
} catch (ex) {
|
|
||||||
// Ignore errors
|
|
||||||
}
|
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
return getPhase;
|
return getPhase;
|
||||||
}
|
}
|
||||||
|
|
@ -464,12 +450,7 @@ function getPhase(topic) {
|
||||||
* notification. For testing purposes only.
|
* notification. For testing purposes only.
|
||||||
*/
|
*/
|
||||||
get _trigger() {
|
get _trigger() {
|
||||||
let accepted = false;
|
let accepted = Services.prefs.getBoolPref("toolkit.asyncshutdown.testing", false);
|
||||||
try {
|
|
||||||
accepted = Services.prefs.getBoolPref("toolkit.asyncshutdown.testing");
|
|
||||||
} catch (ex) {
|
|
||||||
// Ignore errors
|
|
||||||
}
|
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
return () => spinner.observe();
|
return () => spinner.observe();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -243,16 +243,7 @@ function getLocale() {
|
||||||
|
|
||||||
/* Get the distribution pref values, from defaults only */
|
/* Get the distribution pref values, from defaults only */
|
||||||
function getDistributionPrefValue(aPrefName) {
|
function getDistributionPrefValue(aPrefName) {
|
||||||
var prefValue = "default";
|
return gPref.getDefaultBranch(null).getCharPref(aPrefName, "default");
|
||||||
|
|
||||||
var defaults = gPref.getDefaultBranch(null);
|
|
||||||
try {
|
|
||||||
prefValue = defaults.getCharPref(aPrefName);
|
|
||||||
} catch (e) {
|
|
||||||
// use default when pref not found
|
|
||||||
}
|
|
||||||
|
|
||||||
return prefValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -368,11 +368,7 @@ this.DownloadIntegration = {
|
||||||
*/
|
*/
|
||||||
getPreferredDownloadsDirectory: Task.async(function* () {
|
getPreferredDownloadsDirectory: Task.async(function* () {
|
||||||
let directoryPath = null;
|
let directoryPath = null;
|
||||||
let prefValue = 1;
|
let prefValue = Services.prefs.getIntPref("browser.download.folderList", 1);
|
||||||
|
|
||||||
try {
|
|
||||||
prefValue = Services.prefs.getIntPref("browser.download.folderList");
|
|
||||||
} catch(e) {}
|
|
||||||
|
|
||||||
switch(prefValue) {
|
switch(prefValue) {
|
||||||
case 0: // Desktop
|
case 0: // Desktop
|
||||||
|
|
|
||||||
|
|
@ -104,13 +104,7 @@ nsDefaultCLH.prototype = {
|
||||||
// if the pref is missing, ignore the exception
|
// if the pref is missing, ignore the exception
|
||||||
try {
|
try {
|
||||||
var chromeURI = prefs.getCharPref("toolkit.defaultChromeURI");
|
var chromeURI = prefs.getCharPref("toolkit.defaultChromeURI");
|
||||||
|
var flags = prefs.getCharPref("toolkit.defaultChromeFeatures", "chrome,dialog=no,all");
|
||||||
var flags = "chrome,dialog=no,all";
|
|
||||||
try {
|
|
||||||
flags = prefs.getCharPref("toolkit.defaultChromeFeatures");
|
|
||||||
}
|
|
||||||
catch (e) { }
|
|
||||||
|
|
||||||
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||||
.getService(nsIWindowWatcher);
|
.getService(nsIWindowWatcher);
|
||||||
wwatch.openWindow(null, chromeURI, "_blank",
|
wwatch.openWindow(null, chromeURI, "_blank",
|
||||||
|
|
|
||||||
|
|
@ -239,10 +239,9 @@ var Scheduler = this.Scheduler = {
|
||||||
* Prepare to kill the OS.File worker after a few seconds.
|
* Prepare to kill the OS.File worker after a few seconds.
|
||||||
*/
|
*/
|
||||||
restartTimer: function(arg) {
|
restartTimer: function(arg) {
|
||||||
let delay;
|
let delay = Services.prefs.getIntPref("osfile.reset_worker_delay", 0);
|
||||||
try {
|
|
||||||
delay = Services.prefs.getIntPref("osfile.reset_worker_delay");
|
if (!delay) {
|
||||||
} catch(e) {
|
|
||||||
// Don't auto-shutdown if we don't have a delay preference set.
|
// Don't auto-shutdown if we don't have a delay preference set.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -468,43 +467,25 @@ var Scheduler = this.Scheduler = {
|
||||||
const PREF_OSFILE_LOG = "toolkit.osfile.log";
|
const PREF_OSFILE_LOG = "toolkit.osfile.log";
|
||||||
const PREF_OSFILE_LOG_REDIRECT = "toolkit.osfile.log.redirect";
|
const PREF_OSFILE_LOG_REDIRECT = "toolkit.osfile.log.redirect";
|
||||||
|
|
||||||
/**
|
|
||||||
* Safely read a PREF_OSFILE_LOG preference.
|
|
||||||
* Returns a value read or, in case of an error, oldPref or false.
|
|
||||||
*
|
|
||||||
* @param bool oldPref
|
|
||||||
* An optional value that the DEBUG flag was set to previously.
|
|
||||||
*/
|
|
||||||
function readDebugPref(prefName, oldPref = false) {
|
|
||||||
let pref = oldPref;
|
|
||||||
try {
|
|
||||||
pref = Services.prefs.getBoolPref(prefName);
|
|
||||||
} catch (x) {
|
|
||||||
// In case of an error when reading a pref keep it as is.
|
|
||||||
}
|
|
||||||
// If neither pref nor oldPref were set, default it to false.
|
|
||||||
return pref;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen to PREF_OSFILE_LOG changes and update gShouldLog flag
|
* Listen to PREF_OSFILE_LOG changes and update gShouldLog flag
|
||||||
* appropriately.
|
* appropriately.
|
||||||
*/
|
*/
|
||||||
Services.prefs.addObserver(PREF_OSFILE_LOG,
|
Services.prefs.addObserver(PREF_OSFILE_LOG,
|
||||||
function prefObserver(aSubject, aTopic, aData) {
|
function prefObserver(aSubject, aTopic, aData) {
|
||||||
SharedAll.Config.DEBUG = readDebugPref(PREF_OSFILE_LOG, SharedAll.Config.DEBUG);
|
SharedAll.Config.DEBUG = Services.prefs.getBoolPref(PREF_OSFILE_LOG, SharedAll.Config.DEBUG);
|
||||||
if (Scheduler.launched) {
|
if (Scheduler.launched) {
|
||||||
// Don't start the worker just to set this preference.
|
// Don't start the worker just to set this preference.
|
||||||
Scheduler.post("SET_DEBUG", [SharedAll.Config.DEBUG]);
|
Scheduler.post("SET_DEBUG", [SharedAll.Config.DEBUG]);
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
SharedAll.Config.DEBUG = readDebugPref(PREF_OSFILE_LOG, false);
|
SharedAll.Config.DEBUG = Services.prefs.getBoolPref(PREF_OSFILE_LOG, false);
|
||||||
|
|
||||||
Services.prefs.addObserver(PREF_OSFILE_LOG_REDIRECT,
|
Services.prefs.addObserver(PREF_OSFILE_LOG_REDIRECT,
|
||||||
function prefObserver(aSubject, aTopic, aData) {
|
function prefObserver(aSubject, aTopic, aData) {
|
||||||
SharedAll.Config.TEST = readDebugPref(PREF_OSFILE_LOG_REDIRECT, OS.Shared.TEST);
|
SharedAll.Config.TEST = Services.prefs.getBoolPref(PREF_OSFILE_LOG_REDIRECT, OS.Shared.TEST);
|
||||||
}, false);
|
}, false);
|
||||||
SharedAll.Config.TEST = readDebugPref(PREF_OSFILE_LOG_REDIRECT, false);
|
SharedAll.Config.TEST = Services.prefs.getBoolPref(PREF_OSFILE_LOG_REDIRECT, false);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -515,7 +496,7 @@ var nativeWheneverAvailable = true;
|
||||||
const PREF_OSFILE_NATIVE = "toolkit.osfile.native";
|
const PREF_OSFILE_NATIVE = "toolkit.osfile.native";
|
||||||
Services.prefs.addObserver(PREF_OSFILE_NATIVE,
|
Services.prefs.addObserver(PREF_OSFILE_NATIVE,
|
||||||
function prefObserver(aSubject, aTopic, aData) {
|
function prefObserver(aSubject, aTopic, aData) {
|
||||||
nativeWheneverAvailable = readDebugPref(PREF_OSFILE_NATIVE, nativeWheneverAvailable);
|
nativeWheneverAvailable = Services.prefs.getBoolPref(PREF_OSFILE_NATIVE, nativeWheneverAvailable);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -557,10 +538,9 @@ Services.prefs.addObserver(PREF_OSFILE_TEST_SHUTDOWN_OBSERVER,
|
||||||
function prefObserver() {
|
function prefObserver() {
|
||||||
// The temporary phase topic used to trigger the unclosed
|
// The temporary phase topic used to trigger the unclosed
|
||||||
// phase warning.
|
// phase warning.
|
||||||
let TOPIC = null;
|
let TOPIC = Services.prefs.getCharPref(PREF_OSFILE_TEST_SHUTDOWN_OBSERVER,
|
||||||
|
"");
|
||||||
try {
|
try {
|
||||||
TOPIC = Services.prefs.getCharPref(
|
|
||||||
PREF_OSFILE_TEST_SHUTDOWN_OBSERVER);
|
|
||||||
} catch (x) {
|
} catch (x) {
|
||||||
}
|
}
|
||||||
if (TOPIC) {
|
if (TOPIC) {
|
||||||
|
|
|
||||||
|
|
@ -77,11 +77,8 @@ PlacesCategoriesStarter.prototype = {
|
||||||
break;
|
break;
|
||||||
case "idle-daily":
|
case "idle-daily":
|
||||||
// Once a week run places.sqlite maintenance tasks.
|
// Once a week run places.sqlite maintenance tasks.
|
||||||
let lastMaintenance = 0;
|
let lastMaintenance =
|
||||||
try {
|
Services.prefs.getIntPref("places.database.lastMaintenance", 0);
|
||||||
lastMaintenance =
|
|
||||||
Services.prefs.getIntPref("places.database.lastMaintenance");
|
|
||||||
} catch (ex) {}
|
|
||||||
let nowSeconds = parseInt(Date.now() / 1000);
|
let nowSeconds = parseInt(Date.now() / 1000);
|
||||||
if (lastMaintenance < nowSeconds - MAINTENANCE_INTERVAL_SECONDS) {
|
if (lastMaintenance < nowSeconds - MAINTENANCE_INTERVAL_SECONDS) {
|
||||||
PlacesDBUtils.maintenanceOnIdle();
|
PlacesDBUtils.maintenanceOnIdle();
|
||||||
|
|
|
||||||
|
|
@ -95,11 +95,7 @@ function observe(subject, topic, data) {
|
||||||
|
|
||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
if (data == PREF_SHOW_REMOTE_ICONS) {
|
if (data == PREF_SHOW_REMOTE_ICONS) {
|
||||||
try {
|
showRemoteIcons = Services.prefs.getBoolPref(PREF_SHOW_REMOTE_ICONS, true);
|
||||||
showRemoteIcons = Services.prefs.getBoolPref(PREF_SHOW_REMOTE_ICONS);
|
|
||||||
} catch (_) {
|
|
||||||
showRemoteIcons = true; // no such pref - default is to show the icons.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -437,10 +437,7 @@ XPCOMUtils.defineLazyGetter(this, "Prefs", () => {
|
||||||
store.suggestTyped = prefs.get(...PREF_SUGGEST_HISTORY_ONLYTYPED);
|
store.suggestTyped = prefs.get(...PREF_SUGGEST_HISTORY_ONLYTYPED);
|
||||||
store.suggestSearches = prefs.get(...PREF_SUGGEST_SEARCHES);
|
store.suggestSearches = prefs.get(...PREF_SUGGEST_SEARCHES);
|
||||||
store.maxCharsForSearchSuggestions = prefs.get(...PREF_MAX_CHARS_FOR_SUGGEST);
|
store.maxCharsForSearchSuggestions = prefs.get(...PREF_MAX_CHARS_FOR_SUGGEST);
|
||||||
store.keywordEnabled = true;
|
store.keywordEnabled = Services.prefs.getBoolPref("keyword.enabled", true);
|
||||||
try {
|
|
||||||
store.keywordEnabled = Services.prefs.getBoolPref("keyword.enabled");
|
|
||||||
} catch (ex) {}
|
|
||||||
|
|
||||||
// If history is not set, onlyTyped value should be ignored.
|
// If history is not set, onlyTyped value should be ignored.
|
||||||
if (!store.suggestHistory) {
|
if (!store.suggestHistory) {
|
||||||
|
|
|
||||||
|
|
@ -812,11 +812,8 @@ nsPlacesExpiration.prototype = {
|
||||||
|
|
||||||
_loadPrefs: Task.async(function* () {
|
_loadPrefs: Task.async(function* () {
|
||||||
// Get the user's limit, if it was set.
|
// Get the user's limit, if it was set.
|
||||||
try {
|
this._urisLimit = this._prefBranch.getIntPref(PREF_MAX_URIS,
|
||||||
// We want to silently fail since getIntPref throws if it does not exist,
|
PREF_MAX_URIS_NOTSET);
|
||||||
// and use a default to fallback to.
|
|
||||||
this._urisLimit = this._prefBranch.getIntPref(PREF_MAX_URIS);
|
|
||||||
} catch (ex) { /* User limit not set */ }
|
|
||||||
|
|
||||||
if (this._urisLimit < 0) {
|
if (this._urisLimit < 0) {
|
||||||
// Some testing code expects a pref change to be synchronous, so
|
// Some testing code expects a pref change to be synchronous, so
|
||||||
|
|
@ -874,11 +871,8 @@ nsPlacesExpiration.prototype = {
|
||||||
this._urisLimit);
|
this._urisLimit);
|
||||||
|
|
||||||
// Get the expiration interval value.
|
// Get the expiration interval value.
|
||||||
try {
|
this._interval = this._prefBranch.getIntPref(PREF_INTERVAL_SECONDS,
|
||||||
// We want to silently fail since getIntPref throws if it does not exist,
|
PREF_INTERVAL_SECONDS_NOTSET);
|
||||||
// and use a default to fallback to.
|
|
||||||
this._interval = this._prefBranch.getIntPref(PREF_INTERVAL_SECONDS);
|
|
||||||
} catch (ex) { /* User interval not set */ }
|
|
||||||
if (this._interval <= 0) {
|
if (this._interval <= 0) {
|
||||||
this._interval = PREF_INTERVAL_SECONDS_NOTSET;
|
this._interval = PREF_INTERVAL_SECONDS_NOTSET;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,14 +56,8 @@ var prefPrefix = "places.frecency.";
|
||||||
function* task_initializeBucket(bucket) {
|
function* task_initializeBucket(bucket) {
|
||||||
let [cutoffName, weightName] = bucket;
|
let [cutoffName, weightName] = bucket;
|
||||||
// get pref values
|
// get pref values
|
||||||
var weight = 0, cutoff = 0;
|
var weight = prefs.getIntPref(prefPrefix + weightName, 0);
|
||||||
try {
|
var cutoff = prefs.getIntPref(prefPrefix + cutoffName, 0);
|
||||||
weight = prefs.getIntPref(prefPrefix + weightName);
|
|
||||||
} catch (ex) {}
|
|
||||||
try {
|
|
||||||
cutoff = prefs.getIntPref(prefPrefix + cutoffName);
|
|
||||||
} catch (ex) {}
|
|
||||||
|
|
||||||
if (cutoff < 1)
|
if (cutoff < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,14 +65,7 @@ function initDialog()
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
function isListOfPrinterFeaturesAvailable()
|
function isListOfPrinterFeaturesAvailable()
|
||||||
{
|
{
|
||||||
var has_printerfeatures = false;
|
return gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".has_special_printerfeatures", false);
|
||||||
|
|
||||||
try {
|
|
||||||
has_printerfeatures = gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".has_special_printerfeatures");
|
|
||||||
} catch (ex) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return has_printerfeatures;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,7 @@ function stripTrailingWhitespace(element)
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
function getPrinterDescription(printerName)
|
function getPrinterDescription(printerName)
|
||||||
{
|
{
|
||||||
var s = "";
|
return gPrefs.getCharPref("print.printer_" + printerName + ".printer_description", "")
|
||||||
|
|
||||||
try {
|
|
||||||
/* This may not work with non-ASCII test (see bug 235763 comment #16) */
|
|
||||||
s = gPrefs.getCharPref("print.printer_" + printerName + ".printer_description")
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,7 @@ function checkDouble(element, maxVal)
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
function isListOfPrinterFeaturesAvailable()
|
function isListOfPrinterFeaturesAvailable()
|
||||||
{
|
{
|
||||||
var has_printerfeatures = false;
|
return gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".has_special_printerfeatures", false);
|
||||||
|
|
||||||
try {
|
|
||||||
has_printerfeatures = gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".has_special_printerfeatures");
|
|
||||||
} catch (ex) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return has_printerfeatures;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -390,12 +390,7 @@ function isPartnerBuild() {
|
||||||
|
|
||||||
// Method to determine if we should be using geo-specific defaults
|
// Method to determine if we should be using geo-specific defaults
|
||||||
function geoSpecificDefaultsEnabled() {
|
function geoSpecificDefaultsEnabled() {
|
||||||
let geoSpecificDefaults = false;
|
return Services.prefs.getBoolPref("browser.search.geoSpecificDefaults", false);
|
||||||
try {
|
|
||||||
geoSpecificDefaults = Services.prefs.getBoolPref("browser.search.geoSpecificDefaults");
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
return geoSpecificDefaults;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some notes on countryCode and region prefs:
|
// Some notes on countryCode and region prefs:
|
||||||
|
|
@ -500,11 +495,7 @@ function isUSTimezone() {
|
||||||
// If it fails we don't touch that pref so isUS() does its normal thing.
|
// If it fails we don't touch that pref so isUS() does its normal thing.
|
||||||
var ensureKnownCountryCode = Task.async(function* (ss) {
|
var ensureKnownCountryCode = Task.async(function* (ss) {
|
||||||
// If we have a country-code already stored in our prefs we trust it.
|
// If we have a country-code already stored in our prefs we trust it.
|
||||||
let countryCode;
|
let countryCode = Services.prefs.getCharPref("browser.search.countryCode", "");
|
||||||
try {
|
|
||||||
countryCode = Services.prefs.getCharPref("browser.search.countryCode");
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
if (!countryCode) {
|
if (!countryCode) {
|
||||||
// We don't have it cached, so fetch it. fetchCountryCode() will call
|
// We don't have it cached, so fetch it. fetchCountryCode() will call
|
||||||
// storeCountryCode if it gets a result (even if that happens after the
|
// storeCountryCode if it gets a result (even if that happens after the
|
||||||
|
|
@ -726,10 +717,7 @@ var fetchRegionDefault = (ss) => new Promise(resolve => {
|
||||||
|
|
||||||
// Append the optional cohort value.
|
// Append the optional cohort value.
|
||||||
const cohortPref = "browser.search.cohort";
|
const cohortPref = "browser.search.cohort";
|
||||||
let cohort;
|
let cohort = Services.prefs.getCharPref(cohortPref, "");
|
||||||
try {
|
|
||||||
cohort = Services.prefs.getCharPref(cohortPref);
|
|
||||||
} catch (e) {}
|
|
||||||
if (cohort)
|
if (cohort)
|
||||||
endpoint += "/" + cohort;
|
endpoint += "/" + cohort;
|
||||||
|
|
||||||
|
|
@ -993,19 +981,13 @@ function QueryParameter(aName, aValue, aPurpose) {
|
||||||
function ParamSubstitution(aParamValue, aSearchTerms, aEngine) {
|
function ParamSubstitution(aParamValue, aSearchTerms, aEngine) {
|
||||||
var value = aParamValue;
|
var value = aParamValue;
|
||||||
|
|
||||||
var distributionID = Services.appinfo.distributionID;
|
var distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID",
|
||||||
try {
|
Services.appinfo.distributionID || "");
|
||||||
distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
|
var official;
|
||||||
}
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official", MOZ_OFFICIAL))
|
||||||
catch (ex) { }
|
|
||||||
var official = MOZ_OFFICIAL;
|
|
||||||
try {
|
|
||||||
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official"))
|
|
||||||
official = "official";
|
official = "official";
|
||||||
else
|
else
|
||||||
official = "unofficial";
|
official = "unofficial";
|
||||||
}
|
|
||||||
catch (ex) { }
|
|
||||||
|
|
||||||
// Custom search parameters. These are only available to default search
|
// Custom search parameters. These are only available to default search
|
||||||
// engines.
|
// engines.
|
||||||
|
|
|
||||||
|
|
@ -418,12 +418,7 @@ function isPartnerBuild() {
|
||||||
|
|
||||||
// Method to determine if we should be using geo-specific defaults
|
// Method to determine if we should be using geo-specific defaults
|
||||||
function geoSpecificDefaultsEnabled() {
|
function geoSpecificDefaultsEnabled() {
|
||||||
let geoSpecificDefaults = false;
|
return Services.prefs.getBoolPref("browser.search.geoSpecificDefaults", false);
|
||||||
try {
|
|
||||||
geoSpecificDefaults = Services.prefs.getBoolPref("browser.search.geoSpecificDefaults");
|
|
||||||
} catch(e) {}
|
|
||||||
|
|
||||||
return geoSpecificDefaults;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some notes on countryCode and region prefs:
|
// Some notes on countryCode and region prefs:
|
||||||
|
|
@ -528,11 +523,7 @@ function isUSTimezone() {
|
||||||
// If it fails we don't touch that pref so isUS() does its normal thing.
|
// If it fails we don't touch that pref so isUS() does its normal thing.
|
||||||
var ensureKnownCountryCode = Task.async(function* () {
|
var ensureKnownCountryCode = Task.async(function* () {
|
||||||
// If we have a country-code already stored in our prefs we trust it.
|
// If we have a country-code already stored in our prefs we trust it.
|
||||||
let countryCode;
|
let countryCode = Services.prefs.getCharPref("browser.search.countryCode", "");
|
||||||
try {
|
|
||||||
countryCode = Services.prefs.getCharPref("browser.search.countryCode");
|
|
||||||
} catch(e) {}
|
|
||||||
|
|
||||||
if (!countryCode) {
|
if (!countryCode) {
|
||||||
// We don't have it cached, so fetch it. fetchCountryCode() will call
|
// We don't have it cached, so fetch it. fetchCountryCode() will call
|
||||||
// storeCountryCode if it gets a result (even if that happens after the
|
// storeCountryCode if it gets a result (even if that happens after the
|
||||||
|
|
@ -732,10 +723,7 @@ var fetchRegionDefault = () => new Promise(resolve => {
|
||||||
|
|
||||||
// Append the optional cohort value.
|
// Append the optional cohort value.
|
||||||
const cohortPref = "browser.search.cohort";
|
const cohortPref = "browser.search.cohort";
|
||||||
let cohort;
|
let cohort = Services.prefs.getCharPref(cohortPref, "");
|
||||||
try {
|
|
||||||
cohort = Services.prefs.getCharPref(cohortPref);
|
|
||||||
} catch(e) {}
|
|
||||||
if (cohort)
|
if (cohort)
|
||||||
endpoint += "/" + cohort;
|
endpoint += "/" + cohort;
|
||||||
|
|
||||||
|
|
@ -1034,19 +1022,13 @@ function QueryParameter(aName, aValue, aPurpose) {
|
||||||
function ParamSubstitution(aParamValue, aSearchTerms, aEngine) {
|
function ParamSubstitution(aParamValue, aSearchTerms, aEngine) {
|
||||||
var value = aParamValue;
|
var value = aParamValue;
|
||||||
|
|
||||||
var distributionID = MOZ_DISTRIBUTION_ID;
|
var distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID",
|
||||||
try {
|
MOZ_DISTRIBUTION_ID || "");
|
||||||
distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
|
var official;
|
||||||
}
|
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official", MOZ_OFFICIAL))
|
||||||
catch (ex) { }
|
|
||||||
var official = MOZ_OFFICIAL;
|
|
||||||
try {
|
|
||||||
if (Services.prefs.getBoolPref(BROWSER_SEARCH_PREF + "official"))
|
|
||||||
official = "official";
|
official = "official";
|
||||||
else
|
else
|
||||||
official = "unofficial";
|
official = "unofficial";
|
||||||
}
|
|
||||||
catch (ex) { }
|
|
||||||
|
|
||||||
// Custom search parameters. These are only available to default search
|
// Custom search parameters. These are only available to default search
|
||||||
// engines.
|
// engines.
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,7 @@ this.UITelemetry = {
|
||||||
Services.obs.addObserver(this, "profile-before-change", false);
|
Services.obs.addObserver(this, "profile-before-change", false);
|
||||||
|
|
||||||
// Pick up the current value.
|
// Pick up the current value.
|
||||||
try {
|
this._enabled = Services.prefs.getBoolPref(PREF_ENABLED, false);
|
||||||
this._enabled = Services.prefs.getBoolPref(PREF_ENABLED);
|
|
||||||
} catch (e) {
|
|
||||||
this._enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._enabled;
|
return this._enabled;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,7 @@ Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||||
|
|
||||||
// Log only if browser.safebrowsing.debug is true
|
// Log only if browser.safebrowsing.debug is true
|
||||||
function log(...stuff) {
|
function log(...stuff) {
|
||||||
let logging = null;
|
let logging = Services.prefs.getBoolPref("browser.safebrowsing.debug", false);
|
||||||
try {
|
|
||||||
logging = Services.prefs.getBoolPref("browser.safebrowsing.debug");
|
|
||||||
} catch(e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!logging) {
|
if (!logging) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,9 @@ function run_test() {
|
||||||
QueryInterface(Ci.nsIXULRuntime);
|
QueryInterface(Ci.nsIXULRuntime);
|
||||||
var abi = macutils && macutils.isUniversalBinary ? "Universal-gcc3" : appInfo.XPCOMABI;
|
var abi = macutils && macutils.isUniversalBinary ? "Universal-gcc3" : appInfo.XPCOMABI;
|
||||||
|
|
||||||
let channel = "default";
|
|
||||||
let defaults = prefs.QueryInterface(Ci.nsIPrefService).getDefaultBranch(null);
|
let defaults = prefs.QueryInterface(Ci.nsIPrefService).getDefaultBranch(null);
|
||||||
try {
|
let channel = defaults.getCharPref("app.update.channel", "default");
|
||||||
channel = defaults.getCharPref("app.update.channel");
|
|
||||||
} catch (e) {}
|
|
||||||
// Set distribution values.
|
// Set distribution values.
|
||||||
defaults.setCharPref("distribution.id", "bacon");
|
defaults.setCharPref("distribution.id", "bacon");
|
||||||
defaults.setCharPref("distribution.version", "1.0");
|
defaults.setCharPref("distribution.version", "1.0");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue