rem:   annosvc.setAnnotationInt32(bmsvc.getItemURI(id3), "testAnno", 10, 0, 0); 
context: function run_test() {  var testRoot = bmsvc.createFolder(root,                                    "Result-sort functionality tests root",                                    bmsvc.DEFAULT_INDEX);  var uri1 = uri("http://foo.tld/a");  var uri2 = uri("http://foo.tld/b");  var id1 = bmsvc.insertItem(testRoot, uri1, bmsvc.DEFAULT_INDEX);  bmsvc.setItemTitle(id1, "b");  var id2 = bmsvc.insertItem(testRoot, uri2, bmsvc.DEFAULT_INDEX);  bmsvc.setItemTitle(id2, "a");  // url of id1, title of id2  var id3 = bmsvc.insertItem(testRoot, uri1, bmsvc.DEFAULT_INDEX);  bmsvc.setItemTitle(id3, "a");  // query with natural order  var options = histsvc.getNewQueryOptions();  var query = histsvc.getNewQuery();  query.setFolders([testRoot], 1);  var result = histsvc.executeQuery(query, options);  var root = result.root;  root.containerOpen = true;  do_check_eq(root.childCount, 3);  const NHQO = Ci.nsINavHistoryQueryOptions;  function checkOrder(a, b, c) {    do_check_eq(root.getChild(0).bookmarkId, a);    do_check_eq(root.getChild(1).bookmarkId, b);    do_check_eq(root.getChild(2).bookmarkId, c);  }  // natural order  checkOrder(id1, id2, id3);  // title: id3 should precede id2 since we fall-back to URI-based sorting  result.sortingMode = NHQO.SORT_BY_TITLE_ASCENDING;  checkOrder(id3, id2, id1);  // In reverse  result.sortingMode = NHQO.SORT_BY_TITLE_DESCENDING;  checkOrder(id1, id2, id3);  // uri sort: id1 should precede id3 since we fall-back to natural order  result.sortingMode = NHQO.SORT_BY_URI_ASCENDING;  checkOrder(id1, id3, id2);  // test live update  bmsvc.changeBookmarkURI(id1, uri2);  checkOrder(id3, id1, id2);  bmsvc.changeBookmarkURI(id1, uri1);  checkOrder(id1, id3, id2);  // XXXtodo: test history sortings (visit count, visit date)  // XXXtodo: test different item types once folderId and bookmarkId are merged.  annosvc.setAnnotationString(bmsvc.getItemURI(id1), "testAnno", "a", 0, 0);  annosvc.setAnnotationString(bmsvc.getItemURI(id3), "testAnno", "b", 0, 0);  result.sortingAnnotation = "testAnno";  result.sortingMode = NHQO.SORT_BY_ANNOTATION_DESCENDING;  // id1 precedes id2 per title-descending fallback  checkOrder(id3, id1, id2);    // different annotation types, we fall back to the title sorting route  annosvc.setAnnotationInt32(bmsvc.getItemURI(id3), "testAnno", 10, 0, 0);  // XXXtodo: test live update for sortingAnnotation (not yet implemented);  // manually force sort for now...  result.sortingMode = result.sortingMode;  checkOrder(id1, id2, id3);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9421/c5bd30ba2d4dc00f2201b182ab54ccadf9fd1355/test_result_sort.js/buggy/toolkit/components/places/tests/unit/test_result_sort.js