morgan pushed to branch tor-browser-140.2.0esr-15.0-1 at The Tor Project /
Applications / Tor Browser
Commits:
6aaf40e2 by Henry Wilkes at 2025-08-26T20:12:02+00:00
fixup! BB 33852: Clean up about:logins (LockWise) to avoid mentioning sync, etc.
TB 44128: Fix about:logins to be able to hard disable the "new-login-button".
- - - - -
3 changed files:
- browser/components/aboutlogins/content/aboutLogins.mjs
- browser/components/aboutlogins/content/components/login-command-button.mjs
- browser/components/aboutlogins/content/components/login-list.mjs
Changes:
=====================================
browser/components/aboutlogins/content/aboutLogins.mjs
=====================================
@@ -27,9 +27,6 @@ const gElements = {
".menuitem-remove-all-logins"
);
},
- get createNewLoginButton() {
- return this.loginList.shadowRoot.querySelector(".create-login-button");
- },
};
let numberOfLogins = 0;
@@ -136,9 +133,7 @@ window.addEventListener("AboutLoginsChromeToContent", event
=> {
gElements.loginList.setSortDirection(event.detail.value.selectedSort);
document.documentElement.classList.add("initialized");
gElements.loginList.classList.add("initialized");
- if (!event.detail.value.canCreateLogins) {
- gElements.createNewLoginButton.disabled = true;
- }
+ gElements.loginList.canCreateLogins = event.detail.value.canCreateLogins;
break;
}
case "ShowLoginItemError": {
=====================================
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,
})}
`;
}
=====================================
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);
}
View it on GitLab:
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/6aaf40e205e948c8413468f099712948bdb85d7d
--
View it on GitLab:
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/6aaf40e205e948c8413468f099712948bdb85d7d
You're receiving this email because of your account on gitlab.torproject.org.
_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]