Bug 952465 - [Session Restore] Replace Components.utils.reportError with Console.jsm. r=Yoric

This commit is contained in:
Peiyong Lin 2014-01-06 15:27:25 -05:00
parent d274be280f
commit 0b99d17f2d
6 changed files with 21 additions and 11 deletions

View File

@ -36,6 +36,8 @@ Cu.import("resource://gre/modules/osfile/_PromiseWorker.jsm", this);
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/AsyncShutdown.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
@ -102,7 +104,7 @@ const TaskUtils = {
return promise.then(
null,
function onError(reason) {
Cu.reportError("Uncaught asynchronous error: " + reason + " at\n" + reason.stack);
console.error("Uncaught asynchronous error", reason, "at", reason.stack);
throw reason;
}
);
@ -179,8 +181,7 @@ let SessionFileInternal = {
this._recordTelemetry(msg.telemetry);
} catch (ex) {
TelemetryStopwatch.cancel("FX_SESSION_RESTORE_WRITE_FILE_LONGEST_OP_MS", refObj);
Cu.reportError("Could not write session state file " + this.path
+ ": " + ex);
console.error("Could not write session state file ", this.path, ex);
}
if (isFinalWrite) {
@ -193,7 +194,7 @@ let SessionFileInternal = {
SessionWorker.post("writeLoadStateOnceAfterStartup", [aLoadState]).then(msg => {
this._recordTelemetry(msg.telemetry);
return msg;
}, Cu.reportError);
}, console.error);
},
createBackupCopy: function (ext) {

View File

@ -17,7 +17,8 @@ Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "SessionStore",
"resource:///modules/sessionstore/SessionStore.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SessionFile",
"resource:///modules/sessionstore/SessionFile.jsm");
@ -309,7 +310,7 @@ let SessionSaverInternal = {
return SessionFile.write(data).then(() => {
this.updateLastSaveTime();
notify(null, "sessionstore-state-write-complete");
}, Cu.reportError);
}, console.error);
},
/**

View File

@ -12,6 +12,8 @@ const Ci = Components.interfaces;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivacyLevel",
"resource:///modules/sessionstore/PrivacyLevel.jsm");
@ -104,7 +106,7 @@ let SessionStorageInternal = {
storage.setItem(key, value);
} catch (e) {
// throws e.g. for URIs that can't have sessionStorage
Cu.reportError(e);
console.error(e);
}
}
}

View File

@ -102,6 +102,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "gScreenManager",
XPCOMUtils.defineLazyServiceGetter(this, "Telemetry",
"@mozilla.org/base/telemetry;1", "nsITelemetry");
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DocShellCapabilities",
"resource:///modules/sessionstore/DocShellCapabilities.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Messenger",
@ -959,7 +961,7 @@ let SessionStoreInternal = {
// Let everyone know we're done.
this._deferredInitialized.resolve();
}
}, Cu.reportError);
}, console.error);
};
aWindow.addEventListener("load", onload);
@ -3136,7 +3138,7 @@ let SessionStoreInternal = {
cookie.value, !!cookie.secure, !!cookie.httponly, true,
"expiry" in cookie ? cookie.expiry : MAX_EXPIRY);
}
catch (ex) { Cu.reportError(ex); } // don't let a single cookie stop recovering
catch (ex) { console.error(ex); } // don't let a single cookie stop recovering
}
},

View File

@ -12,6 +12,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/Promise.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Messenger",
"resource:///modules/sessionstore/Messenger.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivacyLevel",
@ -328,7 +330,7 @@ let TabStateInternal = {
history = syncHandler.collectSessionHistory(includePrivateData);
} catch (e) {
// This may happen if the tab has crashed.
Cu.reportError(e);
console.error(e);
return tabData;
}

View File

@ -43,6 +43,8 @@ Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
"resource://gre/modules/devtools/Console.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SessionFile",
"resource:///modules/sessionstore/SessionFile.jsm");
@ -85,7 +87,7 @@ SessionStartup.prototype = {
SessionFile.read().then(
this._onSessionFileRead.bind(this),
Cu.reportError
console.error
);
},