mirror of
https://codeberg.org/librewolf/source.git
synced 2024-12-21 21:23:08 -05:00
experimental identity pane
This commit is contained in:
parent
6ba51309d1
commit
25757cfdd7
2 changed files with 346 additions and 0 deletions
|
@ -18,6 +18,7 @@ patches/sed-patches/stop-undesired-requests.patch
|
|||
patches/ui-patches/firefox-view.patch
|
||||
patches/ui-patches/handlers.patch
|
||||
patches/ui-patches/hide-default-browser.patch
|
||||
patches/ui-patches/identity-pane.patch
|
||||
patches/ui-patches/lw-logo-devtools.patch
|
||||
patches/ui-patches/pref-naming.patch
|
||||
patches/ui-patches/privacy-preferences.patch
|
||||
|
|
345
patches/ui-patches/identity-pane.patch
Normal file
345
patches/ui-patches/identity-pane.patch
Normal file
|
@ -0,0 +1,345 @@
|
|||
diff --git a/browser/base/content/browser-siteProtections.js b/browser/base/content/browser-siteProtections.js
|
||||
--- a/browser/base/content/browser-siteProtections.js
|
||||
+++ b/browser/base/content/browser-siteProtections.js
|
||||
@@ -415,6 +415,10 @@ let TrackingProtection =
|
||||
this.prefEmailTrackingProtectionEnabledInPrivateWindows,
|
||||
this
|
||||
);
|
||||
+ Services.prefs.addObserver(
|
||||
+ "privacy.resistFingerprinting.exemptedDomains",
|
||||
+ this
|
||||
+ );
|
||||
}
|
||||
|
||||
uninit() {
|
||||
@@ -428,6 +432,10 @@ let TrackingProtection =
|
||||
this.prefEmailTrackingProtectionEnabledInPrivateWindows,
|
||||
this
|
||||
);
|
||||
+ Services.prefs.removeObserver(
|
||||
+ "privacy.resistFingerprinting.exemptedDomains",
|
||||
+ this
|
||||
+ );
|
||||
}
|
||||
|
||||
observe() {
|
||||
@@ -1402,6 +1396,19 @@ var gProtectionsHandler = {
|
||||
"protections-popup-tp-switch"
|
||||
));
|
||||
},
|
||||
+ get _protectionsPopupRFPSwitch() {
|
||||
+ delete this._protectionsPopupRFPSwitch;
|
||||
+ return (this._protectionsPopupRFPSwitch = document.getElementById(
|
||||
+ "protections-popup-rfp-switch"
|
||||
+ ));
|
||||
+ },
|
||||
+
|
||||
+ get _protectionsPopupCookieSwitch() {
|
||||
+ delete this._protectionsPopupCookieSwitch;
|
||||
+ return (this._protectionsPopupCookieSwitch = document.getElementById(
|
||||
+ "protections-popup-cookie-switch"
|
||||
+ ));
|
||||
+ },
|
||||
get _protectionsPopupBlockingHeader() {
|
||||
delete this._protectionsPopupBlockingHeader;
|
||||
return (this._protectionsPopupBlockingHeader = document.getElementById(
|
||||
@@ -1774,6 +1781,11 @@ var gProtectionsHandler = {
|
||||
if (event.target == this._protectionsPopup) {
|
||||
window.removeEventListener("focus", this, true);
|
||||
}
|
||||
+ if (this._shouldReloadNextHide) {
|
||||
+ this._shouldReloadNextHide = false;
|
||||
+ BrowserReload();
|
||||
+ setTimeout(BrowserReload, 500);
|
||||
+ }
|
||||
},
|
||||
|
||||
onHeaderClicked(event) {
|
||||
@@ -2094,6 +2106,23 @@ var gProtectionsHandler = {
|
||||
tpSwitch.toggleAttribute("enabled", currentlyEnabled);
|
||||
}
|
||||
|
||||
+ this._protectionsPopupRFPSwitch.toggleAttribute(
|
||||
+ "enabled",
|
||||
+ !Services.prefs
|
||||
+ .getStringPref("privacy.resistFingerprinting.exemptedDomains")
|
||||
+ .split(",")
|
||||
+ .map(x => x.trim())
|
||||
+ .includes(host)
|
||||
+ );
|
||||
+
|
||||
+ this._protectionsPopupCookieSwitch.toggleAttribute(
|
||||
+ "enabled",
|
||||
+ !Services.perms.testPermissionFromPrincipal(
|
||||
+ gBrowser.contentPrincipal,
|
||||
+ "cookie"
|
||||
+ ) == Services.perms.ALLOW_ACTION
|
||||
+ );
|
||||
+
|
||||
this._notBlockingWhyLink.setAttribute(
|
||||
"tooltip",
|
||||
currentlyEnabled
|
||||
@@ -2256,9 +2285,9 @@ var gProtectionsHandler = {
|
||||
// Indicating that we need to show a toast after refreshing the page.
|
||||
// And caching the current URI and window ID in order to only show the mini
|
||||
// panel if it's still on the same page.
|
||||
- this._showToastAfterRefresh = true;
|
||||
this._previousURI = gBrowser.currentURI.spec;
|
||||
this._previousOuterWindowID = gBrowser.selectedBrowser.outerWindowID;
|
||||
+ this._shouldReloadNextHide = true;
|
||||
|
||||
if (newExceptionState) {
|
||||
this.disableForCurrentPage(false);
|
||||
@@ -2268,22 +2297,52 @@ var gProtectionsHandler = {
|
||||
this.recordClick("etp_toggle_on");
|
||||
}
|
||||
|
||||
- // We need to flush the TP state change immediately without waiting the
|
||||
- // 500ms delay if the Tab get switched out.
|
||||
- let targetTab = gBrowser.selectedTab;
|
||||
- let onTabSelectHandler;
|
||||
- let tabSelectPromise = new Promise(resolve => {
|
||||
- onTabSelectHandler = () => resolve();
|
||||
- gBrowser.tabContainer.addEventListener("TabSelect", onTabSelectHandler);
|
||||
- });
|
||||
- let timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
|
||||
+ delete this._TPSwitchCommanding;
|
||||
+ },
|
||||
+
|
||||
+ async onRFPSwitchCommand(event) {
|
||||
+ const enabled = this._protectionsPopupRFPSwitch.toggleAttribute("enabled");
|
||||
|
||||
- await Promise.race([tabSelectPromise, timeoutPromise]);
|
||||
- gBrowser.tabContainer.removeEventListener("TabSelect", onTabSelectHandler);
|
||||
- PanelMultiView.hidePopup(this._protectionsPopup);
|
||||
- gBrowser.reloadTab(targetTab);
|
||||
+ if (enabled) {
|
||||
+ Services.prefs.setStringPref(
|
||||
+ "privacy.resistFingerprinting.exemptedDomains",
|
||||
+ Services.prefs
|
||||
+ .getStringPref("privacy.resistFingerprinting.exemptedDomains")
|
||||
+ .split(",")
|
||||
+ .filter(x => x.trim() != gBrowser.currentURI.host)
|
||||
+ .join(",")
|
||||
+ );
|
||||
+ } else {
|
||||
+ Services.prefs.setStringPref(
|
||||
+ "privacy.resistFingerprinting.exemptedDomains",
|
||||
+ Services.prefs.getStringPref(
|
||||
+ "privacy.resistFingerprinting.exemptedDomains"
|
||||
+ ) +
|
||||
+ "," +
|
||||
+ gBrowser.currentURI.host
|
||||
+ );
|
||||
+ }
|
||||
|
||||
- delete this._TPSwitchCommanding;
|
||||
+ this._shouldReloadNextHide = true;
|
||||
+ },
|
||||
+
|
||||
+ async onCookieSwitchCommand(event) {
|
||||
+ const enabled = this._protectionsPopupCookieSwitch.toggleAttribute(
|
||||
+ "enabled"
|
||||
+ );
|
||||
+
|
||||
+ if (enabled) {
|
||||
+ Services.perms.removeFromPrincipal(gBrowser.contentPrincipal, "cookie");
|
||||
+ } else {
|
||||
+ Services.perms.addFromPrincipal(
|
||||
+ gBrowser.contentPrincipal,
|
||||
+ "cookie",
|
||||
+ Services.perms.ALLOW_ACTION,
|
||||
+ Services.perms.EXPIRE_NEVER
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ this._shouldReloadNextHide = true;
|
||||
},
|
||||
|
||||
onCookieBannerToggleCommand() {
|
||||
diff --git a/browser/components/controlcenter/content/protectionsPanel.inc.xhtml b/browser/components/controlcenter/content/protectionsPanel.inc.xhtml
|
||||
--- a/browser/components/controlcenter/content/protectionsPanel.inc.xhtml
|
||||
+++ b/browser/components/controlcenter/content/protectionsPanel.inc.xhtml
|
||||
@@ -45,22 +45,45 @@
|
||||
<vbox id="protections-popup-main-body" class="panel-subview-body">
|
||||
<vbox id="protections-popup-tp-switch-section" class="protections-popup-section protections-popup-switch-section">
|
||||
<hbox id="protections-popup-tp-switch-section-header" class="protections-popup-switch-section-header">
|
||||
- <vbox class="protections-popup-tp-switch-label-box" flex="1" align="start">
|
||||
- <label class="protections-popup-switch-header protections-popup-tp-switch-on-header"
|
||||
- role="heading"
|
||||
- aria-level="2" data-l10n-id="protections-panel-etp-on-header"></label>
|
||||
- <label class="protections-popup-switch-header protections-popup-tp-switch-off-header"
|
||||
- role="heading"
|
||||
- aria-level="2" data-l10n-id="protections-panel-etp-off-header"></label>
|
||||
+ <vbox class="protections-popup-switch-label-box" flex="1" align="start">
|
||||
+ <label class="protections-popup-switch-header"
|
||||
+ role="heading"
|
||||
+ aria-level="2" data-l10n-id="protections-panel-etp-header"></label>
|
||||
</vbox>
|
||||
- <vbox class="protections-popup-tp-switch-box">
|
||||
+ <vbox class="protections-popup-switch-box">
|
||||
<toolbarbutton id="protections-popup-tp-switch"
|
||||
- class="protections-popup-tp-switch"
|
||||
- enabled="false"
|
||||
- oncommand="gProtectionsHandler.onTPSwitchCommand();" />
|
||||
+ class="protections-popup-switch"
|
||||
+ enabled="false"
|
||||
+ oncommand="gProtectionsHandler.onTPSwitchCommand();" />
|
||||
</vbox>
|
||||
</hbox>
|
||||
- <hbox id="protections-popup-tp-switch-section-footer">
|
||||
+ <hbox id="protections-popup-rfp-switch-section-header" class="protections-popup-switch-section-header">
|
||||
+ <vbox class="protections-popup-switch-label-box" flex="1" align="start">
|
||||
+ <label class="protections-popup-switch-header"
|
||||
+ role="heading"
|
||||
+ aria-level="2" data-l10n-id="protections-panel-rfp-header"></label>
|
||||
+ </vbox>
|
||||
+ <vbox class="protections-popup-switch-box">
|
||||
+ <toolbarbutton id="protections-popup-rfp-switch"
|
||||
+ class="protections-popup-switch"
|
||||
+ enabled="false"
|
||||
+ oncommand="gProtectionsHandler.onRFPSwitchCommand();" />
|
||||
+ </vbox>
|
||||
+ </hbox>
|
||||
+ <hbox id="protections-popup-cookie-switch-section-header" class="protections-popup-switch-section-header">
|
||||
+ <vbox class="protections-popup-switch-label-box" flex="1" align="start">
|
||||
+ <label class="protections-popup-switch-header"
|
||||
+ role="heading"
|
||||
+ aria-level="2" data-l10n-id="protections-panel-cookie-header"></label>
|
||||
+ </vbox>
|
||||
+ <vbox class="protections-popup-switch-box">
|
||||
+ <toolbarbutton id="protections-popup-cookie-switch"
|
||||
+ class="protections-popup-switch"
|
||||
+ enabled="false"
|
||||
+ oncommand="gProtectionsHandler.onCookieSwitchCommand();" />
|
||||
+ </vbox>
|
||||
+ </hbox>
|
||||
+ <hbox id="protections-popup-tp-switch-section-footer" hidden="true">
|
||||
<toolbarbutton id="protections-popup-tp-switch-breakage-link"
|
||||
oncommand="gProtectionsHandler.showSiteNotWorkingView(); gProtectionsHandler.recordClick('sitenotworking_link');"
|
||||
class="subviewbutton subviewbutton-nav" align="center" flex="1">
|
||||
@@ -90,8 +113,7 @@
|
||||
</hbox>
|
||||
|
||||
<!-- Tracking Protection Section -->
|
||||
- <toolbarseparator></toolbarseparator>
|
||||
- <vbox id="tracking-protection-container" class="protections-popup-section">
|
||||
+ <vbox id="tracking-protection-container" class="protections-popup-section" hidden="true">
|
||||
<description id="protections-popup-no-trackers-found-description" data-l10n-id="protections-panel-no-trackers-found"></description>
|
||||
<tooltip id="protections-popup-not-blocking-why-etp-on-tooltip" data-l10n-id="protections-panel-not-blocking-why-etp-on-tooltip"></tooltip>
|
||||
<tooltip id="protections-popup-not-blocking-why-etp-off-tooltip" data-l10n-id="protections-panel-not-blocking-why-etp-off-tooltip"></tooltip>
|
||||
@@ -150,8 +172,7 @@
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
||||
- <toolbarseparator></toolbarseparator>
|
||||
- <vbox id="protections-popup-footer" class="panel-subview-footer-button">
|
||||
+ <vbox id="protections-popup-footer" class="panel-subview-footer-button" hidden="true">
|
||||
<toolbarbutton id="protections-popup-settings-button"
|
||||
class="subviewbutton protections-popup-footer-button"
|
||||
oncommand="gProtectionsHandler.openPreferences(); gProtectionsHandler.recordClick('settings');">
|
||||
diff --git a/browser/locales/en-US/browser/protectionsPanel.ftl b/browser/locales/en-US/browser/protectionsPanel.ftl
|
||||
--- a/browser/locales/en-US/browser/protectionsPanel.ftl
|
||||
+++ b/browser/locales/en-US/browser/protectionsPanel.ftl
|
||||
@@ -26,6 +26,10 @@ protections-panel-etp-more-info =
|
||||
protections-panel-etp-on-header = Enhanced Tracking Protection is ON for this site
|
||||
protections-panel-etp-off-header = Enhanced Tracking Protection is OFF for this site
|
||||
|
||||
+protections-panel-etp-header = Enhanced Tracking Protection
|
||||
+protections-panel-rfp-header = Resist Fingerprinting
|
||||
+protections-panel-cookie-header = Clear Cookies and Site Data on Exit
|
||||
+
|
||||
# The link to be clicked to open the sub-panel view
|
||||
protections-panel-site-not-working = Site not working?
|
||||
|
||||
diff --git a/browser/themes/shared/controlcenter/panel.css b/browser/themes/shared/controlcenter/panel.css
|
||||
--- a/browser/themes/shared/controlcenter/panel.css
|
||||
+++ b/browser/themes/shared/controlcenter/panel.css
|
||||
@@ -550,11 +550,6 @@
|
||||
background-color: var(--button-active-bgcolor)
|
||||
}
|
||||
|
||||
-#protections-popup[hasException] .protections-popup-tp-switch-on-header,
|
||||
-#protections-popup:not([hasException]) .protections-popup-tp-switch-off-header {
|
||||
- display: none;
|
||||
-}
|
||||
-
|
||||
#protections-popup-cookie-banner-section[hasException] .protections-popup-cookie-banner-switch-on-header,
|
||||
#protections-popup-cookie-banner-section:not([hasException]) .protections-popup-cookie-banner-switch-off-header {
|
||||
display: none;
|
||||
@@ -570,8 +565,8 @@
|
||||
display: revert;
|
||||
}
|
||||
|
||||
-.protections-popup-tp-switch-label-box,
|
||||
-.protections-popup-tp-switch-box {
|
||||
+.protections-popup-switch-label-box,
|
||||
+.protections-popup-switch-box {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@@ -579,11 +574,7 @@
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
-.protections-popup-switch-header {
|
||||
- font-weight: 600;
|
||||
-}
|
||||
-
|
||||
-.protections-popup-tp-switch {
|
||||
+.protections-popup-switch {
|
||||
appearance: none;
|
||||
box-sizing: border-box;
|
||||
min-width: 30px;
|
||||
@@ -597,7 +588,7 @@
|
||||
transition: padding .2s ease;
|
||||
}
|
||||
|
||||
-.protections-popup-tp-switch::before {
|
||||
+.protections-popup-switch::before {
|
||||
position: relative;
|
||||
display: block;
|
||||
content: "";
|
||||
@@ -608,28 +599,28 @@
|
||||
outline: 1px solid var(--panel-separator-color);
|
||||
}
|
||||
|
||||
-.protections-popup-tp-switch[enabled] {
|
||||
+.protections-popup-switch[enabled] {
|
||||
background-color: var(--button-primary-bgcolor);
|
||||
border-color: var(--button-primary-hover-bgcolor);
|
||||
/* Push the toggle to the right. */
|
||||
padding-inline-start: 16px;
|
||||
}
|
||||
|
||||
-.protections-popup-tp-switch[enabled]:hover {
|
||||
+.protections-popup-switch[enabled]:hover {
|
||||
background-color: var(--button-primary-hover-bgcolor);
|
||||
border-color: var(--button-primary-active-bgcolor);
|
||||
}
|
||||
|
||||
-.protections-popup-tp-switch[enabled]:hover:active {
|
||||
+.protections-popup-switch[enabled]:hover:active {
|
||||
background-color: var(--button-primary-active-bgcolor);
|
||||
border-color: var(--button-primary-active-bgcolor);
|
||||
}
|
||||
|
||||
-.protections-popup-tp-switch:not([enabled]):hover {
|
||||
+.protections-popup-switch:not([enabled]):hover {
|
||||
background-color: var(--button-hover-bgcolor);
|
||||
}
|
||||
|
||||
-.protections-popup-tp-switch:not([enabled]):hover:active {
|
||||
+.protections-popup-switch:not([enabled]):hover:active {
|
||||
background-color: var(--button-active-bgcolor);
|
||||
}
|
||||
|
||||
@@ -761,7 +752,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
-.protections-popup-tp-switch:focus-visible {
|
||||
+.protections-popup-switch:focus-visible {
|
||||
outline: var(--focus-outline);
|
||||
outline-offset: var(--focus-outline-offset);
|
||||
}
|
Loading…
Reference in a new issue