promise.js
function InitializePromise ( promise, executor) {
    var resolve, reject, completion, status;
    if ( Type(promise['[[PromiseStatus]]']) !== 'undefined' ) {
      throw TypeError();
    }
    if ( !IsCallable(executor) ) {
      throw TypeError();
    }
    defineInternal(promise, '[[PromiseStatus]]', 'unresolved');
    defineInternal(promise, '[[PromiseResolveReactions]]', []);
    defineInternal(promise, '[[PromiseRejectReactions]]', []);
    resolve = CreateResolveFunction(promise);
    reject = CreateRejectFunction(promise);
    try {
      completion = executor.call(undefined, resolve, reject);
    } catch ( e ) {
      try {
        status = reject.call(undefined, e);
      } catch ( e ) {
        return e;
      }
    }
    return promise;
  }
function InitializePromise ( promise, executor) {
    var resolve, reject, completion, status;
    if ( Type(promise['[[PromiseStatus]]']) !== 'undefined' ) {
      throw TypeError();
    }
    if ( !IsCallable(executor) ) {
      throw TypeError();
    }
    defineInternal(promise, '[[PromiseStatus]]', 'unresolved');
    defineInternal(promise, '[[PromiseResolveReactions]]', []);
    defineInternal(promise, '[[PromiseRejectReactions]]', []);
    resolve = CreateResolveFunction(promise);
    reject = CreateRejectFunction(promise);
    try {
      completion = executor.call(undefined, resolve, reject);
    } catch ( e ) {
      try {
        status = reject.call(undefined, e);
      } catch ( e ) {
        return e;
      }
    }
    return promise;
  }
25.4.3.1.1 InitializePromise( promise, executor )