rem: var selType = BookmarksUtils.resolveType (aSelection.item[0]); 
add: var selType = BookmarksUtils.resolveType(aSelection.item[0]); 
context:   realSortByName: function (aSelection)  {    var theFolder;    if (aSelection.length != 1)      return;    var selType = BookmarksUtils.resolveType (aSelection.item[0]);    if (selType == "Folder" || selType == "Bookmark" ||        selType == "PersonalToolbarFolder" || selType == "Livemark")    {      theFolder = aSelection.parent[0];    } else {      // we're not going to try to sort ImmutableBookmark siblings or      // any other such thing, since it'll probably just get us into      // trouble      return;    }    var toSort = [];    RDFC.Init(BMDS, theFolder);    var folderContents = RDFC.GetElements();    while (folderContents.hasMoreElements()) {        var rsrc = folderContents.getNext().QueryInterface(kRDFRSCIID);        var rtype = BookmarksUtils.resolveType(rsrc);        if (rtype == "BookmarkSeparator")          continue;        toSort.push(rsrc);    }    const kName = RDF.GetResource(gNC_NS+"Name");    var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]                                  .getService(Components.interfaces.nsILocaleService);    var collationFactory = Components.classes["@mozilla.org/intl/collation-factory;1"]                                     .getService(Components.interfaces.nsICollationFactory);    var collation = collationFactory.CreateCollation(localeService.getApplicationLocale());    toSort.sort (function (a, b) {                   var atype = BookmarksUtils.resolveType(a);                   var btype = BookmarksUtils.resolveType(b);                   var aisfolder = (atype == "Folder") || (atype == "PersonalToolbarFolder");                   var bisfolder = (btype == "Folder") || (btype == "PersonalToolbarFolder");                   // folders above bookmarks                   if (aisfolder && !bisfolder)                     return -1;                   if (bisfolder && !aisfolder)                     return 1;                   // then sort by name                   var aname = BMDS.GetTarget(a, kName, true).QueryInterface(kRDFLITIID).Value;                   var bname = BMDS.GetTarget(b, kName, true).QueryInterface(kRDFLITIID).Value;                   return collation.compareString(0, aname, bname);                 });    // we now have the resources here sorted by name    BMDS.beginUpdateBatch();    RDFC.Init(BMDS, theFolder);    // remove existing elements    var folderContents = RDFC.GetElements();    while (folderContents.hasMoreElements()) {      RDFC.RemoveElement (folderContents.getNext(), false);    }    // and add our elements back    for (var i = 0; i < toSort.length; i++) {      RDFC.InsertElementAt (toSort[i], i+1, true);    }    BMDS.endUpdateBatch();  }
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/9423a3edd3cb656b8703ec4197a1884223313494/bookmarks.js/buggy/browser/components/bookmarks/content/bookmarks.js