function Promise(executor) {
  if (executor === promiseRawSymbol) {
    return %_NewObject(GlobalPromise, new.target);
  }
  if (IS_UNDEFINED(new.target)) throw MakeTypeError(kNotAPromise, this);
  if (!IS_CALLABLE(executor)) {
    throw MakeTypeError(kResolverNotAFunction, executor);
  }

  var promise = PromiseInit(%_NewObject(GlobalPromise, new.target));
  var callbacks = CreateResolvingFunctions(promise);
  var debug_is_active = DEBUG_IS_ACTIVE;
  try {
    if (debug_is_active) %DebugPushPromise(promise, Promise);
    executor(callbacks.resolve, callbacks.reject);
  } catch (e) {
    %_Call(callbacks.reject, UNDEFINED, e);
  } finally {
    if (debug_is_active) %DebugPopPromise();
  }

  return promise;
}
function Promise(executor) {
  if (executor === promiseRawSymbol) {
    return %_NewObject(GlobalPromise, new.target);
  }
  if (IS_UNDEFINED(new.target)) throw MakeTypeError(kNotAPromise, this);
  if (!IS_CALLABLE(executor)) {
    throw MakeTypeError(kResolverNotAFunction, executor);
  }

  var promise = PromiseInit(%_NewObject(GlobalPromise, new.target));
  var callbacks = CreateResolvingFunctions(promise);
  var debug_is_active = DEBUG_IS_ACTIVE;
  try {
    if (debug_is_active) %DebugPushPromise(promise, Promise);
    executor(callbacks.resolve, callbacks.reject);
  } catch (e) {
    %_Call(callbacks.reject, UNDEFINED, e);
  } finally {
    if (debug_is_active) %DebugPopPromise();
  }

  return promise;
}
function Promise ( executor ) { if ( executor === promiseRawSymbol ) { return % _NewObject ( GlobalPromise , new . target ) ; } if ( IS_UNDEFINED ( new . target ) ) throw MakeTypeError ( kNotAPromise , this ) ; if ( ! IS_CALLABLE ( executor ) ) { throw MakeTypeError ( kResolverNotAFunction , executor ) ; } var promise = PromiseInit ( % _NewObject ( GlobalPromise , new . target ) ) ; var callbacks = CreateResolvingFunctions ( promise ) ; var debug_is_active = DEBUG_IS_ACTIVE ; try { if ( debug_is_active ) % DebugPushPromise ( promise , Promise ) ; executor ( callbacks . resolve , callbacks . reject ) ; } catch ( e ) { % _Call ( callbacks . reject , UNDEFINED , e ) ; } finally { if ( debug_is_active ) % DebugPopPromise ( ) ; } return promise ; }
ES#sec-promise-executor Promise ( executor )
ES#sec - promise - executor Promise ( executor )