Bug 1592616 - Don't show breakage report link when we're not blocking anything. r=nhnt11

Differential Revision: https://phabricator.services.mozilla.com/D51381
This commit is contained in:
Johann Hofmann
2019-11-03 04:10:43 +00:00
parent c5ab2e5205
commit 3937eaa7b1
3 changed files with 26 additions and 1 deletions

View File

@@ -2185,6 +2185,7 @@ var gProtectionsHandler = {
// ContentBlockingAllowList here.
this._protectionsPopupTPSwitchBreakageLink.hidden =
ContentBlockingAllowList.includes(gBrowser.selectedBrowser) ||
!this._protectionsPopup.hasAttribute("blocking") ||
!this._protectionsPopupTPSwitch.hasAttribute("enabled");
},

View File

@@ -3,6 +3,11 @@
/* Basic UI tests for the protections panel */
"use strict";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
ChromeUtils.defineModuleGetter(
this,
"ContentBlockingAllowList",
@@ -19,6 +24,7 @@ add_task(async function setup() {
["browser.contentblocking.report.monitor.enabled", false],
["browser.contentblocking.report.lockwise.enabled", false],
["browser.contentblocking.report.proxy.enabled", false],
["privacy.trackingprotection.enabled", true],
],
});
let oldCanRecord = Services.telemetry.canRecordExtended;
@@ -34,7 +40,7 @@ add_task(async function setup() {
add_task(async function testToggleSwitch() {
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"https://example.com"
TRACKING_PAGE
);
await openProtectionsPanel();
let events = Services.telemetry.snapshotEvents(

View File

@@ -108,6 +108,20 @@ add_task(async function testReportBreakageCancel() {
Services.prefs.clearUserPref(TP_PREF);
});
add_task(async function testNoTracking() {
await BrowserTestUtils.withNewTab(BENIGN_PAGE, async function() {
await openProtectionsPopup();
let siteNotWorkingButton = document.getElementById(
"protections-popup-tp-switch-breakage-link"
);
ok(
BrowserTestUtils.is_hidden(siteNotWorkingButton),
"site not working button is not visible"
);
});
});
add_task(async function testTP() {
Services.prefs.setBoolPref(TP_PREF, true);
// Make sure that we correctly strip the query.
@@ -139,9 +153,11 @@ add_task(async function testFP() {
// Make sure that we correctly strip the query.
let url = TRACKING_PAGE + "?a=b&1=abc&unicode=🦊";
await BrowserTestUtils.withNewTab(url, async function(browser) {
let promise = waitForContentBlockingEvent();
await SpecialPowers.spawn(browser, [], function() {
content.postMessage("fingerprinting", "*");
});
await promise;
await testReportBreakage(TRACKING_PAGE, "fingerprinting");
});
@@ -156,9 +172,11 @@ add_task(async function testCM() {
// Make sure that we correctly strip the query.
let url = TRACKING_PAGE + "?a=b&1=abc&unicode=🦊";
await BrowserTestUtils.withNewTab(url, async function(browser) {
let promise = waitForContentBlockingEvent();
await SpecialPowers.spawn(browser, [], function() {
content.postMessage("cryptomining", "*");
});
await promise;
await testReportBreakage(TRACKING_PAGE, "cryptomining");
});