mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +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,16 +601,26 @@ pub(crate) fn wait_for_all_promise(
|
||||||
failure_promise.reject_native(&reason, can_gc);
|
failure_promise.reject_native(&reason, can_gc);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for all with promises, given successSteps and failureSteps.
|
if promises.is_empty() {
|
||||||
wait_for_all(
|
// Note: part of `wait_for_all`.
|
||||||
cx,
|
// Done here by using `resolve_native`.
|
||||||
global,
|
// TODO: #37259
|
||||||
promises,
|
// If total is 0, then:
|
||||||
success_steps,
|
// Queue a microtask to perform successSteps given « ».
|
||||||
failure_steps,
|
let empty_list: Vec<HandleValue> = vec![];
|
||||||
realm,
|
promise.resolve_native(&empty_list, can_gc);
|
||||||
can_gc,
|
} else {
|
||||||
);
|
// Wait for all with promises, given successSteps and failureSteps.
|
||||||
|
wait_for_all(
|
||||||
|
cx,
|
||||||
|
global,
|
||||||
|
promises,
|
||||||
|
success_steps,
|
||||||
|
failure_steps,
|
||||||
|
realm,
|
||||||
|
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