Bug 964349 - Move CrashReporter.annotateCrashReport() calls out of sessionstore r=gavin

This commit is contained in:
Tim Taubert 2014-01-27 08:45:28 -08:00
parent 8d1cf2aa7f
commit 107799a35a
2 changed files with 16 additions and 45 deletions

View File

@ -3733,6 +3733,22 @@ var XULBrowserWindow = {
setTimeout(function () { XULBrowserWindow.asyncUpdateUI(); }, 0);
else
this.asyncUpdateUI();
#ifdef MOZ_CRASHREPORTER
if (aLocationURI) {
let uri = aLocationURI.clone();
try {
// If the current URI contains a username/password, remove it.
uri.userPass = "";
} catch (ex) { /* Ignore failures on about: URIs. */ }
try {
Services.appinfo.annotateCrashReport("URL", uri.spec);
} catch (ex if ex.result == Components.results.NS_ERROR_NOT_INITIALIZED) {
// Don't make noise when the crash reporter is built but not enabled.
}
}
#endif
},
asyncUpdateUI: function () {
@ -3992,15 +4008,6 @@ var CombinedStopReload = {
var TabsProgressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
#ifdef MOZ_CRASHREPORTER
if (aRequest instanceof Ci.nsIChannel &&
aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT &&
gCrashReporter.enabled) {
gCrashReporter.annotateCrashReport("URL", aRequest.URI.spec);
}
#endif
// Collect telemetry data about tab load times.
if (aWebProgress.isTopLevel) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) {

View File

@ -131,11 +131,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "TabStateCache",
XPCOMUtils.defineLazyModuleGetter(this, "Utils",
"resource:///modules/sessionstore/Utils.jsm");
#ifdef MOZ_CRASHREPORTER
XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
"@mozilla.org/xre/app-info;1", "nsICrashReporter");
#endif
/**
* |true| if we are in debug mode, |false| otherwise.
* Debug mode is controlled by preference browser.sessionstore.debug
@ -1300,8 +1295,6 @@ let SessionStoreInternal = {
if (!aNoNotification) {
this.saveStateDelayed(aWindow);
}
this._updateCrashReportURL(aWindow);
},
/**
@ -1403,9 +1396,6 @@ let SessionStoreInternal = {
delete aBrowser.__SS_data;
this.saveStateDelayed(aWindow);
// attempt to update the current URL we send in a crash report
this._updateCrashReportURL(aWindow);
},
/**
@ -1424,9 +1414,6 @@ let SessionStoreInternal = {
if (tab.linkedBrowser.__SS_restoreState &&
tab.linkedBrowser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE)
this.restoreTabContent(tab);
// attempt to update the current URL we send in a crash report
this._updateCrashReportURL(aWindow);
}
},
@ -3066,29 +3053,6 @@ let SessionStoreInternal = {
return Services.io.newURI(aString, null, null);
},
/**
* Annotate a breakpad crash report with the currently selected tab's URL.
*/
_updateCrashReportURL: function ssi_updateCrashReportURL(aWindow) {
#ifdef MOZ_CRASHREPORTER
try {
var currentURI = aWindow.gBrowser.currentURI.clone();
// if the current URI contains a username/password, remove it
try {
currentURI.userPass = "";
}
catch (ex) { } // ignore failures on about: URIs
CrashReporter.annotateCrashReport("URL", currentURI.spec);
}
catch (ex) {
// don't make noise when crashreporter is built but not enabled
if (ex.result != Components.results.NS_ERROR_NOT_INITIALIZED)
debug(ex);
}
#endif
},
/**
* @param aState is a session state
* @param aRecentCrashes is the number of consecutive crashes