  if (handlerApp) { let typeItem = this._list.selectedItem; let actionsMenu = document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu"); let menuItems = actionsMenu.menupopup.childNodes; for (let i = 0; i < menuItems.length; i++) { let menuItem = menuItems[i]; if (menuItem.handlerApp && menuItem.handlerApp.equals(handlerApp)) { actionsMenu.selectedIndex = i; this.onSelectAction(menuItem); break; } } } 
  chooseApp: function(aEvent) {    // Don't let the normal "on select action" handler get this event,    // as we handle it specially ourselves.    aEvent.stopPropagation();    var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);    var winTitle = this._prefsBundle.getString("fpTitleChooseApp");    fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);    fp.appendFilters(Ci.nsIFilePicker.filterApps);    if (fp.show() == Ci.nsIFilePicker.returnOK && fp.file) {      // XXXben - we need to compare this with the running instance executable      //          just don't know how to do that via script...      // XXXmano TBD: can probably add this to nsIShellService#ifdef XP_WIN#expand      if (fp.file.leafName == "__MOZ_APP_NAME__.exe")#else#ifdef XP_MACOSX#expand      if (fp.file.leafName == "__MOZ_APP_DISPLAYNAME__.app")#else#expand      if (fp.file.leafName == "__MOZ_APP_NAME__-bin")#endif#endif        { this.rebuildActionsMenu(); return; }      let handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].                       createInstance(Ci.nsIHandlerApp);      handlerApp.name = getDisplayNameForFile(fp.file);      handlerApp.QueryInterface(Ci.nsILocalHandlerApp);      handlerApp.executable = fp.file;      var handlerInfo = this._handledTypes[this._list.selectedItem.type];      handlerInfo.preferredApplicationHandler = handlerApp;      handlerInfo.preferredAction = Ci.nsIHandlerInfo.useHelperApp;      handlerInfo.store();    }    // We rebuild the actions menu whether the user picked an app or canceled.    // If they picked an app, we want to add the app to the menu and select it.    // If they canceled, we want to go back to their previous selection.    this.rebuildActionsMenu();  },
5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5459/16fe1c10ed03ade95659ef73edd0d82b7a324c4d/applications.js/buggy/browser/components/preferences/applications.js