rem: doSetOKCancel(Commit);  
context: function doLoad(){  doSetOKCancel(Commit);  // adjust category popup  var internetSearch = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"].getService();  if (internetSearch) internetSearch = internetSearch.QueryInterface(Components.interfaces.nsIInternetSearchService);  if (internetSearch)  {    internetSearchDS = internetSearch.QueryInterface(Components.interfaces.nsIRDFDataSource);    catDS = internetSearch.GetCategoryDataSource();    if (catDS)  catDS = catDS.QueryInterface(Components.interfaces.nsIRDFDataSource);    if (catDS)    {      var categoryList = document.getElementById("categoryList");      if (categoryList)      {        categoryList.database.AddDataSource(catDS);        var ref = categoryList.getAttribute("ref");        if (ref)  categoryList.setAttribute("ref", ref);      }      var engineList = document.getElementById("engineList");      if (engineList)      {        engineList.database.AddDataSource(catDS);      }    }  }  // try and determine last category name used  var lastCategoryName = "";  try  {    var pref = Components.classes["@mozilla.org/preferences-service;1"]                         .getService(Components.interfaces.nsIPrefBranch);    lastCategoryName = pref.getCharPref( "browser.search.last_search_category" );    if (lastCategoryName != "")    {      // strip off the prefix if necessary      var prefix="NC:SearchCategory?category=";      if (lastCategoryName.indexOf(prefix) == 0)      {        lastCategoryName = lastCategoryName.substr(prefix.length);      }    }  }  catch( e )  {    debug("Exception in SearchPanelStartup\n");    lastCategoryName = "";  }  debug("\nSearchPanelStartup: lastCategoryName = '" + lastCategoryName + "'\n");  // select the appropriate category  var categoryList = document.getElementById( "categoryList" );  var categoryPopup = document.getElementById( "categoryPopup" );  if( categoryList && categoryPopup )  {    var found = false;    for( var i = 0; i < categoryPopup.childNodes.length; i++ )    {      if( ( lastCategoryName == "" && categoryPopup.childNodes[i].getAttribute("value") == "NC:SearchEngineRoot" ) ||          ( categoryPopup.childNodes[i].getAttribute("id") == lastCategoryName ) )      {        categoryList.selectedItem = categoryPopup.childNodes[i];        found = true;        break;      }    }    if (categoryPopup.childNodes.length > 0)    {      if (found == false)      {        categoryList.selectedItem = categoryPopup.childNodes[0];      }      chooseCategory(categoryList.selectedItem);    }  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/6c769e76e9803b1f1b3531a54ac85b147c8b5dbc/search-editor.js/buggy/xpfe/components/search/resources/search-editor.js