Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Prepare Promises for new host hooks and job queue API #2528

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions boa_engine/src/builtins/async_generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,14 +697,13 @@ impl AsyncGenerator {
.build();

// 11. Perform PerformPromiseThen(promise, onFulfilled, onRejected).
let promise_obj = promise
.as_object()
.expect("constructed promise must be a promise");
promise_obj
.borrow_mut()
.as_promise_mut()
.expect("constructed promise must be a promise")
.perform_promise_then(&on_fulfilled.into(), &on_rejected.into(), None, context);
Promise::perform_promise_then(
&promise,
&on_fulfilled.into(),
&on_rejected.into(),
None,
context,
);
}

/// `AsyncGeneratorDrainQueue ( generator )`
Expand Down
19 changes: 7 additions & 12 deletions boa_engine/src/builtins/iterable/async_from_sync_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,18 +430,13 @@ impl AsyncFromSyncIterator {
// re-package the result in a new "unwrapped" IteratorResult object.

// 11. Perform PerformPromiseThen(valueWrapper, onFulfilled, undefined, promiseCapability).
value_wrapper
.as_object()
.expect("result of promise resolve must be promise")
.borrow_mut()
.as_promise_mut()
.expect("constructed promise must be a promise")
.perform_promise_then(
&on_fulfilled.into(),
&JsValue::Undefined,
Some(promise_capability.clone()),
context,
);
Promise::perform_promise_then(
&value_wrapper,
&on_fulfilled.into(),
&JsValue::Undefined,
Some(promise_capability.clone()),
context,
);

// 12. Return promiseCapability.[[Promise]].
Ok(promise_capability.promise().clone().into())
Expand Down
Loading