B2G/gecko/toolkit/components/places/tests/unit/test_415460.js
/**
 * Checks to see that a search has exactly one result in the database.
 *
 * @param aTerms
 *        The terms to search for.
 * @returns true if the search returns one result, false otherwise.
 */
Checks to see that a search has exactly one result in the database.
@param aTerms
The terms to search for.
@returns true if the search returns one result, false otherwise.
Checks to see that a search has exactly one result in the database . @param aTerms The terms to search for . @returns true if the search returns one result false otherwise .
function search_has_result(aTerms)
{
  var options = hs.getNewQueryOptions();
  options.maxResults = 1;
  options.resultType = options.RESULTS_AS_URI;
  var query = hs.getNewQuery();
  query.searchTerms = aTerms;
  var result = hs.executeQuery(query, options);
  var root = result.root;
  root.containerOpen = true;
  var cc = root.childCount;
  root.containerOpen = false;
  return (cc == 1);
}
function search_has_result ( aTerms ) { var options = hs . getNewQueryOptions ( ) ; options . maxResults = 1 ; options . resultType = options . RESULTS_AS_URI ; var query = hs . getNewQuery ( ) ; query . searchTerms = aTerms ; var result = hs . executeQuery ( query , options ) ; var root = result . root ; root . containerOpen = true ; var cc = root . childCount ; root . containerOpen = false ; return ( cc == 1 ) ; }
Checks to see that a search has exactly one result in the database.
Checks to see that a search has exactly one result in the database .