es2015/object-store/AbstractBaseStorage.js
function handleCursorIteration(request, cursorConstructor, recordCallback,
    reject) {
  let iterationRequested = false
  let cursor = new cursorConstructor(request, () => {
    iterationRequested = true
  }, (subRequest) => {
    return PromiseSync.resolve(subRequest).catch((error) => {
      reject(error)
      throw error
    })
  })
  
  try {
    recordCallback(cursor)
  } catch (error) {
    iterationRequested = false
    reject(error)
  }
  
  return iterationRequested
}
function handleCursorIteration(request, cursorConstructor, recordCallback,
    reject) {
  let iterationRequested = false
  let cursor = new cursorConstructor(request, () => {
    iterationRequested = true
  }, (subRequest) => {
    return PromiseSync.resolve(subRequest).catch((error) => {
      reject(error)
      throw error
    })
  })
  
  try {
    recordCallback(cursor)
  } catch (error) {
    iterationRequested = false
    reject(error)
  }
  
  return iterationRequested
}
Handles a single iteration of a Indexed DB cursor iterating the records in
the storage.

@param {IDBRequest} request Indexed DB request resolved to a cursor.
@param {function(new: ReadOnlyCursor, IDBRequest, function(), function(IDBRequest): PromiseSync)} cursorConstructor
Constructor of the high-level cursor implementation to use.
@param {function(ReadOnlyCursor)} recordCallback The callback to execute,
passing a high-level cursor instance pointing to the current record.
@param {function(Error)} reject Callback to call if any sub-operation
triggered by the callback results in an error.
@return {boolean} {@code true} if the cursor should iterate to the next
record.