From 95dc54d216d63b7314214afc1b50025b73a132b1 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Sun, 17 Sep 2017 01:34:07 +0200 Subject: [PATCH] Use normal tasks to reject and resolve promises --- components/script/dom/bindings/refcounted.rs | 10 +++++----- 1 file 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, script_thread: &ScriptThread) { + fn run(self: Box) { 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(TrustedPromise, T); impl Task for ResolvePromise { - fn run_with_script_thread(self: Box, script_thread: &ScriptThread) { + fn run(self: Box) { 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); }