Bug 894349 - Sort permissions in the site identity panel and the page info window alphabetically. r=jaws
authorDão Gottwald <dao@mozilla.com>
Tue, 16 Jul 2013 22:12:48 +0200
changeset 138755 f38845197c8b35941727c89c8de02d08c8b531d8
parent 138754 e482a2e5d3b4e70a4f5c906fbec229a34b55f863
child 138756 e97286839337c46c3d136372bce06836437a595b
push idunknown
push userunknown
push dateunknown
reviewersjaws
bugs894349
milestone25.0a1
Bug 894349 - Sort permissions in the site identity panel and the page info window alphabetically. r=jaws
browser/modules/SitePermissions.jsm
--- a/browser/modules/SitePermissions.jsm
+++ b/browser/modules/SitePermissions.jsm
@@ -22,17 +22,21 @@ this.SitePermissions = {
    */
   isSupportedURI: function (aURI) {
     return aURI.schemeIs("http") || aURI.schemeIs("https");
   },
 
   /* Returns an array of all permission IDs.
    */
   listPermissions: function () {
-    return Object.keys(gPermissionObject);
+    let array = Object.keys(gPermissionObject);
+    array.sort((a, b) => {
+      return this.getPermissionLabel(a).localeCompare(this.getPermissionLabel(b));
+    });
+    return array;
   },
 
   /* Returns an array of permission states to be exposed to the user for a
    * permission with the given ID.
    */
   getAvailableStates: function (aPermissionID) {
     if (aPermissionID in gPermissionObject &&
         gPermissionObject[aPermissionID].states)