Bug 1570846 - Switch permissionsManager and cookieViewer to use Services.jsm. r=frg a=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sun, 11 Aug 2019 14:17:22 +0200
changeset 32261 fbd3fd31c479d6d76a6f43a1d52cdfbaa0bbaf41
parent 32260 b8df6618678c0e9d483e1eddef9ba8835f48da7f
child 32262 3819fbc7686bbde419f6b5ace2bc9c2908afae61
push id209
push userfrgrahl@gmx.net
push dateSun, 11 Aug 2019 12:21:39 +0000
treeherdercomm-esr60@7a01e33fff91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg, frg
bugs1570846
Bug 1570846 - Switch permissionsManager and cookieViewer to use Services.jsm. r=frg a=frg
suite/components/permissions/content/cookieViewer.js
suite/components/permissions/content/cookieViewer.xul
suite/components/permissions/content/permissionsManager.js
suite/components/permissions/content/permissionsManager.xul
--- a/suite/components/permissions/content/cookieViewer.js
+++ b/suite/components/permissions/content/cookieViewer.js
@@ -2,76 +2,69 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
-var kObserverService;
-
-// interface variables
-var cookiemanager         = null;          // cookiemanager interface
-var permissionmanager     = null;          // permissionmanager interface
-var promptservice         = null;          // promptservice interface
-var gDateService = null;
-
 // cookies and permissions list
 var cookies              = [];
 var permissions          = [];
 var allCookies           = [];
 var deletedCookies       = [];
 var deletedPermissions   = [];
 
-const nsIPermissionManager = Ci.nsIPermissionManager;
-const nsICookiePermission = Ci.nsICookiePermission;
-
 var cookieBundle;
 var gUpdatingBatch = "";
 
 function Startup() {
 
   // arguments passed to this routine:
   //   cookieManager
 
-  // xpconnect to cookiemanager/permissionmanager/promptservice interfaces
-  cookiemanager = Cc["@mozilla.org/cookiemanager;1"]
-                    .getService(Ci.nsICookieManager);
-  permissionmanager = Cc["@mozilla.org/permissionmanager;1"]
-                        .getService(Ci.nsIPermissionManager);
-  promptservice = Cc["@mozilla.org/embedcomp/prompt-service;1"]
-                    .getService(Ci.nsIPromptService);
-
   // intialize string bundle
   cookieBundle = document.getElementById("cookieBundle");
 
   // load in the cookies and permissions
   cookiesTree = document.getElementById("cookiesTree");
   permissionsTree = document.getElementById("permissionsTree");
   loadCookies();
   loadPermissions();
 
   // be prepared to reload the display if anything changes
-  kObserverService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
-  kObserverService.addObserver(cookieReloadDisplay, "cookie-changed");
-  kObserverService.addObserver(cookieReloadDisplay, "perm-changed");
+  Services.obs.addObserver.addObserver(cookieReloadDisplay, "cookie-changed");
+  Services.obs.addObserver.addObserver(cookieReloadDisplay, "perm-changed");
 
   // filter the table if requested by caller
   if (window.arguments &&
       window.arguments[0] &&
       window.arguments[0].filterString)
     setFilter(window.arguments[0].filterString);
 
   document.getElementById("filter").focus();
 }
 
 function Shutdown() {
-  kObserverService.removeObserver(cookieReloadDisplay, "cookie-changed");
-  kObserverService.removeObserver(cookieReloadDisplay, "perm-changed");
+  Services.obs.removeObserver(cookieReloadDisplay, "cookie-changed");
+  Services.obs.removeObserver(cookieReloadDisplay, "perm-changed");
+}
+
+function PromptConfirm(title, msg, yes) {
+  var flags =
+    ((Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
+     (Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1) +
+     Services.prompt.BUTTON_POS_1_DEFAULT)
+  return Services.prompt.confirmEx(window,
+                                   cookieBundle.getString(title),
+                                   cookieBundle.getString(msg),
+                                   flags,
+                                   cookieBundle.getString(yes),
+                                   null, null, null, {value:0});
 }
 
 var cookieReloadDisplay = {
   observe: function(subject, topic, state) {
     if (topic == gUpdatingBatch)
       return;
     if (topic == "cookie-changed") {
       allCookies.length = 0;
@@ -86,18 +79,16 @@ var cookieReloadDisplay = {
 function doSelectAll() {
   var elem = document.commandDispatcher.focusedElement;
   if (elem && "treeBoxObject" in elem)
     elem.view.selection.selectAll();
 }
 
 /*** =================== COOKIES CODE =================== ***/
 
-const nsICookie = Ci.nsICookie;
-
 var cookiesTreeView = {
   rowCount : 0,
   setTree : function(tree){},
   getImageSrc : function(row,column) {},
   getProgressMode : function(row,column) {},
   getCellValue : function(row,column) {},
   getCellText : function(row,column){
     var rv="";
@@ -136,17 +127,17 @@ function Cookie(id, host, name, path, or
   this.rawHost = rawHost;
   this.isSecure = isSecure;
   this.expires = GetExpiresString(expires);
   this.expiresSortValue = expires;
 }
 
 function loadCookies() {
   // load cookies into a table
-  var enumerator = cookiemanager.enumerator;
+  var enumerator = Services.cookies.enumerator;
   var count = 0;
   while (enumerator.hasMoreElements()) {
     var nextCookie = enumerator.getNext();
     if (!nextCookie) break;
     nextCookie = nextCookie.QueryInterface(Ci.nsICookie);
     var host = nextCookie.host;
     allCookies[count] =
       new Cookie(count++, host, nextCookie.name,
@@ -234,25 +225,21 @@ function ClearCookieProperties() {
   var properties =
     ["ifl_name","ifl_value","ifl_host","ifl_path","ifl_isSecure","ifl_expires"];
   for (let prop of properties) {
     document.getElementById(prop).value = "";
   }
 }
 
 function DeleteCookie() {
-  if (cookiesTreeView.selection.count > 1) {
-    var title = cookieBundle.getString("deleteSelectedCookiesTitle");
-    var msg = cookieBundle.getString("deleteSelectedCookies");
-    var flags = ((promptservice.BUTTON_TITLE_IS_STRING * promptservice.BUTTON_POS_0) +
-                 (promptservice.BUTTON_TITLE_CANCEL * promptservice.BUTTON_POS_1) +
-                 promptservice.BUTTON_POS_1_DEFAULT)
-    var yes = cookieBundle.getString("deleteSelectedCookiesYes");
-    if (promptservice.confirmEx(window, title, msg, flags, yes, null, null, null, {value:0}) == 1)
-      return;
+  if (cookiesTreeView.selection.count > 1 &&
+      PromptConfirm("deleteSelectedCookiesTitle",
+                    "deleteSelectedCookies",
+                    "deleteSelectedCookiesYes") == 1) {
+    return;
   }
   DeleteSelectedItemFromTree(cookiesTree, cookiesTreeView,
                                  cookies, deletedCookies,
                                  "removeCookie", "removeAllCookies");
   if (document.getElementById("filter").value) {
     // remove selected cookies from unfiltered set
     for (let cookie of deletedCookies) {
       allCookies.splice(allCookies.indexOf(cookie), 1);
@@ -260,41 +247,38 @@ function DeleteCookie() {
   }
   if (!cookies.length) {
     ClearCookieProperties();
   }
   FinalizeCookieDeletions();
 }
 
 function DeleteAllCookies() {
-  var title = cookieBundle.getString("deleteAllCookiesTitle");
-  var msg = cookieBundle.getString("deleteAllCookies");
-  var flags = ((promptservice.BUTTON_TITLE_IS_STRING * promptservice.BUTTON_POS_0) +
-               (promptservice.BUTTON_TITLE_CANCEL * promptservice.BUTTON_POS_1) +
-               promptservice.BUTTON_POS_1_DEFAULT)
-  var yes = cookieBundle.getString("deleteAllCookiesYes");
-  if (promptservice.confirmEx(window, title, msg, flags, yes, null, null, null, {value:0}) == 1)
+  if (PromptConfirm("deleteAllCookiesTitle",
+                    "deleteAllCookies",
+                    "deleteAllCookiesYes") == 1) {
     return;
+  }
 
   ClearCookieProperties();
   DeleteAllFromTree(cookiesTree, cookiesTreeView,
                         cookies, deletedCookies,
                         "removeCookie", "removeAllCookies");
   allCookies.length = 0;
   FinalizeCookieDeletions();
 }
 
 function FinalizeCookieDeletions() {
   gUpdatingBatch = "cookie-changed";
   for (let delCookie of deletedCookies) {
-    cookiemanager.remove(delCookie.host,
-                         delCookie.name,
-                         delCookie.path,
-                         document.getElementById("checkbox").checked,
-                         delCookie.originAttributes);
+    Services.cookies.remove(delCookie.host,
+                            delCookie.name,
+                            delCookie.path,
+                            document.getElementById("checkbox").checked,
+                            delCookie.originAttributes);
   }
   deletedCookies.length = 0;
   gUpdatingBatch = "";
 }
 
 function HandleCookieKeyPress(e) {
   if (e.keyCode == KeyEvent.DOM_VK_DELETE ||
       (AppConstants.platform == "macosx" &&
@@ -379,17 +363,17 @@ function Permission(id, principal, type,
   this.host = principal.URI.hostPort;
   this.scheme = principal.URI.scheme;
   this.type = type;
   this.capability = capability;
 }
 
 function loadPermissions() {
   // load permissions into a table
-  var enumerator = permissionmanager.enumerator;
+  var enumerator = Services.perms.enumerator;
   var canStr = cookieBundle.getString("can");
   var canSessionStr = cookieBundle.getString("canSession");
   var cannotStr = cookieBundle.getString("cannot");
   while (enumerator.hasMoreElements()) {
     var nextPermission = enumerator.getNext();
     nextPermission = nextPermission.QueryInterface(Ci.nsIPermission);
     // We are only interested in cookie permissions in this code.
     if (nextPermission.type == "cookie") {
@@ -403,23 +387,23 @@ function loadPermissions() {
         Cu.reportError("Invalid permission found: " +
                        nextPermission.principal.origin + " " +
                        nextPermission.type);
         continue;
       }
 
       var capability;
       switch (nextPermission.capability) {
-        case nsIPermissionManager.ALLOW_ACTION:
+        case Ci.nsIPermissionManager.ALLOW_ACTION:
           capability = canStr;
           break;
-        case nsIPermissionManager.DENY_ACTION:
+        case Ci.nsIPermissionManager.DENY_ACTION:
           capability = cannotStr;
           break;
-        case nsICookiePermission.ACCESS_SESSION:
+        case Ci.nsICookiePermission.ACCESS_SESSION:
           capability = canSessionStr;
           break;
         default:
           continue;
       }
       permissions.push(new Permission(permissions.length,
                                       nextPermission.principal,
                                       nextPermission.type,
@@ -448,25 +432,21 @@ function PermissionSelected() {
   var selections = GetTreeSelections(permissionsTree);
   if (selections.length)
     document.getElementById("removePermission").removeAttribute("disabled");
   else
     document.getElementById("removePermission").setAttribute("disabled", "true");
 }
 
 function DeletePermission() {
-  if (permissionsTreeView.selection.count > 1) {
-    var title = cookieBundle.getString("deleteSelectedSitesTitle");
-    var msg = cookieBundle.getString("deleteSelectedCookiesSites");
-    var flags = ((promptservice.BUTTON_TITLE_IS_STRING * promptservice.BUTTON_POS_0) +
-                 (promptservice.BUTTON_TITLE_CANCEL * promptservice.BUTTON_POS_1) +
-                 promptservice.BUTTON_POS_1_DEFAULT)
-    var yes = cookieBundle.getString("deleteSelectedSitesYes");
-    if (promptservice.confirmEx(window, title, msg, flags, yes, null, null, null, {value:0}) == 1)
-      return;
+  if (permissionsTreeView.selection.count > 1 &&
+      PromptConfirm("deleteSelectedSitesTitle",
+                    "deleteSelectedCookiesSites",
+                    "deleteSelectedSitesYes") == 1) {
+    return;
   }
   DeleteSelectedItemFromTree(permissionsTree, permissionsTreeView,
                                  permissions, deletedPermissions,
                                  "removePermission", "removeAllPermissions");
   FinalizePermissionDeletions();
 }
 
 function setCookiePermissions(action) {
@@ -476,37 +456,34 @@ function setCookiePermissions(action) {
   try {
     var url = new URL(site.value);
   } catch (e) {
     // show an error if URL is invalid
     window.alert(cookieBundle.getString("allowedURLSchemes"));
     return;
   }
 
-  var ioService = Cc["@mozilla.org/network/io-service;1"]
-                    .getService(Ci.nsIIOService);
-
   try {
-    var uri = ioService.newURI(url);
+    var uri = Services.io.newURI(url);
   } catch (e) {
     // show an error if URI can not be constructed or adding it failed
     window.alert(cookieBundle.getString("errorAddPermission"));
     return;
   }
   // only allow a few schemes here
   // others like file:// would produce an invalid entry in the database
   if (uri.scheme != 'http'  &&
       uri.scheme != 'https') {
     // show an error if uri uses invalid scheme
     window.alert(uri.scheme + ": " + cookieBundle.getString("allowedURLSchemes"));
     return;
   }
 
-  if (permissionmanager.testPermission(uri, "cookie") != action)
-    permissionmanager.add(uri, "cookie", action);
+  if (Services.perms.testPermission(uri, "cookie") != action)
+    Services.perms.add(uri, "cookie", action);
 
   site.focus();
   site.value = "";
 }
 
 function buttonEnabling(textfield) {
   // trim any leading space
   var site = textfield.value.replace(/^\s*([-\w]*:\/+)?/, "");
@@ -514,38 +491,35 @@ function buttonEnabling(textfield) {
   var session = document.getElementById("btnSession");
   var allow = document.getElementById("btnAllow");
   block.disabled = !site;
   session.disabled = !site;
   allow.disabled = !site;
 }
 
 function DeleteAllPermissions() {
-  var title = cookieBundle.getString("deleteAllSitesTitle");
-  var msg = cookieBundle.getString("deleteAllCookiesSites");
-  var flags = ((promptservice.BUTTON_TITLE_IS_STRING * promptservice.BUTTON_POS_0) +
-               (promptservice.BUTTON_TITLE_CANCEL * promptservice.BUTTON_POS_1) +
-               promptservice.BUTTON_POS_1_DEFAULT)
-  var yes = cookieBundle.getString("deleteAllSitesYes");
-  if (promptservice.confirmEx(window, title, msg, flags, yes, null, null, null, {value:0}) == 1)
+  if (PromptConfirm("deleteAllSitesTitle",
+                    "deleteAllCookiesSites",
+                    "deleteAllSitesYes") == 1) {
     return;
+  }
 
   DeleteAllFromTree(permissionsTree, permissionsTreeView,
                         permissions, deletedPermissions,
                         "removePermission", "removeAllPermissions");
   FinalizePermissionDeletions();
 }
 
 function FinalizePermissionDeletions() {
   if (!deletedPermissions.length)
     return;
 
   gUpdatingBatch = "perm-changed";
   for (let permission of deletedPermissions)
-    permissionmanager.removeFromPrincipal(permission.principal, permission.type);
+    Services.perms.removeFromPrincipal(permission.principal, permission.type);
   deletedPermissions.length = 0;
   gUpdatingBatch = "";
 }
 
 function HandlePermissionKeyPress(e) {
   if (e.keyCode == 46) {
     DeletePermission();
   }
--- a/suite/components/permissions/content/cookieViewer.xul
+++ b/suite/components/permissions/content/cookieViewer.xul
@@ -149,23 +149,23 @@
 
       <vbox id="servers" flex="1">
           <description id="permissionsText">&div.bannedservers.label;</description>
           <separator class="thin"/>
           <hbox>
             <textbox id="cookie-site" flex="1" oninput="buttonEnabling(this);"/>
             <button id="btnBlock" label="&blockSite.label;" disabled="true"
                     accesskey="&blockSite.accesskey;"
-                    oncommand="setCookiePermissions(nsIPermissionManager.DENY_ACTION);"/>
+                    oncommand="setCookiePermissions(Ci.nsIPermissionManager.DENY_ACTION);"/>
             <button id="btnSession" label="&allowSiteSession.label;" disabled="true"
                     accesskey="&allowSiteSession.accesskey;"
-                    oncommand="setCookiePermissions(nsICookiePermission.ACCESS_SESSION);"/>
+                    oncommand="setCookiePermissions(Ci.nsICookiePermission.ACCESS_SESSION);"/>
             <button id="btnAllow" label="&allowSite.label;" disabled="true"
                     accesskey="&allowSite.accesskey;"
-                    oncommand="setCookiePermissions(nsIPermissionManager.ALLOW_ACTION);"/>
+                    oncommand="setCookiePermissions(Ci.nsIPermissionManager.ALLOW_ACTION);"/>
           </hbox>
           <separator class="thin"/>
           <tree id="permissionsTree"
                 flex="1"
                 style="height: 10em;"
                 hidecolumnpicker="true"
                 onkeypress="HandlePermissionKeyPress(event)"
                 onselect="PermissionSelected();">
--- a/suite/components/permissions/content/permissionsManager.js
+++ b/suite/components/permissions/content/permissionsManager.js
@@ -1,16 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-const nsIPermissionManager = Ci.nsIPermissionManager;
-const nsICookiePermission = Ci.nsICookiePermission;
-
-var permissionManager;
+Cu.import("resource://gre/modules/Services.jsm");
 
 var additions = [];
 var removals = [];
 
 var sortColumn;
 var sortAscending;
 
 var permissionsTreeView = {
@@ -39,19 +36,16 @@ var permissionsTree;
 var permissionType = "popup";
 var gManageCapability;
 
 var permissionsBundle;
 
 function Startup() {
   var introText, windowTitle;
 
-  permissionManager = Cc["@mozilla.org/permissionmanager;1"]
-                        .getService(nsIPermissionManager);
-
   permissionsTree = document.getElementById("permissionsTree");
 
   permissionsBundle = document.getElementById("permissionsBundle");
 
   sortAscending = (permissionsTree.getAttribute("sortAscending") == "true");
   sortColumn = permissionsTree.getAttribute("sortColumn");
 
   if (window.arguments && window.arguments[0]) {
@@ -122,17 +116,17 @@ function trimSpacesAndScheme(aString) {
 
 function btnDisable(aDisabled) {
   document.getElementById("btnSession").disabled = aDisabled;
   document.getElementById("btnBlock").disabled = aDisabled;
   document.getElementById("btnAllow").disabled = aDisabled;
 }
 
 function loadPermissions() {
-  var enumerator = permissionManager.enumerator;
+  var enumerator = Services.perms.enumerator;
   var count = 0;
   var permission;
 
   try {
     while (enumerator.hasMoreElements()) {
       permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
       if (permission.type == permissionType &&
           (!gManageCapability || permission.capability == gManageCapability))
@@ -150,24 +144,24 @@ function loadPermissions() {
 
   // disable "remove all" button if there are none
   document.getElementById("removeAllPermissions").disabled = additions.length == 0;
 }
 
 function capabilityString(aCapability) {
   var capability = null;
   switch (aCapability) {
-    case nsIPermissionManager.ALLOW_ACTION:
+    case Ci.nsIPermissionManager.ALLOW_ACTION:
       capability = "can";
       break;
-    case nsIPermissionManager.DENY_ACTION:
+    case Ci.nsIPermissionManager.DENY_ACTION:
       capability = "cannot";
       break;
     // we should only ever hit this for cookies
-    case nsICookiePermission.ACCESS_SESSION:
+    case Ci.nsICookiePermission.ACCESS_SESSION:
       capability = "canSession";
       break;
     default:
       break;
   }
   return permissionsBundle.getString(capability);
 }
 
@@ -180,76 +174,70 @@ function permissionPush(aId, aHost, aTyp
 function permissionColumnSort(aColumn, aUpdateSelection) {
   sortAscending =
     SortTree(permissionsTree, permissionsTreeView, additions,
              aColumn, sortColumn, sortAscending, aUpdateSelection);
   sortColumn = aColumn;
 }
 
 function permissionSelected() {
-  if (permissionManager) {
+  if (Services.perms) {
     var selections = GetTreeSelections(permissionsTree);
     document.getElementById("removePermission").disabled = (selections.length < 1);
   }
 }
 
 function deletePermissions() {
   DeleteSelectedItemFromTree(permissionsTree, permissionsTreeView, additions, removals,
                              "removePermission", "removeAllPermissions");
 }
 
 function deleteAllPermissions() {
   DeleteAllFromTree(permissionsTree, permissionsTreeView, additions, removals,
                     "removePermission", "removeAllPermissions");
 }
 
 function finalizeChanges() {
-  var ioService = Cc["@mozilla.org/network/io-service;1"]
-                    .getService(Ci.nsIIOService);
   var i, p;
 
   for (i in removals) {
     p = removals[i];
     try {
-      permissionManager.remove(p.host, p.type);
+      Services.perms.remove(p.host, p.type);
     } catch(ex) {
     }
   }
 
   for (i in additions) {
     p = additions[i];
     try {
-      var uri = ioService.newURI("http://" + p.host);
-      permissionManager.add(uri, p.type, p.perm);
+      var uri = Services.io.newURI("http://" + p.host);
+      Services.perms.add(uri, p.type, p.perm);
     } catch(ex) {
     }
   }
 }
 
 function handlePermissionKeyPress(e) {
   if (e.keyCode == 46) {
     deletePermissions();
   }
 }
 
 function addPermission(aPermission) {
   var textbox = document.getElementById("url");
   // trim any leading and trailing spaces and scheme
   var host = trimSpacesAndScheme(textbox.value);
   try {
-    var ioService = Cc["@mozilla.org/network/io-service;1"]
-                      .getService(Ci.nsIIOService);
-    var uri = ioService.newURI("http://" + host);
+    var uri = Services.io.newURI("http://" + host);
     host = uri.host;
   } catch(ex) {
-    var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
-                          .getService(Ci.nsIPromptService);
     var message = permissionsBundle.getFormattedString("alertInvalid", [host]);
     var title = permissionsBundle.getString("alertInvalidTitle");
-    promptService.alert(window, title, message);
+    Services.prompt.alert(window, title, message);
     textbox.value = "";
     textbox.focus();
     handleHostInput(textbox);
     return;
   }
 
   // we need this whether the perm exists or not
   var stringCapability = capabilityString(aPermission);
--- a/suite/components/permissions/content/permissionsManager.xul
+++ b/suite/components/permissions/content/permissionsManager.xul
@@ -32,21 +32,21 @@
          value="&address.label;"
          accesskey="&address.accesskey;"
          control="url"/>
   <hbox align="start">
     <textbox id="url" flex="1" oninput="handleHostInput(event.target);"/>
   </hbox>
   <hbox pack="end">
      <button id="btnBlock" disabled="true" accesskey="&block.accesskey;"
-             label="&block.label;" oncommand="addPermission(nsIPermissionManager.DENY_ACTION);"/>
+             label="&block.label;" oncommand="addPermission(Ci.nsIPermissionManager.DENY_ACTION);"/>
      <button id="btnSession" disabled="true" accesskey="&session.accesskey;"
-             label="&session.label;" oncommand="addPermission(nsICookiePermission.ACCESS_SESSION);"/>
+             label="&session.label;" oncommand="addPermission(Ci.nsICookiePermission.ACCESS_SESSION);"/>
      <button id="btnAllow" disabled="true" accesskey="&allow.accesskey;"
-             label="&allow.label;" oncommand="addPermission(nsIPermissionManager.ALLOW_ACTION);"/>
+             label="&allow.label;" oncommand="addPermission(Ci.nsIPermissionManager.ALLOW_ACTION);"/>
   </hbox>
   <separator class="thin"/>
   <tree id="permissionsTree" flex="1" style="height: 18em;"
         hidecolumnpicker="true"
         onkeypress="handlePermissionKeyPress(event)"
         onselect="permissionSelected();"
         sortAscending="false"
         sortColumn="rawHost"