Backed out 3 changesets (bug 1562575) for Mochitest failures in browser/tools/mozscreenshots/controlCenter/browser_controlCenter.js. CLOSED TREE

Backed out changeset fce18a9477b0 (bug 1562575)
Backed out changeset c9b01b908020 (bug 1562575)
Backed out changeset de006229ba8f (bug 1562575)
This commit is contained in:
Dorel Luca 2019-07-12 18:42:19 +03:00
Родитель 77d61d6a6f
Коммит da86b02dc2
32 изменённых файлов: 2248 добавлений и 1900 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -343,10 +343,20 @@ var gIdentityHandler = {
},
recordClick(object) {
let extra = {};
for (let blocker of ContentBlocking.blockers) {
if (blocker.telemetryIdentifier) {
extra[blocker.telemetryIdentifier] = blocker.activated
? "true"
: "false";
}
}
Services.telemetry.recordEvent(
"security.ui.identitypopup",
"click",
object
object,
null,
extra
);
},
@ -959,6 +969,8 @@ var gIdentityHandler = {
// Update per-site permissions section.
this.updateSitePermissions();
ContentBlocking.toggleReportBreakageButton();
},
setURI(uri) {
@ -1089,10 +1101,24 @@ var gIdentityHandler = {
window.addEventListener("focus", this, true);
}
let extra = {};
for (let blocker of ContentBlocking.blockers) {
if (blocker.telemetryIdentifier) {
extra[blocker.telemetryIdentifier] = blocker.activated
? "true"
: "false";
}
}
let shieldStatus = ContentBlocking.iconBox.hasAttribute("active")
? "shield-showing"
: "shield-hidden";
Services.telemetry.recordEvent(
"security.ui.identitypopup",
"open",
"identity_popup"
"identity_popup",
shieldStatus,
extra
);
},

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1943,7 +1943,7 @@ var gBrowserInit = {
BookmarkingUI.init();
BrowserSearch.delayedStartupInit();
AutoShowBookmarksToolbar.init();
gProtectionsHandler.init();
ContentBlocking.init();
let safeMode = document.getElementById("helpSafeMode");
if (Services.appinfo.inSafeMode) {
@ -2423,7 +2423,7 @@ var gBrowserInit = {
Services.prefs.removeObserver(ctrlTab.prefName, ctrlTab);
ctrlTab.uninit();
gBrowserThumbnails.uninit();
gProtectionsHandler.uninit();
ContentBlocking.uninit();
FullZoom.destroy();
Services.obs.removeObserver(gIdentityHandler, "perm-changed");
@ -5739,7 +5739,7 @@ var XULBrowserWindow = {
);
}
gProtectionsHandler.onContentBlockingEvent(
ContentBlocking.onContentBlockingEvent(
this._event,
aWebProgress,
aIsSimulated
@ -6366,6 +6366,8 @@ var TabsProgressListener = {
gBrowser.getNotificationBox(aBrowser).removeTransientNotifications();
FullZoom.onLocationChange(aLocationURI, false, aBrowser);
ContentBlocking.onLocationChange();
},
onLinkIconAvailable(browser, dataURI, iconURI) {

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

@ -81,6 +81,7 @@
/* eslint-env mozilla/browser-window */
Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", this);
Services.scriptloader.loadSubScript("chrome://browser/content/browser-captivePortal.js", this);
Services.scriptloader.loadSubScript("chrome://browser/content/browser-contentblocking.js", this);
if (AppConstants.MOZ_DATA_REPORTING) {
Services.scriptloader.loadSubScript("chrome://browser/content/browser-data-submission-info-bar.js", this);
}

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

@ -52,7 +52,6 @@ support-files = ../permissions/permissions.html
[browser_identityPopup_clearSiteData.js]
[browser_identityPopup_custom_roots.js]
[browser_identityPopup_focus.js]
[browser_identityPopup_telemetry.js]
[browser_insecureLoginForms.js]
support-files =
insecure_opener.html

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

@ -1,43 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const BENIGN_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
/**
* Enable local telemetry recording for the duration of the tests.
*/
var oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
registerCleanupFunction(function() {
Services.telemetry.canRecordExtended = oldCanRecord;
});
add_task(async function testIdentityPopupEvents() {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
await promiseTabLoadEvent(tab, BENIGN_PAGE);
Services.telemetry.clearEvents();
let shown = BrowserTestUtils.waitForEvent(
gIdentityHandler._identityPopup,
"popupshown"
);
EventUtils.synthesizeMouseAtCenter(gIdentityHandler._identityBox, {});
await shown;
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
let openEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "open" &&
e[3] == "identity_popup"
);
is(openEvents.length, 1, "recorded telemetry for opening the identity popup");
gBrowser.removeCurrentTab();
});

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

@ -3,12 +3,6 @@
/* Basic UI tests for the protections panel */
ChromeUtils.defineModuleGetter(
this,
"ContentBlockingAllowList",
"resource://gre/modules/ContentBlockingAllowList.jsm"
);
add_task(async function setup() {
await SpecialPowers.pushPrefEnv({
set: [
@ -60,7 +54,43 @@ add_task(async function testToggleSwitch() {
!gProtectionsHandler._protectionsPopupTPSwitch.hasAttribute("enabled"),
"TP Switch should be disabled"
);
ContentBlockingAllowList.remove(tab.linkedBrowser);
Services.perms.remove(
ContentBlocking._baseURIForChannelClassifier,
"trackingprotection"
);
BrowserTestUtils.removeTab(tab);
});
add_task(async function testSiteNotWorking() {
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"https://example.com"
);
await openProtectionsPanel();
let viewShownPromise = BrowserTestUtils.waitForEvent(
gProtectionsHandler._protectionsPopupMultiView,
"ViewShown"
);
document.getElementById("protections-popup-tp-switch-breakage-link").click();
let event = await viewShownPromise;
is(
event.originalTarget.id,
"protections-popup-siteNotWorkingView",
"Site Not Working? view should be shown"
);
viewShownPromise = BrowserTestUtils.waitForEvent(
gProtectionsHandler._protectionsPopupMultiView,
"ViewShown"
);
document
.getElementById("protections-popup-siteNotWorkingView-sendReport")
.click();
event = await viewShownPromise;
is(
event.originalTarget.id,
"protections-popup-sendReportView",
"Send Report view should be shown"
);
BrowserTestUtils.removeTab(tab);
});
@ -254,6 +284,9 @@ add_task(async function testToggleSwitchFlow() {
await popuphiddenPromise;
// Clean up the TP state.
ContentBlockingAllowList.remove(tab.linkedBrowser);
Services.perms.remove(
ContentBlocking._baseURIForChannelClassifier,
"trackingprotection"
);
BrowserTestUtils.removeTab(tab);
});

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

@ -34,13 +34,10 @@ async function testTrackingProtectionAnimation(tabbrowser) {
tabbrowser,
BENIGN_PAGE
);
let gProtectionsHandler = tabbrowser.ownerGlobal.gProtectionsHandler;
let ContentBlocking = tabbrowser.ownerGlobal.ContentBlocking;
ok(!gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox not active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("animate"),
"iconBox not animating"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "iconBox not active");
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
info("Load a test page containing tracking elements");
let trackingTab = await BrowserTestUtils.openNewForegroundTab(
@ -48,10 +45,10 @@ async function testTrackingProtectionAnimation(tabbrowser) {
TRACKING_PAGE
);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(gProtectionsHandler.iconBox.hasAttribute("animate"), "iconBox animating");
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(ContentBlocking.iconBox.hasAttribute("animate"), "iconBox animating");
await BrowserTestUtils.waitForEvent(
gProtectionsHandler.animatedIcon,
ContentBlocking.animatedIcon,
"animationend"
);
@ -61,10 +58,10 @@ async function testTrackingProtectionAnimation(tabbrowser) {
COOKIE_PAGE
);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(gProtectionsHandler.iconBox.hasAttribute("animate"), "iconBox animating");
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(ContentBlocking.iconBox.hasAttribute("animate"), "iconBox animating");
await BrowserTestUtils.waitForEvent(
gProtectionsHandler.animatedIcon,
ContentBlocking.animatedIcon,
"animationend"
);
@ -73,33 +70,24 @@ async function testTrackingProtectionAnimation(tabbrowser) {
tabbrowser.selectedTab = benignTab;
await securityChanged;
ok(!gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox not active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("animate"),
"iconBox not animating"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "iconBox not active");
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
info("Switch from benign -> tracking tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
tabbrowser.selectedTab = trackingTab;
await securityChanged;
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("animate"),
"iconBox not animating"
);
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
info("Switch from tracking -> tracking cookies tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
tabbrowser.selectedTab = trackingCookiesTab;
await securityChanged;
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("animate"),
"iconBox not animating"
);
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
info("Reload tracking cookies tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
@ -110,10 +98,10 @@ async function testTrackingProtectionAnimation(tabbrowser) {
tabbrowser.reload();
await Promise.all([securityChanged, contentBlockingEvent]);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(gProtectionsHandler.iconBox.hasAttribute("animate"), "iconBox animating");
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(ContentBlocking.iconBox.hasAttribute("animate"), "iconBox animating");
await BrowserTestUtils.waitForEvent(
gProtectionsHandler.animatedIcon,
ContentBlocking.animatedIcon,
"animationend"
);
@ -124,10 +112,10 @@ async function testTrackingProtectionAnimation(tabbrowser) {
tabbrowser.reload();
await Promise.all([securityChanged, contentBlockingEvent]);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(gProtectionsHandler.iconBox.hasAttribute("animate"), "iconBox animating");
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(ContentBlocking.iconBox.hasAttribute("animate"), "iconBox animating");
await BrowserTestUtils.waitForEvent(
gProtectionsHandler.animatedIcon,
ContentBlocking.animatedIcon,
"animationend"
);
@ -140,11 +128,8 @@ async function testTrackingProtectionAnimation(tabbrowser) {
let result = await Promise.race([securityChanged, timeoutPromise]);
is(result, undefined, "No securityChange events should be received");
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("animate"),
"iconBox not animating"
);
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
info("Inject tracking element inside tracking tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
@ -155,11 +140,8 @@ async function testTrackingProtectionAnimation(tabbrowser) {
result = await Promise.race([securityChanged, timeoutPromise]);
is(result, undefined, "No securityChange events should be received");
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("animate"),
"iconBox not animating"
);
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
tabbrowser.selectedTab = trackingCookiesTab;
@ -172,11 +154,8 @@ async function testTrackingProtectionAnimation(tabbrowser) {
result = await Promise.race([securityChanged, timeoutPromise]);
is(result, undefined, "No securityChange events should be received");
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("animate"),
"iconBox not animating"
);
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
info("Inject tracking element inside tracking cookies tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
@ -187,11 +166,8 @@ async function testTrackingProtectionAnimation(tabbrowser) {
result = await Promise.race([securityChanged, timeoutPromise]);
is(result, undefined, "No securityChange events should be received");
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "iconBox active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("animate"),
"iconBox not animating"
);
ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
while (tabbrowser.tabs.length > 1) {
tabbrowser.removeCurrentTab();
@ -201,11 +177,8 @@ async function testTrackingProtectionAnimation(tabbrowser) {
add_task(async function testNormalBrowsing() {
await UrlClassifierTestUtils.addTestTrackers();
let gProtectionsHandler = gBrowser.ownerGlobal.gProtectionsHandler;
ok(
gProtectionsHandler,
"gProtectionsHandler is attached to the browser window"
);
let ContentBlocking = gBrowser.ownerGlobal.ContentBlocking;
ok(ContentBlocking, "CB is attached to the browser window");
let TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
ok(TrackingProtection, "TP is attached to the browser window");
let ThirdPartyCookies = gBrowser.ownerGlobal.ThirdPartyCookies;
@ -231,11 +204,8 @@ add_task(async function testPrivateBrowsing() {
});
let tabbrowser = privateWin.gBrowser;
let gProtectionsHandler = tabbrowser.ownerGlobal.gProtectionsHandler;
ok(
gProtectionsHandler,
"gProtectionsHandler is attached to the private window"
);
let ContentBlocking = tabbrowser.ownerGlobal.ContentBlocking;
ok(ContentBlocking, "CB is attached to the private window");
let TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
ok(TrackingProtection, "TP is attached to the private window");
let ThirdPartyCookies = tabbrowser.ownerGlobal.ThirdPartyCookies;

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

@ -46,10 +46,7 @@ add_task(async function testBackgroundTabs() {
"Foreground tab has the correct content blocking event."
);
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
await BrowserTestUtils.switchTab(gBrowser, backgroundTab);
@ -65,7 +62,7 @@ add_task(async function testBackgroundTabs() {
"Foreground tab still has the correct content blocking event."
);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "shield is active");
ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
gBrowser.removeTab(backgroundTab);
gBrowser.removeTab(tab);

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

@ -13,9 +13,13 @@ const CONTAINER_PAGE =
const TPC_PREF = "network.cookie.cookieBehavior";
add_task(async function setup() {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
await UrlClassifierTestUtils.addTestTrackers();
registerCleanupFunction(() => {
Services.telemetry.canRecordExtended = oldCanRecord;
UrlClassifierTestUtils.cleanupTestTrackers();
});
});
@ -44,7 +48,9 @@ async function assertSitesListed(
let [tab] = await Promise.all([promise, waitForContentBlockingEvent(count)]);
let browser = tab.linkedBrowser;
await openProtectionsPopup();
await openIdentityPopup();
Services.telemetry.clearEvents();
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-cookies"
@ -57,6 +63,17 @@ async function assertSitesListed(
ok(true, "Cookies view was shown");
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS
).parent;
let buttonEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "click" &&
e[3] == "cookies_subview_btn"
);
is(buttonEvents.length, 1, "recorded telemetry for the button click");
let listHeaders = cookiesView.querySelectorAll(
".identity-popup-cookiesView-list-header"
);
@ -112,7 +129,7 @@ async function assertSitesListed(
);
}
let mainView = document.getElementById("protections-popup-mainView");
let mainView = document.getElementById("identity-popup-mainView");
viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
let backButton = cookiesView.querySelector(".subviewbutton-back");
backButton.click();
@ -284,7 +301,7 @@ add_task(async function testCookiesSubViewAllowed() {
});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent(3)]);
await openProtectionsPopup();
await openIdentityPopup();
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-cookies"
@ -400,7 +417,7 @@ add_task(async function testCookiesSubViewAllowedHeuristic() {
await new Promise(resolve => waitForFocus(resolve, popup));
await new Promise(resolve => waitForFocus(resolve, window));
await openProtectionsPopup();
await openIdentityPopup();
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-cookies"
@ -483,7 +500,7 @@ add_task(async function testCookiesSubViewBlockedDoublyNested() {
});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent(3)]);
await openProtectionsPopup();
await openIdentityPopup();
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-cookies"

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

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
@ -49,22 +50,22 @@ async function testIdentityState(hasException) {
false,
TRACKING_PAGE
);
gProtectionsHandler.disableForCurrentPage();
ContentBlocking.disableForCurrentPage();
await loaded;
}
ok(
!gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
!ContentBlocking.content.hasAttribute("detected"),
"cryptominers are not detected"
);
if (hasException) {
ok(
BrowserTestUtils.is_visible(gProtectionsHandler.iconBox),
!BrowserTestUtils.is_hidden(ContentBlocking.iconBox),
"icon box is visible to indicate the exception"
);
} else {
ok(
BrowserTestUtils.is_hidden(gProtectionsHandler.iconBox),
BrowserTestUtils.is_hidden(ContentBlocking.iconBox),
"icon box is not visible"
);
}
@ -77,16 +78,13 @@ async function testIdentityState(hasException) {
await promise;
ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
"trackers are detected"
);
ok(
BrowserTestUtils.is_visible(gProtectionsHandler.iconBox),
BrowserTestUtils.is_visible(ContentBlocking.iconBox),
"icon box is visible"
);
is(
gProtectionsHandler.iconBox.hasAttribute("hasException"),
ContentBlocking.iconBox.hasAttribute("hasException"),
hasException,
"Shows an exception when appropriate"
);
@ -97,7 +95,7 @@ async function testIdentityState(hasException) {
false,
TRACKING_PAGE
);
gProtectionsHandler.enableForCurrentPage();
ContentBlocking.enableForCurrentPage();
await loaded;
}
@ -121,7 +119,7 @@ async function testSubview(hasException) {
false,
TRACKING_PAGE
);
gProtectionsHandler.disableForCurrentPage();
ContentBlocking.disableForCurrentPage();
await loaded;
}
@ -131,7 +129,7 @@ async function testSubview(hasException) {
});
await promise;
await openProtectionsPopup();
await openIdentityPopup();
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-cryptominers"
@ -159,7 +157,7 @@ async function testSubview(hasException) {
"Indicates the miner was blocked or allowed"
);
let mainView = document.getElementById("protections-popup-mainView");
let mainView = document.getElementById("identity-popup-mainView");
viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
let backButton = subview.querySelector(".subviewbutton-back");
backButton.click();
@ -173,7 +171,7 @@ async function testSubview(hasException) {
false,
TRACKING_PAGE
);
gProtectionsHandler.enableForCurrentPage();
ContentBlocking.enableForCurrentPage();
await loaded;
}

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

@ -18,19 +18,16 @@ add_task(async function test_fetch() {
});
await contentBlockingEvent;
let gProtectionsHandler = newTabBrowser.ownerGlobal.gProtectionsHandler;
ok(gProtectionsHandler, "got CB object");
let ContentBlocking = newTabBrowser.ownerGlobal.ContentBlocking;
ok(ContentBlocking, "got CB object");
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
ContentBlocking.content.hasAttribute("detected"),
"has detected content blocking"
);
ok(
gProtectionsHandler.iconBox.hasAttribute("active"),
"icon box is active"
);
ok(ContentBlocking.iconBox.hasAttribute("active"), "icon box is active");
is(
gProtectionsHandler.iconBox.getAttribute("tooltiptext"),
ContentBlocking.iconBox.getAttribute("tooltiptext"),
gNavigatorBundle.getString("trackingProtection.icon.activeTooltip"),
"correct tooltip"
);

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

@ -1,3 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
@ -49,22 +50,22 @@ async function testIdentityState(hasException) {
false,
TRACKING_PAGE
);
gProtectionsHandler.disableForCurrentPage();
ContentBlocking.disableForCurrentPage();
await loaded;
}
ok(
!gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
!ContentBlocking.content.hasAttribute("detected"),
"fingerprinters are not detected"
);
if (hasException) {
ok(
!BrowserTestUtils.is_hidden(gProtectionsHandler.iconBox),
!BrowserTestUtils.is_hidden(ContentBlocking.iconBox),
"icon box is visible to indicate the exception"
);
} else {
ok(
BrowserTestUtils.is_hidden(gProtectionsHandler.iconBox),
BrowserTestUtils.is_hidden(ContentBlocking.iconBox),
"icon box is not visible"
);
}
@ -77,16 +78,13 @@ async function testIdentityState(hasException) {
await promise;
ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
"trackers are detected"
);
ok(
BrowserTestUtils.is_visible(gProtectionsHandler.iconBox),
BrowserTestUtils.is_visible(ContentBlocking.iconBox),
"icon box is visible"
);
is(
gProtectionsHandler.iconBox.hasAttribute("hasException"),
ContentBlocking.iconBox.hasAttribute("hasException"),
hasException,
"Shows an exception when appropriate"
);
@ -97,7 +95,7 @@ async function testIdentityState(hasException) {
false,
TRACKING_PAGE
);
gProtectionsHandler.enableForCurrentPage();
ContentBlocking.enableForCurrentPage();
await loaded;
}
@ -121,7 +119,7 @@ async function testSubview(hasException) {
false,
TRACKING_PAGE
);
gProtectionsHandler.disableForCurrentPage();
ContentBlocking.disableForCurrentPage();
await loaded;
}
@ -131,7 +129,7 @@ async function testSubview(hasException) {
});
await promise;
await openProtectionsPopup();
await openIdentityPopup();
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-fingerprinters"
@ -159,7 +157,7 @@ async function testSubview(hasException) {
"Indicates the fingerprinter was blocked or allowed"
);
let mainView = document.getElementById("protections-popup-mainView");
let mainView = document.getElementById("identity-popup-mainView");
viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
let backButton = subview.querySelector(".subviewbutton-back");
backButton.click();
@ -173,7 +171,7 @@ async function testSubview(hasException) {
false,
TRACKING_PAGE
);
gProtectionsHandler.enableForCurrentPage();
ContentBlocking.enableForCurrentPage();
await loaded;
}

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

@ -8,11 +8,9 @@ const TPC_PREF = "network.cookie.cookieBehavior";
const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
async function waitAndAssertPreferencesShown(_spotlight, identityPopup) {
async function waitAndAssertPreferencesShown(_spotlight) {
await BrowserTestUtils.waitForEvent(
identityPopup
? gIdentityHandler._identityPopup
: gProtectionsHandler._protectionsPopup,
gIdentityHandler._identityPopup,
"popuphidden"
);
await TestUtils.waitForCondition(
@ -51,11 +49,16 @@ add_task(async function setup() {
});
});
// Tests that pressing the content blocking preferences icon in the protections popup
// Tests that pressing the content blocking preferences icon in the identity popup
// links to about:preferences
add_task(async function testOpenPreferencesFromCBPrefsButton() {
await BrowserTestUtils.withNewTab("https://example.com", async function() {
await openProtectionsPopup();
let promisePanelOpen = BrowserTestUtils.waitForEvent(
gIdentityHandler._identityPopup,
"popupshown"
);
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let preferencesButton = document.getElementById(
"tracking-protection-preferences-button"
@ -66,9 +69,23 @@ add_task(async function testOpenPreferencesFromCBPrefsButton() {
"The preferences button is shown."
);
Services.telemetry.clearEvents();
let shown = waitAndAssertPreferencesShown("trackingprotection");
preferencesButton.click();
await shown;
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
let clickEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "click" &&
e[3] == "cb_prefs_button"
);
is(clickEvents.length, 1, "recorded telemetry for the click");
});
});
@ -76,7 +93,12 @@ add_task(async function testOpenPreferencesFromCBPrefsButton() {
// links to about:preferences
add_task(async function testOpenPreferencesFromPermissionsPrefsButton() {
await BrowserTestUtils.withNewTab("https://example.com", async function() {
await openIdentityPopup();
let promisePanelOpen = BrowserTestUtils.waitForEvent(
gIdentityHandler._identityPopup,
"popupshown"
);
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let preferencesButton = document.getElementById(
"identity-popup-permission-preferences-button"
@ -89,7 +111,7 @@ add_task(async function testOpenPreferencesFromPermissionsPrefsButton() {
Services.telemetry.clearEvents();
let shown = waitAndAssertPreferencesShown("permissions", true);
let shown = waitAndAssertPreferencesShown("permissions");
preferencesButton.click();
await shown;
@ -113,7 +135,12 @@ add_task(async function testOpenPreferencesFromTrackersSubview() {
Services.prefs.setBoolPref(TP_PREF, true);
await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function() {
await openProtectionsPopup();
let promisePanelOpen = BrowserTestUtils.waitForEvent(
gIdentityHandler._identityPopup,
"popupshown"
);
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-tracking-protection"
@ -138,9 +165,23 @@ add_task(async function testOpenPreferencesFromTrackersSubview() {
"The preferences button is shown."
);
Services.telemetry.clearEvents();
let shown = waitAndAssertPreferencesShown("trackingprotection");
preferencesButton.click();
await shown;
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
let clickEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "click" &&
e[3] == "trackers_prefs_btn"
);
is(clickEvents.length, 1, "recorded telemetry for the click");
});
Services.prefs.clearUserPref(TP_PREF);
@ -155,7 +196,12 @@ add_task(async function testOpenPreferencesFromCookiesSubview() {
);
await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function() {
await openProtectionsPopup();
let promisePanelOpen = BrowserTestUtils.waitForEvent(
gIdentityHandler._identityPopup,
"popupshown"
);
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-cookies"
@ -180,9 +226,23 @@ add_task(async function testOpenPreferencesFromCookiesSubview() {
"The preferences button is shown."
);
Services.telemetry.clearEvents();
let shown = waitAndAssertPreferencesShown("trackingprotection");
preferencesButton.click();
await shown;
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
let clickEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "click" &&
e[3] == "cookies_prefs_btn"
);
is(clickEvents.length, 1, "recorded telemetry for the click");
});
Services.prefs.clearUserPref(TPC_PREF);

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

@ -9,13 +9,13 @@ const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
const DTSCBN_PREF = "dom.testing.sync-content-blocking-notifications";
var TrackingProtection = null;
var gProtectionsHandler = null;
var ContentBlocking = null;
var browser = null;
registerCleanupFunction(function() {
Services.prefs.clearUserPref(TP_PB_PREF);
Services.prefs.clearUserPref(DTSCBN_PREF);
gProtectionsHandler = TrackingProtection = browser = null;
ContentBlocking = TrackingProtection = browser = null;
UrlClassifierTestUtils.cleanupTestTrackers();
});
@ -26,9 +26,9 @@ function hidden(sel) {
return display === "none";
}
function protectionsPopupState() {
function identityPopupState() {
let win = browser.ownerGlobal;
return win.document.getElementById("protections-popup").state;
return win.document.getElementById("identity-popup").state;
}
function clickButton(sel) {
@ -39,30 +39,43 @@ function clickButton(sel) {
function testTrackingPage(window) {
info("Tracking content must be blocked");
ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
"trackers are detected"
);
ok(
!gProtectionsHandler._protectionsPopup.hasAttribute("hasException"),
!ContentBlocking.content.hasAttribute("hasException"),
"content shows no exception"
);
ok(
BrowserTestUtils.is_visible(gProtectionsHandler.iconBox),
BrowserTestUtils.is_visible(ContentBlocking.iconBox),
"icon box is visible"
);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "shield is active");
ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("hasException"),
!ContentBlocking.iconBox.hasAttribute("hasException"),
"icon box shows no exception"
);
is(
gProtectionsHandler.iconBox.getAttribute("tooltiptext"),
ContentBlocking.iconBox.getAttribute("tooltiptext"),
gNavigatorBundle.getString("trackingProtection.icon.activeTooltip"),
"correct tooltip"
);
ok(hidden("#tracking-action-block"), "blockButton is hidden");
if (PrivateBrowsingUtils.isWindowPrivate(window)) {
ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
ok(
!hidden("#tracking-action-unblock-private"),
"unblockButtonPrivate is visible"
);
} else {
ok(!hidden("#tracking-action-unblock"), "unblockButton is visible");
ok(
hidden("#tracking-action-unblock-private"),
"unblockButtonPrivate is hidden"
);
}
ok(
hidden("#identity-popup-content-blocking-not-detected"),
"blocking not detected label is hidden"
@ -75,30 +88,29 @@ function testTrackingPage(window) {
function testTrackingPageUnblocked() {
info("Tracking content must be white-listed and not blocked");
ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
"trackers are detected"
);
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("hasException"),
ContentBlocking.content.hasAttribute("hasException"),
"content shows exception"
);
ok(!gProtectionsHandler.iconBox.hasAttribute("active"), "shield is active");
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
ok(
gProtectionsHandler.iconBox.hasAttribute("hasException"),
ContentBlocking.iconBox.hasAttribute("hasException"),
"shield shows exception"
);
is(
gProtectionsHandler.iconBox.getAttribute("tooltiptext"),
ContentBlocking.iconBox.getAttribute("tooltiptext"),
gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"),
"correct tooltip"
);
ok(
BrowserTestUtils.is_visible(gProtectionsHandler.iconBox),
BrowserTestUtils.is_visible(ContentBlocking.iconBox),
"icon box is visible"
);
ok(!hidden("#tracking-action-block"), "blockButton is visible");
ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
ok(
hidden("#identity-popup-content-blocking-not-detected"),
@ -123,8 +135,8 @@ add_task(async function testExceptionAddition() {
waitForStateStop: true,
});
gProtectionsHandler = browser.ownerGlobal.gProtectionsHandler;
ok(gProtectionsHandler, "CB is attached to the private window");
ContentBlocking = browser.ownerGlobal.ContentBlocking;
ok(ContentBlocking, "CB is attached to the private window");
TrackingProtection = browser.ownerGlobal.TrackingProtection;
ok(TrackingProtection, "TP is attached to the private window");
@ -141,8 +153,8 @@ add_task(async function testExceptionAddition() {
info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab);
gProtectionsHandler.disableForCurrentPage();
is(protectionsPopupState(), "closed", "protections popup is closed");
clickButton("#tracking-action-unblock");
is(identityPopupState(), "closed", "Identity popup is closed");
await tabReloadPromise;
testTrackingPageUnblocked();
@ -171,8 +183,8 @@ add_task(async function testExceptionPersistence() {
waitForStateStop: true,
});
gProtectionsHandler = browser.ownerGlobal.gProtectionsHandler;
ok(gProtectionsHandler, "CB is attached to the private window");
ContentBlocking = browser.ownerGlobal.ContentBlocking;
ok(ContentBlocking, "CB is attached to the private window");
TrackingProtection = browser.ownerGlobal.TrackingProtection;
ok(TrackingProtection, "TP is attached to the private window");
@ -188,8 +200,8 @@ add_task(async function testExceptionPersistence() {
info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab);
gProtectionsHandler.disableForCurrentPage();
is(protectionsPopupState(), "closed", "protections popup is closed");
clickButton("#tracking-action-unblock");
is(identityPopupState(), "closed", "Identity popup is closed");
await Promise.all([
tabReloadPromise,

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

@ -28,7 +28,12 @@ let { Preferences } = ChromeUtils.import(
add_task(async function setup() {
await UrlClassifierTestUtils.addTestTrackers();
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
registerCleanupFunction(() => {
Services.telemetry.canRecordExtended = oldCanRecord;
// Clear prefs that are touched in this test again for sanity.
Services.prefs.clearUserPref(TP_PREF);
Services.prefs.clearUserPref(CB_PREF);
@ -127,10 +132,10 @@ add_task(async function testReportBreakageVisibility() {
}
await BrowserTestUtils.withNewTab(scenario.url, async function() {
await openProtectionsPopup();
await openIdentityPopup();
let reportBreakageButton = document.getElementById(
"protections-popup-tp-switch-breakage-link"
"identity-popup-content-blocking-report-breakage"
);
await TestUtils.waitForCondition(
() =>
@ -153,40 +158,44 @@ add_task(async function testReportBreakageCancel() {
Services.prefs.setBoolPref(PREF_REPORT_BREAKAGE_ENABLED, true);
await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function() {
await openProtectionsPopup();
await openIdentityPopup();
let siteNotWorkingButton = document.getElementById(
"protections-popup-tp-switch-breakage-link"
Services.telemetry.clearEvents();
let reportBreakageButton = document.getElementById(
"identity-popup-content-blocking-report-breakage"
);
ok(
BrowserTestUtils.is_visible(siteNotWorkingButton),
"site not working button is visible"
BrowserTestUtils.is_visible(reportBreakageButton),
"report breakage button is visible"
);
let siteNotWorkingView = document.getElementById(
"protections-popup-siteNotWorkingView"
let reportBreakageView = document.getElementById(
"identity-popup-breakageReportView"
);
let viewShown = BrowserTestUtils.waitForEvent(
siteNotWorkingView,
reportBreakageView,
"ViewShown"
);
siteNotWorkingButton.click();
reportBreakageButton.click();
await viewShown;
let sendReportButton = document.getElementById(
"protections-popup-siteNotWorkingView-sendReport"
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS
).parent;
let clickEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "click" &&
e[3] == "report_breakage"
);
let sendReportView = document.getElementById(
"protections-popup-sendReportView"
);
viewShown = BrowserTestUtils.waitForEvent(sendReportView, "ViewShown");
sendReportButton.click();
await viewShown;
is(clickEvents.length, 1, "recorded telemetry for the click");
ok(true, "Report breakage view was shown");
viewShown = BrowserTestUtils.waitForEvent(siteNotWorkingView, "ViewShown");
let mainView = document.getElementById("identity-popup-mainView");
viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
let cancelButton = document.getElementById(
"protections-popup-sendReportView-cancel"
"identity-popup-breakageReportView-cancel"
);
cancelButton.click();
await viewShown;
@ -268,54 +277,42 @@ async function testReportBreakage(url, tags) {
Services.prefs.setBoolPref(PREF_REPORT_BREAKAGE_ENABLED, true);
Services.prefs.setStringPref(PREF_REPORT_BREAKAGE_URL, path);
await openProtectionsPopup();
let siteNotWorkingButton = document.getElementById(
"protections-popup-tp-switch-breakage-link"
);
await TestUtils.waitForCondition(
() => BrowserTestUtils.is_visible(siteNotWorkingButton),
"site not working button is visible"
);
let siteNotWorkingView = document.getElementById(
"protections-popup-siteNotWorkingView"
);
let viewShown = BrowserTestUtils.waitForEvent(
siteNotWorkingView,
"ViewShown"
);
siteNotWorkingButton.click();
await viewShown;
let sendReportButton = document.getElementById(
"protections-popup-siteNotWorkingView-sendReport"
);
let sendReportView = document.getElementById(
"protections-popup-sendReportView"
);
viewShown = BrowserTestUtils.waitForEvent(sendReportView, "ViewShown");
sendReportButton.click();
await viewShown;
ok(true, "Report breakage view was shown");
await openIdentityPopup();
let comments = document.getElementById(
"protections-popup-sendReportView-collection-comments"
"identity-popup-breakageReportView-collection-comments"
);
is(comments.value, "", "Comments textarea should initially be empty");
let reportBreakageButton = document.getElementById(
"identity-popup-content-blocking-report-breakage"
);
await TestUtils.waitForCondition(
() => BrowserTestUtils.is_visible(reportBreakageButton),
"report breakage button is visible"
);
let reportBreakageView = document.getElementById(
"identity-popup-breakageReportView"
);
let viewShown = BrowserTestUtils.waitForEvent(
reportBreakageView,
"ViewShown"
);
reportBreakageButton.click();
await viewShown;
let submitButton = document.getElementById(
"protections-popup-sendReportView-submit"
"identity-popup-breakageReportView-submit"
);
let reportURL = document.getElementById(
"protections-popup-sendReportView-collection-url"
"identity-popup-breakageReportView-collection-url"
).value;
is(reportURL, url, "Shows the correct URL in the report UI.");
// Make sure that sending the report closes the identity popup.
let popuphidden = BrowserTestUtils.waitForEvent(
gProtectionsHandler._protectionsPopup,
gIdentityHandler._identityPopup,
"popuphidden"
);

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

@ -24,14 +24,14 @@ const TRACKING_PAGE =
"http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
const COOKIE_PAGE =
"http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookiePage.html";
var gProtectionsHandler = null;
var ContentBlocking = null;
var TrackingProtection = null;
var ThirdPartyCookies = null;
var tabbrowser = null;
var gTrackingPageURL = TRACKING_PAGE;
registerCleanupFunction(function() {
TrackingProtection = gProtectionsHandler = ThirdPartyCookies = tabbrowser = null;
TrackingProtection = ContentBlocking = ThirdPartyCookies = tabbrowser = null;
UrlClassifierTestUtils.cleanupTestTrackers();
Services.prefs.clearUserPref(TP_PREF);
Services.prefs.clearUserPref(TP_PB_PREF);
@ -59,31 +59,27 @@ function clickButton(sel) {
function testBenignPage() {
info("Non-tracking content must not be blocked");
ok(
!gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
!ContentBlocking.content.hasAttribute("detected"),
"no trackers are detected"
);
ok(
!gProtectionsHandler._protectionsPopup.hasAttribute("hasException"),
!ContentBlocking.content.hasAttribute("hasException"),
"content shows no exception"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(
!gProtectionsHandler.iconBox.hasAttribute("hasException"),
!ContentBlocking.iconBox.hasAttribute("hasException"),
"icon box shows no exception"
);
ok(
!gProtectionsHandler.iconBox.hasAttribute("tooltiptext"),
!ContentBlocking.iconBox.hasAttribute("tooltiptext"),
"icon box has no tooltip"
);
ok(
BrowserTestUtils.is_hidden(gProtectionsHandler.iconBox),
"icon box is hidden"
);
ok(BrowserTestUtils.is_hidden(ContentBlocking.iconBox), "icon box is hidden");
ok(hidden("#tracking-action-block"), "blockButton is hidden");
ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
ok(
!hidden("#identity-popup-content-blocking-not-detected"),
@ -106,32 +102,31 @@ function testBenignPage() {
function testBenignPageWithException() {
info("Non-tracking content must not be blocked");
ok(
!gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
!ContentBlocking.content.hasAttribute("detected"),
"no trackers are detected"
);
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("hasException"),
ContentBlocking.content.hasAttribute("hasException"),
"content shows exception"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(
gProtectionsHandler.iconBox.hasAttribute("hasException"),
ContentBlocking.iconBox.hasAttribute("hasException"),
"shield shows exception"
);
is(
gProtectionsHandler.iconBox.getAttribute("tooltiptext"),
ContentBlocking.iconBox.getAttribute("tooltiptext"),
gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"),
"correct tooltip"
);
ok(
!BrowserTestUtils.is_hidden(gProtectionsHandler.iconBox),
!BrowserTestUtils.is_hidden(ContentBlocking.iconBox),
"icon box is not hidden"
);
ok(!hidden("#tracking-action-block"), "blockButton is visible");
ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
ok(
!hidden("#identity-popup-content-blocking-not-detected"),
@ -163,39 +158,57 @@ function areTrackersBlocked(isPrivateBrowsing) {
function testTrackingPage(window) {
info("Tracking content must be blocked");
ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
"trackers are detected"
);
ok(
!gProtectionsHandler._protectionsPopup.hasAttribute("hasException"),
!ContentBlocking.content.hasAttribute("hasException"),
"content shows no exception"
);
let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
let blockedByTP = areTrackersBlocked(isWindowPrivate);
is(
BrowserTestUtils.is_visible(gProtectionsHandler.iconBox),
BrowserTestUtils.is_visible(ContentBlocking.iconBox),
blockedByTP,
"icon box is" + (blockedByTP ? "" : " not") + " visible"
);
is(
gProtectionsHandler.iconBox.hasAttribute("active"),
ContentBlocking.iconBox.hasAttribute("active"),
blockedByTP,
"shield is" + (blockedByTP ? "" : " not") + " active"
);
ok(
!gProtectionsHandler.iconBox.hasAttribute("hasException"),
!ContentBlocking.iconBox.hasAttribute("hasException"),
"icon box shows no exception"
);
is(
gProtectionsHandler.iconBox.getAttribute("tooltiptext"),
ContentBlocking.iconBox.getAttribute("tooltiptext"),
blockedByTP
? gNavigatorBundle.getString("trackingProtection.icon.activeTooltip")
: "",
"correct tooltip"
);
ok(hidden("#tracking-action-block"), "blockButton is hidden");
if (isWindowPrivate) {
ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
is(
!hidden("#tracking-action-unblock-private"),
blockedByTP,
"unblockButtonPrivate is" + (blockedByTP ? "" : " not") + " visible"
);
} else {
ok(
hidden("#tracking-action-unblock-private"),
"unblockButtonPrivate is hidden"
);
is(
!hidden("#tracking-action-unblock"),
blockedByTP,
"unblockButton is" + (blockedByTP ? "" : " not") + " visible"
);
}
ok(
hidden("#identity-popup-content-blocking-not-detected"),
"blocking not detected label is hidden"
@ -224,33 +237,29 @@ function testTrackingPage(window) {
function testTrackingPageUnblocked(blockedByTP, window) {
info("Tracking content must be white-listed and not blocked");
ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("detected"),
"trackers are detected"
);
ok(
gProtectionsHandler._protectionsPopup.hasAttribute("hasException"),
ContentBlocking.content.hasAttribute("hasException"),
"content shows exception"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(
gProtectionsHandler.iconBox.hasAttribute("hasException"),
ContentBlocking.iconBox.hasAttribute("hasException"),
"shield shows exception"
);
is(
gProtectionsHandler.iconBox.getAttribute("tooltiptext"),
ContentBlocking.iconBox.getAttribute("tooltiptext"),
gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"),
"correct tooltip"
);
ok(
BrowserTestUtils.is_visible(gProtectionsHandler.iconBox),
BrowserTestUtils.is_visible(ContentBlocking.iconBox),
"icon box is visible"
);
ok(!hidden("#tracking-action-block"), "blockButton is visible");
ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
ok(
hidden("#identity-popup-content-blocking-not-detected"),
@ -306,7 +315,7 @@ async function testContentBlocking(tab) {
info("Disable CB for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab);
tab.ownerGlobal.gProtectionsHandler.disableForCurrentPage();
clickButton("#tracking-action-unblock");
await tabReloadPromise;
let isPrivateBrowsing = PrivateBrowsingUtils.isWindowPrivate(tab.ownerGlobal);
let blockedByTP = areTrackersBlocked(isPrivateBrowsing);
@ -314,7 +323,7 @@ async function testContentBlocking(tab) {
info("Re-enable TP for the page (which reloads the page)");
tabReloadPromise = promiseTabLoadEvent(tab);
tab.ownerGlobal.gProtectionsHandler.enableForCurrentPage();
clickButton("#tracking-action-block");
await tabReloadPromise;
testTrackingPage(tab.ownerGlobal);
}
@ -327,11 +336,8 @@ add_task(async function testNormalBrowsing() {
tabbrowser = gBrowser;
let tab = (tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser));
gProtectionsHandler = gBrowser.ownerGlobal.gProtectionsHandler;
ok(
gProtectionsHandler,
"gProtectionsHandler is attached to the browser window"
);
ContentBlocking = gBrowser.ownerGlobal.ContentBlocking;
ok(ContentBlocking, "CB is attached to the browser window");
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
ok(TrackingProtection, "TP is attached to the browser window");
is(
@ -366,11 +372,8 @@ add_task(async function testPrivateBrowsing() {
Services.prefs.setIntPref(TPC_PREF, Ci.nsICookieService.BEHAVIOR_ACCEPT);
gProtectionsHandler = tabbrowser.ownerGlobal.gProtectionsHandler;
ok(
gProtectionsHandler,
"gProtectionsHandler is attached to the private window"
);
ContentBlocking = tabbrowser.ownerGlobal.ContentBlocking;
ok(ContentBlocking, "CB is attached to the private window");
TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
ok(TrackingProtection, "TP is attached to the private window");
is(
@ -398,11 +401,8 @@ add_task(async function testThirdPartyCookies() {
tabbrowser = gBrowser;
let tab = (tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser));
gProtectionsHandler = gBrowser.ownerGlobal.gProtectionsHandler;
ok(
gProtectionsHandler,
"gProtectionsHandler is attached to the browser window"
);
ContentBlocking = gBrowser.ownerGlobal.ContentBlocking;
ok(ContentBlocking, "CB is attached to the browser window");
ThirdPartyCookies = gBrowser.ownerGlobal.ThirdPartyCookies;
ok(ThirdPartyCookies, "TP is attached to the browser window");
is(

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

@ -23,10 +23,7 @@ add_task(async function testResetOnLocationChange() {
0,
"Benign page has no content blocking event"
);
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
await Promise.all([
promiseTabLoadEvent(tab, TRACKING_PAGE),
@ -38,7 +35,7 @@ add_task(async function testResetOnLocationChange() {
Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT,
"Tracking page has a content blocking event"
);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "shield is active");
ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
await promiseTabLoadEvent(tab, BENIGN_PAGE);
@ -47,10 +44,7 @@ add_task(async function testResetOnLocationChange() {
0,
"Benign page has no content blocking event"
);
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
let contentBlockingEvent = waitForContentBlockingEvent(3);
let trackingTab = await BrowserTestUtils.openNewForegroundTab(
@ -64,7 +58,7 @@ add_task(async function testResetOnLocationChange() {
Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT,
"Tracking page has a content blocking event"
);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "shield is active");
ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
gBrowser.selectedTab = tab;
is(
@ -72,10 +66,7 @@ add_task(async function testResetOnLocationChange() {
0,
"Benign page has no content blocking event"
);
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
gBrowser.removeTab(trackingTab);
gBrowser.removeTab(tab);
@ -89,22 +80,16 @@ add_task(async function testResetOnTabChange() {
Services.prefs.setBoolPref(TP_PREF, true);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, ABOUT_PAGE);
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
await Promise.all([
promiseTabLoadEvent(tab, TRACKING_PAGE),
waitForContentBlockingEvent(3),
]);
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "shield is active");
ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
await promiseTabLoadEvent(tab, ABOUT_PAGE);
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
let contentBlockingEvent = waitForContentBlockingEvent(3);
let trackingTab = await BrowserTestUtils.openNewForegroundTab(
@ -112,13 +97,10 @@ add_task(async function testResetOnTabChange() {
TRACKING_PAGE
);
await contentBlockingEvent;
ok(gProtectionsHandler.iconBox.hasAttribute("active"), "shield is active");
ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
gBrowser.selectedTab = tab;
ok(
!gProtectionsHandler.iconBox.hasAttribute("active"),
"shield is not active"
);
ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
gBrowser.removeTab(trackingTab);
gBrowser.removeTab(tab);

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

@ -59,7 +59,7 @@ add_task(async function testShieldHistogram() {
info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab);
gProtectionsHandler.disableForCurrentPage();
document.querySelector("#tracking-action-unblock").doCommand();
await tabReloadPromise;
is(getShieldCounts()[0], 3, "Adds one more page load");
is(
@ -70,7 +70,7 @@ add_task(async function testShieldHistogram() {
info("Re-enable TP for the page (which reloads the page)");
tabReloadPromise = promiseTabLoadEvent(tab);
gProtectionsHandler.enableForCurrentPage();
document.querySelector("#tracking-action-block").doCommand();
await tabReloadPromise;
is(getShieldCounts()[0], 4, "Adds one more page load");
is(
@ -84,3 +84,78 @@ add_task(async function testShieldHistogram() {
// Reset these to make counting easier for the next test
getShieldHistogram().clear();
});
add_task(async function testIdentityPopupEvents() {
Services.prefs.setBoolPref(PREF, true);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
await promiseTabLoadEvent(tab, BENIGN_PAGE);
Services.telemetry.clearEvents();
await openIdentityPopup();
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
let openEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "open" &&
e[3] == "identity_popup"
);
is(openEvents.length, 1, "recorded telemetry for opening the identity popup");
is(openEvents[0][4], "shield-hidden", "recorded the shield as hidden");
await promiseTabLoadEvent(tab, TRACKING_PAGE);
await openIdentityPopup();
events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
openEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "open" &&
e[3] == "identity_popup"
);
is(openEvents.length, 1, "recorded telemetry for opening the identity popup");
is(openEvents[0][4], "shield-showing", "recorded the shield as showing");
info("Disable TP for the page (which reloads the page)");
let tabReloadPromise = promiseTabLoadEvent(tab);
document.querySelector("#tracking-action-unblock").doCommand();
await tabReloadPromise;
events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
let clickEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "click" &&
e[3] == "unblock"
);
is(clickEvents.length, 1, "recorded telemetry for the click");
info("Re-enable TP for the page (which reloads the page)");
tabReloadPromise = promiseTabLoadEvent(tab);
document.querySelector("#tracking-action-block").doCommand();
await tabReloadPromise;
events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
clickEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" && e[2] == "click" && e[3] == "block"
);
is(clickEvents.length, 1, "recorded telemetry for the click");
gBrowser.removeCurrentTab();
});

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

@ -10,16 +10,22 @@ const TRACKING_PAGE =
const TP_PREF = "privacy.trackingprotection.enabled";
add_task(async function setup() {
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
await UrlClassifierTestUtils.addTestTrackers();
registerCleanupFunction(() => {
Services.telemetry.canRecordExtended = oldCanRecord;
UrlClassifierTestUtils.cleanupTestTrackers();
});
});
async function assertSitesListed(blocked) {
await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function(browser) {
await openProtectionsPopup();
await openIdentityPopup();
Services.telemetry.clearEvents();
let categoryItem = document.getElementById(
"identity-popup-content-blocking-category-tracking-protection"
@ -35,6 +41,17 @@ async function assertSitesListed(blocked) {
ok(true, "Trackers view was shown");
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS
).parent;
let buttonEvents = events.filter(
e =>
e[1] == "security.ui.identitypopup" &&
e[2] == "click" &&
e[3] == "trackers_subview_btn"
);
is(buttonEvents.length, 1, "recorded telemetry for the button click");
let listItems = trackersView.querySelectorAll(
".identity-popup-content-blocking-list-item"
);
@ -49,7 +66,7 @@ async function assertSitesListed(blocked) {
"Strict info is hidden if TP is enabled."
);
let mainView = document.getElementById("protections-popup-mainView");
let mainView = document.getElementById("identity-popup-mainView");
viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
let backButton = trackersView.querySelector(".subviewbutton-back");
backButton.click();

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

@ -2,12 +2,6 @@ var { UrlClassifierTestUtils } = ChromeUtils.import(
"resource://testing-common/UrlClassifierTestUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"ContentBlockingAllowList",
"resource://gre/modules/ContentBlockingAllowList.jsm"
);
/**
* Waits for a load (or custom) event to finish in a given tab. If provided
* load an uri into the tab.
@ -49,14 +43,6 @@ function openIdentityPopup() {
return viewShown;
}
function openProtectionsPopup() {
let mainView = document.getElementById("protections-popup-mainView");
let viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
// TODO: This should click on the icon once we have it.
gProtectionsHandler.showProtectionsPopup();
return viewShown;
}
function waitForSecurityChange(numChanges = 1, win = null) {
if (!win) {
win = window;

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

@ -37,6 +37,7 @@ browser.jar:
content/browser/browser-ctrlTab.js (content/browser-ctrlTab.js)
content/browser/browser-customization.js (content/browser-customization.js)
content/browser/browser-data-submission-info-bar.js (content/browser-data-submission-info-bar.js)
content/browser/browser-contentblocking.js (content/browser-contentblocking.js)
#ifndef MOZILLA_OFFICIAL
content/browser/browser-development-helpers.js (content/browser-development-helpers.js)
#endif

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

@ -56,6 +56,80 @@
oncommand="gIdentityHandler.showSecuritySubView(); gIdentityHandler.recordClick('security_subview_btn');"/>
</hbox>
<!-- Tracking Protection Section -->
<hbox id="tracking-protection-container"
class="identity-popup-section"
when-connection="not-secure secure secure-ev secure-cert-user-overridden extension">
<vbox id="identity-popup-content-blocking-content" flex="1">
<hbox align="start">
<label id="content-blocking-label"
class="identity-popup-headline"
flex="1">&contentBlocking.title;</label>
<toolbarbutton id="tracking-protection-preferences-button"
class="identity-popup-preferences-button subviewbutton"
tooltiptext="&identity.contentBlockingPreferences.tooltip;"
oncommand="ContentBlocking.openPreferences('identityPopup-TP-preferencesButton'); gIdentityHandler.recordClick('cb_prefs_button');" />
</hbox>
<description id="identity-popup-content-blocking-detected"
crop="end">&contentBlocking.detected;</description>
<description id="identity-popup-content-blocking-not-detected"
crop="end">&contentBlocking.notDetected;</description>
<vbox id="identity-popup-content-blocking-category-list">
<toolbarbutton id="identity-popup-content-blocking-category-tracking-protection"
onclick="ContentBlocking.showTrackersSubview(); gIdentityHandler.recordClick('trackers_subview_btn');"
class="identity-popup-content-blocking-category" align="center">
<image class="identity-popup-content-blocking-category-icon tracking-protection-icon"/>
<label flex="1" class="identity-popup-content-blocking-category-label">&contentBlocking.trackingProtection3.label;</label>
<label flex="1" id="identity-popup-content-blocking-tracking-protection-state-label" class="identity-popup-content-blocking-category-state-label"/>
</toolbarbutton>
<toolbarbutton id="identity-popup-content-blocking-category-cookies"
onclick="ContentBlocking.showCookiesSubview(); gIdentityHandler.recordClick('cookies_subview_btn');"
class="identity-popup-content-blocking-category" align="center">
<image class="identity-popup-content-blocking-category-icon thirdpartycookies-icon"/>
<label flex="1" id="identity-popup-content-blocking-category-label-default"
class="identity-popup-content-blocking-category-label">&contentBlocking.cookies.label;</label>
<label flex="1" id="identity-popup-content-blocking-cookies-state-label" class="identity-popup-content-blocking-category-state-label"/>
</toolbarbutton>
<toolbarbutton id="identity-popup-content-blocking-category-cryptominers"
onclick="ContentBlocking.showCryptominersSubview();"
class="identity-popup-content-blocking-category" align="center">
<image class="identity-popup-content-blocking-category-icon cryptominers-icon"/>
<label flex="1" class="identity-popup-content-blocking-category-label">&contentBlocking.cryptominers.label;</label>
<label flex="1" id="identity-popup-content-blocking-cryptominers-state-label" class="identity-popup-content-blocking-category-state-label"/>
</toolbarbutton>
<toolbarbutton id="identity-popup-content-blocking-category-fingerprinters"
onclick="ContentBlocking.showFingerprintersSubview();"
class="identity-popup-content-blocking-category" align="center">
<image class="identity-popup-content-blocking-category-icon fingerprinters-icon"/>
<label flex="1" class="identity-popup-content-blocking-category-label">&contentBlocking.fingerprinters.label;</label>
<label flex="1" id="identity-popup-content-blocking-fingerprinters-state-label" class="identity-popup-content-blocking-category-state-label"/>
</toolbarbutton>
</vbox>
<button id="tracking-action-unblock"
class="panel-button tracking-protection-button"
label="&trackingProtection.unblock5.label;"
accesskey="&trackingProtection.unblock5.accesskey;"
oncommand="ContentBlocking.disableForCurrentPage(); gIdentityHandler.recordClick('unblock');" />
<button id="tracking-action-unblock-private"
class="panel-button tracking-protection-button"
label="&trackingProtection.unblockPrivate5.label;"
accesskey="&trackingProtection.unblockPrivate5.accesskey;"
oncommand="ContentBlocking.disableForCurrentPage(); gIdentityHandler.recordClick('unblock_private');" />
<button id="tracking-action-block"
class="panel-button tracking-protection-button"
label="&trackingProtection.block6.label;"
accesskey="&trackingProtection.block6.accesskey;"
oncommand="ContentBlocking.enableForCurrentPage(); gIdentityHandler.recordClick('block');" />
<label id="identity-popup-content-blocking-report-breakage"
onclick="ContentBlocking.showReportBreakageSubview(); gIdentityHandler.recordClick('report_breakage');"
class="text-link subviewkeynav"
flex="1">&contentBlocking.openBreakageReportView2.label;</label>
</vbox>
</hbox>
<!-- Permissions Section -->
<hbox class="identity-popup-section"
when-connection="not-secure secure secure-ev secure-cert-user-overridden file extension">
@ -180,5 +254,100 @@
</vbox>
</panelview>
<!-- Trackers SubView -->
<panelview id="identity-popup-trackersView"
role="document"
title="&contentBlocking.trackersView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-trackersView-list" class="identity-popup-content-blocking-list">
</vbox>
<hbox id="identity-popup-trackersView-strict-info">
<image/>
<label>&contentBlocking.trackersView.strictInfo.label;</label>
</hbox>
<vbox class="panel-footer">
<button id="identity-popup-trackersView-settings-button"
label="&contentBlocking.manageSettings.label;"
accesskey="&contentBlocking.manageSettings.accesskey;"
oncommand="ContentBlocking.openPreferences(); gIdentityHandler.recordClick('trackers_prefs_btn');"/>
</vbox>
</panelview>
<!-- Cookies SubView -->
<panelview id="identity-popup-cookiesView"
role="document"
title="&contentBlocking.cookiesView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-cookiesView-list" class="identity-popup-content-blocking-list">
</vbox>
<vbox class="panel-footer">
<button id="identity-popup-cookiesView-settings-button"
label="&contentBlocking.manageSettings.label;"
accesskey="&contentBlocking.manageSettings.accesskey;"
oncommand="ContentBlocking.openPreferences(); gIdentityHandler.recordClick('cookies_prefs_btn');"/>
</vbox>
</panelview>
<!-- Fingerprinters SubView -->
<panelview id="identity-popup-fingerprintersView"
role="document"
title="&contentBlocking.fingerprintersView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-fingerprintersView-list" class="identity-popup-content-blocking-list">
</vbox>
<vbox class="panel-footer">
<button id="identity-popup-fingerprintersView-settings-button"
label="&contentBlocking.manageSettings.label;"
accesskey="&contentBlocking.manageSettings.accesskey;"
oncommand="ContentBlocking.openPreferences();"/>
</vbox>
</panelview>
<!-- Cryptominers SubView -->
<panelview id="identity-popup-cryptominersView"
role="document"
title="&contentBlocking.cryptominersView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-cryptominersView-list" class="identity-popup-content-blocking-list">
</vbox>
<vbox class="panel-footer">
<button id="identity-popup-cryptominersView-settings-button"
label="&contentBlocking.manageSettings.label;"
accesskey="&contentBlocking.manageSettings.accesskey;"
oncommand="ContentBlocking.openPreferences();"/>
</vbox>
</panelview>
<!-- Report Breakage SubView -->
<panelview id="identity-popup-breakageReportView"
title="&contentBlocking.breakageReportView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-breakageReportView-heading">
<description>&contentBlocking.breakageReportView2.description;</description>
<label id="identity-popup-breakageReportView-learn-more"
is="text-link">&contentBlocking.breakageReportView.learnMore;</label>
</vbox>
<vbox id="identity-popup-breakageReportView-body" class="panel-view-body-unscrollable">
<vbox class="identity-popup-breakageReportView-collection-section">
<label>&contentBlocking.breakageReportView.collection.url.label;</label>
<html:input readonly="readonly" id="identity-popup-breakageReportView-collection-url"/>
</vbox>
<vbox class="identity-popup-breakageReportView-collection-section">
<label>&contentBlocking.breakageReportView.collection.comments.label;</label>
<html:textarea id="identity-popup-breakageReportView-collection-comments"/>
</vbox>
</vbox>
<vbox id="identity-popup-breakageReportView-footer"
class="panel-footer">
<button id="identity-popup-breakageReportView-cancel"
label="&contentBlocking.breakageReportView.cancel.label;"
oncommand="ContentBlocking.backToMainView();"/>
<button id="identity-popup-breakageReportView-submit"
default="true"
label="&contentBlocking.breakageReportView.sendReport.label;"
oncommand="ContentBlocking.onSubmitBreakageReportClicked();"/>
</vbox>
</panelview>
</panelmultiview>
</panel>

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

@ -43,63 +43,10 @@
</vbox>
</hbox>
<!-- Tracking Protection Section -->
<hbox id="tracking-protection-container" class="identity-popup-section">
<vbox id="identity-popup-content-blocking-content" flex="1">
<hbox align="start">
<label id="content-blocking-label"
class="identity-popup-headline"
flex="1">&contentBlocking.title;</label>
<toolbarbutton id="tracking-protection-preferences-button"
class="identity-popup-preferences-button subviewbutton"
tooltiptext="&identity.contentBlockingPreferences.tooltip;"
oncommand="gProtectionsHandler.openPreferences('identityPopup-TP-preferencesButton');" />
</hbox>
<description id="identity-popup-content-blocking-detected"
crop="end">&contentBlocking.detected;</description>
<description id="identity-popup-content-blocking-not-detected"
crop="end">&contentBlocking.notDetected;</description>
<vbox id="identity-popup-content-blocking-category-list">
<toolbarbutton id="identity-popup-content-blocking-category-tracking-protection"
onclick="gProtectionsHandler.showTrackersSubview();"
class="identity-popup-content-blocking-category" align="center">
<image class="identity-popup-content-blocking-category-icon tracking-protection-icon"/>
<label flex="1" class="identity-popup-content-blocking-category-label">&contentBlocking.trackingProtection3.label;</label>
<label flex="1" id="identity-popup-content-blocking-tracking-protection-state-label" class="identity-popup-content-blocking-category-state-label"/>
</toolbarbutton>
<toolbarbutton id="identity-popup-content-blocking-category-cookies"
onclick="gProtectionsHandler.showCookiesSubview();"
class="identity-popup-content-blocking-category" align="center">
<image class="identity-popup-content-blocking-category-icon thirdpartycookies-icon"/>
<label flex="1" id="identity-popup-content-blocking-category-label-default"
class="identity-popup-content-blocking-category-label">&contentBlocking.cookies.label;</label>
<label flex="1" id="identity-popup-content-blocking-cookies-state-label" class="identity-popup-content-blocking-category-state-label"/>
</toolbarbutton>
<toolbarbutton id="identity-popup-content-blocking-category-cryptominers"
onclick="gProtectionsHandler.showCryptominersSubview();"
class="identity-popup-content-blocking-category" align="center">
<image class="identity-popup-content-blocking-category-icon cryptominers-icon"/>
<label flex="1" class="identity-popup-content-blocking-category-label">&contentBlocking.cryptominers.label;</label>
<label flex="1" id="identity-popup-content-blocking-cryptominers-state-label" class="identity-popup-content-blocking-category-state-label"/>
</toolbarbutton>
<toolbarbutton id="identity-popup-content-blocking-category-fingerprinters"
onclick="gProtectionsHandler.showFingerprintersSubview();"
class="identity-popup-content-blocking-category" align="center">
<image class="identity-popup-content-blocking-category-icon fingerprinters-icon"/>
<label flex="1" class="identity-popup-content-blocking-category-label">&contentBlocking.fingerprinters.label;</label>
<label flex="1" id="identity-popup-content-blocking-fingerprinters-state-label" class="identity-popup-content-blocking-category-state-label"/>
</toolbarbutton>
</vbox>
</vbox>
</hbox>
<vbox id="protections-popup-settings-section"
class="identity-popup-section">
<toolbarbutton id="protections-popup-settings-button"
oncommand="gProtectionsHandler.openPreferences();">
oncommand="ContentBlocking.openPreferences();">
<image class="protection-settings-icon"/>
<label class="protections-popup-settings-label" flex="1">Protection Settings</label>
</toolbarbutton>
@ -155,69 +102,6 @@
</hbox>
</panelview>
<!-- Trackers SubView -->
<panelview id="identity-popup-trackersView"
role="document"
title="&contentBlocking.trackersView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-trackersView-list" class="identity-popup-content-blocking-list">
</vbox>
<hbox id="identity-popup-trackersView-strict-info">
<image/>
<label>&contentBlocking.trackersView.strictInfo.label;</label>
</hbox>
<vbox class="panel-footer">
<button id="identity-popup-trackersView-settings-button"
label="&contentBlocking.manageSettings.label;"
accesskey="&contentBlocking.manageSettings.accesskey;"
oncommand="gProtectionsHandler.openPreferences();"/>
</vbox>
</panelview>
<!-- Cookies SubView -->
<panelview id="identity-popup-cookiesView"
role="document"
title="&contentBlocking.cookiesView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-cookiesView-list" class="identity-popup-content-blocking-list">
</vbox>
<vbox class="panel-footer">
<button id="identity-popup-cookiesView-settings-button"
label="&contentBlocking.manageSettings.label;"
accesskey="&contentBlocking.manageSettings.accesskey;"
oncommand="gProtectionsHandler.openPreferences();"/>
</vbox>
</panelview>
<!-- Fingerprinters SubView -->
<panelview id="identity-popup-fingerprintersView"
role="document"
title="&contentBlocking.fingerprintersView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-fingerprintersView-list" class="identity-popup-content-blocking-list">
</vbox>
<vbox class="panel-footer">
<button id="identity-popup-fingerprintersView-settings-button"
label="&contentBlocking.manageSettings.label;"
accesskey="&contentBlocking.manageSettings.accesskey;"
oncommand="gProtectionsHandler.openPreferences();"/>
</vbox>
</panelview>
<!-- Cryptominers SubView -->
<panelview id="identity-popup-cryptominersView"
role="document"
title="&contentBlocking.cryptominersView.label;"
descriptionheightworkaround="true">
<vbox id="identity-popup-cryptominersView-list" class="identity-popup-content-blocking-list">
</vbox>
<vbox class="panel-footer">
<button id="identity-popup-cryptominersView-settings-button"
label="&contentBlocking.manageSettings.label;"
accesskey="&contentBlocking.manageSettings.accesskey;"
oncommand="gProtectionsHandler.openPreferences();"/>
</vbox>
</panelview>
<!-- Send Report SubView -->
<panelview id="protections-popup-sendReportView"

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

@ -257,7 +257,7 @@
<toolbaritem>
<toolbarbutton id="appMenu-tp-button"
class="subviewbutton subviewbutton-iconic"
oncommand="gProtectionsHandler.openPreferences('appMenu-trackingprotection');">
oncommand="ContentBlocking.openPreferences('appMenu-trackingprotection');">
<image id="appMenu-tp-icon" class="toolbarbutton-icon"/>
<label id="appMenu-tp-label" class="toolbarbutton-text"/>
<label id="appMenu-tp-category"/>

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

@ -589,8 +589,8 @@ description#identity-popup-content-verifier,
}
/* Show the "detected"/"not detected" message depending on the content state. */
#protections-popup:not([detected]) #identity-popup-content-blocking-detected,
#protections-popup[detected] #identity-popup-content-blocking-not-detected {
#identity-popup-content-blocking-content:not([detected]) > #identity-popup-content-blocking-detected,
#identity-popup-content-blocking-content[detected] > #identity-popup-content-blocking-not-detected {
display: none;
}
@ -637,6 +637,28 @@ description#identity-popup-content-verifier,
box-shadow: var(--focus-ring-box-shadow);
}
#tracking-action-block {
background-color: #0060df;
color: #fff !important;
}
#tracking-action-block:hover {
background-color: #003eaa;
}
#tracking-action-block:hover:active {
background-color: #002275;
}
#tracking-action-block .button-icon {
fill-opacity: 1;
}
#tracking-action-unblock,
#tracking-action-unblock-private {
list-style-image: url(chrome://browser/skin/tracking-protection-disabled.svg);
}
#identity-popup-content-blocking-report-breakage {
margin-top: 6px;
}
@ -644,10 +666,20 @@ description#identity-popup-content-verifier,
/* Hide the "report breakage" button if we have not detected any trackers
* (except if the user added an exception, in which case they might still
* (especially!) want to report the breakage). */
#protections-popup:not([blocking]):not([hasException]) #protections-popup-tp-switch-breakage-link {
#identity-popup-content-blocking-content:not([blocking]):not([hasException]) #identity-popup-content-blocking-report-breakage {
display: none;
}
/* Show the right action buttons depending on content state */
/* Offer to temporarily add an exception in private mode. */
:root:not([privatebrowsingmode]) #identity-popup-content-blocking-content[blocking]:not([hasException]) > #tracking-action-unblock,
/* Offer to permanently add an exception in normal mode. */
:root[privatebrowsingmode] #identity-popup-content-blocking-content[blocking]:not([hasException]) > #tracking-action-unblock-private,
/* If there's an exception just offer to remove the exception again. */
#identity-popup-content-blocking-content[hasException] > #tracking-action-block {
display: -moz-box;
}
/* PERMISSIONS */
#identity-popup-permissions-content {
@ -740,7 +772,7 @@ description#identity-popup-content-verifier,
text-align: end;
}
#protections-popup[hasException] .identity-popup-content-blocking-category-state-label {
#identity-popup-content-blocking-content[hasException] .identity-popup-content-blocking-category-state-label {
visibility: hidden;
}

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

@ -385,7 +385,7 @@ this.AntiTracking = {
if (options.allowList) {
info("Disabling content blocking for this page");
win.gProtectionsHandler.disableForCurrentPage();
win.ContentBlocking.disableForCurrentPage();
// The previous function reloads the browser, so wait for it to load again!
await BrowserTestUtils.browserLoaded(browser);
@ -558,7 +558,7 @@ this.AntiTracking = {
if (options.allowList) {
info("Enabling content blocking for this page");
win.gProtectionsHandler.enableForCurrentPage();
win.ContentBlocking.enableForCurrentPage();
// The previous function reloads the browser, so wait for it to load again!
await BrowserTestUtils.browserLoaded(browser);

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

@ -25,7 +25,7 @@ add_task(async function() {
let browser = gBrowser.getBrowserForTab(tab);
await BrowserTestUtils.browserLoaded(browser);
gProtectionsHandler.disableForCurrentPage();
ContentBlocking.disableForCurrentPage();
// The previous function reloads the browser, so wait for it to load again!
await BrowserTestUtils.browserLoaded(browser);
@ -112,7 +112,7 @@ add_task(async function() {
expectTrackerFound(originLog[0]);
}
gProtectionsHandler.enableForCurrentPage();
ContentBlocking.enableForCurrentPage();
// The previous function reloads the browser, so wait for it to load again!
await BrowserTestUtils.browserLoaded(browser);

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

@ -22,7 +22,7 @@ add_task(async function() {
await BrowserTestUtils.browserLoaded(browser);
info("Disabling content blocking for this page");
gProtectionsHandler.disableForCurrentPage();
ContentBlocking.disableForCurrentPage();
await BrowserTestUtils.browserLoaded(browser);

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

@ -20,7 +20,7 @@ add_task(async function() {
await BrowserTestUtils.browserLoaded(browser);
info("Disabling content blocking for this page");
gProtectionsHandler.disableForCurrentPage();
ContentBlocking.disableForCurrentPage();
// The previous function reloads the browser, so wait for it to load again!
await BrowserTestUtils.browserLoaded(browser);
@ -57,7 +57,7 @@ add_task(async function() {
});
info("Enabling content blocking for this page");
gProtectionsHandler.enableForCurrentPage();
ContentBlocking.enableForCurrentPage();
// The previous function reloads the browser, so wait for it to load again!
await BrowserTestUtils.browserLoaded(browser);

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

@ -1122,9 +1122,11 @@ security.ui.identitypopup:
- 1522256
- 1522919
- 1553181
- 1562575
description: >
How many times the control center was opened.
Keyed by the state of the content blocking shield, where the shield-showing key indicates
that the shield icon in the identity UI is visible to the user, and shield-hidden indicates
that it is not visible.
expiry_version: "72"
notification_emails:
- jhofmann@mozilla.com
@ -1133,18 +1135,31 @@ security.ui.identitypopup:
release_channel_collection: opt-in
record_in_processes:
- main
extra_keys:
fp: Whether Fingerprinter blocking was active while the user opened the popup
cm: Whether Cryptominer blocking was active while the user opened the popup
tp: Whether Tracking Protection was active while the user opened the popup
cr: Whether Cookie Restrictions was active while the user opened the popup
products:
- firefox
click:
objects: [
"cb_prefs_button",
"permission_prefs_btn",
"clear_sitedata",
"unblock",
"unblock_private",
"block",
"report_breakage",
"security_subview_btn",
"trackers_subview_btn",
"cookies_subview_btn",
"trackers_prefs_btn",
"cookies_prefs_btn"
]
bug_numbers:
- 1484251
- 1553181
- 1562575
description: >
User interaction by click events in the identity popup.
expiry_version: "72"
@ -1155,6 +1170,11 @@ security.ui.identitypopup:
release_channel_collection: opt-in
record_in_processes:
- main
extra_keys:
fp: Whether Fingerprinter blocking was active while the user interacted with the UI
cm: Whether Cryptominer blocking was active while the user interacted with the UI
tp: Whether Tracking Protection was active while the user interacted with the UI
cr: Whether Cookie Restrictions was active while the user interacted with the UI
products:
- firefox
uptake.remotecontent.result: