Make Promise::resolve unsafe

This commit is contained in:
Anthony Ramine 2017-09-22 01:49:22 +02:00
parent 5994e40070
commit 2400731bfc

View file

@ -148,16 +148,14 @@ impl Promise {
rooted!(in(cx) let mut v = UndefinedValue());
unsafe {
val.to_jsval(cx, v.handle_mut());
self.resolve(cx, v.handle());
}
self.resolve(cx, v.handle());
}
#[allow(unrooted_must_root, unsafe_code)]
pub fn resolve(&self, cx: *mut JSContext, value: HandleValue) {
unsafe {
if !ResolvePromise(cx, self.promise_obj(), value) {
JS_ClearPendingException(cx);
}
pub unsafe fn resolve(&self, cx: *mut JSContext, value: HandleValue) {
if !ResolvePromise(cx, self.promise_obj(), value) {
JS_ClearPendingException(cx);
}
}