B2G/gecko/browser/components/places/tests/unit/test_leftpane_corruption_handling.js
/**
 * Convert a folder item id to a JSON representation of it and its contents.
 */
Convert a folder item id to a JSON representation of it and its contents.
Convert a folder item id to a JSON representation of it and its contents .
function folderToJSON(aItemId) {
  let query = PlacesUtils.history.getNewQuery();
  query.setFolders([aItemId], 1);
  let options = PlacesUtils.history.getNewQueryOptions();
  options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
  let root = PlacesUtils.history.executeQuery(query, options).root;
  let writer = {
    value: "",
    write: function PU_wrapNode__write(aStr, aLen) {
      this.value += aStr;
    }
  };
  PlacesUtils.serializeNodeAsJSONToOutputStream(root, writer, false, false);
  do_check_true(writer.value.length > 0);
  return writer.value;
}
function folderToJSON ( aItemId ) { let query = PlacesUtils . history . getNewQuery ( ) ; query . setFolders ( [ aItemId ] , 1 ) ; let options = PlacesUtils . history . getNewQueryOptions ( ) ; options . queryType = Ci . nsINavHistoryQueryOptions . QUERY_TYPE_BOOKMARKS ; let root = PlacesUtils . history . executeQuery ( query , options ) . root ; let writer = { value : "" , write : function PU_wrapNode__write ( aStr , aLen ) { this . value += aStr ; } } ; PlacesUtils . serializeNodeAsJSONToOutputStream ( root , writer , false , false ) ; do_check_true ( writer . value . length > 0 ) ; return writer . value ; }
Convert a folder item id to a JSON representation of it and its contents.
Convert a folder item id to a JSON representation of it and its contents .