mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Make Promise::new_rejected unsafe
This commit is contained in:
parent
860f2d806f
commit
a69c5da208
1 changed files with 3 additions and 5 deletions
|
@ -126,17 +126,15 @@ impl Promise {
|
|||
}
|
||||
|
||||
#[allow(unrooted_must_root, unsafe_code)]
|
||||
pub fn new_rejected(
|
||||
pub unsafe fn new_rejected(
|
||||
global: &GlobalScope,
|
||||
cx: *mut JSContext,
|
||||
value: HandleValue,
|
||||
) -> Fallible<Rc<Promise>> {
|
||||
let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get());
|
||||
rooted!(in(cx) let p = unsafe { CallOriginalPromiseReject(cx, value) });
|
||||
rooted!(in(cx) let p = CallOriginalPromiseReject(cx, value));
|
||||
assert!(!p.handle().is_null());
|
||||
unsafe {
|
||||
Ok(Promise::new_with_js_promise(p.handle(), cx))
|
||||
}
|
||||
Ok(Promise::new_with_js_promise(p.handle(), cx))
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue