rem: if (this._permissions[i].perm == permission) { exists = true; } 
context:   addPermission: function (aIsSave)  {    var textbox = document.getElementById("url");    var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme    try {      var ioService = Components.classes["@mozilla.org/network/io-service;1"]                                .getService(Components.interfaces.nsIIOService);      var uri = ioService.newURI("http://"+host, null, null);      host = uri.host;    } catch(ex) {      var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]                                    .getService(Components.interfaces.nsIPromptService);      var message = this._bundle.getString("invalidURI");      var title = this._bundle.getString("invalidURITitle");      promptService.alert(window, title, message);      return;    }    var permission = 0;    var canLoad = document.getElementById("checkLoad").checked;    var canSend = document.getElementById("checkSend").checked;    if (!canLoad && !canSend) {      // invalid      return;    } else if (canLoad && canSend) {      permission = 3;    } else {      permission = canSend ? 1 : 2;    }    // check whether the permission already exists, if not, add it    var exists = false;    for (var i = 0; i < this._permissions.length; ++i) {      // check if the host and the permission matches      if (this._permissions[i].rawHost == host) {        var capabilityString = this._getCapabilityString(permission);        this._permissions[i].capability = capabilityString;        this._permissions[i].perm = permission;        if (this._permissions[i].perm == permission) {          exists = true;        }        break;      }    }    if (!exists) {      if (aIsSave) {        // if it doesn't exist, but we were saving, remove the entry we were        // editing.        var index = this._tree.currentIndex;        var oldurl = this._tree.view.getCellText(index, this._tree.columns.getFirstColumn());        if (oldurl != host) {          this.onPermissionDeleted();        }      }      host = (host.charAt(0) == ".") ? host.substring(1,host.length) : host;      var uri = ioService.newURI("http://" + host, null, null);      this._pm.add(uri, this._type, permission);    }    // clear the checkboxes    document.getElementById("checkLoad").checked = false;    document.getElementById("checkSend").checked = false;    this.clear();    textbox.focus();    // covers a case where the site exists already, so the buttons don't disable    this.onHostInput(textbox);    // enable "remove all" button as needed    document.getElementById("removeAllPermissions").disabled = this._permissions.length == 0;  },
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/2e6600a8a03d8af828379d00f612b80d5b92cedb/xforms-permissions.js/clean/extensions/xforms/resources/content/xforms-permissions.js