mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Make Promise::reject unsafe
This commit is contained in:
parent
d246c5cf20
commit
d31018d444
1 changed files with 5 additions and 9 deletions
|
@ -166,9 +166,9 @@ impl Promise {
|
|||
rooted!(in(cx) let mut v = UndefinedValue());
|
||||
unsafe {
|
||||
val.to_jsval(cx, v.handle_mut());
|
||||
}
|
||||
self.reject(cx, v.handle());
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub fn reject_error(&self, error: Error) {
|
||||
|
@ -177,20 +177,16 @@ impl Promise {
|
|||
rooted!(in(cx) let mut v = UndefinedValue());
|
||||
unsafe {
|
||||
error.to_jsval(cx, &self.global(), v.handle_mut());
|
||||
}
|
||||
self.reject(cx, v.handle());
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root, unsafe_code)]
|
||||
pub fn reject(&self,
|
||||
cx: *mut JSContext,
|
||||
value: HandleValue) {
|
||||
unsafe {
|
||||
pub unsafe fn reject(&self, cx: *mut JSContext, value: HandleValue) {
|
||||
if !RejectPromise(cx, self.promise_obj(), value) {
|
||||
JS_ClearPendingException(cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root, unsafe_code)]
|
||||
pub fn then(&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue