 result.sortingMode = NHQO.SORT_BY_KEYWORD_ASCENDING; checkOrder(id3, id2, id1); bmsvc.setKeywordForBookmark(id1, "a"); bmsvc.setKeywordForBookmark(id2, "z"); checkOrder(id3, id1, id2);  
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).itemId, a);    do_check_eq(root.getChild(1).itemId, b);    do_check_eq(root.getChild(2).itemId, 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.  // XXXtodo: test sortingAnnotation functionality with non-bookmark nodes  annosvc.setItemAnnotationString(id1, "testAnno", "a", 0, 0);  annosvc.setItemAnnotationString(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);  // test live update  annosvc.setItemAnnotationString(id1, "testAnno", "c", 0, 0);  checkOrder(id1, id3, id2);}
5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5872/1a1e9096370da965faa8b7ddb622d33d7f5b5952/test_result_sort.js/clean/toolkit/components/places/tests/unit/test_result_sort.js