Move timers to GlobalScope

This commit is contained in:
Anthony Ramine 2016-10-04 13:06:37 +02:00
parent 5d8979237b
commit 991801488c
8 changed files with 144 additions and 145 deletions

View file

@ -1077,15 +1077,14 @@ impl XMLHttpRequest {
xhr: Trusted::new(self),
generation_id: self.generation_id.get(),
});
let global = self.global();
let duration = Length::new(duration_ms as u64);
*self.timeout_cancel.borrow_mut() = Some(global.r().schedule_callback(callback, duration));
*self.timeout_cancel.borrow_mut() =
Some(self.global_scope().schedule_callback(callback, duration));
}
fn cancel_timeout(&self) {
if let Some(handle) = self.timeout_cancel.borrow_mut().take() {
let global = self.global();
global.r().unschedule_callback(handle);
self.global_scope().unschedule_callback(handle);
}
}