mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Reject promise with broken promise in AsyncGenerator.prototype.return
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
d49aece60c
commit
b66f1f6678
2 changed files with 20 additions and 17 deletions
|
|
@ -158,21 +158,26 @@ Value AsyncGeneratorObject::asyncGeneratorResumeNext(ExecutionState& state, Asyn
|
|||
// Set generator.[[AsyncGeneratorState]] to "awaiting-return".
|
||||
generator->m_asyncGeneratorState = AsyncGeneratorObject::AwaitingReturn;
|
||||
// Let promise be ? PromiseResolve(%Promise%, « completion.[[Value]] »).
|
||||
auto promise = PromiseObject::promiseResolve(state, state.context()->globalObject()->promise(), next.m_value)->asPromiseObject();
|
||||
// Let stepsFulfilled be the algorithm steps defined in AsyncGeneratorResumeNext Return Processor Fulfilled Functions.
|
||||
// Let onFulfilled be CreateBuiltinFunction(stepsFulfilled, « [[Generator]] »).
|
||||
// Set onFulfilled.[[Generator]] to generator.
|
||||
ExtendedNativeFunctionObject* onFulfilled = new ExtendedNativeFunctionObjectImpl<1>(state, NativeFunctionInfo(AtomicString(), asyncGeneratorResumeNextReturnProcessorFulfilledFunction, 1));
|
||||
onFulfilled->setInternalSlot(AsyncGeneratorObject::BuiltinFunctionSlot::Generator, generator);
|
||||
// Let stepsRejected be the algorithm steps defined in AsyncGeneratorResumeNext Return Processor Rejected Functions.
|
||||
// Let onRejected be CreateBuiltinFunction(stepsRejected, « [[Generator]] »).
|
||||
// Set onRejected.[[Generator]] to generator.
|
||||
ExtendedNativeFunctionObject* onRejected = new ExtendedNativeFunctionObjectImpl<1>(state, NativeFunctionInfo(AtomicString(), asyncGeneratorResumeNextReturnProcessorRejectedFunction, 1));
|
||||
onRejected->setInternalSlot(AsyncGeneratorObject::BuiltinFunctionSlot::Generator, generator);
|
||||
// Perform ! PerformPromiseThen(promise, onFulfilled, onRejected).
|
||||
promise->then(state, onFulfilled, onRejected);
|
||||
// Return undefined.
|
||||
return Value();
|
||||
try {
|
||||
auto promise = PromiseObject::promiseResolve(state, state.context()->globalObject()->promise(), next.m_value)->asPromiseObject();
|
||||
// Let stepsFulfilled be the algorithm steps defined in AsyncGeneratorResumeNext Return Processor Fulfilled Functions.
|
||||
// Let onFulfilled be CreateBuiltinFunction(stepsFulfilled, « [[Generator]] »).
|
||||
// Set onFulfilled.[[Generator]] to generator.
|
||||
ExtendedNativeFunctionObject* onFulfilled = new ExtendedNativeFunctionObjectImpl<1>(state, NativeFunctionInfo(AtomicString(), asyncGeneratorResumeNextReturnProcessorFulfilledFunction, 1));
|
||||
onFulfilled->setInternalSlot(AsyncGeneratorObject::BuiltinFunctionSlot::Generator, generator);
|
||||
// Let stepsRejected be the algorithm steps defined in AsyncGeneratorResumeNext Return Processor Rejected Functions.
|
||||
// Let onRejected be CreateBuiltinFunction(stepsRejected, « [[Generator]] »).
|
||||
// Set onRejected.[[Generator]] to generator.
|
||||
ExtendedNativeFunctionObject* onRejected = new ExtendedNativeFunctionObjectImpl<1>(state, NativeFunctionInfo(AtomicString(), asyncGeneratorResumeNextReturnProcessorRejectedFunction, 1));
|
||||
onRejected->setInternalSlot(AsyncGeneratorObject::BuiltinFunctionSlot::Generator, generator);
|
||||
// Perform ! PerformPromiseThen(promise, onFulfilled, onRejected).
|
||||
promise->then(state, onFulfilled, onRejected);
|
||||
// Return undefined.
|
||||
return Value();
|
||||
} catch (const Value& error) {
|
||||
AsyncGeneratorObject::asyncGeneratorReject(state, generator, error);
|
||||
return Value();
|
||||
}
|
||||
} else {
|
||||
// Assert: completion.[[Type]] is throw.
|
||||
// Perform ! AsyncGeneratorReject(generator, completion.[[Value]]).
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@
|
|||
<test id="built-ins/ArrayBuffer/prototype/resize/this-is-immutable-arraybuffer-object"><reason>TODO</reason></test>
|
||||
<test id="built-ins/ArrayBuffer/prototype/transfer/this-is-immutable-arraybuffer"><reason>TODO</reason></test>
|
||||
<test id="built-ins/ArrayBuffer/prototype/transferToFixedLength/this-is-immutable-arraybuffer"><reason>TODO</reason></test>
|
||||
<test id="built-ins/AsyncGeneratorPrototype/return/return-state-completed-broken-promise"><reason>TODO</reason></test>
|
||||
<test id="built-ins/AsyncGeneratorPrototype/return/return-suspendedStart-broken-promise"><reason>TODO</reason></test>
|
||||
<test id="built-ins/DataView/custom-proto-access-resizes-buffer-invalid-by-length"><reason>TODO</reason></test>
|
||||
<test id="built-ins/DataView/custom-proto-access-resizes-buffer-invalid-by-offset"><reason>TODO</reason></test>
|
||||
<test id="built-ins/DataView/custom-proto-access-resizes-buffer-valid-by-offset"><reason>TODO</reason></test>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue