mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
script: add CanGc
argument to Promise::new_resolved
and Promise::new_rejected
(#35605)
* add CanGc to new_resolved and use it where possible Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * add CanGc to new_rejected Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
parent
dd13342f18
commit
adb831eefe
8 changed files with 23 additions and 29 deletions
|
@ -386,14 +386,10 @@ impl WritableStreamDefaultController {
|
|||
let promise = Promise::new_with_js_promise(result_object.handle(), cx);
|
||||
promise
|
||||
} else {
|
||||
let promise = Promise::new(global, can_gc);
|
||||
promise.resolve_native(&result.get());
|
||||
promise
|
||||
Promise::new_resolved(global, cx, result.get(), can_gc)
|
||||
}
|
||||
} else {
|
||||
let promise = Promise::new(global, can_gc);
|
||||
promise.resolve_native(&());
|
||||
promise
|
||||
Promise::new_resolved(global, cx, (), can_gc)
|
||||
};
|
||||
|
||||
let rooted_default_controller = DomRoot::from_ref(self);
|
||||
|
@ -451,9 +447,7 @@ impl WritableStreamDefaultController {
|
|||
ExceptionHandling::Rethrow,
|
||||
)
|
||||
} else {
|
||||
let promise = Promise::new(global, can_gc);
|
||||
promise.resolve_native(&());
|
||||
Ok(promise)
|
||||
Ok(Promise::new_resolved(global, cx, (), can_gc))
|
||||
};
|
||||
result.unwrap_or_else(|e| {
|
||||
let promise = Promise::new(global, can_gc);
|
||||
|
@ -479,9 +473,7 @@ impl WritableStreamDefaultController {
|
|||
ExceptionHandling::Rethrow,
|
||||
)
|
||||
} else {
|
||||
let promise = Promise::new(global, can_gc);
|
||||
promise.resolve_native(&());
|
||||
Ok(promise)
|
||||
Ok(Promise::new_resolved(global, cx, (), can_gc))
|
||||
};
|
||||
result.unwrap_or_else(|e| {
|
||||
let promise = Promise::new(global, can_gc);
|
||||
|
@ -502,9 +494,7 @@ impl WritableStreamDefaultController {
|
|||
let result = if let Some(algo) = algo {
|
||||
algo.Call_(&this_object.handle(), ExceptionHandling::Rethrow)
|
||||
} else {
|
||||
let promise = Promise::new(global, can_gc);
|
||||
promise.resolve_native(&());
|
||||
Ok(promise)
|
||||
Ok(Promise::new_resolved(global, cx, (), can_gc))
|
||||
};
|
||||
result.unwrap_or_else(|e| {
|
||||
let promise = Promise::new(global, can_gc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue