B2G/gecko/toolkit/components/places/tests/queries/head_queries.js
/**
 * The Query Data Object - this object encapsulates data for our queries and is
 * used to parameterize our calls to the Places APIs to put data into the
 * database. It also has some interesting meta functions to determine which APIs
 * should be called, and to determine if this object should show up in the
 * resulting query.
 * Its parameter is an object specifying which attributes you want to set.
 * For ex:
 * var myobj = new queryData({isVisit: true, uri:"http://mozilla.com", title="foo"});
 * Note that it doesn't do any input checking on that object.
 */
The Query Data Object - this object encapsulates data for our queries and is
used to parameterize our calls to the Places APIs to put data into the
database. It also has some interesting meta functions to determine which APIs
should be called, and to determine if this object should show up in the
resulting query.
Its parameter is an object specifying which attributes you want to set.
The Query Data Object - this object encapsulates data for our queries and is used to parameterize our calls to the Places APIs to put data into the database . It also has some interesting meta functions to determine which APIs should be called and to determine if this object should show up in the resulting query . Its parameter is an object specifying which attributes you want to set .
function queryData(obj) {
  this.isVisit = obj.isVisit ? obj.isVisit : false;
  this.isBookmark = obj.isBookmark ? obj.isBookmark: false;
  this.uri = obj.uri ? obj.uri : "";
  this.lastVisit = obj.lastVisit ? obj.lastVisit : today;
  this.referrer = obj.referrer ? obj.referrer : null;
  this.transType = obj.transType ? obj.transType : Ci.nsINavHistoryService.TRANSITION_TYPED;
  this.isRedirect = obj.isRedirect ? obj.isRedirect : false;
  this.sessionID = obj.sessionID ? obj.sessionID : 0;
  this.isDetails = obj.isDetails ? obj.isDetails : false;
  this.title = obj.title ? obj.title : "";
  this.markPageAsTyped = obj.markPageAsTyped ? obj.markPageAsTyped : false;
  this.isPageAnnotation = obj.isPageAnnotation ? obj.isPageAnnotation : false;
  this.removeAnnotation= obj.removeAnnotation ? true : false;
  this.annoName = obj.annoName ? obj.annoName : "";
  this.annoVal = obj.annoVal ? obj.annoVal : "";
  this.annoFlags = obj.annoFlags ? obj.annoFlags : 0;
  this.annoExpiration = obj.annoExpiration ? obj.annoExpiration : 0;
  this.isItemAnnotation = obj.isItemAnnotation ? obj.isItemAnnotation : false;
  this.itemId = obj.itemId ? obj.itemId : 0;
  this.isPageBinaryAnnotation = obj.isPageBinaryAnnotation ?
                                obj.isPageBinaryAnnotation : false;
  this.isItemBinaryAnnotation = obj.isItemBinaryAnnotation ?
                                obj.isItemBinaryAnnotation : false;
  this.binaryData = obj.binaryData ? obj.binaryData : null;
  this.binaryDataLength = obj.binaryDataLength ? obj.binaryDataLength : 0;
  this.annoMimeType = obj.annoMimeType ? obj.annoMimeType : "";
  this.isTag = obj.isTag ? obj.isTag : false;
  this.tagArray = obj.tagArray ? obj.tagArray : null;
  this.isLivemark = obj.isLivemark ? obj.isLivemark : false;
  this.parentFolder = obj.parentFolder ? obj.parentFolder
                                       : PlacesUtils.placesRootId;
  this.feedURI = obj.feedURI ? obj.feedURI : "";
  this.index = obj.index ? obj.index : PlacesUtils.bookmarks.DEFAULT_INDEX;
  this.isFolder = obj.isFolder ? obj.isFolder : false;
  this.contractId = obj.contractId ? obj.contractId : "";
  this.lastModified = obj.lastModified ? obj.lastModified : today;
  this.dateAdded = obj.dateAdded ? obj.dateAdded : today;
  this.keyword = obj.keyword ? obj.keyword : "";
  this.visitCount = obj.visitCount ? obj.visitCount : 0;
  this.readOnly = obj.readOnly ? obj.readOnly : false;
  this.isSeparator = obj.hasOwnProperty("isSeparator") && obj.isSeparator;
  this.isInQuery = obj.isInQuery ? obj.isInQuery : false;
}
function queryData ( obj ) { this . isVisit = obj . isVisit ? obj . isVisit : false ; this . isBookmark = obj . isBookmark ? obj . isBookmark : false ; this . uri = obj . uri ? obj . uri : "" ; this . lastVisit = obj . lastVisit ? obj . lastVisit : today ; this . referrer = obj . referrer ? obj . referrer : null ; this . transType = obj . transType ? obj . transType : Ci . nsINavHistoryService . TRANSITION_TYPED ; this . isRedirect = obj . isRedirect ? obj . isRedirect : false ; this . sessionID = obj . sessionID ? obj . sessionID : 0 ; this . isDetails = obj . isDetails ? obj . isDetails : false ; this . title = obj . title ? obj . title : "" ; this . markPageAsTyped = obj . markPageAsTyped ? obj . markPageAsTyped : false ; this . isPageAnnotation = obj . isPageAnnotation ? obj . isPageAnnotation : false ; this . removeAnnotation = obj . removeAnnotation ? true : false ; this . annoName = obj . annoName ? obj . annoName : "" ; this . annoVal = obj . annoVal ? obj . annoVal : "" ; this . annoFlags = obj . annoFlags ? obj . annoFlags : 0 ; this . annoExpiration = obj . annoExpiration ? obj . annoExpiration : 0 ; this . isItemAnnotation = obj . isItemAnnotation ? obj . isItemAnnotation : false ; this . itemId = obj . itemId ? obj . itemId : 0 ; this . isPageBinaryAnnotation = obj . isPageBinaryAnnotation ? obj . isPageBinaryAnnotation : false ; this . isItemBinaryAnnotation = obj . isItemBinaryAnnotation ? obj . isItemBinaryAnnotation : false ; this . binaryData = obj . binaryData ? obj . binaryData : null ; this . binaryDataLength = obj . binaryDataLength ? obj . binaryDataLength : 0 ; this . annoMimeType = obj . annoMimeType ? obj . annoMimeType : "" ; this . isTag = obj . isTag ? obj . isTag : false ; this . tagArray = obj . tagArray ? obj . tagArray : null ; this . isLivemark = obj . isLivemark ? obj . isLivemark : false ; this . parentFolder = obj . parentFolder ? obj . parentFolder : PlacesUtils . placesRootId ; this . feedURI = obj . feedURI ? obj . feedURI : "" ; this . index = obj . index ? obj . index : PlacesUtils . bookmarks . DEFAULT_INDEX ; this . isFolder = obj . isFolder ? obj . isFolder : false ; this . contractId = obj . contractId ? obj . contractId : "" ; this . lastModified = obj . lastModified ? obj . lastModified : today ; this . dateAdded = obj . dateAdded ? obj . dateAdded : today ; this . keyword = obj . keyword ? obj . keyword : "" ; this . visitCount = obj . visitCount ? obj . visitCount : 0 ; this . readOnly = obj . readOnly ? obj . readOnly : false ; this . isSeparator = obj . hasOwnProperty ( "isSeparator" ) && obj . isSeparator ; this . isInQuery = obj . isInQuery ? obj . isInQuery : false ; }
The Query Data Object - this object encapsulates data for our queries and is
 used to parameterize our calls to the Places APIs to put data into the
 database.
The Query Data Object - this object encapsulates data for our queries and is used to parameterize our calls to the Places APIs to put data into the database .
// And now, the attribute for whether or not this object should appear in the // resulting query