tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 5e7e228e10171c59099d3122c72f7d99f501f18a
parent 703486a0fca38b76c6ed957c954090e427c1443c
Author: Kathy Brade <brade@pearlcrescent.com>
Date:   Tue, 14 Jul 2020 11:15:07 -0400

BB 33852: Clean up about:logins (LockWise) to avoid mentioning sync, etc.

Hide elements on about:logins that mention sync, "Firefox LockWise", and
Mozilla's LockWise mobile apps.

Disable the "Create New Login" button when security.nocertdb is true.

Diffstat:
Mbrowser/components/aboutlogins/AboutLoginsParent.sys.mjs | 2++
Mbrowser/components/aboutlogins/content/aboutLogins.css | 5+++++
Mbrowser/components/aboutlogins/content/aboutLogins.mjs | 1+
Mbrowser/components/aboutlogins/content/components/fxaccounts-button.css | 5+++++
Mbrowser/components/aboutlogins/content/components/login-command-button.mjs | 5++++-
Mbrowser/components/aboutlogins/content/components/login-list.mjs | 25++++++++++++++++++++++++-
6 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/browser/components/aboutlogins/AboutLoginsParent.sys.mjs b/browser/components/aboutlogins/AboutLoginsParent.sys.mjs @@ -49,6 +49,7 @@ ChromeUtils.defineLazyGetter(lazy, "AboutLoginsL10n", () => { const ABOUT_LOGINS_ORIGIN = "about:logins"; const AUTH_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes const PRIMARY_PASSWORD_NOTIFICATION_ID = "primary-password-login-required"; +const NOCERTDB_PREF = "security.nocertdb"; // about:logins will always use the privileged content process, // even if it is disabled for other consumers such as about:newtab. @@ -322,6 +323,7 @@ export class AboutLoginsParent extends JSWindowActorParent { Services.policies.isAllowed("profileImport") && AppConstants.platform != "linux", preselectedLogin: this.preselectedLogin, + canCreateLogins: !Services.prefs.getBoolPref(NOCERTDB_PREF, false), }); await AboutLogins.sendAllLoginRelatedObjects( diff --git a/browser/components/aboutlogins/content/aboutLogins.css b/browser/components/aboutlogins/content/aboutLogins.css @@ -68,6 +68,11 @@ login-item[data-editing="true"] + login-intro, display: none; } +/* Do not promote Mozilla Sync. */ +login-intro { + display: none !important; +} + .heading-wrapper { display: flex; justify-content: center; diff --git a/browser/components/aboutlogins/content/aboutLogins.mjs b/browser/components/aboutlogins/content/aboutLogins.mjs @@ -133,6 +133,7 @@ window.addEventListener("AboutLoginsChromeToContent", event => { gElements.loginList.setSortDirection(event.detail.value.selectedSort); document.documentElement.classList.add("initialized"); gElements.loginList.classList.add("initialized"); + gElements.loginList.canCreateLogins = event.detail.value.canCreateLogins; break; } case "ShowLoginItemError": { diff --git a/browser/components/aboutlogins/content/components/fxaccounts-button.css b/browser/components/aboutlogins/content/components/fxaccounts-button.css @@ -8,6 +8,11 @@ align-items: center; } +/* Do not promote Mozilla Sync. */ +.logged-out-view { + display: none !important; +} + .fxaccounts-extra-text { /* Only show at most 3 lines of text to limit the text from overflowing the header. */ diff --git a/browser/components/aboutlogins/content/components/login-command-button.mjs b/browser/components/aboutlogins/content/components/login-command-button.mjs @@ -48,6 +48,9 @@ export class CreateLoginButton extends MozLitElement { static get properties() { return { disabled: { type: Boolean, reflect: true }, + // Whether the button is disabled no matter if the "disabled" attribute is + // switched. + hardDisabled: { type: Boolean, reflect: true }, }; } @@ -62,7 +65,7 @@ export class CreateLoginButton extends MozLitElement { l10nId: "create-login-button", variant: "icon-button", icon: "chrome://global/skin/icons/plus.svg", - disabled: this.disabled, + disabled: this.disabled || this.hardDisabled, })} `; } diff --git a/browser/components/aboutlogins/content/components/login-list.mjs b/browser/components/aboutlogins/content/components/login-list.mjs @@ -111,6 +111,28 @@ export default class LoginList extends HTMLElement { this._blankLoginListItem.hidden = true; } + /** + * Whether the user can create logins. + * + * @type {boolean} + */ + _canCreateLogins = false; + + get canCreateLogins() { + return this._canCreateLogins; + } + + set canCreateLogins(value) { + this._canCreateLogins = Boolean(value); + this._canCreateLoginsUpdate(); + } + + _canCreateLoginsUpdate() { + if (this._createLoginButton) { + this._createLoginButton.hardDisabled = !this.canCreateLogins; + } + } + connectedCallback() { if (this.shadowRoot) { return; @@ -122,6 +144,7 @@ export default class LoginList extends HTMLElement { this._count = shadowRoot.querySelector(".count"); this._createLoginButton = shadowRoot.querySelector("create-login-button"); + this._canCreateLoginsUpdate(); this._list = shadowRoot.querySelector("ol"); this._list.appendChild(this._blankLoginListItem); this._sortSelect = shadowRoot.querySelector("#login-sort"); @@ -426,7 +449,7 @@ export default class LoginList extends HTMLElement { break; } case "AboutLoginsShowBlankLogin": { - if (!event.defaultPrevented) { + if (!event.defaultPrevented && this.canCreateLogins) { this._selectedGuid = null; this._setListItemAsSelected(this._blankLoginListItem); }