promise.js
function CreatePromiseCapabilityRecord ( promise, constructor ) {
    var promiseCapability = {}, executor, constructorResult;
    defineInternal(promiseCapability, '[[Promise]]', promise);
    defineInternal(promiseCapability, '[[Resolve]]', undefined);
    defineInternal(promiseCapability, '[[Reject]]', undefined);
    executor = new GetCapabilitiesExecutor();
    defineInternal(executor, '[[Capability]]', promiseCapability);
    try {
      constructorResult = constructor.call(promise, executor);
    } catch ( e ) {
      return e;
    }
    if ( !IsCallable(promiseCapability['[[Resolve]]']) ) {
      throw TypeError();
    }
    if ( !IsCallable(promiseCapability['[[Reject]]']) ) {
      throw TypeError();
    }
    if ( typeof constructorResult === 'object' &&
      !SameValue(promise, constructorResult) ) {
      throw TypeError();
    }
    return promiseCapability;
  }
function CreatePromiseCapabilityRecord ( promise, constructor ) {
    var promiseCapability = {}, executor, constructorResult;
    defineInternal(promiseCapability, '[[Promise]]', promise);
    defineInternal(promiseCapability, '[[Resolve]]', undefined);
    defineInternal(promiseCapability, '[[Reject]]', undefined);
    executor = new GetCapabilitiesExecutor();
    defineInternal(executor, '[[Capability]]', promiseCapability);
    try {
      constructorResult = constructor.call(promise, executor);
    } catch ( e ) {
      return e;
    }
    if ( !IsCallable(promiseCapability['[[Resolve]]']) ) {
      throw TypeError();
    }
    if ( !IsCallable(promiseCapability['[[Reject]]']) ) {
      throw TypeError();
    }
    if ( typeof constructorResult === 'object' &&
      !SameValue(promise, constructorResult) ) {
      throw TypeError();
    }
    return promiseCapability;
  }
25.4.1.5.1 CreatePromiseCapabilityRecord( promise, constructor )