Skip to content

Commit 9bec24e

Browse files
committed
Bug 1868527 - hide 'Site not working?' from the protections panel when the 'Report Broken Site' feature is active; r=pbz
Differential Revision: https://phabricator.services.mozilla.com/D196184
1 parent 1ec9975 commit 9bec24e

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

browser/base/content/test/protectionsUI/browser_protectionsUI_report_breakage.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ let { Preferences } = ChromeUtils.importESModule(
3434
add_setup(async function () {
3535
await UrlClassifierTestUtils.addTestTrackers();
3636

37+
// Disable Report Broken Site, as it hides "Site not working?" when enabled.
38+
await SpecialPowers.pushPrefEnv({
39+
set: [["ui.new-webcompat-reporter.enabled", false]],
40+
});
41+
3742
registerCleanupFunction(() => {
3843
// Clear prefs that are touched in this test again for sanity.
3944
Services.prefs.clearUserPref(TP_PREF);

browser/components/reportbrokensite/ReportBrokenSite.sys.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,15 @@ export var ReportBrokenSite = new (class ReportBrokenSite {
394394
reportSiteIssue.hidden = this.enabled || !this.reportSiteIssueEnabledPref;
395395
reportSiteIssue.disabled = !canReportUrl;
396396
}
397+
398+
// "Site not working?" on the protections panel should be hidden when
399+
// Report Broken Site is visible (bug 1868527).
400+
const siteNotWorking = document.getElementById(
401+
"protections-popup-tp-switch-section-footer"
402+
);
403+
if (siteNotWorking) {
404+
siteNotWorking.hidden = this.enabled;
405+
}
397406
}
398407

399408
#checkPrefs(whichChanged) {

browser/components/reportbrokensite/test/browser/browser.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ support-files = [
1515

1616
["browser_report_site_issue_fallback.js"]
1717

18+
["browser_site_not_working_fallback.js"]
19+
1820
["browser_send_more_info.js"]
1921

2022
["browser_back_buttons.js"]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* Any copyright is dedicated to the Public Domain.
2+
* http://creativecommons.org/publicdomain/zero/1.0/ */
3+
4+
/* Tests that when Report Broken Site is active,
5+
* "Site not working?" is hidden on the protections panel.
6+
*/
7+
8+
"use strict";
9+
10+
add_common_setup();
11+
12+
const TP_PREF = "privacy.trackingprotection.enabled";
13+
14+
const TRACKING_PAGE =
15+
"https://tracking.example.org/browser/browser/base/content/test/protectionsUI/trackingPage.html";
16+
17+
const SITE_NOT_WORKING = "protections-popup-tp-switch-section-footer";
18+
19+
add_task(async function testSiteNotWorking() {
20+
await SpecialPowers.pushPrefEnv({ set: [[TP_PREF, true]] });
21+
await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function () {
22+
const menu = ProtectionsPanel();
23+
24+
ensureReportBrokenSitePreffedOn();
25+
await menu.open();
26+
const siteNotWorking = document.getElementById(SITE_NOT_WORKING);
27+
isMenuItemHidden(siteNotWorking, "Site not working is hidden");
28+
await menu.close();
29+
30+
ensureReportBrokenSitePreffedOff();
31+
await menu.open();
32+
isMenuItemEnabled(siteNotWorking, "Site not working is shown");
33+
await menu.close();
34+
});
35+
});

0 commit comments

Comments
 (0)