Backed out 5 changesets (bug 1550131) for browser-chrome failures at browser/components/aboutlogins/tests/browser/browser_masterPassword.js
authorCoroiu Cristina <ccoroiu@mozilla.com>
Tue, 21 May 2019 01:22:53 +0300
changeset 474631 d650f8a160f8c80d2645f4b2936175db013460ec
parent 474630 a4c80ac02e503ab80d94b6aa1584a4c659c0c073
child 474632 91837a92ccf50661a810bae5f130d049cb88a060
push id85911
push userccoroiu@mozilla.com
push dateMon, 20 May 2019 22:25:14 +0000
treeherderautoland@d650f8a160f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1550131
milestone69.0a1
backs out95918413069f5ff80feb050f8ef8d45dd8e08b6e
8e7d6a1c30fa282f118b6c8e065c0f2e10fd1f3a
97eabc06294643214ff8d88a432e39c9e2242391
32ff6a0b84360340e1e2fff213a8e0065586272a
b562886d574d225ceeae632b98285110fdc80a64
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 5 changesets (bug 1550131) for browser-chrome failures at browser/components/aboutlogins/tests/browser/browser_masterPassword.js Backed out changeset 95918413069f (bug 1550131) Backed out changeset 8e7d6a1c30fa (bug 1550131) Backed out changeset 97eabc062946 (bug 1550131) Backed out changeset 32ff6a0b8436 (bug 1550131) Backed out changeset b562886d574d (bug 1550131)
browser/components/aboutlogins/AboutLoginsParent.jsm
browser/components/aboutlogins/content/aboutLogins.ftl
browser/components/aboutlogins/tests/browser/browser.ini
browser/components/aboutlogins/tests/browser/browser_masterPassword.js
--- a/browser/components/aboutlogins/AboutLoginsParent.jsm
+++ b/browser/components/aboutlogins/AboutLoginsParent.jsm
@@ -4,29 +4,26 @@
 
 "use strict";
 
 var EXPORTED_SYMBOLS = ["AboutLoginsParent"];
 
 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "E10SUtils",
                                "resource://gre/modules/E10SUtils.jsm");
-ChromeUtils.defineModuleGetter(this, "Localization",
-                               "resource://gre/modules/Localization.jsm");
 ChromeUtils.defineModuleGetter(this, "LoginHelper",
                                "resource://gre/modules/LoginHelper.jsm");
 ChromeUtils.defineModuleGetter(this, "Services",
                                "resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "log", () => {
   return LoginHelper.createLogger("AboutLoginsParent");
 });
 
 const ABOUT_LOGINS_ORIGIN = "about:logins";
-const MASTER_PASSWORD_NOTIFICATION_ID = "master-password-login-required";
 
 const PRIVILEGED_PROCESS_PREF =
   "browser.tabs.remote.separatePrivilegedContentProcess";
 const PRIVILEGED_PROCESS_ENABLED =
   Services.prefs.getBoolPref(PRIVILEGED_PROCESS_PREF, false);
 
 // When the privileged content process is enabled, we expect about:logins
 // to load in it. Otherwise, it's in a normal web content process.
@@ -43,17 +40,16 @@ const convertSubjectToLogin = subject =>
     const login = LoginHelper.loginToVanillaObject(subject);
     if (!isValidLogin(login)) {
       return null;
     }
     return login;
 };
 
 var AboutLoginsParent = {
-  _l10n: null,
   _subscribers: new WeakSet(),
 
   // Listeners are added in BrowserGlue.jsm
   receiveMessage(message) {
     // Only respond to messages sent from about:logins.
     if (message.target.remoteType != EXPECTED_ABOUTLOGINS_REMOTE_TYPE ||
         message.target.contentPrincipal.originNoSuffix != ABOUT_LOGINS_ORIGIN) {
       return;
@@ -73,18 +69,16 @@ var AboutLoginsParent = {
           return;
         }
 
         message.target.ownerGlobal.openWebLinkIn(logins[0].hostname, "tab", {relatedToCurrent: true});
         break;
       }
       case "AboutLogins:Subscribe": {
         if (!ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers).length) {
-          Services.obs.addObserver(this, "passwordmgr-crypto-login");
-          Services.obs.addObserver(this, "passwordmgr-crypto-loginCanceled");
           Services.obs.addObserver(this, "passwordmgr-storage-changed");
         }
         this._subscribers.add(message.target);
 
         let messageManager = message.target.messageManager;
         messageManager.sendAsyncMessage("AboutLogins:AllLogins", this.getAllLogins());
         break;
       }
@@ -107,33 +101,20 @@ var AboutLoginsParent = {
         Services.logins.modifyLogin(logins[0], modifiedLogin);
         break;
       }
     }
   },
 
   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");
       return;
     }
 
-    if (topic == "passwordmgr-crypto-login") {
-      this.removeMasterPasswordLoginNotifications();
-      this.messageSubscribers("AboutLogins:AllLogins", this.getAllLogins());
-      return;
-    }
-
-    if (topic == "passwordmgr-crypto-loginCanceled") {
-      this.showMasterPasswordLoginNotifications();
-      return;
-    }
-
     switch (type) {
       case "addLogin": {
         const login = convertSubjectToLogin(subject);
         if (!login) {
           return;
         }
         this.messageSubscribers("AboutLogins:LoginAdded", login);
         break;
@@ -155,78 +136,25 @@ var AboutLoginsParent = {
         this.messageSubscribers("AboutLogins:LoginRemoved", login);
       }
       default: {
         break;
       }
     }
   },
 
-  async showMasterPasswordLoginNotifications() {
-    if (!this._l10n) {
-      this._l10n = new Localization(["browser/aboutLogins.ftl"]);
-    }
-
-    let messageString = await this._l10n.formatValue("master-password-notification-message");
-    for (let subscriber of this._subscriberIterator()) {
-      // If there's already an existing notification bar, don't do anything.
-      let {gBrowser} = subscriber.ownerGlobal;
-      let browser = subscriber;
-      let notificationBox = gBrowser.getNotificationBox(browser);
-      let notification = notificationBox.getNotificationWithValue(MASTER_PASSWORD_NOTIFICATION_ID);
-      if (notification) {
-        continue;
-      }
-
-      // Configure the notification bar
-      let priority = notificationBox.PRIORITY_WARNING_MEDIUM;
-      let iconURL = "chrome://browser/skin/login.svg";
-      let reloadLabel = await this._l10n.formatValue("master-password-reload-button-label");
-      let reloadKey = await this._l10n.formatValue("master-password-reload-button-accesskey");
-
-      let buttons = [{
-        label: reloadLabel,
-        accessKey: reloadKey,
-        popup: null,
-        callback() { browser.reload(); },
-      }];
-
-      notification = notificationBox.appendNotification(messageString, MASTER_PASSWORD_NOTIFICATION_ID,
-                                                        iconURL, priority, buttons);
-    }
-  },
-
-  removeMasterPasswordLoginNotifications() {
-    for (let subscriber of this._subscriberIterator()) {
-      let {gBrowser} = subscriber.ownerGlobal;
-      let browser = subscriber;
-      let notificationBox = gBrowser.getNotificationBox(browser);
-      let notification = notificationBox.getNotificationWithValue(MASTER_PASSWORD_NOTIFICATION_ID);
-      if (!notification) {
-        continue;
-      }
-      notificationBox.removeNotification(notification);
-    }
-  },
-
-  * _subscriberIterator() {
+  messageSubscribers(name, details) {
     let subscribers = ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers);
     for (let subscriber of subscribers) {
       if (subscriber.remoteType != EXPECTED_ABOUTLOGINS_REMOTE_TYPE ||
           !subscriber.contentPrincipal ||
           subscriber.contentPrincipal.originNoSuffix != ABOUT_LOGINS_ORIGIN) {
         this._subscribers.delete(subscriber);
         continue;
       }
-      yield subscriber;
-    }
-  },
-
-  messageSubscribers(name, details) {
-    for (let subscriber of this._subscriberIterator()) {
       try {
         subscriber.messageManager.sendAsyncMessage(name, details);
       } catch (ex) {}
     }
   },
 
   getAllLogins() {
     return Services.logins
--- a/browser/components/aboutlogins/content/aboutLogins.ftl
+++ b/browser/components/aboutlogins/content/aboutLogins.ftl
@@ -35,14 +35,8 @@ login-item =
   .copy-username-button = Copy
   .open-site-button = Launch
   .password-label = Password
   .save-changes-button = Save Changes
   .time-created = Created: { DATETIME($timeCreated, day: "numeric", month: "long", year: "numeric") }
   .time-changed = Last changed: { DATETIME($timeChanged, day: "numeric", month: "long", year: "numeric") }
   .time-used = Last used: { DATETIME($timeUsed, day: "numeric", month: "long", year: "numeric") }
   .username-label = Username
-
-master-password-notification-message = Please enter your master password to view saved logins & passwords
-# TODO: Not sure how to use formatValue with these as attributes on a single ID
-master-password-reload-button-label = Log in
-# TODO: Not sure how to use formatValue with these as attributes on a single ID
-master-password-reload-button-accesskey = L
--- a/browser/components/aboutlogins/tests/browser/browser.ini
+++ b/browser/components/aboutlogins/tests/browser/browser.ini
@@ -1,10 +1,9 @@
 [DEFAULT]
 prefs =
   signon.management.page.enabled=true
 
 [browser_copyToClipboardButton.js]
 [browser_deleteLogin.js]
 [browser_loginListChanges.js]
-[browser_masterPassword.js]
 [browser_openSite.js]
 [browser_updateLogin.js]
deleted file mode 100644
--- a/browser/components/aboutlogins/tests/browser/browser_masterPassword.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-ChromeUtils.import("resource://testing-common/LoginTestUtils.jsm", this);
-
-/**
- * Waits for the master password prompt and performs an action.
- * @param {string} action Set to "authenticate" to log in or "cancel" to
- *        close the dialog without logging in.
- */
-function waitForMPDialog(action) {
-  let dialogShown = TestUtils.topicObserved("common-dialog-loaded");
-  return dialogShown.then(function([subject]) {
-    let dialog = subject.Dialog;
-    is(dialog.args.title, "Password Required");
-    if (action == "authenticate") {
-      SpecialPowers.wrap(dialog.ui.password1Textbox)
-                   .setUserInput(LoginTestUtils.masterPassword.masterPassword);
-      dialog.ui.button0.click();
-    } else if (action == "cancel") {
-      dialog.ui.button1.click();
-    }
-    return BrowserTestUtils.waitForEvent(window, "DOMModalDialogClosed");
-  });
-}
-
-function getNumberOfLoginsDisplayed(browser) {
-  return ContentTask.spawn(browser, null, async () => {
-    let loginList = Cu.waiveXrays(content.document.querySelector("login-list"));
-    return loginList._logins.length;
-  });
-}
-
-add_task(async function test() {
-  let login = LoginTestUtils.testData.formLogin({
-    hostname: "https://example.com",
-    formSubmitURL: "https://example.com",
-    username: "username",
-    password: "password",
-  });
-
-  Services.logins.addLogin(login);
-  LoginTestUtils.masterPassword.enable();
-
-  let mpDialogShown = waitForMPDialog("cancel");
-  await BrowserTestUtils.openNewForegroundTab({gBrowser, url: "about:logins"});
-  await mpDialogShown;
-
-  registerCleanupFunction(function() {
-    LoginTestUtils.masterPassword.disable();
-    Services.logins.removeAllLogins();
-    BrowserTestUtils.removeTab(gBrowser.selectedTab);
-  });
-
-  let browser = gBrowser.selectedBrowser;
-  let logins = await getNumberOfLoginsDisplayed(browser);
-  is(logins, 0, "No logins should be displayed when MP is set and unauthenticated");
-
-  let notificationBox = gBrowser.getNotificationBox(browser);
-  let notification = notificationBox.currentNotification;
-
-  ok(notification, "Notification should be visible");
-  is(notification.getAttribute("value"), "master-password-login-required",
-     "Should be showing the right notification");
-
-  let buttons = notification.querySelectorAll(".notification-button");
-  is(buttons.length, 1, "Should have one button.");
-
-  let refreshPromise = BrowserTestUtils.browserLoaded(browser);
-  // Sign in with the Master Password this time the dialog is shown
-  mpDialogShown = waitForMPDialog("authenticate");
-  // Click the button to reload the page.
-  buttons[0].click();
-  await refreshPromise;
-  info("Page reloaded");
-
-  await mpDialogShown;
-  info("Master Password dialog shown and authenticated");
-
-  logins = await getNumberOfLoginsDisplayed(browser);
-  is(logins, 1, "Logins should be displayed when MP is set and authenticated");
-});