mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Make Promise::resolve_native actually sound
We shouldn't have to pass a raw JSContext pointer, and to enter the promise's context's compartment by hand.
This commit is contained in:
parent
658dc8a501
commit
5addc2dfa3
17 changed files with 42 additions and 53 deletions
|
@ -142,7 +142,9 @@ impl Promise {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub fn resolve_native<T>(&self, cx: *mut JSContext, val: &T) where T: ToJSValConvertible {
|
||||
pub fn resolve_native<T>(&self, val: &T) where T: ToJSValConvertible {
|
||||
let cx = self.global().get_cx();
|
||||
let _ac = JSAutoCompartment::new(cx, self.reflector().get_jsobject().get());
|
||||
rooted!(in(cx) let mut v = UndefinedValue());
|
||||
unsafe {
|
||||
val.to_jsval(cx, v.handle_mut());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue