Backed out changeset 80bb50e715a3 (bug 1550122) for browser_loginItemErrors.js failures
authorBogdan Tara <btara@mozilla.com>
Fri, 30 Aug 2019 07:00:07 +0300
changeset 490805 ce8d92d5a45b48b2d191503dcc73dc844bd6986a
parent 490804 4559e60f4ddebbe462b4aa5569849a404b29cafa
child 490806 b25884891abc435e5b79e3a00087018847d697fa
push id94048
push userbtara@mozilla.com
push dateFri, 30 Aug 2019 04:00:45 +0000
treeherderautoland@ce8d92d5a45b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1550122
milestone70.0a1
backs out80bb50e715a30879981baac975767e26f42a7a87
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 80bb50e715a3 (bug 1550122) for browser_loginItemErrors.js failures
browser/components/BrowserGlue.jsm
browser/components/aboutlogins/AboutLoginsChild.jsm
browser/components/aboutlogins/AboutLoginsParent.jsm
browser/components/aboutlogins/content/aboutLogins.html
browser/components/aboutlogins/content/aboutLogins.js
browser/components/aboutlogins/content/components/login-item.css
browser/components/aboutlogins/content/components/login-item.js
browser/components/aboutlogins/tests/browser/browser.ini
browser/components/aboutlogins/tests/browser/browser_loginItemErrors.js
browser/locales/en-US/browser/aboutLogins.ftl
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -133,17 +133,16 @@ let LEGACY_ACTORS = {
       messages: [
         "AboutLogins:AllLogins",
         "AboutLogins:LocalizeBadges",
         "AboutLogins:LoginAdded",
         "AboutLogins:LoginModified",
         "AboutLogins:LoginRemoved",
         "AboutLogins:MasterPasswordResponse",
         "AboutLogins:SendFavicons",
-        "AboutLogins:ShowLoginItemError",
         "AboutLogins:SyncState",
         "AboutLogins:UpdateBreaches",
       ],
     },
   },
 
   AboutReader: {
     child: {
--- a/browser/components/aboutlogins/AboutLoginsChild.jsm
+++ b/browser/components/aboutlogins/AboutLoginsChild.jsm
@@ -182,19 +182,16 @@ class AboutLoginsChild extends ActorChil
       case "AboutLogins:MasterPasswordResponse":
         if (masterPasswordPromise) {
           masterPasswordPromise.resolve(message.data);
         }
         break;
       case "AboutLogins:SendFavicons":
         this.sendToContent("SendFavicons", message.data);
         break;
-      case "AboutLogins:ShowLoginItemError":
-        this.sendToContent("ShowLoginItemError", message.data);
-        break;
       case "AboutLogins:SyncState":
         this.sendToContent("SyncState", message.data);
         break;
       case "AboutLogins:UpdateBreaches":
         this.sendToContent("UpdateBreaches", message.data);
         break;
     }
   }
--- a/browser/components/aboutlogins/AboutLoginsParent.jsm
+++ b/browser/components/aboutlogins/AboutLoginsParent.jsm
@@ -96,22 +96,17 @@ var AboutLoginsParent = {
           return;
         }
         newLogin.origin = origin;
         Object.assign(newLogin, {
           formActionOrigin: "",
           usernameField: "",
           passwordField: "",
         });
-        newLogin = LoginHelper.vanillaObjectToLogin(newLogin);
-        try {
-          Services.logins.addLogin(newLogin);
-        } catch (error) {
-          this.handleLoginStorageErrors(newLogin, error, message);
-        }
+        Services.logins.addLogin(LoginHelper.vanillaObjectToLogin(newLogin));
         break;
       }
       case "AboutLogins:DeleteLogin": {
         let login = LoginHelper.vanillaObjectToLogin(message.data.login);
         Services.logins.removeLogin(login);
         break;
       }
       case "AboutLogins:DismissBreachAlert": {
@@ -459,35 +454,23 @@ var AboutLoginsParent = {
 
         let modifiedLogin = logins[0].clone();
         if (loginUpdates.hasOwnProperty("username")) {
           modifiedLogin.username = loginUpdates.username;
         }
         if (loginUpdates.hasOwnProperty("password")) {
           modifiedLogin.password = loginUpdates.password;
         }
-        try {
-          Services.logins.modifyLogin(logins[0], modifiedLogin);
-        } catch (error) {
-          this.handleLoginStorageErrors(modifiedLogin, error, message);
-        }
+
+        Services.logins.modifyLogin(logins[0], modifiedLogin);
         break;
       }
     }
   },
 
-  handleLoginStorageErrors(login, error, message) {
-    const messageManager = message.target.messageManager;
-    const errorMessage = error.message;
-    messageManager.sendAsyncMessage("AboutLogins:ShowLoginItemError", {
-      login: augmentVanillaLoginObject(login),
-      errorMessage,
-    });
-  },
-
   async observe(subject, topic, type) {
     if (!ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers).length) {
       Services.obs.removeObserver(this, "passwordmgr-crypto-login");
       Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled");
       Services.obs.removeObserver(this, "passwordmgr-storage-changed");
       Services.obs.removeObserver(this, UIState.ON_UPDATE);
       this._observersAdded = false;
       return;
--- a/browser/components/aboutlogins/content/aboutLogins.html
+++ b/browser/components/aboutlogins/content/aboutLogins.html
@@ -136,19 +136,16 @@
         </ul>
       </section>
     </template>
 
     <template id="login-item-template">
       <link rel="stylesheet" href="chrome://global/skin/in-content/common.css">
       <link rel="stylesheet" href="chrome://browser/content/aboutlogins/common.css">
       <link rel="stylesheet" href="chrome://browser/content/aboutlogins/components/login-item.css">
-      <div class="error-message">
-        <span class="error-message-text"></span>
-      </div>
       <div class="breach-alert">
         <span class="breach-alert-text" data-l10n-id="breach-alert-text"></span>
         <a class="breach-alert-link" data-l10n-id="breach-alert-link" href="#" rel="noopener noreferer" target="_blank"></a>
         <button class="dismiss-breach-alert"></button>
       </div>
       <div class="header">
         <div class="login-item-favicon-wrapper">
           <img class="login-item-favicon" src="" alt=""/>
--- a/browser/components/aboutlogins/content/aboutLogins.js
+++ b/browser/components/aboutlogins/content/aboutLogins.js
@@ -61,20 +61,16 @@ window.addEventListener("AboutLoginsChro
       numberOfLogins--;
       updateNoLogins();
       break;
     }
     case "SendFavicons": {
       gElements.loginList.addFavicons(event.detail.value);
       break;
     }
-    case "ShowLoginItemError": {
-      gElements.loginItem.showLoginItemError(event.detail.value);
-      break;
-    }
     case "SyncState": {
       gElements.fxAccountsButton.updateState(event.detail.value);
       gElements.loginFooter.hidden = event.detail.value.hideMobileFooter;
       break;
     }
     case "UpdateBreaches": {
       gElements.loginList.updateBreaches(event.detail.value);
       gElements.loginItem.updateBreaches(event.detail.value);
--- a/browser/components/aboutlogins/content/components/login-item.css
+++ b/browser/components/aboutlogins/content/components/login-item.css
@@ -289,36 +289,16 @@ a.breach-alert-link {
   inset-block-start: 12px;
 }
 
 .dismiss-breach-alert,
 .dismiss-breach-alert:hover {
   background-color: transparent;
 }
 
-.error-message {
-  color: #fff;
-  background-color: var(--red-60);
-  border: 1px solid transparent;
-  padding-block: 6px;
-  display: inline-block;
-  padding-inline-start: 32px;
-  padding-inline-end: 16px;
-  background-image: url("chrome://global/skin/icons/warning.svg");
-  background-repeat: no-repeat;
-  background-position: left 10px center;
-  -moz-context-properties: fill;
-  fill: currentColor;
-  margin-bottom: 38px;
-}
-
-.error-message:dir(rtl) {
-  background-position-x: right 10px;
-}
-
 @supports -moz-bool-pref("browser.in-content.dark-mode") {
   @media (prefers-color-scheme: dark) {
     :host {
       --reveal-checkbox-opacity: .8;
       --reveal-checkbox-opacity-hover: 1;
       --reveal-checkbox-opacity-active: .6;
       --success-color: #86DE74;
     }
--- a/browser/components/aboutlogins/content/components/login-item.js
+++ b/browser/components/aboutlogins/content/components/login-item.js
@@ -36,17 +36,16 @@ export default class LoginItem extends H
     this._copyPasswordButton = this.shadowRoot.querySelector(
       ".copy-password-button"
     );
     this._copyUsernameButton = this.shadowRoot.querySelector(
       ".copy-username-button"
     );
     this._deleteButton = this.shadowRoot.querySelector(".delete-button");
     this._editButton = this.shadowRoot.querySelector(".edit-button");
-    this._errorMessage = this.shadowRoot.querySelector(".error-message");
     this._form = this.shadowRoot.querySelector("form");
     this._originInput = this.shadowRoot.querySelector("input[name='origin']");
     this._usernameInput = this.shadowRoot.querySelector(
       "input[name='username']"
     );
     this._passwordInput = this.shadowRoot.querySelector(
       "input[name='password']"
     );
@@ -84,19 +83,17 @@ export default class LoginItem extends H
     this._originInput.addEventListener("auxclick", this);
     window.addEventListener("AboutLoginsInitialLoginSelected", this);
     window.addEventListener("AboutLoginsLoadInitialFavicon", this);
     window.addEventListener("AboutLoginsLoginSelected", this);
     window.addEventListener("AboutLoginsShowBlankLogin", this);
   }
 
   async render() {
-    [this._errorMessage, this._breachAlert].forEach(el => {
-      el.hidden = true;
-    });
+    this._breachAlert.hidden = true;
     if (this._breachesMap && this._breachesMap.has(this._login.guid)) {
       const breachDetails = this._breachesMap.get(this._login.guid);
       const breachAlertLink = this._breachAlert.querySelector(
         ".breach-alert-link"
       );
       breachAlertLink.href = breachDetails.breachAlertURL;
       document.l10n.setAttributes(
         this._dismissBreachAlert,
@@ -158,40 +155,16 @@ export default class LoginItem extends H
     document.dispatchEvent(
       new CustomEvent("AboutLoginsDismissBreachAlert", {
         bubbles: true,
         detail: this._login,
       })
     );
   }
 
-  showLoginItemError(error) {
-    const errorMessageText = this._errorMessage.querySelector(
-      ".error-message-text"
-    );
-    if (!error.errorMessage) {
-      return;
-    }
-    if (error.errorMessage.includes("This login already exists")) {
-      document.l10n.setAttributes(
-        errorMessageText,
-        "about-logins-error-message-duplicate-login",
-        {
-          loginTitle: error.login.title,
-        }
-      );
-    } else {
-      document.l10n.setAttributes(
-        errorMessageText,
-        "about-logins-error-message-default"
-      );
-    }
-    this._errorMessage.hidden = false;
-  }
-
   async handleEvent(event) {
     switch (event.type) {
       case "AboutLoginsInitialLoginSelected": {
         this.setLogin(event.detail, { skipFocusChange: true });
         break;
       }
       case "AboutLoginsLoadInitialFavicon": {
         this.render();
--- a/browser/components/aboutlogins/tests/browser/browser.ini
+++ b/browser/components/aboutlogins/tests/browser/browser.ini
@@ -12,17 +12,16 @@ skip-if = asan || debug
 skip-if = asan || debug || verify # bug 1574023
 [browser_confirmDeleteDialog.js]
 [browser_contextmenuFillLogins.js]
 [browser_copyToClipboardButton.js]
 [browser_createLogin.js]
 [browser_deleteLogin.js]
 [browser_dismissFooter.js]
 [browser_fxAccounts.js]
-[browser_loginItemErrors.js]
 [browser_loginListChanges.js]
 [browser_masterPassword.js]
 skip-if = (os == 'linux') # bug 1569789
 [browser_noLoginsView.js]
 [browser_openFiltered.js]
 [browser_openImport.js]
 skip-if = (os != "win") # import is only available on Windows
 [browser_openPreferences.js]
deleted file mode 100644
--- a/browser/components/aboutlogins/tests/browser/browser_loginItemErrors.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-add_task(async function setup() {
-  await BrowserTestUtils.openNewForegroundTab({
-    gBrowser,
-    url: "about:logins",
-  });
-  registerCleanupFunction(() => {
-    BrowserTestUtils.removeTab(gBrowser.selectedTab);
-    Services.logins.removeAllLogins();
-  });
-});
-
-add_task(async function test_showLoginItemErrors() {
-  const browser = gBrowser.selectedBrowser;
-  let LOGIN_TO_UPDATE = new nsLoginInfo(
-    "https://example.com/",
-    "https://example.com/",
-    null,
-    "user2",
-    "pass2",
-    "username",
-    "password"
-  );
-  LOGIN_TO_UPDATE = Services.logins.addLogin(LOGIN_TO_UPDATE);
-
-  await ContentTask.spawn(
-    browser,
-    LoginHelper.loginToVanillaObject(LOGIN_TO_UPDATE),
-    async loginToUpdate => {
-      const loginItem = Cu.waiveXrays(
-        content.document.querySelector("login-item")
-      );
-      const loginItemErrorMessage = Cu.waiveXrays(
-        loginItem.shadowRoot.querySelector(".error-message")
-      );
-      const loginList = Cu.waiveXrays(
-        content.document.querySelector("login-list")
-      );
-
-      const createButton = loginList._createLoginButton;
-      createButton.click();
-
-      const loginUpdates = {
-        origin: "https://example.com/",
-        password: "my1GoodPassword",
-        username: "user1",
-      };
-
-      const event = Cu.cloneInto(
-        {
-          bubbles: true,
-          detail: loginUpdates,
-        },
-        content
-      );
-
-      content.dispatchEvent(
-        // adds first lgoin
-        new content.CustomEvent("AboutLoginsCreateLogin", event)
-      );
-
-      ok(
-        loginItemErrorMessage.hidden,
-        "An error message should not be displayed after adding a new login."
-      );
-
-      content.dispatchEvent(
-        // adds a duplicate of the first login
-        new content.CustomEvent("AboutLoginsCreateLogin", event)
-      );
-
-      const loginItemErrorMessageVisible = await ContentTaskUtils.waitForCondition(
-        () => {
-          return !loginItemErrorMessage.hidden;
-        },
-        "Waiting for error message to be shown after attempting to create a duplicate login."
-      );
-      ok(
-        loginItemErrorMessageVisible,
-        "An error message should be shown after user attempts to add a login that already exists."
-      );
-
-      const loginItemErrorMessageText = loginItemErrorMessage.querySelector(
-        "span"
-      );
-      ok(
-        loginItemErrorMessageText.dataset.l10nId ===
-          "about-logins-error-message-duplicate-login",
-        "The correct error message is displayed."
-      );
-
-      let loginListItem = Cu.waiveXrays(
-        loginList.shadowRoot.querySelector(
-          `.login-list-item[data-guid='${loginToUpdate.guid}']`
-        )
-      );
-      loginListItem.click();
-
-      ok(
-        loginItemErrorMessage.hidden,
-        "The error message should no longer be visible."
-      );
-
-      const editButton = loginItem.shadowRoot.querySelector(".edit-button");
-      editButton.click();
-
-      content.dispatchEvent(
-        // attempt to update LOGIN_TO_UPDATE to a username/origin combination that already exists.
-        new content.CustomEvent("AboutLoginsUpdateLogin", event)
-      );
-
-      const loginAlreadyExistsErrorShownAfterUpdate = ContentTaskUtils.waitForCondition(
-        () => {
-          return !loginItemErrorMessage.hidden;
-        },
-        "Waiting for error message to show after updating login to existing login."
-      );
-      ok(
-        loginAlreadyExistsErrorShownAfterUpdate,
-        "An error message should be shown after updating a login to a username/origin combination that already exists."
-      );
-    }
-  );
-});
--- a/browser/locales/en-US/browser/aboutLogins.ftl
+++ b/browser/locales/en-US/browser/aboutLogins.ftl
@@ -136,19 +136,8 @@ confirm-discard-changes-dialog-message =
 confirm-discard-changes-dialog-confirm-button = Discard
 
 ## Breach Alert notification
 
 breach-alert-text = Passwords were leaked or stolen from this website since you last updated your login details. Change your password to protect your account.
 breach-alert-link = Learn more about this breach.
 breach-alert-dismiss =
     .title = Close this alert
-
-## Error Messages
-
-# This is an error message that appears when a user attempts to save
-# a new login that is identical to an existing saved login.
-# Variables:
-#   $loginTitle (String) - The title of the website associated with the login.
-about-logins-error-message-duplicate-login = An entry for { $loginTitle } with that username already exists.
-
-# This is a generic error message.
-about-logins-error-message-default = An error occurred while trying to save this password.