Bug 1567180 - Update etp header section on protection report r=fluent-reviewers,mtigley,flod

Differential Revision: https://phabricator.services.mozilla.com/D38524

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Erica Wright 2019-07-22 13:17:13 +00:00
parent 4816f6c338
commit 3bfc779a88
8 changed files with 77 additions and 4 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 64 64"><linearGradient id="a" x1="11.95" x2="52.05" y1="6.9" y2="47.01" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b833e1"/><stop offset=".37" stop-color="#9059ff"/><stop offset=".61" stop-color="#5b6df8"/><stop offset="1" stop-color="#0090ed"/></linearGradient><linearGradient id="b" x1="18.54" x2="39.34" y1="19.64" y2="40.45" xlink:href="#a"/><path fill="url(#a)" d="M56 13.57a6.52 6.52 0 0 0-5.43-6.45L32 4 13.43 7.12A6.52 6.52 0 0 0 8 13.57c0 4.25 0 11.89.33 15.33.91 9.88 2.76 15.29 7.32 21.45a24.94 24.94 0 0 0 16 9.63L32 60h.33a24.94 24.94 0 0 0 16-9.63c4.56-6.16 6.41-11.57 7.32-21.45.35-3.47.35-11.11.35-15.35zm-6.31 14.78c-.81 8.85-2.25 13.15-6.16 18.42A19.25 19.25 0 0 1 32 54a19.17 19.17 0 0 1-11.53-7.19c-3.91-5.27-5.35-9.58-6.16-18.42C14.09 26 14 20.64 14 13.58a.55.55 0 0 1 .43-.55L32 10l17.57 3a.55.55 0 0 1 .43.55c0 7.08-.09 12.45-.31 14.8z"/><path fill="url(#b)" d="M20.28 27.8c.78 8.5 2.12 11.5 5 15.4A13 13 0 0 0 32 47.79V16.13l-12 2c0 4.6.13 8.06.28 9.67z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -22,6 +22,7 @@ browser.jar:
content/browser/logos/lockwise.svg (content/logos/lockwise.svg)
content/browser/logos/lockwise-mobile-app.svg (content/logos/lockwise-mobile-app.svg)
content/browser/logos/monitor.svg (content/logos/monitor.svg)
content/browser/logos/tracking-protection.svg (content/logos/tracking-protection.svg)
content/browser/aboutNetError.xhtml (content/aboutNetError.xhtml)
content/browser/aboutNetError.js (content/aboutNetError.js)
content/browser/aboutRobots-icon.png (content/aboutRobots-icon.png)

View File

@ -72,6 +72,7 @@ var AboutProtectionsHandler = {
LockwiseCard: "browser.contentblocking.report.lockwise.enabled",
MonitorCard: "browser.contentblocking.report.monitor.enabled",
},
PREF_CB_CATEGORY: "browser.contentblocking.category",
init() {
this.receiveMessage = this.receiveMessage.bind(this);
@ -252,6 +253,9 @@ var AboutProtectionsHandler = {
win.openTrustedLinkIn("about:preferences#sync", "tab");
break;
case "FetchContentBlockingEvents":
let category = Services.prefs.getStringPref(this.PREF_CB_CATEGORY);
this.sendMessage(aMessage.target, "SendCBCategory", category);
let sumEvents = await TrackingDBService.sumAllEvents();
let earliestDate = await TrackingDBService.getEarliestRecordedDate();
let eventsByDate = await TrackingDBService.getEventsByDateRange(

View File

@ -125,7 +125,7 @@ a.hidden,
}
.etp-card .icon {
background: url("chrome://browser/skin/controlcenter/tracking-protection.svg") no-repeat center/cover;
background: url("chrome://browser/content/logos/tracking-protection.svg") no-repeat center/cover;
}
.lockwise-card .icon {

View File

@ -23,3 +23,10 @@ graph-total-summary =
[one] { $count } tracker blocked since { DATETIME($earliestDate, day: "numeric", month: "long", year: "numeric") }
*[other] { $count } trackers blocked since { DATETIME($earliestDate, day: "numeric", month: "long", year: "numeric") }
}
# The terminology used to refer to categories of Content Blocking is also used in chrome/browser/browser.properties and should be translated consistently.
# The category name in the <b> tag will be bold.
# "Standard" in this case is an adjective, meaning "default" or "normal".
protection-header-details-standard = Protection Level is set to <b>Standard</b>
protection-header-details-strict = Protection Level is set to <b>Strict</b>
protection-header-details-custom = Protection Level is set to <b>Custom</b>

View File

@ -31,9 +31,7 @@
<p class="content">
Trackers follow you around online to collect information about your browsing habits and interests. Firefox blocks many of these trackers and other malicious scripts.
</p>
<p id="protection-details">
Protection Level is set to <span>Standard</span>
</p>
<p id="protection-details"></p>
</div>
</div>
<div class="card-body">

View File

@ -32,6 +32,25 @@ document.addEventListener("DOMContentLoaded", e => {
// Get the display prefs for each component
RPMSendAsyncMessage("GetEnabledPrefs");
RPMAddMessageListener("SendCBCategory", message => {
if (message.data == "custom") {
protectionDetails.setAttribute(
"data-l10n-id",
"protection-header-details-custom"
);
} else if (message.data == "strict") {
protectionDetails.setAttribute(
"data-l10n-id",
"protection-header-details-strict"
);
} else {
protectionDetails.setAttribute(
"data-l10n-id",
"protection-header-details-standard"
);
}
});
let createGraph = data => {
let dateInMS = data.earliestDate
? new Date(data.earliestDate).getTime()

View File

@ -253,3 +253,46 @@ add_task(async function test_graph_display() {
await db.close();
BrowserTestUtils.removeTab(tab);
});
// Ensure that the string in the ETP card header is changing when we change
// the category pref.
add_task(async function test_etp_header_string() {
Services.prefs.setStringPref("browser.contentblocking.category", "standard");
let tab = await BrowserTestUtils.openNewForegroundTab({
url: "about:protections",
gBrowser,
});
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
await ContentTaskUtils.waitForCondition(() => {
let l10nID = content.document
.querySelector("#protection-details")
.getAttribute("data-l10n-id");
return l10nID == "protection-header-details-standard";
}, "The standard string is showing");
});
Services.prefs.setStringPref("browser.contentblocking.category", "strict");
await reloadTab(tab);
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
await ContentTaskUtils.waitForCondition(() => {
let l10nID = content.document
.querySelector("#protection-details")
.getAttribute("data-l10n-id");
return l10nID == "protection-header-details-strict";
}, "The strict string is showing");
});
Services.prefs.setStringPref("browser.contentblocking.category", "custom");
await reloadTab(tab);
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
await ContentTaskUtils.waitForCondition(() => {
let l10nID = content.document
.querySelector("#protection-details")
.getAttribute("data-l10n-id");
return l10nID == "protection-header-details-custom";
}, "The strict string is showing");
});
Services.prefs.setStringPref("browser.contentblocking.category", "standard");
BrowserTestUtils.removeTab(tab);
});