rem: if (!isDuplicate) { var newPermission = new Permission(host, length); permissions.push(newPermission);  sortAscending = !sortAscending; loadTree();  if (removals[host] != null) removals[host] = null; else additions[host] = host; }  addSiteBox.value = ""; } 
add:  document.getElementById("removeAllPermissions").disabled = additions.length == 0; 
context: function addPermission() {  var addSiteBox = document.getElementById("addSiteBox");  var host = addSiteBox.value;    if (host != "") {    host = host.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme        var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]                                  .getService(Components.interfaces.nsIPromptService);     var ioService = Components.classes["@mozilla.org/network/io-service;1"]                              .getService(Components.interfaces.nsIIOService);        try {      var uri = ioService.newURI("http://"+host, null, null);    }    catch(ex) {      var msgInvalid = popupStringBundle.getFormattedString("alertInvalid", [host]);      if (promptService)        promptService.alert(window, "", msgInvalid);      addSiteBox.value = "";      return;    }    host = uri.hostPort;    if (!host) {      addSiteBox.value = "";      return;    }    var length = permissions.length;        var isDuplicate = false;    for (var i = 0; i < length; i++) {      if (permissions[i].host == host) {        var msgDuplicate = popupStringBundle.getFormattedString("alertDuplicate", [host]);         if (promptService)          promptService.alert(window, "", msgDuplicate);        isDuplicate = true;        break;      }    }    if (!isDuplicate) {      var newPermission = new Permission(host, length);      permissions.push(newPermission);      sortAscending = !sortAscending; //keep same sort direction      loadTree();          if (removals[host] != null)        removals[host] = null;      else        additions[host] = host;    }    addSiteBox.value = "";  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/c50bdfb4ec30c1c58f4046bc2bfb7ae17626fe3f/permissionsManager.js/buggy/suite/common/permissions/permissionsManager.js