зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1424373
- Don't set crash reporting prefs when showing about:tabcrashed for a crash without a report. r=Mossop
--HG-- extra : rebase_source : 3330154807a268c5cc85bfbf19c64f3a790d4aee
This commit is contained in:
Родитель
001b4325b4
Коммит
b27c33fa9d
|
@ -303,6 +303,7 @@ var AboutTabCrashed = {
|
||||||
includeURL,
|
includeURL,
|
||||||
URL,
|
URL,
|
||||||
autoSubmit,
|
autoSubmit,
|
||||||
|
hasReport: this.hasReport,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,7 +21,7 @@ add_task(async function test_show_form() {
|
||||||
set: [[AUTOSUBMIT_PREF, false]],
|
set: [[AUTOSUBMIT_PREF, false]],
|
||||||
});
|
});
|
||||||
|
|
||||||
return BrowserTestUtils.withNewTab({
|
await BrowserTestUtils.withNewTab({
|
||||||
gBrowser,
|
gBrowser,
|
||||||
url: PAGE,
|
url: PAGE,
|
||||||
}, async function(browser) {
|
}, async function(browser) {
|
||||||
|
@ -69,7 +69,7 @@ add_task(async function test_show_form() {
|
||||||
set: [[AUTOSUBMIT_PREF, true]],
|
set: [[AUTOSUBMIT_PREF, true]],
|
||||||
});
|
});
|
||||||
|
|
||||||
return BrowserTestUtils.withNewTab({
|
await BrowserTestUtils.withNewTab({
|
||||||
gBrowser,
|
gBrowser,
|
||||||
url: PAGE,
|
url: PAGE,
|
||||||
}, async function(browser) {
|
}, async function(browser) {
|
||||||
|
@ -97,3 +97,58 @@ add_task(async function test_show_form() {
|
||||||
"Autosubmission pref should have been set.");
|
"Autosubmission pref should have been set.");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that we properly set the autoSubmit preference if the user is
|
||||||
|
* presented with a tabcrashed page without a crash report.
|
||||||
|
*/
|
||||||
|
add_task(async function test_no_offer() {
|
||||||
|
// We should default to sending the report.
|
||||||
|
Assert.ok(TabCrashHandler.prefs.getBoolPref("sendReport"));
|
||||||
|
|
||||||
|
await SpecialPowers.pushPrefEnv({
|
||||||
|
set: [[AUTOSUBMIT_PREF, false]],
|
||||||
|
});
|
||||||
|
|
||||||
|
await BrowserTestUtils.withNewTab({
|
||||||
|
gBrowser,
|
||||||
|
url: PAGE,
|
||||||
|
}, async function(browser) {
|
||||||
|
await TabStateFlusher.flush(browser);
|
||||||
|
|
||||||
|
// Make it so that it seems like no dump is available for the next crash.
|
||||||
|
prepareNoDump();
|
||||||
|
|
||||||
|
// Now crash the browser.
|
||||||
|
await BrowserTestUtils.crashBrowser(browser);
|
||||||
|
|
||||||
|
// eslint-disable-next-line mozilla/no-cpows-in-tests
|
||||||
|
let doc = browser.contentDocument;
|
||||||
|
|
||||||
|
// Ensure the request to autosubmit is invisible, since there's no report.
|
||||||
|
let requestRect = doc.getElementById("requestAutoSubmit")
|
||||||
|
.getBoundingClientRect();
|
||||||
|
Assert.equal(0, requestRect.height,
|
||||||
|
"Request for autosubmission has no height");
|
||||||
|
Assert.equal(0, requestRect.width,
|
||||||
|
"Request for autosubmission has no width");
|
||||||
|
|
||||||
|
// Since the pref is set to false, the checkbox should be
|
||||||
|
// unchecked.
|
||||||
|
let autoSubmit = doc.getElementById("autoSubmit");
|
||||||
|
Assert.ok(!autoSubmit.checked,
|
||||||
|
"Checkbox for autosubmission is not checked.");
|
||||||
|
|
||||||
|
let restoreButton = doc.getElementById("restoreTab");
|
||||||
|
restoreButton.click();
|
||||||
|
|
||||||
|
await BrowserTestUtils.browserLoaded(browser, false, PAGE);
|
||||||
|
|
||||||
|
// The autosubmission pref should now be set.
|
||||||
|
Assert.ok(!Services.prefs.getBoolPref(AUTOSUBMIT_PREF),
|
||||||
|
"Autosubmission pref should not have changed.");
|
||||||
|
});
|
||||||
|
|
||||||
|
// We should not have changed the default value for sending the report.
|
||||||
|
Assert.ok(TabCrashHandler.prefs.getBoolPref("sendReport"));
|
||||||
|
});
|
||||||
|
|
|
@ -2,16 +2,8 @@
|
||||||
|
|
||||||
const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
|
const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
|
||||||
|
|
||||||
/**
|
|
||||||
* Monkey patches TabCrashHandler.getDumpID to return null in order to test
|
|
||||||
* about:tabcrashed when a dump is not available.
|
|
||||||
*/
|
|
||||||
add_task(async function setup() {
|
add_task(async function setup() {
|
||||||
let originalGetDumpID = TabCrashHandler.getDumpID;
|
prepareNoDump();
|
||||||
TabCrashHandler.getDumpID = function(browser) { return null; };
|
|
||||||
registerCleanupFunction(() => {
|
|
||||||
TabCrashHandler.getDumpID = originalGetDumpID;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -121,3 +121,15 @@ async function setupLocalCrashReportServer() {
|
||||||
env.set("MOZ_CRASHREPORTER_URL", serverUrl);
|
env.set("MOZ_CRASHREPORTER_URL", serverUrl);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Monkey patches TabCrashHandler.getDumpID to return null in order to test
|
||||||
|
* about:tabcrashed when a dump is not available.
|
||||||
|
*/
|
||||||
|
function prepareNoDump() {
|
||||||
|
let originalGetDumpID = TabCrashHandler.getDumpID;
|
||||||
|
TabCrashHandler.getDumpID = function(browser) { return null; };
|
||||||
|
registerCleanupFunction(() => {
|
||||||
|
TabCrashHandler.getDumpID = originalGetDumpID;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -368,8 +368,14 @@ this.TabCrashHandler = {
|
||||||
* even if they are empty.
|
* even if they are empty.
|
||||||
*/
|
*/
|
||||||
maybeSendCrashReport(message) {
|
maybeSendCrashReport(message) {
|
||||||
if (!AppConstants.MOZ_CRASHREPORTER)
|
if (!AppConstants.MOZ_CRASHREPORTER) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!message.data.hasReport) {
|
||||||
|
// There was no report, so nothing to do.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let browser = message.target.browser;
|
let browser = message.target.browser;
|
||||||
|
|
||||||
|
@ -381,8 +387,9 @@ this.TabCrashHandler = {
|
||||||
|
|
||||||
let childID = this.browserMap.get(browser);
|
let childID = this.browserMap.get(browser);
|
||||||
let dumpID = this.childMap.get(childID);
|
let dumpID = this.childMap.get(childID);
|
||||||
if (!dumpID)
|
if (!dumpID) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!message.data.sendReport) {
|
if (!message.data.sendReport) {
|
||||||
Services.telemetry.getHistogramById("FX_CONTENT_CRASH_NOT_SUBMITTED").add(1);
|
Services.telemetry.getHistogramById("FX_CONTENT_CRASH_NOT_SUBMITTED").add(1);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче