Bug 1875678 - use set/getStringPref instead of set/getCharPref in services/. r=skhamis,sync-reviewers

Theoretically we only need to change this where the strings might be
non-ascii but it seems safer in the long run to just avoid the "char"
versions entirely.

Differential Revision: https://phabricator.services.mozilla.com/D200342
This commit is contained in:
Mark Hammond 2024-02-07 00:59:20 +00:00
Родитель 69300a43c4
Коммит e4a5ee36a6
50 изменённых файлов: 166 добавлений и 145 удалений

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

@ -392,7 +392,7 @@ export var Sync = {
};
export function initConfig(autoconfig) {
Services.prefs.setCharPref(AUTOCONFIG_PREF, autoconfig);
Services.prefs.setStringPref(AUTOCONFIG_PREF, autoconfig);
}
export async function triggerSync(username, password, autoconfig) {

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

@ -54,7 +54,7 @@ ChromeUtils.defineLazyGetter(lazy, "log", function () {
let level =
Services.prefs.getPrefType(PREF_LOG_LEVEL) ==
Ci.nsIPrefBranch.PREF_STRING &&
Services.prefs.getCharPref(PREF_LOG_LEVEL);
Services.prefs.getStringPref(PREF_LOG_LEVEL);
appender.level = Log.Level[level] || Log.Level.Error;
} catch (e) {
log.error(e);

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

@ -236,7 +236,8 @@ LogManager.prototype = {
// dump=Error, we need to keep dump=Debug so consumerA is respected.
for (let branch of allBranches) {
let lookPrefBranch = Services.prefs.getBranch(branch);
let lookVal = Log.Level[lookPrefBranch.getCharPref(prefName, null)];
let lookVal =
Log.Level[lookPrefBranch.getStringPref(prefName, null)];
if (lookVal && lookVal < level) {
level = lookVal;
}
@ -247,7 +248,7 @@ LogManager.prototype = {
this._prefs.addObserver(prefName, observer);
this._prefObservers.push([prefName, observer]);
// and call the observer now with the current pref value.
observer(this._prefs.getCharPref(prefName, null));
observer(this._prefs.getStringPref(prefName, null));
return observer;
};

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

@ -42,9 +42,12 @@ add_task(async function test_noPrefs() {
// Test that changes to the prefs used by the log manager are updated dynamically.
add_task(async function test_PrefChanges() {
Services.prefs.setCharPref("log-manager.test.log.appender.console", "Trace");
Services.prefs.setCharPref("log-manager.test.log.appender.dump", "Trace");
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"log-manager.test.log.appender.console",
"Trace"
);
Services.prefs.setStringPref("log-manager.test.log.appender.dump", "Trace");
Services.prefs.setStringPref(
"log-manager.test.log.appender.file.level",
"Trace"
);
@ -56,9 +59,12 @@ add_task(async function test_PrefChanges() {
equal(dapp.level, Log.Level.Trace);
equal(fapp.level, Log.Level.Trace);
// adjust the prefs and they should magically be reflected in the appenders.
Services.prefs.setCharPref("log-manager.test.log.appender.console", "Debug");
Services.prefs.setCharPref("log-manager.test.log.appender.dump", "Debug");
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"log-manager.test.log.appender.console",
"Debug"
);
Services.prefs.setStringPref("log-manager.test.log.appender.dump", "Debug");
Services.prefs.setStringPref(
"log-manager.test.log.appender.file.level",
"Debug"
);
@ -66,9 +72,12 @@ add_task(async function test_PrefChanges() {
equal(dapp.level, Log.Level.Debug);
equal(fapp.level, Log.Level.Debug);
// and invalid values should cause them to fallback to their defaults.
Services.prefs.setCharPref("log-manager.test.log.appender.console", "xxx");
Services.prefs.setCharPref("log-manager.test.log.appender.dump", "xxx");
Services.prefs.setCharPref("log-manager.test.log.appender.file.level", "xxx");
Services.prefs.setStringPref("log-manager.test.log.appender.console", "xxx");
Services.prefs.setStringPref("log-manager.test.log.appender.dump", "xxx");
Services.prefs.setStringPref(
"log-manager.test.log.appender.file.level",
"xxx"
);
equal(capp.level, Log.Level.Fatal);
equal(dapp.level, Log.Level.Error);
equal(fapp.level, Log.Level.Debug);
@ -78,24 +87,24 @@ add_task(async function test_PrefChanges() {
// Test that the same log used by multiple log managers does the right thing.
add_task(async function test_SharedLogs() {
// create the prefs for the first instance.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"log-manager-1.test.log.appender.console",
"Trace"
);
Services.prefs.setCharPref("log-manager-1.test.log.appender.dump", "Trace");
Services.prefs.setCharPref(
Services.prefs.setStringPref("log-manager-1.test.log.appender.dump", "Trace");
Services.prefs.setStringPref(
"log-manager-1.test.log.appender.file.level",
"Trace"
);
let lm1 = new LogManager("log-manager-1.test.", ["TestLog3"], "test");
// and the second.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"log-manager-2.test.log.appender.console",
"Debug"
);
Services.prefs.setCharPref("log-manager-2.test.log.appender.dump", "Debug");
Services.prefs.setCharPref(
Services.prefs.setStringPref("log-manager-2.test.log.appender.dump", "Debug");
Services.prefs.setStringPref(
"log-manager-2.test.log.appender.file.level",
"Debug"
);
@ -111,12 +120,12 @@ add_task(async function test_SharedLogs() {
// Set the prefs on the -1 branch to "Error" - it should then end up with
// "Debug" from the -2 branch.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"log-manager-1.test.log.appender.console",
"Error"
);
Services.prefs.setCharPref("log-manager-1.test.log.appender.dump", "Error");
Services.prefs.setCharPref(
Services.prefs.setStringPref("log-manager-1.test.log.appender.dump", "Error");
Services.prefs.setStringPref(
"log-manager-1.test.log.appender.file.level",
"Error"
);

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

@ -16,7 +16,7 @@ add_test(function test_set_basic() {
let now = new Date();
CommonUtils.setDatePref(prefs, "test00", now);
let value = prefs.getCharPref("test00");
let value = prefs.getStringPref("test00");
Assert.equal(value, "" + now.getTime());
let now2 = CommonUtils.getDatePref(prefs, "test00");
@ -42,7 +42,7 @@ add_test(function test_set_bounds_checking() {
});
add_test(function test_get_bounds_checking() {
prefs.setCharPref("test_bounds_checking", "13241431");
prefs.setStringPref("test_bounds_checking", "13241431");
let log = new DummyLogger();
let d = CommonUtils.getDatePref(prefs, "test_bounds_checking", 0, log);
@ -66,7 +66,7 @@ add_test(function test_get_bad_default() {
});
add_test(function test_get_invalid_number() {
prefs.setCharPref("get_invalid_number", "hello world");
prefs.setStringPref("get_invalid_number", "hello world");
let log = new DummyLogger();
let d = CommonUtils.getDatePref(prefs, "get_invalid_number", 42, log);

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

@ -510,7 +510,7 @@ export var CommonUtils = {
throw new Error("Default value is not a number: " + def);
}
let valueStr = branch.getCharPref(pref, null);
let valueStr = branch.getStringPref(pref, null);
if (valueStr !== null) {
let valueInt = parseInt(valueStr, 10);
@ -614,7 +614,7 @@ export var CommonUtils = {
);
}
branch.setCharPref(pref, "" + date.getTime());
branch.setStringPref(pref, "" + date.getTime());
},
/**

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

@ -8,7 +8,7 @@ ChromeUtils.defineESModuleGetters(this, {
});
// Enable logging from jwcrypto.jsm.
Services.prefs.setCharPref("services.crypto.jwcrypto.log.level", "Debug");
Services.prefs.setStringPref("services.crypto.jwcrypto.log.level", "Debug");
add_task(async function test_jwe_roundtrip_ecdh_es_encryption() {
const plaintext = crypto.getRandomValues(new Uint8Array(123));

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

@ -30,7 +30,7 @@ try {
LOG_LEVEL =
Services.prefs.getPrefType(PREF_LOG_LEVEL) ==
Ci.nsIPrefBranch.PREF_STRING &&
Services.prefs.getCharPref(PREF_LOG_LEVEL);
Services.prefs.getStringPref(PREF_LOG_LEVEL);
} catch (e) {}
var log = Log.repository.getLogger("Identity.FxAccounts");

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

@ -28,7 +28,7 @@ const SIGNUP = "/account/create";
const DEVICES_FILTER_DAYS = 21;
export var FxAccountsClient = function (
host = Services.prefs.getCharPref(HOST_PREF)
host = Services.prefs.getStringPref(HOST_PREF)
) {
this.host = host;

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

@ -199,7 +199,7 @@ export var FxAccountsConfig = {
},
getAutoConfigURL() {
let pref = Services.prefs.getCharPref(
let pref = Services.prefs.getStringPref(
"identity.fxaccounts.autoconfig.uri",
""
);
@ -263,31 +263,31 @@ export var FxAccountsConfig = {
if (!authServerBase.endsWith("/v1")) {
authServerBase += "/v1";
}
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.fxaccounts.auth.uri",
authServerBase
);
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.fxaccounts.remote.oauth.uri",
config.oauth_server_base_url + "/v1"
);
// At the time of landing this, our servers didn't yet answer with pairing_server_base_uri.
// Remove this condition check once Firefox 68 is stable.
if (config.pairing_server_base_uri) {
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.fxaccounts.remote.pairing.uri",
config.pairing_server_base_uri
);
}
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.fxaccounts.remote.profile.uri",
config.profile_server_base_url + "/v1"
);
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.sync.tokenserver.uri",
config.sync_tokenserver_base_url + "/1.0/sync/1.5"
);
Services.prefs.setCharPref("identity.fxaccounts.remote.root", rootURL);
Services.prefs.setStringPref("identity.fxaccounts.remote.root", rootURL);
// Ensure the webchannel is pointed at the correct uri
lazy.EnsureFxAccountsWebChannel();

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

@ -73,7 +73,7 @@ let rightEmail = "Greta.Garbo@gmail.COM";
let password = "123456";
function runTest() {
is(Services.prefs.getCharPref("identity.fxaccounts.auth.uri"), TEST_SERVER,
is(Services.prefs.getStringPref("identity.fxaccounts.auth.uri"), TEST_SERVER,
"Pref for auth.uri should be set to test server");
let fxa = new MockFxAccounts();

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

@ -45,9 +45,9 @@ var log = Log.repository.getLogger("Services.FxAccounts.test");
log.level = Log.Level.Debug;
// See verbose logging from FxAccounts.jsm and jwcrypto.jsm.
Services.prefs.setCharPref("identity.fxaccounts.loglevel", "Trace");
Services.prefs.setStringPref("identity.fxaccounts.loglevel", "Trace");
Log.repository.getLogger("FirefoxAccounts").level = Log.Level.Trace;
Services.prefs.setCharPref("services.crypto.jwcrypto.log.level", "Debug");
Services.prefs.setStringPref("services.crypto.jwcrypto.log.level", "Debug");
/*
* The FxAccountsClient communicates with the remote Firefox
@ -1143,7 +1143,7 @@ add_test(function test_resend_email() {
});
});
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.fxaccounts.remote.oauth.uri",
"https://example.com/v1"
);
@ -1346,7 +1346,7 @@ add_test(function test_getOAuthToken_invalid_scope_array() {
add_test(function test_getOAuthToken_misconfigure_oauth_uri() {
let fxa = new MockFxAccounts();
const prevServerURL = Services.prefs.getCharPref(
const prevServerURL = Services.prefs.getStringPref(
"identity.fxaccounts.remote.oauth.uri"
);
Services.prefs.deleteBranch("identity.fxaccounts.remote.oauth.uri");
@ -1354,7 +1354,7 @@ add_test(function test_getOAuthToken_misconfigure_oauth_uri() {
fxa.getOAuthToken().catch(err => {
Assert.equal(err.message, "INVALID_PARAMETER");
// revert the pref
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.fxaccounts.remote.oauth.uri",
prevServerURL
);

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

@ -10,7 +10,7 @@ const { FxAccounts } = ChromeUtils.importESModule(
add_task(
async function test_non_https_remote_server_uri_with_requireHttps_false() {
Services.prefs.setBoolPref("identity.fxaccounts.allowHttp", true);
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.fxaccounts.remote.root",
"http://example.com/"
);
@ -25,7 +25,7 @@ add_task(
);
add_task(async function test_non_https_remote_server_uri() {
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.fxaccounts.remote.root",
"http://example.com/"
);
@ -43,13 +43,16 @@ add_task(async function test_is_production_config() {
Assert.ok(FxAccounts.config.isProductionConfig());
// Set an auto-config URL.
Services.prefs.setCharPref("identity.fxaccounts.autoconfig.uri", "http://x");
Services.prefs.setStringPref(
"identity.fxaccounts.autoconfig.uri",
"http://x"
);
Assert.equal(FxAccounts.config.getAutoConfigURL(), "http://x");
Assert.ok(!FxAccounts.config.isProductionConfig());
// Clear the auto-config URL, but set one of the other config params.
Services.prefs.clearUserPref("identity.fxaccounts.autoconfig.uri");
Services.prefs.setCharPref("identity.sync.tokenserver.uri", "http://t");
Services.prefs.setStringPref("identity.sync.tokenserver.uri", "http://t");
Assert.ok(!FxAccounts.config.isProductionConfig());
Services.prefs.clearUserPref("identity.sync.tokenserver.uri");
});

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

@ -35,7 +35,7 @@ const BOGUS_PUBLICKEY =
"BBXOKjUb84pzws1wionFpfCBjDuCh4-s_1b52WA46K5wYL2gCWEOmFKWn_NkS5nmJwTBuO8qxxdjAIDtNeklvQc";
const BOGUS_AUTHKEY = "GSsIiaD2Mr83iPqwFNK4rw";
Services.prefs.setCharPref("identity.fxaccounts.loglevel", "Trace");
Services.prefs.setStringPref("identity.fxaccounts.loglevel", "Trace");
const DEVICE_REGISTRATION_VERSION = 42;

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

@ -6,7 +6,7 @@
// Tests for FxAccounts, storage and the master password.
// See verbose logging from FxAccounts.jsm
Services.prefs.setCharPref("identity.fxaccounts.loglevel", "Trace");
Services.prefs.setStringPref("identity.fxaccounts.loglevel", "Trace");
const { FxAccounts } = ChromeUtils.importESModule(
"resource://gre/modules/FxAccounts.sys.mjs"

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

@ -387,7 +387,7 @@ In order to enable verbose logging, set the log level preference to ``debug``.
.. code-block:: javascript
Services.prefs.setCharPref("services.settings.loglevel", "debug");
Services.prefs.setStringPref("services.settings.loglevel", "debug");
Remote Settings Dev Tools
-------------------------

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

@ -223,7 +223,7 @@ function remoteSettingsFunction() {
// Check if the server backoff time is elapsed.
if (lazy.gPrefs.prefHasUserValue(PREF_SETTINGS_SERVER_BACKOFF)) {
const backoffReleaseTime = lazy.gPrefs.getCharPref(
const backoffReleaseTime = lazy.gPrefs.getStringPref(
PREF_SETTINGS_SERVER_BACKOFF
);
const remainingMilliseconds =
@ -288,7 +288,7 @@ function remoteSettingsFunction() {
// Every time we register a new client, we have to fetch the whole list again.
const lastEtag = _invalidatePolling
? ""
: lazy.gPrefs.getCharPref(PREF_SETTINGS_LAST_ETAG, "");
: lazy.gPrefs.getStringPref(PREF_SETTINGS_LAST_ETAG, "");
let pollResult;
try {
@ -352,7 +352,10 @@ function remoteSettingsFunction() {
"Server asks clients to backoff for ${backoffSeconds} seconds"
);
const backoffReleaseTime = Date.now() + backoffSeconds * 1000;
lazy.gPrefs.setCharPref(PREF_SETTINGS_SERVER_BACKOFF, backoffReleaseTime);
lazy.gPrefs.setStringPref(
PREF_SETTINGS_SERVER_BACKOFF,
backoffReleaseTime
);
}
// Record new update time and the difference between local and server time.
@ -450,7 +453,7 @@ function remoteSettingsFunction() {
}
// Save current Etag for next poll.
lazy.gPrefs.setCharPref(PREF_SETTINGS_LAST_ETAG, currentEtag);
lazy.gPrefs.setStringPref(PREF_SETTINGS_LAST_ETAG, currentEtag);
// Report the global synchronization success.
const status = lazy.UptakeTelemetry.STATUS.SUCCESS;
@ -523,7 +526,7 @@ function remoteSettingsFunction() {
serverURL: lazy.Utils.SERVER_URL,
pollingEndpoint: lazy.Utils.SERVER_URL + lazy.Utils.CHANGES_PATH,
serverTimestamp,
localTimestamp: lazy.gPrefs.getCharPref(PREF_SETTINGS_LAST_ETAG, null),
localTimestamp: lazy.gPrefs.getStringPref(PREF_SETTINGS_LAST_ETAG, null),
lastCheck: lazy.gPrefs.getIntPref(PREF_SETTINGS_LAST_UPDATE, 0),
mainBucket: lazy.Utils.actualBucketName(
AppConstants.REMOTE_SETTINGS_DEFAULT_BUCKET

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

@ -61,7 +61,7 @@ function run_test() {
}
async function clear_state() {
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
`http://localhost:${server.identity.primaryPort}/v1`
);
@ -101,7 +101,7 @@ add_task(clear_state);
add_task(async function test_base_attachment_url_depends_on_server() {
const before = await downloader._baseAttachmentsURL();
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
`http://localhost:${server.identity.primaryPort}/v2`
);

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

@ -64,12 +64,12 @@ function run_test() {
Policy.getChannel = () => "nightly";
// Point the blocklist clients to use this local HTTP server.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
`http://localhost:${server.identity.primaryPort}/v1`
);
Services.prefs.setCharPref("services.settings.loglevel", "debug");
Services.prefs.setStringPref("services.settings.loglevel", "debug");
client = RemoteSettings("password-fields");
clientWithDump = RemoteSettings("language-dictionaries");

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

@ -48,7 +48,7 @@ var server;
async function clear_state() {
// set up prefs so the kinto updater talks to the test server
Services.prefs.setCharPref(
Services.prefs.setStringPref(
PREF_SETTINGS_SERVER,
`http://localhost:${server.identity.primaryPort}/v1`
);
@ -203,7 +203,7 @@ add_task(async function test_check_success() {
Assert.ok(maybeSyncCalled, "maybeSync was called");
Assert.ok(notificationObserved, "a notification should have been observed");
// Last timestamp was saved. An ETag header value is a quoted string.
Assert.equal(Services.prefs.getCharPref(PREF_LAST_ETAG), '"1100"');
Assert.equal(Services.prefs.getStringPref(PREF_LAST_ETAG), '"1100"');
// check the last_update is updated
Assert.equal(Services.prefs.getIntPref(PREF_LAST_UPDATE), serverTime / 1000);
@ -268,7 +268,7 @@ add_task(async function test_update_timer_interface() {
});
// Everything went fine.
Assert.equal(Services.prefs.getCharPref(PREF_LAST_ETAG), '"42"');
Assert.equal(Services.prefs.getStringPref(PREF_LAST_ETAG), '"42"');
Assert.equal(Services.prefs.getIntPref(PREF_LAST_UPDATE), serverTime / 1000);
});
add_task(clear_state);
@ -283,7 +283,7 @@ add_task(async function test_check_up_to_date() {
const serverTime = 4000;
server.registerPathHandler(CHANGES_PATH, serveChangesEntries(serverTime, []));
Services.prefs.setCharPref(PREF_LAST_ETAG, '"1100"');
Services.prefs.setStringPref(PREF_LAST_ETAG, '"1100"');
// Ensure that the remote-settings:changes-poll-end notification is sent.
let notificationObserved = false;
@ -764,7 +764,7 @@ add_task(async function test_server_error_4xx() {
}
server.registerPathHandler(CHANGES_PATH, simulateErrorResponse);
Services.prefs.setCharPref(PREF_LAST_ETAG, '"abc"');
Services.prefs.setStringPref(PREF_LAST_ETAG, '"abc"');
let error;
try {
@ -1113,7 +1113,7 @@ add_task(async function test_backoff() {
},
])
);
Services.prefs.setCharPref(
Services.prefs.setStringPref(
PREF_SETTINGS_SERVER_BACKOFF,
`${Date.now() - 1000}`
);
@ -1144,7 +1144,7 @@ add_task(async function test_network_error() {
);
// Simulate a network error (to check telemetry report).
Services.prefs.setCharPref(PREF_SETTINGS_SERVER, "http://localhost:42/v1");
Services.prefs.setStringPref(PREF_SETTINGS_SERVER, "http://localhost:42/v1");
try {
await RemoteSettings.pollChanges();
} catch (e) {}

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

@ -23,9 +23,9 @@ let maybeSyncBackup;
async function clear_state() {
// Disable logging output.
Services.prefs.setCharPref("services.settings.loglevel", "critical");
Services.prefs.setStringPref("services.settings.loglevel", "critical");
// Pull data from the test server.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
PREF_SETTINGS_SERVER,
`http://localhost:${server.identity.primaryPort}/v1`
);

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

@ -38,7 +38,7 @@ add_task(
skip_if: () => !AppConstants.RELEASE_OR_BETA,
},
async function test_server_url_cannot_be_toggled_in_release() {
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
"http://localhost:8888/v1"
);
@ -58,7 +58,7 @@ add_task(
skip_if: () => AppConstants.RELEASE_OR_BETA,
},
async function test_server_url_cannot_be_toggled_in_dev_nightly() {
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
"http://localhost:8888/v1"
);
@ -107,7 +107,7 @@ add_task(
skip_if: () => !AppConstants.RELEASE_OR_BETA,
},
async function test_load_dumps_will_always_be_loaded_in_release() {
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
"http://localhost:8888/v1"
);
@ -128,7 +128,7 @@ add_task(
skip_if: () => AppConstants.RELEASE_OR_BETA,
},
async function test_load_dumps_can_be_disabled_in_dev_nightly() {
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
"http://localhost:8888/v1"
);
@ -148,7 +148,7 @@ add_task(clear_state);
add_task(
async function test_server_url_can_be_changed_in_all_versions_if_running_for_devtools() {
Services.env.set("MOZ_REMOTE_SETTINGS_DEVTOOLS", "1");
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
"http://localhost:8888/v1"
);
@ -179,7 +179,7 @@ add_task(clear_state);
add_task(
async function test_dumps_are_not_loaded_if_server_is_not_prod_if_running_for_devtools() {
Services.env.set("MOZ_REMOTE_SETTINGS_DEVTOOLS", "1");
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
"http://localhost:8888/v1"
);
@ -193,7 +193,7 @@ add_task(clear_state);
add_task(
async function test_dumps_are_loaded_if_server_is_prod_if_running_for_devtools() {
Services.env.set("MOZ_REMOTE_SETTINGS_DEVTOOLS", "1");
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"services.settings.server",
AppConstants.REMOTE_SETTINGS_SERVER_URL
);

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

@ -47,7 +47,7 @@ function run_test() {
// because these tests were originally written for OneCRL.
client = RemoteSettings("signed", { signerName: SIGNER_NAME });
Services.prefs.setCharPref("services.settings.loglevel", "debug");
Services.prefs.setStringPref("services.settings.loglevel", "debug");
// Set up an HTTP Server
server = new HttpServer();
@ -148,7 +148,7 @@ add_task(async function test_check_synchronization_with_signatures() {
}
// set up prefs so the kinto updater talks to the test server
Services.prefs.setCharPref(
Services.prefs.setStringPref(
PREF_SETTINGS_SERVER,
`http://localhost:${server.identity.primaryPort}/v1`
);

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

@ -192,7 +192,7 @@ const UIStateInternal = {
_setLastSyncTime(state) {
if (state?.status == UIState.STATUS_SIGNED_IN) {
const lastSync = Services.prefs.getCharPref(
const lastSync = Services.prefs.getStringPref(
"services.sync.lastSync",
null
);

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

@ -16,7 +16,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
function AddonUtilsInternal() {
this._log = Log.repository.getLogger("Sync.AddonUtils");
this._log.Level =
Log.Level[Svc.PrefBranch.getCharPref("log.logger.addonutils", null)];
Log.Level[Svc.PrefBranch.getStringPref("log.logger.addonutils", null)];
}
AddonUtilsInternal.prototype = {
/**

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

@ -647,7 +647,7 @@ EngineManager.prototype = {
},
persistDeclined() {
Svc.PrefBranch.setCharPref(
Svc.PrefBranch.setStringPref(
"declinedEngines",
[...this._declined].join(",")
);
@ -1007,7 +1007,7 @@ SyncEngine.prototype = {
);
await this.resetClient();
Svc.PrefBranch.setStringPref(this.name + ".syncID", newSyncID);
Svc.PrefBranch.setCharPref(this.name + ".lastSync", "0");
Svc.PrefBranch.setStringPref(this.name + ".lastSync", "0");
return newSyncID;
},
@ -1052,7 +1052,7 @@ SyncEngine.prototype = {
},
async setLastSync(lastSync) {
// Store the value as a string to keep floating point precision
Svc.PrefBranch.setCharPref(this.name + ".lastSync", lastSync.toString());
Svc.PrefBranch.setStringPref(this.name + ".lastSync", lastSync.toString());
},
async resetLastSync() {
this._log.debug("Resetting " + this.name + " last sync time");

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

@ -262,7 +262,7 @@ PrefStore.prototype = {
_setAllPrefs(values) {
const selectedThemeIDPref = "extensions.activeThemeID";
let selectedThemeIDBefore = this._prefs.getCharPref(
let selectedThemeIDBefore = this._prefs.getStringPref(
selectedThemeIDPref,
null
);

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

@ -429,7 +429,7 @@ Sync11Service.prototype = {
Svc.PrefBranch.getPrefType("registerEngines") !=
Ci.nsIPrefBranch.PREF_INVALID
) {
engines = Svc.PrefBranch.getCharPref("registerEngines").split(",");
engines = Svc.PrefBranch.getStringPref("registerEngines").split(",");
this._log.info("Registering custom set of engines", engines);
} else {
// default is all engines.
@ -437,7 +437,7 @@ Sync11Service.prototype = {
}
let declined = [];
let pref = Svc.PrefBranch.getCharPref("declinedEngines", null);
let pref = Svc.PrefBranch.getStringPref("declinedEngines", null);
if (pref) {
declined = pref.split(",");
}
@ -1009,7 +1009,7 @@ Sync11Service.prototype = {
this._ignorePrefObserver = false;
this.clusterURL = null;
Svc.PrefBranch.setCharPref("lastversion", WEAVE_VERSION);
Svc.PrefBranch.setStringPref("lastversion", WEAVE_VERSION);
try {
this.identity.finalize();
@ -1303,7 +1303,7 @@ Sync11Service.prototype = {
Utils.mpLocked()
) {
reason = kSyncMasterPasswordLocked;
} else if (Svc.PrefBranch.getCharPref("firstSync", null) == "notReady") {
} else if (Svc.PrefBranch.getStringPref("firstSync", null) == "notReady") {
reason = kFirstSyncChoiceNotMade;
} else if (!Async.isAppReady()) {
reason = kFirefoxShuttingDown;

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

@ -111,7 +111,7 @@ EngineSynchronizer.prototype = {
// a first sync.
let allowEnginesHint = false;
// Wipe data in the desired direction if necessary
switch (Svc.PrefBranch.getCharPref("firstSync", null)) {
switch (Svc.PrefBranch.getStringPref("firstSync", null)) {
case "resetClient":
await this.service.resetClient(engineManager.enabledEngineNames);
break;
@ -227,7 +227,7 @@ EngineSynchronizer.prototype = {
this.service.status.service == SYNC_FAILED_PARTIAL ||
this.service.status.service == STATUS_OK
) {
Svc.PrefBranch.setCharPref("lastSync", new Date().toString());
Svc.PrefBranch.setStringPref("lastSync", new Date().toString());
}
} finally {
Svc.PrefBranch.clearUserPref("firstSync");

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

@ -198,7 +198,7 @@ SyncAuthManager.prototype = {
!Svc.PrefBranch.getStringPref("client.syncID", null);
if (isFirstSync) {
this._log.info("Doing initial sync actions");
Svc.PrefBranch.setCharPref("firstSync", "resetClient");
Svc.PrefBranch.setStringPref("firstSync", "resetClient");
Services.obs.notifyObservers(null, "weave:service:setup-complete");
}
// There's no need to wait for sync to complete and it would deadlock
@ -361,7 +361,7 @@ SyncAuthManager.prototype = {
// all services.sync prefs. So if that still exists, it wins.
let url = Svc.PrefBranch.getStringPref("tokenServerURI", null); // Svc.PrefBranch "root" is services.sync
if (!url) {
url = Services.prefs.getCharPref("identity.sync.tokenserver.uri");
url = Services.prefs.getStringPref("identity.sync.tokenserver.uri");
}
while (url.endsWith("/")) {
// trailing slashes cause problems...

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

@ -17,7 +17,7 @@ var fhs = Cc["@mozilla.org/satchel/form-history-startup;1"].getService(
fhs.observe(null, "profile-after-change", null);
// An app is going to have some prefs set which xpcshell tests don't.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"identity.sync.tokenserver.uri",
"http://token-server"
);

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

@ -920,7 +920,7 @@ add_task(async function test_command_sync() {
notEqual(clientWBO(remoteId).payload, undefined);
Svc.PrefBranch.setCharPref("client.GUID", remoteId);
Svc.PrefBranch.setStringPref("client.GUID", remoteId);
await engine._resetClient();
equal(engine.localID, remoteId);
_("Performing sync on resetted client.");

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

@ -37,7 +37,7 @@ add_task(async function test_locally_changed_keys() {
server.start();
try {
Svc.PrefBranch.setCharPref("registerEngines", "Tab");
Svc.PrefBranch.setStringPref("registerEngines", "Tab");
await configureIdentity({ username: "johndoe" }, server);
// We aren't doing a .login yet, so fudge the cluster URL.

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

@ -219,7 +219,7 @@ add_task(async function test_prefs_change_during_sync() {
} finally {
_("Updating local pref value");
// Change the value of a synced pref.
Services.prefs.setCharPref(TEST_PREF, "hello");
Services.prefs.setStringPref(TEST_PREF, "hello");
await engine._tracker.asyncObserver.promiseObserversComplete();
}
};

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

@ -115,7 +115,7 @@ add_task(async function test_lastSync_not_updated_on_complete_failure() {
Assert.equal(Status.service, STATUS_OK);
Assert.equal(Status.sync, SYNC_SUCCEEDED);
let lastSync = Svc.PrefBranch.getCharPref("lastSync");
let lastSync = Svc.PrefBranch.getStringPref("lastSync");
Assert.ok(lastSync);
@ -133,7 +133,7 @@ add_task(async function test_lastSync_not_updated_on_complete_failure() {
Assert.equal(Status.service, SYNC_FAILED);
// We shouldn't update lastSync on complete failure.
Assert.equal(lastSync, Svc.PrefBranch.getCharPref("lastSync"));
Assert.equal(lastSync, Svc.PrefBranch.getStringPref("lastSync"));
await clean();
await promiseStopServer(server);
@ -379,7 +379,7 @@ add_task(
Assert.ok(!Status.enforceBackoff);
Assert.equal(Status.service, STATUS_OK);
Svc.PrefBranch.setCharPref("firstSync", "wipeRemote");
Svc.PrefBranch.setStringPref("firstSync", "wipeRemote");
let promiseObserved = promiseOneObserver("weave:service:reset-file-log");
await Service.sync();
@ -389,7 +389,7 @@ add_task(
Assert.equal(backoffInterval, 42);
Assert.equal(Status.service, SYNC_FAILED);
Assert.equal(Status.sync, SERVER_MAINTENANCE);
Assert.equal(Svc.PrefBranch.getCharPref("firstSync"), "wipeRemote");
Assert.equal(Svc.PrefBranch.getStringPref("firstSync"), "wipeRemote");
await clean();
await promiseStopServer(server);
@ -406,7 +406,7 @@ add_task(async function test_sync_engine_generic_fail() {
engine.sync = async function sync() {
Svc.Obs.notify("weave:engine:sync:error", ENGINE_UNKNOWN_FAIL, "catapult");
};
let lastSync = Svc.PrefBranch.getCharPref("lastSync", null);
let lastSync = Svc.PrefBranch.getStringPref("lastSync", null);
let log = Log.repository.getLogger("Sync.ErrorHandler");
Svc.PrefBranch.setBoolPref("log.appender.file.logOnError", true);
@ -437,7 +437,7 @@ add_task(async function test_sync_engine_generic_fail() {
Assert.equal(Status.service, SYNC_FAILED_PARTIAL);
// lastSync should update on partial failure.
Assert.notEqual(lastSync, Svc.PrefBranch.getCharPref("lastSync"));
Assert.notEqual(lastSync, Svc.PrefBranch.getStringPref("lastSync"));
// Test Error log was written on SYNC_FAILED_PARTIAL.
let logFiles = getLogFiles();

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

@ -338,7 +338,7 @@ add_test(function test_newFailed_errorLog() {
});
add_test(function test_errorLog_dumpAddons() {
Svc.PrefBranch.setCharPref("log.logger", "Trace");
Svc.PrefBranch.setStringPref("log.logger", "Trace");
Svc.PrefBranch.setBoolPref("log.appender.file.logOnError", true);
Svc.Obs.add("weave:service:reset-file-log", function onResetFileLog() {

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

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Svc.PrefBranch.setCharPref("registerEngines", "");
Svc.PrefBranch.setStringPref("registerEngines", "");
const { Service } = ChromeUtils.importESModule(
"resource://services-sync/service.sys.mjs"
);
@ -174,7 +174,7 @@ add_task(async function test_unsuccessful_sync_adjustSyncInterval() {
_("Test unsuccessful sync calls adjustSyncInterval");
// Force sync to fail.
Svc.PrefBranch.setCharPref("firstSync", "notReady");
Svc.PrefBranch.setStringPref("firstSync", "notReady");
let server = await sync_httpd_setup();
await setUp(server);
@ -326,7 +326,7 @@ add_task(async function test_adjust_interval_on_sync_error() {
_("Test unsuccessful sync updates client mode & sync intervals");
// Force a sync fail.
Svc.PrefBranch.setCharPref("firstSync", "notReady");
Svc.PrefBranch.setStringPref("firstSync", "notReady");
Assert.equal(syncFailures, 0);
Assert.equal(false, scheduler.numClients > 1);

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

@ -66,7 +66,7 @@ add_task(async function run_test() {
try {
_("Expect the compact light theme to be active");
Assert.strictEqual(
Services.prefs.getCharPref("extensions.activeThemeID"),
Services.prefs.getStringPref("extensions.activeThemeID"),
COMPACT_THEME_ID
);
@ -152,12 +152,12 @@ add_task(async function run_test() {
_("Update some prefs, including one that's to be reset/deleted.");
// This pref is not going to be reset or deleted as there's no "control pref"
// in either the incoming record or locally.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"testing.deleted-without-control-pref",
"I'm deleted-without-control-pref"
);
// Another pref with only a local control pref.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"testing.deleted-with-local-control-pref",
"I'm deleted-with-local-control-pref"
);
@ -166,7 +166,7 @@ add_task(async function run_test() {
true
);
// And a pref without a local control pref but one that's incoming.
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"testing.deleted-with-incoming-control-pref",
"I'm deleted-with-incoming-control-pref"
);
@ -197,12 +197,12 @@ add_task(async function run_test() {
await store.update(record);
Assert.strictEqual(Services.prefs.getIntPref("testing.int"), 42);
Assert.strictEqual(
Services.prefs.getCharPref("testing.string"),
Services.prefs.getStringPref("testing.string"),
"im in ur prefs"
);
Assert.strictEqual(Services.prefs.getBoolPref("testing.bool"), false);
Assert.strictEqual(
Services.prefs.getCharPref("testing.deleted-without-control-pref"),
Services.prefs.getStringPref("testing.deleted-without-control-pref"),
"I'm deleted-without-control-pref"
);
Assert.strictEqual(
@ -210,11 +210,13 @@ add_task(async function run_test() {
Ci.nsIPrefBranch.PREF_INVALID
);
Assert.strictEqual(
Services.prefs.getCharPref("testing.deleted-with-incoming-control-pref"),
Services.prefs.getStringPref(
"testing.deleted-with-incoming-control-pref"
),
"I'm deleted-with-incoming-control-pref"
);
Assert.strictEqual(
Services.prefs.getCharPref("testing.dont.change"),
Services.prefs.getStringPref("testing.dont.change"),
"Please don't change me."
);
Assert.strictEqual(
@ -319,7 +321,7 @@ add_task(async function test_incoming_sets_seen() {
do_get_file("prefs_test_prefs_store.js")
);
const defaultValue = "the value";
Assert.equal(Services.prefs.getCharPref("testing.seen"), defaultValue);
Assert.equal(Services.prefs.getStringPref("testing.seen"), defaultValue);
let record = await store.createRecord(PREFS_GUID, "prefs");
// Haven't seen a non-default value before, so remains null.
@ -358,25 +360,28 @@ add_task(async function test_outgoing_when_changed() {
do_get_file("prefs_test_prefs_store.js")
);
const defaultValue = "the value";
Assert.equal(Services.prefs.getCharPref("testing.seen"), defaultValue);
Assert.equal(Services.prefs.getStringPref("testing.seen"), defaultValue);
let record = await store.createRecord(PREFS_GUID, "prefs");
// Haven't seen a non-default value before, so remains null.
Assert.strictEqual(record.value["testing.seen"], null);
// Change the value.
Services.prefs.setCharPref("testing.seen", "new value");
Services.prefs.setStringPref("testing.seen", "new value");
record = await store.createRecord(PREFS_GUID, "prefs");
// creating the record toggled that "seen" pref.
Assert.strictEqual(
Services.prefs.getBoolPref("services.sync.prefs.sync-seen.testing.seen"),
true
);
Assert.strictEqual(Services.prefs.getCharPref("testing.seen"), "new value");
Assert.strictEqual(Services.prefs.getStringPref("testing.seen"), "new value");
// Resetting the pref does not change that seen value.
Services.prefs.clearUserPref("testing.seen");
Assert.strictEqual(Services.prefs.getCharPref("testing.seen"), defaultValue);
Assert.strictEqual(
Services.prefs.getStringPref("testing.seen"),
defaultValue
);
record = await store.createRecord(PREFS_GUID, "prefs");
Assert.strictEqual(

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

@ -80,7 +80,7 @@ add_task(async function run_test() {
await tracker.clearChangedIDs();
_("Changing some other random pref won't do anything.");
Services.prefs.setCharPref("testing.other", "blergh");
Services.prefs.setStringPref("testing.other", "blergh");
await tracker.asyncObserver.promiseObserversComplete();
Assert.equal(tracker.score, SCORE_INCREMENT_XLARGE * 3);
Assert.equal(tracker.modified, false);

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

@ -41,7 +41,7 @@ function triggerRedirect() {
let prefs = Services.prefs.getBranch("network.proxy.");
prefs.setIntPref("type", 2);
prefs.setCharPref("autoconfig_url", "data:text/plain," + PROXY_FUNCTION);
prefs.setStringPref("autoconfig_url", "data:text/plain," + PROXY_FUNCTION);
}
add_task(async function test_headers_copied() {

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

@ -73,7 +73,7 @@ add_task(async function test_desktop_post() {
add_task(async function test_desktop_get() {
_("Testing async.");
Svc.PrefBranch.setCharPref("client.type", "desktop");
Svc.PrefBranch.setStringPref("client.type", "desktop");
let r = new Resource(server.baseURI + "/1.1/johndoe/storage/meta/global");
await r.get();
_("User-Agent: " + ua);
@ -83,7 +83,7 @@ add_task(async function test_desktop_get() {
add_task(async function test_mobile_get() {
_("Testing mobile.");
Svc.PrefBranch.setCharPref("client.type", "mobile");
Svc.PrefBranch.setStringPref("client.type", "mobile");
let r = new Resource(server.baseURI + "/1.1/johndoe/storage/meta/global");
await r.get();
_("User-Agent: " + ua);

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

@ -5,8 +5,8 @@ const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
// Svc.PrefBranch.setCharPref("services.sync.log.appender.dump", "All");
Svc.PrefBranch.setCharPref("registerEngines", "Tab,Bookmarks,Form,History");
// Svc.PrefBranch.setStringPref("services.sync.log.appender.dump", "All");
Svc.PrefBranch.setStringPref("registerEngines", "Tab,Bookmarks,Form,History");
add_task(async function run_test() {
validate_all_future_pings();

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

@ -110,17 +110,17 @@ add_task(async function test_lastSync() {
// Floats are properly stored as floats and synced with the preference
await engine.setLastSync(123.45);
Assert.equal(await engine.getLastSync(), 123.45);
Assert.equal(Svc.PrefBranch.getCharPref("steam.lastSync"), "123.45");
Assert.equal(Svc.PrefBranch.getStringPref("steam.lastSync"), "123.45");
// Integer is properly stored
await engine.setLastSync(67890);
Assert.equal(await engine.getLastSync(), 67890);
Assert.equal(Svc.PrefBranch.getCharPref("steam.lastSync"), "67890");
Assert.equal(Svc.PrefBranch.getStringPref("steam.lastSync"), "67890");
// resetLastSync() resets the value (and preference) to 0
await engine.resetLastSync();
Assert.equal(await engine.getLastSync(), 0);
Assert.equal(Svc.PrefBranch.getCharPref("steam.lastSync"), "0");
Assert.equal(Svc.PrefBranch.getStringPref("steam.lastSync"), "0");
} finally {
for (const pref of Svc.PrefBranch.getChildList("")) {
Svc.PrefBranch.clearUserPref(pref);

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

@ -22,7 +22,7 @@ async function clean(engine) {
for (const pref of Svc.PrefBranch.getChildList("")) {
Svc.PrefBranch.clearUserPref(pref);
}
Svc.PrefBranch.setCharPref("log.logger.engine.rotary", "Trace");
Svc.PrefBranch.setStringPref("log.logger.engine.rotary", "Trace");
Service.recordManager.clearCache();
await engine._tracker.clearChangedIDs();
await engine.finalize();
@ -78,7 +78,7 @@ async function createServerAndConfigureClient() {
add_task(async function setup() {
await generateNewKeys(Service.collectionKeys);
Svc.PrefBranch.setCharPref("log.logger.engine.rotary", "Trace");
Svc.PrefBranch.setStringPref("log.logger.engine.rotary", "Trace");
});
add_task(async function test_syncStartup_emptyOrOutdatedGlobalsResetsSync() {

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

@ -469,7 +469,7 @@ add_task(async function test_handleSyncError() {
await setUp(server);
// Force sync to fail.
Svc.PrefBranch.setCharPref("firstSync", "notReady");
Svc.PrefBranch.setStringPref("firstSync", "notReady");
_("Ensure expected initial environment.");
Assert.equal(scheduler._syncErrors, 0);
@ -523,7 +523,7 @@ add_task(async function test_handleSyncError() {
_("Arrange for a successful sync to reset the scheduler error count");
let promiseObserved = promiseOneObserver("weave:service:sync:finish");
Svc.PrefBranch.setCharPref("firstSync", "wipeRemote");
Svc.PrefBranch.setStringPref("firstSync", "wipeRemote");
scheduler.scheduleNextSync(-1);
await promiseObserved;
await cleanUpAndGo(server);
@ -662,7 +662,7 @@ add_task(async function test_no_autoconnect_during_wizard() {
await setUp(server);
// Simulate the Sync setup wizard.
Svc.PrefBranch.setCharPref("firstSync", "notReady");
Svc.PrefBranch.setStringPref("firstSync", "notReady");
// Ensure we don't actually try to sync (or log in for that matter).
function onLoginStart() {

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

@ -275,7 +275,7 @@ add_task(async function run_sync_on_tab_change_test() {
await tracker.clearChangedIDs();
clearQuickWriteTimer(tracker);
Svc.PrefBranch.setCharPref(
Svc.PrefBranch.setStringPref(
"engine.tabs.filteredSchemes",
// Removing the about scheme for this test
"resource|chrome|file|blob|moz-extension"

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

@ -34,7 +34,7 @@ add_task(async function test_isReady_unconfigured() {
add_task(async function test_isReady_signedin() {
UIState.reset();
Services.prefs.setCharPref("services.sync.username", "foo");
Services.prefs.setStringPref("services.sync.username", "foo");
let refreshState = sinon.spy(UIStateInternal, "refreshState");
@ -58,7 +58,7 @@ add_task(async function test_refreshState_signedin() {
const fxAccountsOrig = UIStateInternal.fxAccounts;
const now = new Date().toString();
Services.prefs.setCharPref("services.sync.lastSync", now);
Services.prefs.setStringPref("services.sync.lastSync", now);
UIStateInternal.syncing = false;
UIStateInternal.fxAccounts = {
@ -119,7 +119,7 @@ add_task(async function test_refreshState_signedin_profile_unavailable() {
const fxAccountsOrig = UIStateInternal.fxAccounts;
const now = new Date().toString();
Services.prefs.setCharPref("services.sync.lastSync", now);
Services.prefs.setStringPref("services.sync.lastSync", now);
Services.prefs.setStringPref("services.sync.username", "test@test.com");
UIStateInternal.syncing = false;
@ -251,7 +251,7 @@ async function configureUIState(syncing, lastSync = new Date()) {
const fxAccountsOrig = UIStateInternal.fxAccounts;
UIStateInternal._syncing = syncing;
Services.prefs.setCharPref("services.sync.lastSync", lastSync.toString());
Services.prefs.setStringPref("services.sync.lastSync", lastSync.toString());
Services.prefs.setStringPref("services.sync.username", "test@test.com");
UIStateInternal.fxAccounts = {
@ -286,7 +286,7 @@ add_task(async function test_syncFinished() {
ok(oldState.syncing);
let uiUpdateObserved = observeUIUpdate();
Services.prefs.setCharPref("services.sync.lastSync", new Date().toString());
Services.prefs.setStringPref("services.sync.lastSync", new Date().toString());
Services.obs.notifyObservers(null, "weave:service:sync:finish");
await uiUpdateObserved;

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

@ -25,9 +25,9 @@ export var Logger = {
}
if (path) {
Services.prefs.setCharPref("tps.logfile", path);
Services.prefs.setStringPref("tps.logfile", path);
} else {
path = Services.prefs.getCharPref("tps.logfile");
path = Services.prefs.getStringPref("tps.logfile");
}
this._file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);

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

@ -68,7 +68,7 @@ Preference.prototype = {
"string",
"Wrong type used for preference value"
);
Services.prefs.setCharPref(this.name, this.value);
Services.prefs.setStringPref(this.name, this.value);
break;
case Ci.nsIPrefBranch.PREF_BOOL:
Logger.AssertEqual(
@ -100,7 +100,7 @@ Preference.prototype = {
value = Services.prefs.getIntPref(this.name);
break;
case Ci.nsIPrefBranch.PREF_STRING:
value = Services.prefs.getCharPref(this.name);
value = Services.prefs.getStringPref(this.name);
break;
case Ci.nsIPrefBranch.PREF_BOOL:
value = Services.prefs.getBoolPref(this.name);

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

@ -190,7 +190,7 @@ export var TPS = {
this._setupComplete = true;
if (this._syncWipeAction) {
lazy.Weave.Svc.PrefBranch.setCharPref(
lazy.Weave.Svc.PrefBranch.setStringPref(
"firstSync",
this._syncWipeAction
);
@ -1103,7 +1103,7 @@ export var TPS = {
*/
async _executeTestPhase(file, phase, settings) {
try {
this.config = JSON.parse(Services.prefs.getCharPref("tps.config"));
this.config = JSON.parse(Services.prefs.getStringPref("tps.config"));
// parse the test file
Services.scriptloader.loadSubScript(file, this);
this._currentPhase = phase;
@ -1375,7 +1375,7 @@ export var TPS = {
// also handle it via the "weave:service:setup-complete" notification.
if (wipeAction) {
this._syncWipeAction = wipeAction;
lazy.Weave.Svc.PrefBranch.setCharPref("firstSync", wipeAction);
lazy.Weave.Svc.PrefBranch.setStringPref("firstSync", wipeAction);
} else {
lazy.Weave.Svc.PrefBranch.clearUserPref("firstSync");
}