Bug 1562575 - Part 2 - Move content blocking section into the protections panel. r=ewright

This is a pretty big change on paper, but most of the lines are copy-pasted, with some small
adjustments to get the content blocking code comfortable in browser-siteProtections.js.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Johann Hofmann 2019-07-12 10:27:24 +00:00
Родитель 230d70e54a
Коммит 0d0bc26e56
10 изменённых файлов: 1525 добавлений и 1734 удалений

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

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

@ -959,8 +959,6 @@ var gIdentityHandler = {
// Update per-site permissions section.
this.updateSitePermissions();
ContentBlocking.toggleReportBreakageButton();
},
setURI(uri) {

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

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

@ -1943,7 +1943,7 @@ var gBrowserInit = {
BookmarkingUI.init();
BrowserSearch.delayedStartupInit();
AutoShowBookmarksToolbar.init();
ContentBlocking.init();
gProtectionsHandler.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();
ContentBlocking.uninit();
gProtectionsHandler.uninit();
FullZoom.destroy();
Services.obs.removeObserver(gIdentityHandler, "perm-changed");
@ -5739,7 +5739,7 @@ var XULBrowserWindow = {
);
}
ContentBlocking.onContentBlockingEvent(
gProtectionsHandler.onContentBlockingEvent(
this._event,
aWebProgress,
aIsSimulated
@ -6366,8 +6366,6 @@ var TabsProgressListener = {
gBrowser.getNotificationBox(aBrowser).removeTransientNotifications();
FullZoom.onLocationChange(aLocationURI, false, aBrowser);
ContentBlocking.onLocationChange();
},
onLinkIconAvailable(browser, dataURI, iconURI) {

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

@ -81,7 +81,6 @@
/* 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);
}

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

@ -37,7 +37,6 @@ 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,80 +56,6 @@
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">
@ -254,100 +180,5 @@
</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,10 +43,63 @@
</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="ContentBlocking.openPreferences();">
oncommand="gProtectionsHandler.openPreferences();">
<image class="protection-settings-icon"/>
<label class="protections-popup-settings-label" flex="1">Protection Settings</label>
</toolbarbutton>
@ -102,6 +155,69 @@
</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="ContentBlocking.openPreferences('appMenu-trackingprotection');">
oncommand="gProtectionsHandler.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. */
#identity-popup-content-blocking-content:not([detected]) > #identity-popup-content-blocking-detected,
#identity-popup-content-blocking-content[detected] > #identity-popup-content-blocking-not-detected {
#protections-popup:not([detected]) #identity-popup-content-blocking-detected,
#protections-popup[detected] #identity-popup-content-blocking-not-detected {
display: none;
}
@ -637,28 +637,6 @@ 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;
}
@ -666,20 +644,10 @@ 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). */
#identity-popup-content-blocking-content:not([blocking]):not([hasException]) #identity-popup-content-blocking-report-breakage {
#protections-popup:not([blocking]):not([hasException]) #protections-popup-tp-switch-breakage-link {
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 {
@ -772,7 +740,7 @@ description#identity-popup-content-verifier,
text-align: end;
}
#identity-popup-content-blocking-content[hasException] .identity-popup-content-blocking-category-state-label {
#protections-popup[hasException] .identity-popup-content-blocking-category-state-label {
visibility: hidden;
}