aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/refcounted.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-09-17 01:34:07 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-09-17 01:34:07 +0200
commit95dc54d216d63b7314214afc1b50025b73a132b1 (patch)
treeae675747924c03ec083a7389e5493521a179ea3a /components/script/dom/bindings/refcounted.rs
parent9a267e53feed09ae236a554b7b58b607cdcc55d9 (diff)
downloadservo-95dc54d216d63b7314214afc1b50025b73a132b1.tar.gz
servo-95dc54d216d63b7314214afc1b50025b73a132b1.zip
Use normal tasks to reject and resolve promises
Diffstat (limited to 'components/script/dom/bindings/refcounted.rs')
-rw-r--r--components/script/dom/bindings/refcounted.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs
index b315416c48c..1be8a369d8f 100644
--- a/components/script/dom/bindings/refcounted.rs
+++ b/components/script/dom/bindings/refcounted.rs
@@ -32,7 +32,7 @@ use dom::promise::Promise;
use js::jsapi::JSAutoCompartment;
use js::jsapi::JSTracer;
use libc;
-use script_thread::{ScriptThread, Task};
+use script_thread::Task;
use std::cell::RefCell;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::hash_map::HashMap;
@@ -125,11 +125,11 @@ impl TrustedPromise {
pub fn reject_task(self, error: Error) -> impl Send + Task {
struct RejectPromise(TrustedPromise, Error);
impl Task for RejectPromise {
- fn run_with_script_thread(self: Box<Self>, script_thread: &ScriptThread) {
+ fn run(self: Box<Self>) {
debug!("Rejecting promise.");
let this = *self;
- let cx = script_thread.get_cx();
let promise = this.0.root();
+ let cx = promise.global().get_cx();
let _ac = JSAutoCompartment::new(cx, promise.reflector().get_jsobject().get());
promise.reject_error(cx, this.1);
}
@@ -145,11 +145,11 @@ impl TrustedPromise {
{
struct ResolvePromise<T>(TrustedPromise, T);
impl<T: ToJSValConvertible> Task for ResolvePromise<T> {
- fn run_with_script_thread(self: Box<Self>, script_thread: &ScriptThread) {
+ fn run(self: Box<Self>) {
debug!("Resolving promise.");
let this = *self;
- let cx = script_thread.get_cx();
let promise = this.0.root();
+ let cx = promise.global().get_cx();
let _ac = JSAutoCompartment::new(cx, promise.reflector().get_jsobject().get());
promise.resolve_native(cx, &this.1);
}