morgan pushed to branch tor-browser-140.2.0esr-15.0-1 at The Tor Project / Applications / Tor Browser

Commits:

3 changed files:

Changes:

  • browser/components/aboutlogins/content/aboutLogins.mjs
    ... ... @@ -27,9 +27,6 @@ const gElements = {
    27 27
           ".menuitem-remove-all-logins"
    
    28 28
         );
    
    29 29
       },
    
    30
    -  get createNewLoginButton() {
    
    31
    -    return this.loginList.shadowRoot.querySelector(".create-login-button");
    
    32
    -  },
    
    33 30
     };
    
    34 31
     
    
    35 32
     let numberOfLogins = 0;
    
    ... ... @@ -136,9 +133,7 @@ window.addEventListener("AboutLoginsChromeToContent", event => {
    136 133
           gElements.loginList.setSortDirection(event.detail.value.selectedSort);
    
    137 134
           document.documentElement.classList.add("initialized");
    
    138 135
           gElements.loginList.classList.add("initialized");
    
    139
    -      if (!event.detail.value.canCreateLogins) {
    
    140
    -        gElements.createNewLoginButton.disabled = true;
    
    141
    -      }
    
    136
    +      gElements.loginList.canCreateLogins = event.detail.value.canCreateLogins;
    
    142 137
           break;
    
    143 138
         }
    
    144 139
         case "ShowLoginItemError": {
    

  • browser/components/aboutlogins/content/components/login-command-button.mjs
    ... ... @@ -48,6 +48,9 @@ export class CreateLoginButton extends MozLitElement {
    48 48
       static get properties() {
    
    49 49
         return {
    
    50 50
           disabled: { type: Boolean, reflect: true },
    
    51
    +      // Whether the button is disabled no matter if the "disabled" attribute is
    
    52
    +      // switched.
    
    53
    +      hardDisabled: { type: Boolean, reflect: true },
    
    51 54
         };
    
    52 55
       }
    
    53 56
     
    
    ... ... @@ -62,7 +65,7 @@ export class CreateLoginButton extends MozLitElement {
    62 65
             l10nId: "create-login-button",
    
    63 66
             variant: "icon-button",
    
    64 67
             icon: "chrome://global/skin/icons/plus.svg",
    
    65
    -        disabled: this.disabled,
    
    68
    +        disabled: this.disabled || this.hardDisabled,
    
    66 69
           })}
    
    67 70
         `;
    
    68 71
       }
    

  • browser/components/aboutlogins/content/components/login-list.mjs
    ... ... @@ -111,6 +111,28 @@ export default class LoginList extends HTMLElement {
    111 111
         this._blankLoginListItem.hidden = true;
    
    112 112
       }
    
    113 113
     
    
    114
    +  /**
    
    115
    +   * Whether the user can create logins.
    
    116
    +   *
    
    117
    +   * @type {boolean}
    
    118
    +   */
    
    119
    +  _canCreateLogins = false;
    
    120
    +
    
    121
    +  get canCreateLogins() {
    
    122
    +    return this._canCreateLogins;
    
    123
    +  }
    
    124
    +
    
    125
    +  set canCreateLogins(value) {
    
    126
    +    this._canCreateLogins = Boolean(value);
    
    127
    +    this._canCreateLoginsUpdate();
    
    128
    +  }
    
    129
    +
    
    130
    +  _canCreateLoginsUpdate() {
    
    131
    +    if (this._createLoginButton) {
    
    132
    +      this._createLoginButton.hardDisabled = !this.canCreateLogins;
    
    133
    +    }
    
    134
    +  }
    
    135
    +
    
    114 136
       connectedCallback() {
    
    115 137
         if (this.shadowRoot) {
    
    116 138
           return;
    
    ... ... @@ -122,6 +144,7 @@ export default class LoginList extends HTMLElement {
    122 144
     
    
    123 145
         this._count = shadowRoot.querySelector(".count");
    
    124 146
         this._createLoginButton = shadowRoot.querySelector("create-login-button");
    
    147
    +    this._canCreateLoginsUpdate();
    
    125 148
         this._list = shadowRoot.querySelector("ol");
    
    126 149
         this._list.appendChild(this._blankLoginListItem);
    
    127 150
         this._sortSelect = shadowRoot.querySelector("#login-sort");
    
    ... ... @@ -426,7 +449,7 @@ export default class LoginList extends HTMLElement {
    426 449
             break;
    
    427 450
           }
    
    428 451
           case "AboutLoginsShowBlankLogin": {
    
    429
    -        if (!event.defaultPrevented) {
    
    452
    +        if (!event.defaultPrevented && this.canCreateLogins) {
    
    430 453
               this._selectedGuid = null;
    
    431 454
               this._setListItemAsSelected(this._blankLoginListItem);
    
    432 455
             }