Bug 1524258 - Sort the permission capabilities based on their localization ID so we don't have to wait for the asynchronous localization. r=Gijs, a=jcristau
authorJared Wein <jwein@mozilla.com>
Tue, 05 Feb 2019 21:01:08 +0000
changeset 516013 dd68a244ab58
parent 516012 914a7948852d
child 516014 310de8854f9b
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, jcristau
bugs1524258
milestone66.0
Bug 1524258 - Sort the permission capabilities based on their localization ID so we don't have to wait for the asynchronous localization. r=Gijs, a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D18372
browser/components/preferences/permissions.js
--- a/browser/components/preferences/permissions.js
+++ b/browser/components/preferences/permissions.js
@@ -415,18 +415,21 @@ var gPermissionManager = {
       case "siteCol":
         sortFunc = (a, b) => {
           return comp.compare(a.getAttribute("origin"), b.getAttribute("origin"));
         };
         break;
 
       case "statusCol":
         sortFunc = (a, b) => {
-          return a.querySelector(".website-capability-value").getAttribute("value") >
-                 b.querySelector(".website-capability-value").getAttribute("value");
+          // The capabilities values ("Allow" and "Block") are localized asynchronously.
+          // Sort based on the guaranteed-present localization ID instead, note that the
+          // ascending/descending arrow may be pointing the wrong way.
+          return a.querySelector(".website-capability-value").getAttribute("data-l10n-id") >
+                 b.querySelector(".website-capability-value").getAttribute("data-l10n-id");
         };
         break;
     }
 
     let comp = new Services.intl.Collator(undefined, {
       usage: "sort",
     });