зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 0f3b01e74838 (bug 1642556) for failures on test_errorhandler_filelog.js. CLOSED TREE
This commit is contained in:
Родитель
f8f21f2398
Коммит
c0c732c1f7
|
@ -953,7 +953,6 @@ var gSync = {
|
|||
let action = PageActions.actionForID("sendToDevice");
|
||||
showBrowserPageActionFeedback(action);
|
||||
}
|
||||
fxAccounts.flushLogFile();
|
||||
});
|
||||
};
|
||||
const onSendAllCommand = event => {
|
||||
|
|
|
@ -55,21 +55,6 @@ add_task(async function setup() {
|
|||
is(gBrowser.visibleTabs.length, 2, "there are two visible tabs");
|
||||
});
|
||||
|
||||
add_task(async function test_sendTabToDevice_callsFlushLogFile() {
|
||||
const sandbox = setupSendTabMocks({ fxaDevices });
|
||||
updateTabContextMenu(testTab);
|
||||
await openTabContextMenu("context_sendTabToDevice");
|
||||
let promiseObserved = promiseObserver("service:log-manager:flush-log-file");
|
||||
document
|
||||
.getElementById("context_sendTabToDevicePopupMenu")
|
||||
.querySelector("menuitem")
|
||||
.click();
|
||||
|
||||
await promiseObserved;
|
||||
await hideTabContextMenu();
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
add_task(async function test_tab_contextmenu() {
|
||||
const sandbox = setupSendTabMocks({ fxaDevices });
|
||||
let expectation = sandbox
|
||||
|
@ -255,13 +240,3 @@ async function hideTabContextMenu() {
|
|||
contextMenu.hidePopup();
|
||||
await awaitPopupHidden;
|
||||
}
|
||||
|
||||
function promiseObserver(topic) {
|
||||
return new Promise(resolve => {
|
||||
let obs = (aSubject, aTopic, aData) => {
|
||||
Services.obs.removeObserver(obs, aTopic);
|
||||
resolve(aSubject);
|
||||
};
|
||||
Services.obs.addObserver(obs, topic);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ const {
|
|||
SERVER_ERRNO_TO_ERROR,
|
||||
log,
|
||||
logPII,
|
||||
logManager,
|
||||
} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
|
@ -774,20 +773,6 @@ class FxAccounts {
|
|||
return this._internal.whenVerified(data);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a log file for the FxA action that just completed
|
||||
* and refresh the input & output streams.
|
||||
*/
|
||||
async flushLogFile() {
|
||||
const logType = await logManager.resetFileLog();
|
||||
if (logType == logManager.ERROR_LOG_WRITTEN) {
|
||||
Cu.reportError(
|
||||
"FxA encountered an error - see about:sync-log for the log file."
|
||||
);
|
||||
}
|
||||
Services.obs.notifyObservers(null, "service:log-manager:flush-log-file");
|
||||
}
|
||||
}
|
||||
|
||||
var FxAccountsInternal = function() {};
|
||||
|
|
|
@ -6,13 +6,7 @@ const { XPCOMUtils } = ChromeUtils.import(
|
|||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { Preferences } = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm"
|
||||
);
|
||||
const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
|
||||
const { LogManager } = ChromeUtils.import(
|
||||
"resource://services-common/logmanager.js"
|
||||
);
|
||||
|
||||
// loglevel should be one of "Fatal", "Error", "Warn", "Info", "Config",
|
||||
// "Debug", "Trace" or "All". If none is specified, "Debug" will be used by
|
||||
|
@ -32,21 +26,6 @@ XPCOMUtils.defineLazyGetter(exports, "log", function() {
|
|||
return log;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(exports, "logManager", function() {
|
||||
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(new Preferences("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() {
|
||||
|
|
|
@ -1980,23 +1980,6 @@ add_task(async function test_deriveKeys() {
|
|||
);
|
||||
});
|
||||
|
||||
add_task(async function test_flushLogFile() {
|
||||
_("Tests flushLogFile");
|
||||
let account = await MakeFxAccounts();
|
||||
let promiseObserved = new Promise(res => {
|
||||
log.info("Adding flush-log-file observer.");
|
||||
Services.obs.addObserver(function onFlushLogFile() {
|
||||
Services.obs.removeObserver(
|
||||
onFlushLogFile,
|
||||
"service:log-manager:flush-log-file"
|
||||
);
|
||||
res();
|
||||
}, "service:log-manager:flush-log-file");
|
||||
});
|
||||
account.flushLogFile();
|
||||
await promiseObserved;
|
||||
});
|
||||
|
||||
/*
|
||||
* End of tests.
|
||||
* Utility functions follow.
|
||||
|
|
|
@ -38,8 +38,8 @@ const {
|
|||
kSyncMasterPasswordLocked,
|
||||
} = ChromeUtils.import("resource://services-sync/constants.js");
|
||||
const { Svc, Utils } = ChromeUtils.import("resource://services-sync/util.js");
|
||||
const { logManager } = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsCommon.js"
|
||||
const { LogManager } = ChromeUtils.import(
|
||||
"resource://services-common/logmanager.js"
|
||||
);
|
||||
const { Async } = ChromeUtils.import("resource://services-common/async.js");
|
||||
const { CommonUtils } = ChromeUtils.import(
|
||||
|
@ -866,6 +866,18 @@ ErrorHandler.prototype = {
|
|||
// And allow our specific log to have a custom level via a pref.
|
||||
this._log = Log.repository.getLogger("Sync.ErrorHandler");
|
||||
this._log.manageLevelFromPref("services.sync.log.logger.service.main");
|
||||
|
||||
let logs = [
|
||||
"Sync",
|
||||
"Services.Common",
|
||||
"FirefoxAccounts",
|
||||
"Hawk",
|
||||
"browserwindow.syncui",
|
||||
"BookmarkSyncUtils",
|
||||
"addons.xpi",
|
||||
];
|
||||
|
||||
this._logManager = new LogManager(Svc.Prefs, logs, "sync");
|
||||
},
|
||||
|
||||
observe(subject, topic, data) {
|
||||
|
@ -950,7 +962,7 @@ ErrorHandler.prototype = {
|
|||
// although for privacy reasons we also delete all logs (but we allow
|
||||
// a preference to avoid this to help with debugging.)
|
||||
if (!Svc.Prefs.get("log.keepLogsOnReset", false)) {
|
||||
return logManager.removeAllLogs().then(() => {
|
||||
return this._logManager.removeAllLogs().then(() => {
|
||||
Svc.Obs.notify("weave:service:remove-file-log");
|
||||
});
|
||||
}
|
||||
|
@ -988,11 +1000,11 @@ ErrorHandler.prototype = {
|
|||
*/
|
||||
async resetFileLog() {
|
||||
// If we're writing an error log, dump extensions that may be causing problems.
|
||||
if (logManager.sawError) {
|
||||
if (this._logManager.sawError) {
|
||||
await this._dumpAddons();
|
||||
}
|
||||
const logType = await logManager.resetFileLog();
|
||||
if (logType == logManager.ERROR_LOG_WRITTEN) {
|
||||
const logType = await this._logManager.resetFileLog();
|
||||
if (logType == this._logManager.ERROR_LOG_WRITTEN) {
|
||||
Cu.reportError(
|
||||
"Sync encountered an error - see about:sync-log for the log file."
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче