promise.js
function UpdatePromiseFromPotentialThenable ( x, promiseCapability ) {
    var then, rejectResult, thenCallResult;
    if ( Type(x) !== 'object' ) {
      return 'not a thenable';
    }
    try {
      then = x.then;
    } catch ( e ) {
      rejectResult = promiseCapability['[[Reject]]'].call(undefined, e);
      return null;
    }
    if ( !IsCallable(then) ) {
      return 'not a thenable';
    }
    try {
      thenCallResult = then.call(x, promiseCapability['[[Resolve]]'],
        promiseCapability['[[Reject]]']
      );
    } catch ( e ) {
      rejectResult = promiseCapability['[[Reject]]'].call(undefined, e);
      return null;
    }
    return null;
  }
function UpdatePromiseFromPotentialThenable ( x, promiseCapability ) {
    var then, rejectResult, thenCallResult;
    if ( Type(x) !== 'object' ) {
      return 'not a thenable';
    }
    try {
      then = x.then;
    } catch ( e ) {
      rejectResult = promiseCapability['[[Reject]]'].call(undefined, e);
      return null;
    }
    if ( !IsCallable(then) ) {
      return 'not a thenable';
    }
    try {
      thenCallResult = then.call(x, promiseCapability['[[Resolve]]'],
        promiseCapability['[[Reject]]']
      );
    } catch ( e ) {
      rejectResult = promiseCapability['[[Reject]]'].call(undefined, e);
      return null;
    }
    return null;
  }
25.4.1.8 UpdatePromiseFromPotentialThenable ( x, promiseCapability )