apps/email/js/ext/mailapi/same-frame-setup.js
/**
   * Request the load of the given block and the invocation of the callback with
   * the block when the load completes.
   */
Request the load of the given block and the invocation of the callback with
the block when the load completes.
Request the load of the given block and the invocation of the callback with the block when the load completes .
function ifs__loadBlock(type, blockInfo, callback) {
    var blockId = blockInfo.blockId;
    var aggrId = type + blockId;
    if (this._pendingLoads.indexOf(aggrId) !== -1) {
      this._pendingLoadListeners[aggrId].push(callback);
      return;
    }
    var index = this._pendingLoads.length;
    this._pendingLoads.push(aggrId);
    this._pendingLoadListeners[aggrId] = [callback];
    var self = this;
    function onLoaded(block) {
      if (!block)
        self._LOG.badBlockLoad(type, blockId);
      self._LOG.loadBlock_end(type, blockId, block);
      if (type === 'header') {
        self._headerBlocks[blockId] = block;
        self._loadedHeaderBlockInfos.push(blockInfo);
      }
      else {
        self._bodyBlocks[blockId] = block;
        self._loadedBodyBlockInfos.push(blockInfo);
      }
      self._pendingLoads.splice(self._pendingLoads.indexOf(aggrId), 1);
      var listeners = self._pendingLoadListeners[aggrId];
      delete self._pendingLoadListeners[aggrId];
      for (var i = 0; i < listeners.length; i++) {
        try {
          listeners[i](block);
        }
        catch (ex) {
          self._LOG.callbackErr(ex);
        }
      }
      if (self._pendingLoads.length === 0)
        self._runDeferredCalls();
    }
    this._LOG.loadBlock_begin(type, blockId);
    if (type === 'header')
      this._imapDb.loadHeaderBlock(this.folderId, blockId, onLoaded);
    else
      this._imapDb.loadBodyBlock(this.folderId, blockId, onLoaded);
  }
function ifs__loadBlock ( type , blockInfo , callback ) { var blockId = blockInfo . blockId ; var aggrId = type + blockId ; if ( this . _pendingLoads . indexOf ( aggrId ) !== - 1 ) { this . _pendingLoadListeners [ aggrId ] . push ( callback ) ; return ; } var index = this . _pendingLoads . length ; this . _pendingLoads . push ( aggrId ) ; this . _pendingLoadListeners [ aggrId ] = [ callback ] ; var self = this ; function onLoaded ( block ) { if ( ! block ) self . _LOG . badBlockLoad ( type , blockId ) ; self . _LOG . loadBlock_end ( type , blockId , block ) ; if ( type === 'header' ) { self . _headerBlocks [ blockId ] = block ; self . _loadedHeaderBlockInfos . push ( blockInfo ) ; } else { self . _bodyBlocks [ blockId ] = block ; self . _loadedBodyBlockInfos . push ( blockInfo ) ; } self . _pendingLoads . splice ( self . _pendingLoads . indexOf ( aggrId ) , 1 ) ; var listeners = self . _pendingLoadListeners [ aggrId ] ; delete self . _pendingLoadListeners [ aggrId ] ; for ( var i = 0 ; i < listeners . length ; i ++ ) { try { listeners [ i ] ( block ) ; } catch ( ex ) { self . _LOG . callbackErr ( ex ) ; } } if ( self . _pendingLoads . length === 0 ) self . _runDeferredCalls ( ) ; } this . _LOG . loadBlock_begin ( type , blockId ) ; if ( type === 'header' ) this . _imapDb . loadHeaderBlock ( this . folderId , blockId , onLoaded ) ; else this . _imapDb . loadBodyBlock ( this . folderId , blockId , onLoaded ) ; }
Request the load of the given block and the invocation of the callback with
 the block when the load completes.
Request the load of the given block and the invocation of the callback with the block when the load completes .