Bug 1583795 - Select the first breached login when breaches are set initially. r=sfoster
authorJared Wein <jwein@mozilla.com>
Fri, 11 Oct 2019 17:35:54 +0000
changeset 497291 bd59f7b7bb8ac8c2e011391923838c1cd7b35d04
parent 497290 12ff69a8f36063cfc440216c21c6bacb53540ffd
child 497292 6232b11cd533b5bd676b92bb1abe190a94362324
push id36681
push usercbrindusan@mozilla.com
push dateFri, 11 Oct 2019 21:50:12 +0000
treeherdermozilla-central@c5e6477c3a24 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfoster
bugs1583795
milestone71.0a1
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
Bug 1583795 - Select the first breached login when breaches are set initially. r=sfoster Differential Revision: https://phabricator.services.mozilla.com/D48764
browser/components/aboutlogins/content/components/login-list.js
browser/components/aboutlogins/tests/browser/browser_breachAlertDismissals.js
--- a/browser/components/aboutlogins/content/components/login-list.js
+++ b/browser/components/aboutlogins/content/components/login-list.js
@@ -337,16 +337,17 @@ export default class LoginList extends H
     if (this._breachesByLoginGUID.size === 0) {
       this.render();
       return;
     }
     const breachedSortOptionElement = this._sortSelect.namedItem("breached");
     breachedSortOptionElement.hidden = false;
     this._sortSelect.selectedIndex = breachedSortOptionElement.index;
     this._applySortAndScrollToTop();
+    this._selectFirstVisibleLogin();
   }
 
   /**
    * @param {Map} breachesByLoginGUID A Map of breaches by login GUIDs that
    *                                  should be added to the local cache of
    *                                  breaches.
    */
   updateBreaches(breachesByLoginGUID) {
--- a/browser/components/aboutlogins/tests/browser/browser_breachAlertDismissals.js
+++ b/browser/components/aboutlogins/tests/browser/browser_breachAlertDismissals.js
@@ -10,22 +10,25 @@ EXPECTED_BREACH = {
   DataClasses: ["Email addresses", "Usernames", "Passwords", "IP addresses"],
   _status: "synced",
   id: "047940fe-d2fd-4314-b636-b4a952ee0043",
   last_modified: "1541615610052",
   schema: "1541615609018",
 };
 
 add_task(async function setup() {
+  Services.prefs.setCharPref("signon.management.page.sort", "last-changed");
   TEST_LOGIN3 = await addLogin(TEST_LOGIN3);
+  TEST_LOGIN1 = await addLogin(TEST_LOGIN1);
   await BrowserTestUtils.openNewForegroundTab({
     gBrowser,
     url: "about:logins",
   });
   registerCleanupFunction(() => {
+    Services.prefs.clearUserPref("signon.management.page.sort");
     BrowserTestUtils.removeTab(gBrowser.selectedTab);
     Services.logins.removeAllLogins();
   });
 });
 
 add_task(async function test_show_login() {
   let browser = gBrowser.selectedBrowser;
   await ContentTask.spawn(browser, null, async () => {