Bug 1632080 - Stop sending orphaned crash reports with synthesized crash annotations r=mconley

We originally added this functionality in bug 1566855 because we were
seeing a significant amount of orphaned crashes not being submitted.
Notably some of these were early content process startup crashes and
missing them made us unaware of severe issues that would affect our
users. In the meantime we've addressed most of the cases where a crash
would be orphaned. Since the crashes submitted this way have a buildid
that does not match the version of Firefox that actually crashed they
can be confusing during crash triage.

Given the above we can safely remove this functionality. This patch
reverts most of the changes from bug 1566855 but leaves the test
refactorings in place.

Differential Revision: https://phabricator.services.mozilla.com/D78219
This commit is contained in:
Gabriele Svelto 2020-06-05 06:32:24 +00:00
Родитель 0837dfa5be
Коммит cbadcd16da
3 изменённых файлов: 1 добавлений и 131 удалений

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

@ -9,9 +9,6 @@ const { FileUtils } = ChromeUtils.import(
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
XPCOMUtils.defineLazyGlobalGetters(this, [
"File",
"FormData",
@ -125,26 +122,6 @@ function getPendingMinidump(id) {
});
}
async function synthesizeExtraFile(extra) {
let url = "https://crash-reports.mozilla.com/submit?id=";
Services.appinfo.ID +
"&version=" +
Services.appinfo.version +
"&buildid=" +
Services.appinfo.appBuildID;
let data = {
ServerURL: url,
Vendor: Services.appinfo.vendor,
ProductName: Services.appinfo.name,
ProductID: Services.appinfo.ID,
Version: Services.appinfo.version,
BuildID: Services.appinfo.appBuildID,
ReleaseChannel: AppConstants.MOZ_UPDATE_CHANNEL,
};
await OS.File.writeAtomic(extra, JSON.stringify(data), { encoding: "utf-8" });
}
async function writeSubmittedReportAsync(crashID, viewURL) {
let strings = await getL10nStrings();
let data = strings.crashid.replace("%s", crashID);
@ -400,16 +377,12 @@ Submitter.prototype = {
OS.File.exists(memory),
]);
if (!dumpExists) {
if (!dumpExists || !extraExists) {
this.notifyStatus(FAILED);
this.cleanup();
return this.submitStatusPromise;
}
if (!extraExists) {
await synthesizeExtraFile(extra);
}
this.dump = dump;
this.extra = extra;
this.memory = memoryExists ? memory : null;

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

@ -3,7 +3,6 @@ support-files =
head.js
[browser_aboutCrashes.js]
[browser_aboutCrashesIncomplete.js]
[browser_aboutCrashesResubmit.js]
[browser_bug471404.js]
[browser_clearReports.js]

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

@ -1,102 +0,0 @@
const SERVER_URL =
"http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
var oldServerUrl = null;
function set_fake_crashreporter_url() {
let env = Cc["@mozilla.org/process/environment;1"].getService(
Ci.nsIEnvironment
);
oldServerUrl = env.get("MOZ_CRASHREPORTER_URL");
env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
}
function reset_fake_crashreporter_url() {
let env = Cc["@mozilla.org/process/environment;1"].getService(
Ci.nsIEnvironment
);
env.set("MOZ_CRASHREPORTER_URL", oldServerUrl);
}
function cleanup_and_finish() {
try {
cleanup_fake_appdir();
} catch (ex) {}
Services.prefs.clearUserPref("breakpad.reportURL");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
reset_fake_crashreporter_url();
finish();
}
/*
* check_submit_incomplete
*
* Check that crash reports that are missing the .extra file can be submitted.
* This will check if the submission process works by clicking on the "Submit"
* button in the about:crashes page and then verifies that the submission
* received on the server side contains the minimum set of crash annotations
* required by a valid report.
*/
function check_submit_incomplete(tab, crash) {
let crashReportPromise = TestUtils.topicObserved(
"crash-report-status",
(subject, data) => {
return data == "success";
}
);
crashReportPromise.then(result => {
let crashData = convertPropertyBag(result[0]);
ok(crashData.serverCrashID, "Should have a serverCrashID set.");
ok(crashData.extra.ProductName, "Should have a ProductName field.");
ok(crashData.extra.ReleaseChannel, "Should have a ReleaseChannel field.");
ok(crashData.extra.Vendor, "Should have a Vendor field.");
ok(crashData.extra.Version, "Should have a Version field.");
ok(crashData.extra.BuildID, "Should have a BuildID field.");
ok(crashData.extra.ProductID, "Should have a ProductID field.");
cleanup_and_finish();
});
const browser = gBrowser.getBrowserForTab(tab);
function csp_onsuccess() {
browser.removeEventListener("CrashSubmitSucceeded", csp_onsuccess, true);
ok(true, "the crash report was submitted successfully");
}
function csp_fail() {
browser.removeEventListener("CrashSubmitFailed", csp_fail, true);
ok(false, "failed to submit crash report!");
}
browser.addEventListener("CrashSubmitSucceeded", csp_onsuccess, true);
browser.addEventListener("CrashSubmitFailed", csp_fail, true);
SpecialPowers.spawn(browser, [crash.id], id => {
const submitButton = content.document
.getElementById(id)
.getElementsByClassName("submit-button")[0];
submitButton.click();
});
}
function convertPropertyBag(aBag) {
let result = {};
for (let { name, value } of aBag.enumerator) {
if (value instanceof Ci.nsIPropertyBag) {
value = convertPropertyBag(value);
}
result[name] = value;
}
return result;
}
function test() {
waitForExplicitFinish();
set_fake_crashreporter_url();
const appD = make_fake_appdir();
const crD = appD.clone();
crD.append("Crash Reports");
let crash = addIncompletePendingCrashreport(crD, Date.now());
BrowserTestUtils.openNewForegroundTab(gBrowser, "about:crashes").then(tab => {
check_submit_incomplete(tab, crash);
});
}