Bug 581335 - Hook up crash reporting for content processes [r=vingtetun]

This commit is contained in:
Mark Finkle 2010-11-24 13:32:23 -05:00
Родитель c2b446e153
Коммит b3cb7e27c1
1 изменённых файлов: 24 добавлений и 3 удалений

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

@ -2080,8 +2080,19 @@ var SessionHistoryObserver = {
};
var ContentCrashObserver = {
get CrashSubmit() {
delete this.CrashSubmit;
Cu.import("resource://gre/modules/CrashSubmit.jsm", this);
return this.CrashSubmit;
},
observe: function cco_observe(aSubject, aTopic, aData) {
if (aTopic != "ipc:content-shutdown" && aData != "abnormal")
if (aTopic != "ipc:content-shutdown") {
Cu.reportError("ContentCrashObserver unexpected topic: " + aTopic);
return;
}
if (!aSubject.QueryInterface(Ci.nsIPropertyBag2).hasKey("abnormal"))
return;
// Spin through the open tabs and resurrect the out-of-process tabs. Resurrection
@ -2102,8 +2113,12 @@ var ContentCrashObserver = {
(Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
(Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1);
this._waitingToClose = true;
let reload = Services.prompt.confirmEx(window, title, message, buttons, closeText, reloadText, null, submitText, { value: true });
// Only show the submit checkbox if we have a crash report we can submit
if (!aSubject.hasKey("dumpID"))
submitText = null;
let submit = { value: true };
let reload = Services.prompt.confirmEx(window, title, message, buttons, closeText, reloadText, null, submitText, submit);
if (reload) {
// Fire a TabSelect event to kick start the restore process
let event = document.createEvent("Events");
@ -2120,6 +2135,12 @@ var ContentCrashObserver = {
// system will pick it up.
Browser.closeTab(Browser.selectedTab);
}
// Submit the report, if we have one and the user wants to submit it
if (submit.value && aSubject.hasKey("dumpID")) {
let dumpID = aSubject.getProperty("dumpID");
this.CrashSubmit.submit(dumpID, Elements.stack, null, null);
}
}
};