Loading browser/components/aboutlogins/content/aboutLogins.mjs +1 −6 Original line number Diff line number Diff line Loading @@ -27,9 +27,6 @@ const gElements = { ".menuitem-remove-all-logins" ); }, get createNewLoginButton() { return this.loginList.shadowRoot.querySelector(".create-login-button"); }, }; let numberOfLogins = 0; Loading Loading @@ -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": { Loading browser/components/aboutlogins/content/components/login-command-button.mjs +4 −1 Original line number Diff line number Diff line Loading @@ -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 }, }; } Loading @@ -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, })} `; } Loading browser/components/aboutlogins/content/components/login-list.mjs +24 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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"); Loading Loading @@ -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); } Loading Loading
browser/components/aboutlogins/content/aboutLogins.mjs +1 −6 Original line number Diff line number Diff line Loading @@ -27,9 +27,6 @@ const gElements = { ".menuitem-remove-all-logins" ); }, get createNewLoginButton() { return this.loginList.shadowRoot.querySelector(".create-login-button"); }, }; let numberOfLogins = 0; Loading Loading @@ -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": { Loading
browser/components/aboutlogins/content/components/login-command-button.mjs +4 −1 Original line number Diff line number Diff line Loading @@ -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 }, }; } Loading @@ -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, })} `; } Loading
browser/components/aboutlogins/content/components/login-list.mjs +24 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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"); Loading Loading @@ -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); } Loading