forked from mirrors/gecko-dev
Errors are collected via nsIConsoleService, shaped to a Sentry-compatible format, and sent off. Reporting is on by default, and can be disabled using a checkbox added to the privacy prefs in about:preferences. Collected errors are sampled to avoid overloading the collection service; the sample rate was determined by a previous Shield study that measured the number of errors occurring in Nightly. The feature is hard-disabled outside of Nightly and local builds, and the preference is disabled by default in local builds. It is intended as a prototype that will be evaluated and replaced by a more robust collection system if it proves helpful. Differential Revision: https://phabricator.services.mozilla.com/D561 MozReview-Commit-ID: 6aqUatXyuYs --HG-- extra : rebase_source : 574aa329069f80e0beb52d1fd15f43e65a548c5c extra : amend_source : a817fa4691c520eafaef808531b10581d09aeb14
50 lines
1.7 KiB
JavaScript
50 lines
1.7 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
/* eslint-disable mozilla/no-cpows-in-tests */
|
|
|
|
// Test the initial value of Browser Error collection checkbox
|
|
add_task(async function testBrowserErrorInitialValue() {
|
|
// Skip if non-Nightly since the checkbox will be missing.
|
|
if (!AppConstants.NIGHTLY_BUILD) {
|
|
return;
|
|
}
|
|
|
|
await SpecialPowers.pushPrefEnv({
|
|
set: [["browser.chrome.errorCollection.enabled", true]],
|
|
});
|
|
await openPreferencesViaOpenPreferencesAPI("privacy-reports", {leaveOpen: true});
|
|
|
|
let doc = gBrowser.contentDocument;
|
|
ok(
|
|
doc.querySelector("#collectBrowserErrorsBox").checked,
|
|
"Checkbox for collecting browser errors should be checked when the pref is true"
|
|
);
|
|
|
|
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
|
await SpecialPowers.popPrefEnv();
|
|
});
|
|
|
|
// Test that the Learn More link is set to the correct, formatted URL from a
|
|
// pref value
|
|
add_task(async function testBrowserErrorLearnMore() {
|
|
// Skip if non-Nightly since the checkbox will be missing.
|
|
if (!AppConstants.NIGHTLY_BUILD) {
|
|
return;
|
|
}
|
|
|
|
await SpecialPowers.pushPrefEnv({
|
|
set: [["browser.chrome.errorCollection.infoURL", "https://example.com/%NAME%/"]],
|
|
});
|
|
await openPreferencesViaOpenPreferencesAPI("privacy-reports", {leaveOpen: true});
|
|
|
|
let doc = gBrowser.contentDocument;
|
|
is(
|
|
doc.querySelector("#collectBrowserErrorsLearnMore").href,
|
|
`https://example.com/${Services.appinfo.name}/`,
|
|
"Learn More link for browser error collection should have an href set by a pref"
|
|
);
|
|
|
|
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
|
await SpecialPowers.popPrefEnv();
|
|
});
|