aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/testbinding.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-09-21 16:00:48 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-09-21 16:00:48 +0200
commit5addc2dfa36a48a657c36ecbda0331bfaa8ebf11 (patch)
treedb35ab2ddce4a406097d59f697ccc01ab0a555f7 /components/script/dom/testbinding.rs
parent658dc8a5013973ceff3c91291d5536043b2e8e58 (diff)
downloadservo-5addc2dfa36a48a657c36ecbda0331bfaa8ebf11.tar.gz
servo-5addc2dfa36a48a657c36ecbda0331bfaa8ebf11.zip
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.
Diffstat (limited to 'components/script/dom/testbinding.rs')
-rw-r--r--components/script/dom/testbinding.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs
index 0403cb56573..d6407e31d58 100644
--- a/components/script/dom/testbinding.rs
+++ b/components/script/dom/testbinding.rs
@@ -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);
}
}