Backed out 5 changesets (bug 1555231) for bc leaks at browser_354894_perwindowpb.js. CLOSED TREE

Backed out changeset 016f5882a4cb (bug 1555231)
Backed out changeset 7110eb5e7ab1 (bug 1555231)
Backed out changeset 2569f3cff021 (bug 1555231)
Backed out changeset 0bc58dafb302 (bug 1555231)
Backed out changeset 35fe7ce18534 (bug 1555231)
This commit is contained in:
Brindusan Cristian 2019-07-31 13:12:37 +03:00
parent 7e24c23303
commit 5d4ee5c9f2
7 changed files with 69 additions and 200 deletions

View File

@ -10,13 +10,6 @@ ChromeUtils.defineModuleGetter(
"resource://gre/modules/ContentBlockingAllowList.jsm"
);
XPCOMUtils.defineLazyServiceGetter(
this,
"TrackingDBService",
"@mozilla.org/tracking-db-service;1",
"nsITrackingDBService"
);
var Fingerprinting = {
PREF_ENABLED: "privacy.trackingprotection.fingerprinting.enabled",
reportBreakageLabel: "fingerprinting",
@ -980,27 +973,21 @@ var gProtectionsHandler = {
"protections-popup-tp-switch"
));
},
get _protectionsPopupSettingsButton() {
delete this._protectionsPopupSettingsButton;
return (this._protectionsPopupSettingsButton = document.getElementById(
get _protectionPopupSettingsButton() {
delete this._protectionPopupSettingsButton;
return (this._protectionPopupSettingsButton = document.getElementById(
"protections-popup-settings-button"
));
},
get _protectionsPopupFooter() {
delete this._protectionsPopupFooter;
return (this._protectionsPopupFooter = document.getElementById(
get _protectionPopupFooter() {
delete this._protectionPopupFooter;
return (this._protectionPopupFooter = document.getElementById(
"protections-popup-footer"
));
},
get _protectionsPopupTrackersCounterBox() {
delete this._protectionsPopupTrackersCounterBox;
return (this._protectionsPopupTrackersCounterBox = document.getElementById(
"protections-popup-trackers-blocked-counter-box"
));
},
get _protectionsPopupTrackersCounterDescription() {
delete this._protectionsPopupTrackersCounterDescription;
return (this._protectionsPopupTrackersCounterDescription = document.getElementById(
get _protectionPopupTrackersCounterDescription() {
delete this._protectionPopupTrackersCounterDescription;
return (this._protectionPopupTrackersCounterDescription = document.getElementById(
"protections-popup-trackers-blocked-counter-description"
));
},
@ -1130,12 +1117,6 @@ var gProtectionsHandler = {
this.appMenuLabel.setAttribute("value", this.strings.appMenuTitle);
this.appMenuLabel.setAttribute("tooltiptext", this.strings.appMenuTooltip);
// Set the tooltip for the blocked tracker counter.
this.maybeUpdateEarliestRecordedDateTooltip();
// Add an observer to observe that the history has been cleared.
Services.obs.addObserver(this, "browser:purge-session-history");
},
uninit() {
@ -1155,10 +1136,9 @@ var gProtectionsHandler = {
openPreferences("privacy-trackingprotection", { origin });
},
openProtections(relatedToCurrent = false) {
openProtections() {
switchToTabHavingURI("about:protections", true, {
replaceQueryString: true,
relatedToCurrent,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
},
@ -1236,12 +1216,6 @@ var gProtectionsHandler = {
if (event.target == this._protectionsPopup) {
window.removeEventListener("focus", this, true);
gIdentityHandler._trackingProtectionIconContainer.removeAttribute("open");
// Hide the tracker counter when the popup get hidden.
this._protectionsPopupTrackersCounterBox.toggleAttribute(
"showing",
false
);
}
},
@ -1256,25 +1230,6 @@ var gProtectionsHandler = {
}
},
async onTrackingProtectionIconHoveredOrFocused() {
// We would try to pre-fetch the data whenever the shield icon is hovered or
// focused. We check focus event here due to the keyboard navigation.
if (this._updatingFooter) {
return;
}
this._updatingFooter = true;
// Get the tracker count and set it to the counter in the footer.
const trackerCount = await TrackingDBService.sumAllEvents();
this.setTrackersBlockedCounter(trackerCount);
// Try to get the earliest recorded date in case that there was no record
// during the initiation but new records come after that.
await this.maybeUpdateEarliestRecordedDateTooltip();
this._updatingFooter = false;
},
// This triggers from top level location changes.
onLocationChange() {
if (this._showToastAfterRefresh) {
@ -1429,17 +1384,6 @@ var gProtectionsHandler = {
}
},
observe(subject, topic, data) {
switch (topic) {
case "browser:purge-session-history":
// We need to update the earliest recorded date if history has been
// cleared.
this._hasEarliestRecord = false;
this.maybeUpdateEarliestRecordedDateTooltip();
break;
}
},
refreshProtectionsPopup() {
let host = gIdentityHandler.getHostForDisplay();
@ -1472,8 +1416,11 @@ var gProtectionsHandler = {
!currentlyEnabled
);
// Update the tooltip of the blocked tracker counter.
this.maybeUpdateEarliestRecordedDateTooltip();
// Set the counter of the 'Trackers blocked This Week'.
// We need to get the statistics of trackers. So far, we haven't implemented
// this yet. So we use a fake number here. Should be resolved in
// Bug 1555231.
this.setTrackersBlockedCounter(244051);
},
disableForCurrentPage() {
@ -1533,19 +1480,10 @@ var gProtectionsHandler = {
},
setTrackersBlockedCounter(trackerCount) {
let forms = gNavigatorBundle.getString(
"protections.footer.blockedTrackerCounter.description"
);
this._protectionsPopupTrackersCounterDescription.textContent = PluralForm.get(
trackerCount,
forms
).replace("#1", trackerCount);
// Show the counter if the number of tracker is not zero.
this._protectionsPopupTrackersCounterBox.toggleAttribute(
"showing",
trackerCount != 0
);
this._protectionPopupTrackersCounterDescription.textContent =
// gNavigatorBundle.getFormattedString(
// "protections.trackers_counter", [cnt]);
`Trackers blocked this week: ${trackerCount.toLocaleString()}`;
},
/**
@ -1749,35 +1687,4 @@ var gProtectionsHandler = {
this._protectionsPopup.hidePopup();
this.submitBreakageReport(this.reportURI);
},
async maybeUpdateEarliestRecordedDateTooltip() {
if (this._hasEarliestRecord) {
return;
}
let date = await TrackingDBService.getEarliestRecordedDate();
// If there is no record for any blocked tracker, we don't have to do anything
// since the tracker counter won't be shown.
if (!date) {
return;
}
this._hasEarliestRecord = true;
const dateLocaleStr = new Date(date).toLocaleDateString("default", {
month: "long",
day: "numeric",
year: "numeric",
});
const tooltipStr = gNavigatorBundle.getFormattedString(
"protections.footer.blockedTrackerCounter.tooltip",
[dateLocaleStr]
);
this._protectionsPopupTrackersCounterDescription.setAttribute(
"tooltiptext",
tooltipStr
);
},
};

View File

@ -849,9 +849,7 @@
<box id="tracking-protection-icon-container" align="center"
role="button"
onclick="gProtectionsHandler.handleProtectionsButtonEvent(event);"
onkeypress="gProtectionsHandler.handleProtectionsButtonEvent(event);"
onmouseover="gProtectionsHandler.onTrackingProtectionIconHoveredOrFocused();"
onfocus="gProtectionsHandler.onTrackingProtectionIconHoveredOrFocused();">
onkeypress="gProtectionsHandler.handleProtectionsButtonEvent(event);">
<box id="tracking-protection-icon-box" animationsenabled="true">
<image id="tracking-protection-icon"/>
<box id="tracking-protection-icon-animatable-box" flex="1">

View File

@ -130,7 +130,7 @@ add_task(async function testSettingsButton() {
gBrowser,
"about:preferences#privacy"
);
gProtectionsHandler._protectionsPopupSettingsButton.click();
gProtectionsHandler._protectionPopupSettingsButton.click();
// The protection popup should be hidden after clicking settings button.
await popuphiddenPromise;
@ -144,9 +144,9 @@ add_task(async function testSettingsButton() {
});
/**
* A test for the 'Show Full Report' button in the footer section.
* A test for the 'Show Full Report' button in the footer seciton.
*/
add_task(async function testShowFullReportButton() {
add_task(async function testShowFullReportLink() {
// Open a tab and its protection panel.
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
@ -162,11 +162,11 @@ add_task(async function testShowFullReportButton() {
gBrowser,
"about:protections"
);
let showFullReportButton = document.getElementById(
"protections-popup-show-report-button"
let showFullReportLink = document.getElementById(
"protections-popup-show-full-report-link"
);
showFullReportButton.click();
showFullReportLink.click();
// The protection popup should be hidden after clicking the link.
await popuphiddenPromise;

View File

@ -17,10 +17,6 @@ async function openProtectionsPanel(toast) {
let shieldIconContainer = document.getElementById(
"tracking-protection-icon-container"
);
// Focus to the icon container in order to fetch tracker count.
shieldIconContainer.focus();
if (!toast) {
EventUtils.synthesizeMouseAtCenter(shieldIconContainer, {});
} else {

View File

@ -80,28 +80,24 @@
</vbox>
</hbox>
<vbox id="protections-popup-footer" class="protections-popup-section">
<vbox id="protections-popup-settings-section"
class="protections-popup-section">
<toolbarbutton id="protections-popup-settings-button"
class="protections-popup-footer-button"
oncommand="gProtectionsHandler.openPreferences();">
<image class="protection-popup-footer-icon protections-popup-settings-icon"/>
<label class="protections-popup-footer-button-label" flex="1">&protections.settings.label;</label>
<image class="protection-settings-icon"/>
<label class="protections-popup-settings-label" flex="1">&protections.settings.label;</label>
</toolbarbutton>
<stack id="protections-popup-show-report-stack">
<toolbarbutton id="protections-popup-show-report-button"
class="protections-popup-footer-button"
oncommand="gProtectionsHandler.openProtections(true);">
<image class="protection-popup-footer-icon protections-popup-show-report-icon"/>
<label class="protections-popup-footer-button-label" flex="1">&protections.report.label;</label>
</toolbarbutton>
<hbox id="protections-popup-trackers-blocked-counter-box"
align="center"
right="0">
<description id="protections-popup-trackers-blocked-counter-description"
onclick="gProtectionsHandler.openProtections(true);"/>
</hbox>
</stack>
</vbox>
<hbox id="protections-popup-footer">
<description id="protections-popup-trackers-blocked-counter-description"
flex="1"/>
<label id="protections-popup-show-full-report-link"
is="text-link"
useoriginprincipal="true"
href="about:protections">&protections.report.label;</label>
</hbox>
</panelview>
<!-- Site Not Working? SubView -->

View File

@ -647,20 +647,6 @@ protections.notBlocking.crossSiteTrackingCookies.title=Not Blocking Cross-Site T
protections.notBlocking.trackingContent.title=Not Blocking Tracking Content
protections.notBlocking.socialMediaTrackers.title=Not Blocking Social Media Trackers
# Footer section in the Protections Panel
# LOCALIZATION NOTE (protections.footer.blockedTrackerCounter.description,
# protections.footer.blockedTrackerCounter.tooltip):
# This text indicates the total number of trackers blocked on all sites. In
# its tooltip, we show the date when we started counting this number.
# LOCALIZATION NOTE (protections.footer.blockedTrackerCounter.description):
# Semicolon-separated list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# Replacement for #1 is a locale-string converted positive integer.
protections.footer.blockedTrackerCounter.description=1 Blocked;#1 Blocked
# LOCALIZATION NOTE (protections.footer.blockedTrackerCounter.tooltip):
# %S is the date on which we started counting (e.g., July 17, 2019).
protections.footer.blockedTrackerCounter.tooltip=Since %S
# Edit Bookmark UI
editBookmarkPanel.newBookmarkTitle=New Bookmark
editBookmarkPanel.editBookmarkTitle=Edit This Bookmark

View File

@ -193,8 +193,9 @@
#identity-popup-securityView-body > description,
#identity-popup-permissions-content > description,
#protections-popup-content > description,
.protections-popup-footer-button-label,
#protections-popup-trackers-blocked-counter-description {
.protections-popup-settings-label,
#protections-popup-footer > description,
#protections-popup-footer > label {
font-size: 110%;
margin: 0;
}
@ -433,17 +434,13 @@ description#identity-popup-content-verifier,
.protections-popup-category:-moz-focusring,
.protections-popup-category:hover,
.protections-popup-footer-button:-moz-focusring,
.protections-popup-footer-button:hover,
#protections-popup-show-report-stack:hover > .protections-popup-footer-button {
#protections-popup-settings-button:hover {
border-radius: 2px;
background-color: var(--arrowpanel-dimmed);
outline: none;
}
.protections-popup-category:hover:active,
.protections-popup-footer-button:hover:active,
#protections-popup-show-report-stack:hover:active > .protections-popup-footer-button {
.protections-popup-category:hover:active {
background-color: var(--arrowpanel-dimmed-further);
}
@ -708,8 +705,7 @@ description#identity-popup-content-verifier,
.protections-popup-category-state-label,
.identity-popup-permission-label,
.identity-popup-permission-state-label,
.protections-popup-footer-button-label,
#protections-popup-trackers-blocked-counter-description {
.protections-popup-settings-label {
/* We need to align the action buttons and permission icons with the text.
This is tricky because the icon height is defined in pixels, while the
font height can vary with platform and system settings, and at least on
@ -724,7 +720,7 @@ description#identity-popup-content-verifier,
.protections-popup-category-label,
.identity-popup-permission-label,
.protections-popup-footer-button-label {
.protections-popup-settings-label {
margin-inline-start: 1em;
}
@ -880,49 +876,39 @@ description#identity-popup-content-verifier,
border-top: 1px solid var(--panel-separator-color);
}
/* Protection popup footer categories */
.protections-popup-footer-button {
min-height: 24px;
padding-inline-start: 2em;
margin: 0;
#protections-popup-settings-section {
padding: 4px;
-moz-context-properties: fill, fill-opacity;
}
.protection-popup-footer-icon {
#protections-popup-settings-button {
/* We need to align the setting button with the labels in the tp switch
section. So we add 6px to offset the margin of labels. */
padding-inline-start: calc(1em + 6px);
min-height: 37px;
}
.protection-settings-icon {
width: 16px;
height: 16px;
}
.protections-popup-settings-icon {
list-style-image: url(chrome://browser/skin/settings.svg);
}
.protections-popup-show-report-icon {
list-style-image: url(chrome://browser/skin/controlcenter/dashboard.svg);
}
#protections-popup-footer {
padding: 6px 0;
}
#protections-popup-trackers-blocked-counter-box {
margin-inline-end: calc(4px + 1em);
visibility: hidden;
opacity: 0;
transition: opacity 200ms linear;
}
#protections-popup-trackers-blocked-counter-box[showing] {
visibility: visible;
opacity: 1;
background-color: var(--arrowpanel-dimmed);
border-top: 1px solid var(--panel-separator-color);
min-height: 40px;
-moz-box-align: center;
/* The horizontal padding aligns the content of footer with other sections in
the protections panel */
padding: 4px calc(1em + 4px);
}
#protections-popup-trackers-blocked-counter-description {
color: #737373;
}
:root[lwt-popup-brighttext] #protections-popup-trackers-blocked-counter-description {
color: #f9f9fa;
font-weight: 600;
/* This padding is added to align the counter text with the beginning of texts
in other sections. */
padding-inline-start: 6px;
}
#protections-popup-tp-switch[showdotindicator]::after {