B2G/gaia/apps/communications/dialer/js/call_log_db.js
/**
   * Delete a group of calls and all the calls belonging to that group.
   *
   * param group
   *        Group object to be deleted.
   * param groupId
   *        Identifier of the group to be deleted. We expect a group object or
   *        its identifier.
   *
   * return (via callback) count of deleted calls or error if needed.
   */
Delete a group of calls and all the calls belonging to that group.
param group
Group object to be deleted.
param groupId
Identifier of the group to be deleted. We expect a group object or
its identifier.

return (via callback) count of deleted calls or error if needed.
Delete a group of calls and all the calls belonging to that group . param group Group object to be deleted . param groupId Identifier of the group to be deleted . We expect a group object or its identifier . return ( via callback ) count of deleted calls or error if needed .
function deleteGroup(group, groupId, callback) {
    if (!groupId &&
        (!group || typeof group !== 'object' || !group.date || !group.type)) {
      callback('NOT_VALID_GROUP');
      return;
    }
    var self = this;
    this._newTxn('readwrite', [this._dbGroupsStore, this._dbRecentsStore],
                 function(error, txn, stores) {
      if (error) {
        self._asyncReturn(callback, error);
        return;
      }
      var groupsStore = stores[0];
      var recentsStore = stores[1];
      if (!groupId) {
        groupId = self._getGroupId(group);
      }
      groupsStore.delete(groupId).onsuccess = function onsuccess() {
        var deleted = 0;
        recentsStore.index('groupId').openCursor(groupId)
                    .onsuccess = function onsuccess(event) {
          var cursor = event.target.result;
          if (cursor) {
            cursor.delete();
            deleted++;
            cursor.continue();
          } else {
            self._asyncReturn(callback, deleted);
          }
        };
      };
    });
  }
function deleteGroup ( group , groupId , callback ) { if ( ! groupId && ( ! group || typeof group !== 'object' || ! group . date || ! group . type ) ) { callback ( 'NOT_VALID_GROUP' ) ; return ; } var self = this ; this . _newTxn ( 'readwrite' , [ this . _dbGroupsStore , this . _dbRecentsStore ] , function ( error , txn , stores ) { if ( error ) { self . _asyncReturn ( callback , error ) ; return ; } var groupsStore = stores [ 0 ] ; var recentsStore = stores [ 1 ] ; if ( ! groupId ) { groupId = self . _getGroupId ( group ) ; } groupsStore . delete ( groupId ) . onsuccess = function onsuccess ( ) { var deleted = 0 ; recentsStore . index ( 'groupId' ) . openCursor ( groupId ) . onsuccess = function onsuccess ( event ) { var cursor = event . target . result ; if ( cursor ) { cursor . delete ( ) ; deleted ++ ; cursor . continue ( ) ; } else { self . _asyncReturn ( callback , deleted ) ; } } ; } ; } ) ; }
Delete a group of calls and all the calls belonging to that group.
Delete a group of calls and all the calls belonging to that group .
// Valid group doesn't need to contain number, we can receive // calls from unknown or hidden numbers as well // We delete the given group and all its corresponding calls.