mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1845253 - Replace lazy getters in FxAccountsCommon.js. r=markh
Differential Revision: https://phabricator.services.mozilla.com/D184475
This commit is contained in:
parent
a7fdc9d0de
commit
3b3305e7cf
@ -972,7 +972,7 @@ FxAccountsInternal.prototype = {
|
||||
"updateUserAccountData called with fields",
|
||||
Object.keys(credentials)
|
||||
);
|
||||
if (logPII) {
|
||||
if (logPII()) {
|
||||
log.debug("updateUserAccountData called with data", credentials);
|
||||
}
|
||||
let currentAccountState = this.currentAccountState;
|
||||
@ -1135,7 +1135,7 @@ FxAccountsInternal.prototype = {
|
||||
|
||||
startVerifiedCheck(data) {
|
||||
log.debug("startVerifiedCheck", data && data.verified);
|
||||
if (logPII) {
|
||||
if (logPII()) {
|
||||
log.debug("startVerifiedCheck with user data", data);
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
@ -24,36 +21,26 @@ const PREF_LOG_SENSITIVE_DETAILS = "identity.fxaccounts.log.sensitive";
|
||||
|
||||
var exports = Object.create(null);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(exports, "log", function () {
|
||||
let log = Log.repository.getLogger("FirefoxAccounts");
|
||||
log.manageLevelFromPref(PREF_LOG_LEVEL);
|
||||
return log;
|
||||
});
|
||||
exports.log = Log.repository.getLogger("FirefoxAccounts");
|
||||
exports.log.manageLevelFromPref(PREF_LOG_LEVEL);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(exports, "logManager", function () {
|
||||
let logs = [
|
||||
"Sync",
|
||||
"Services.Common",
|
||||
"FirefoxAccounts",
|
||||
"Hawk",
|
||||
"browserwindow.syncui",
|
||||
"BookmarkSyncUtils",
|
||||
"addons.xpi",
|
||||
];
|
||||
let logs = [
|
||||
"Sync",
|
||||
"Services.Common",
|
||||
"FirefoxAccounts",
|
||||
"Hawk",
|
||||
"browserwindow.syncui",
|
||||
"BookmarkSyncUtils",
|
||||
"addons.xpi",
|
||||
];
|
||||
|
||||
// for legacy reasons, the log manager still thinks it's part of sync
|
||||
return new LogManager("services.sync.", logs, "sync");
|
||||
});
|
||||
// For legacy reasons, the log manager still thinks it's part of sync.
|
||||
exports.logManager = new LogManager("services.sync.", logs, "sync");
|
||||
|
||||
// A boolean to indicate if personally identifiable information (or anything
|
||||
// else sensitive, such as credentials) should be logged.
|
||||
XPCOMUtils.defineLazyGetter(exports, "logPII", function () {
|
||||
try {
|
||||
return Services.prefs.getBoolPref(PREF_LOG_SENSITIVE_DETAILS);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
exports.logPII = () =>
|
||||
Services.prefs.getBoolPref(PREF_LOG_SENSITIVE_DETAILS, false);
|
||||
|
||||
exports.FXACCOUNTS_PERMISSION = "firefox-accounts";
|
||||
|
||||
|
@ -302,7 +302,7 @@ export class FxAccountsKeys {
|
||||
sessionToken,
|
||||
keyFetchToken
|
||||
) {
|
||||
if (logPII) {
|
||||
if (logPII()) {
|
||||
log.debug(
|
||||
`fetchAndUnwrapKeys: sessionToken: ${sessionToken}, keyFetchToken: ${keyFetchToken}`
|
||||
);
|
||||
@ -342,7 +342,7 @@ export class FxAccountsKeys {
|
||||
wrapKB
|
||||
);
|
||||
|
||||
if (logPII) {
|
||||
if (logPII()) {
|
||||
log.debug("kBbytes: " + kBbytes);
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@ export class FxAccountsKeys {
|
||||
unwrapBKey: null,
|
||||
};
|
||||
|
||||
if (logPII) {
|
||||
if (logPII()) {
|
||||
log.debug(`Keys Obtained: ${updateData.scopedKeys}`);
|
||||
} else {
|
||||
log.debug(
|
||||
@ -379,7 +379,7 @@ export class FxAccountsKeys {
|
||||
log.debug(
|
||||
`Fetching keys with token ${!!keyFetchToken} from ${client.host}`
|
||||
);
|
||||
if (logPII) {
|
||||
if (logPII()) {
|
||||
log.debug("fetchKeys - the token is " + keyFetchToken);
|
||||
}
|
||||
return client.accountKeys(keyFetchToken);
|
||||
|
@ -361,7 +361,7 @@ FxAccountsWebChannel.prototype = {
|
||||
let listener = (webChannelId, message, sendingContext) => {
|
||||
if (message) {
|
||||
log.debug("FxAccountsWebChannel message received", message.command);
|
||||
if (logPII) {
|
||||
if (logPII()) {
|
||||
log.debug("FxAccountsWebChannel message details", message);
|
||||
}
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user