refactor: add CanGc as argument to Promise::resolve (#35616)

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
Yerkebulan Tulibergenov 2025-02-23 04:12:21 -08:00 committed by GitHub
parent adb831eefe
commit 0383ba9a5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 330 additions and 294 deletions

View file

@ -184,7 +184,7 @@ impl Promise {
}
#[allow(unsafe_code)]
pub(crate) fn resolve_native<T>(&self, val: &T)
pub(crate) fn resolve_native<T>(&self, val: &T, can_gc: CanGc)
where
T: ToJSValConvertible,
{
@ -194,12 +194,12 @@ impl Promise {
unsafe {
val.to_jsval(*cx, v.handle_mut());
}
self.resolve(cx, v.handle());
self.resolve(cx, v.handle(), can_gc);
}
#[allow(unsafe_code)]
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn resolve(&self, cx: SafeJSContext, value: HandleValue) {
pub(crate) fn resolve(&self, cx: SafeJSContext, value: HandleValue, _can_gc: CanGc) {
unsafe {
if !ResolvePromise(*cx, self.promise_obj(), value) {
JS_ClearPendingException(*cx);