rem: var entries = rdfc.MakeSeq(localstore, rdf.GetResource("nc:urlbar-history")); var entry = rdf.GetLiteral(urlToAdd); var index = entries.IndexOf(entry); 
add: var entries = rdfc.MakeSeq(localstore, rdf.GetResource("nc:urlbar-history")); if (!entries) return; var elements = entries.GetElements(); if (!elements) return; var index = 0;  var uriToAdd = Components.classes["@mozilla.org/network/standard-url;1"] .createInstance(Components.interfaces.nsIURI); uriToAdd.spec = urlToAdd;  var rdfUri = Components.classes["@mozilla.org/network/standard-url;1"] .createInstance(Components.interfaces.nsIURI); while(elements.hasMoreElements()) { entry = elements.getNext(); if (entry) { index ++; entry= entry.QueryInterface(Components.interfaces.nsIRDFLiteral); var rdfValue = entry.Value;  rdfUri.spec = rdfValue; if (rdfUri.equals(uriToAdd)) {     entries.RemoveElementAt(index, true); break; } } } 
context: function addToUrlbarHistory()  {	var urlToAdd = gURLBar.value;	if (!urlToAdd)	   return;	if (localstore) {    var entries = rdfc.MakeSeq(localstore, rdf.GetResource("nc:urlbar-history"));	var entry = rdf.GetLiteral(urlToAdd);    var index = entries.IndexOf(entry);    if (index != -1) {      // we've got it already. Remove it from its old place      // and insert it to the top      //dump("URL already in urlbar history\n");      entries.RemoveElementAt(index, true);    }    // Otherwise, we've got a new URL in town. Add it!    // Put the new entry at the front of the list.    entries.InsertElementAt(entry, 1, true);    // Remove any expired history items so that we don't let this grow    // without bound.    for (index = entries.GetCount(); index > MAX_HISTORY_ITEMS; --index) {      entries.RemoveElementAt(index, true);    }  }  }
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/7e2782ec3ea5bf3d73833f09138f8cbe55659466/sessionHistoryUI.js/clean/xpfe/browser/resources/content/sessionHistoryUI.js