Remove base conditional code for crash reporter and injector.

This commit is contained in:
wolfbeast 2018-03-30 08:50:58 +02:00 • committed by Roy Tam
commit 434f3590e3
131 changed files with 39 additions and 4139 deletions

View file

@ -90,8 +90,6 @@ this.TabCrashHandler = {
Services.telemetry
.getHistogramById("FX_CONTENT_CRASH_DUMP_UNAVAILABLE")
.add(1);
} else if (AppConstants.MOZ_CRASHREPORTER) {
this.childMap.set(childID, dumpID);
}
if (!this.flushCrashedBrowserQueue(childID)) {
@ -115,15 +113,6 @@ this.TabCrashHandler = {
}
}
// check for environment affecting crash reporting
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
let shutdown = env.exists("MOZ_CRASHREPORTER_SHUTDOWN");
if (shutdown) {
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
}
break;
}
case "oop-frameloader-crashed": {
@ -306,105 +295,10 @@ this.TabCrashHandler = {
/**
* Submits a crash report from about:tabcrashed, if the crash
* reporter is enabled and a crash report can be found.
*
* @param aBrowser
* The <xul:browser> that the report was sent from.
* @param aFormData
* An Object with the following properties:
*
* includeURL (bool):
* Whether to include the URL that the user was on
* in the crashed tab before the crash occurred.
* URL (String)
* The URL that the user was on in the crashed tab
* before the crash occurred.
* emailMe (bool):
* Whether or not to include the user's email address
* in the crash report.
* email (String):
* The email address of the user.
* comments (String):
* Any additional comments from the user.
*
* Note that it is expected that all properties are set,
* even if they are empty.
*/
maybeSendCrashReport(message) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}
if (!message.data.hasReport) {
// There was no report, so nothing to do.
return;
}
let browser = message.target.browser;
if (message.data.autoSubmit) {
// The user has opted in to autosubmitted backlogged
// crash reports in the future.
UnsubmittedCrashHandler.autoSubmit = true;
}
let childID = this.browserMap.get(browser.permanentKey);
let dumpID = this.childMap.get(childID);
if (!dumpID) {
return;
}
if (!message.data.sendReport) {
Services.telemetry.getHistogramById("FX_CONTENT_CRASH_NOT_SUBMITTED").add(1);
this.prefs.setBoolPref("sendReport", false);
return;
}
let {
includeURL,
comments,
email,
emailMe,
URL,
} = message.data;
let extraExtraKeyVals = {
"Comments": comments,
"Email": email,
"URL": URL,
};
// For the entries in extraExtraKeyVals, we only want to submit the
// extra data values where they are not the empty string.
for (let key in extraExtraKeyVals) {
let val = extraExtraKeyVals[key].trim();
if (!val) {
delete extraExtraKeyVals[key];
}
}
// URL is special, since it's already been written to extra data by
// default. In order to make sure we don't send it, we overwrite it
// with the empty string.
if (!includeURL) {
extraExtraKeyVals["URL"] = "";
}
CrashSubmit.submit(dumpID, {
recordSubmission: true,
extraExtraKeyVals,
}).then(null, Cu.reportError);
this.prefs.setBoolPref("sendReport", true);
this.prefs.setBoolPref("includeURL", includeURL);
this.prefs.setBoolPref("emailMe", emailMe);
if (emailMe) {
this.prefs.setCharPref("email", email);
} else {
this.prefs.setCharPref("email", "");
}
this.childMap.set(childID, null); // Avoid resubmission.
this.removeSubmitCheckboxesForSameCrash(childID);
/*** STUB ***/
return;
},
removeSubmitCheckboxesForSameCrash: function(childID) {
@ -518,17 +412,10 @@ this.TabCrashHandler = {
/**
* For some <xul:browser>, return a crash report dump ID for that browser
* if we have been informed of one. Otherwise, return null.
*
* @param browser (<xul:browser)
* The browser to try to get the dump ID for
* @returns dumpID (String)
*/
getDumpID(browser) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return null;
}
return this.childMap.get(this.browserMap.get(browser.permanentKey));
/*** STUB ***/
return null;
},
}

View file

@ -660,30 +660,8 @@ PluginContent.prototype = {
},
submitReport: function submitReport(plugin) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}
if (!plugin) {
Cu.reportError("Attempted to submit crash report without an associated plugin.");
return;
}
if (!(plugin instanceof Ci.nsIObjectLoadingContent)) {
Cu.reportError("Attempted to submit crash report on plugin that does not" +
"implement nsIObjectLoadingContent.");
return;
}
let runID = plugin.runID;
let submitURLOptIn = this.getPluginUI(plugin, "submitURLOptIn").checked;
let keyVals = {};
let userComment = this.getPluginUI(plugin, "submitComment").value.trim();
if (userComment)
keyVals.PluginUserComment = userComment;
if (submitURLOptIn)
keyVals.PluginContentURL = plugin.ownerDocument.URL;
this.global.sendAsyncMessage("PluginContent:SubmitReport",
{ runID, keyVals, submitURLOptIn });
/*** STUB ***/
return;
},
reloadPage: function () {