mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +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
|
@ -35,7 +35,7 @@ use dom::promise::Promise;
|
|||
use dom::promisenativehandler::{PromiseNativeHandler, Callback};
|
||||
use dom::url::URL;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{HandleObject, HandleValue, Heap, JSContext, JSObject, JSAutoCompartment};
|
||||
use js::jsapi::{HandleObject, HandleValue, Heap, JSContext, JSObject};
|
||||
use js::jsapi::{JS_NewPlainObject, JS_NewUint8ClampedArray};
|
||||
use js::jsval::{JSVal, NullValue};
|
||||
use script_traits::MsDuration;
|
||||
|
@ -814,9 +814,6 @@ pub struct TestBindingCallback {
|
|||
impl TestBindingCallback {
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn invoke(self) {
|
||||
let p = self.promise.root();
|
||||
let cx = p.global().get_cx();
|
||||
let _ac = JSAutoCompartment::new(cx, p.reflector().get_jsobject().get());
|
||||
p.resolve_native(cx, &self.value);
|
||||
self.promise.root().resolve_native(&self.value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue