B2G/gecko/toolkit/components/places/tests/queries/head_queries.js
/**
 * Helper function to check to see if one object either is or is not in the
 * result set.  It can accept either a queryData object or an array of queryData
 * objects.  If it gets an array, it only compares the first object in the array
 * to see if it is in the result set.
 * Returns: True if item is in query set, and false if item is not in query set
 *          If input is an array, returns True if FIRST object in array is in
 *          query set.  To compare entire array, use the function above.
 */
Helper function to check to see if one object either is or is not in the
result set.  It can accept either a queryData object or an array of queryData
objects.  If it gets an array, it only compares the first object in the array
to see if it is in the result set.
Returns: True if item is in query set, and false if item is not in query set
If input is an array, returns True if FIRST object in array is in
query set.  To compare entire array, use the function above.
Helper function to check to see if one object either is or is not in the result set . It can accept either a queryData object or an array of queryData objects . If it gets an array it only compares the first object in the array to see if it is in the result set . Returns : True if item is in query set and false if item is not in query set If input is an array returns True if FIRST object in array is in query set . To compare entire array use the function above .
function isInResult(aQueryData, aRoot) {
  var rv = false;
  var uri;
  var wasOpen = aRoot.containerOpen;
  if (!wasOpen)
    aRoot.containerOpen = true;
  if ("uri" in aQueryData) {
    uri = aQueryData.uri;
  } else {
    uri = aQueryData[0].uri;
  }
  for (var i=0; i < aRoot.childCount; i++) {
    if (uri == aRoot.getChild(i).uri) {
      rv = true;
      break;
    }
  }
  if (!wasOpen)
    aRoot.containerOpen = false;
  return rv;
}
function isInResult ( aQueryData , aRoot ) { var rv = false ; var uri ; var wasOpen = aRoot . containerOpen ; if ( ! wasOpen ) aRoot . containerOpen = true ; if ( "uri" in aQueryData ) { uri = aQueryData . uri ; } else { uri = aQueryData [ 0 ] . uri ; } for ( var i = 0 ; i < aRoot . childCount ; i ++ ) { if ( uri == aRoot . getChild ( i ) . uri ) { rv = true ; break ; } } if ( ! wasOpen ) aRoot . containerOpen = false ; return rv ; }
Helper function to check to see if one object either is or is not in the
 result set.
Helper function to check to see if one object either is or is not in the result set .
// If we have an array, pluck out the first item. If an object, pluc out the // URI, we just compare URI's here.