Bug 1352325 - [Form Autofill] Sort manage profiles dialog by last modified time. r=lchang draft
authorScott Wu <scottcwwu@gmail.com>
Tue, 25 Apr 2017 14:04:28 +0800
changeset 567552 7d7d640ebdb91359c4521ec11829f2da3c2f804f
parent 567507 85932a5027c024900bb0e58cdbc52ecf9a32e1f5
child 625700 f9ef91fa9c7aba6629fe4cf6243603db305dbcc0
push id55626
push userbmo:scwwu@mozilla.com
push dateTue, 25 Apr 2017 08:36:47 +0000
reviewerslchang
bugs1352325
milestone55.0a1
Bug 1352325 - [Form Autofill] Sort manage profiles dialog by last modified time. r=lchang MozReview-Commit-ID: 8WVLs04aDCm
browser/extensions/formautofill/content/manageProfiles.js
--- a/browser/extensions/formautofill/content/manageProfiles.js
+++ b/browser/extensions/formautofill/content/manageProfiles.js
@@ -59,16 +59,18 @@ ManageProfileDialog.prototype = {
   /**
    * Load profiles and render them.
    *
    * @returns {promise}
    */
   loadProfiles() {
     return this.getProfiles().then(profiles => {
       log.debug("profiles:", profiles);
+      // Sort by last modified time starting with most recent
+      profiles.sort((a, b) => b.timeLastModified - a.timeLastModified);
       this.renderProfileElements(profiles);
       this.updateButtonsStates(this._selectedOptions.length);
     });
   },
 
   /**
    * Get profiles from storage.
    *