mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
handle empty list of promise
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
2f2e962ae0
commit
eb731dde55
2 changed files with 23 additions and 12 deletions
|
@ -526,7 +526,8 @@ pub(crate) fn wait_for_all(
|
||||||
// Note: done using the len of result.
|
// Note: done using the len of result.
|
||||||
|
|
||||||
// If total is 0, then:
|
// If total is 0, then:
|
||||||
// TODO: Queue a microtask to perform successSteps given « ».
|
// Queue a microtask to perform successSteps given « ».
|
||||||
|
// TODO: #37259
|
||||||
|
|
||||||
// Let index be 0.
|
// Let index be 0.
|
||||||
// Note: done with `enumerate` below.
|
// Note: done with `enumerate` below.
|
||||||
|
@ -600,6 +601,15 @@ pub(crate) fn wait_for_all_promise(
|
||||||
failure_promise.reject_native(&reason, can_gc);
|
failure_promise.reject_native(&reason, can_gc);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if promises.is_empty() {
|
||||||
|
// Note: part of `wait_for_all`.
|
||||||
|
// Done here by using `resolve_native`.
|
||||||
|
// TODO: #37259
|
||||||
|
// If total is 0, then:
|
||||||
|
// Queue a microtask to perform successSteps given « ».
|
||||||
|
let empty_list: Vec<HandleValue> = vec![];
|
||||||
|
promise.resolve_native(&empty_list, can_gc);
|
||||||
|
} else {
|
||||||
// Wait for all with promises, given successSteps and failureSteps.
|
// Wait for all with promises, given successSteps and failureSteps.
|
||||||
wait_for_all(
|
wait_for_all(
|
||||||
cx,
|
cx,
|
||||||
|
@ -610,6 +620,7 @@ pub(crate) fn wait_for_all_promise(
|
||||||
realm,
|
realm,
|
||||||
can_gc,
|
can_gc,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Return promise.
|
// Return promise.
|
||||||
promise
|
promise
|
||||||
|
|
|
@ -349,7 +349,7 @@ impl Callback for PipeTo {
|
||||||
get_dictionary_property(
|
get_dictionary_property(
|
||||||
*cx,
|
*cx,
|
||||||
object.handle(),
|
object.handle(),
|
||||||
"0",
|
"push",
|
||||||
done.handle_mut(),
|
done.handle_mut(),
|
||||||
can_gc,
|
can_gc,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue