aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/script_task.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2014-03-29 16:30:17 -0700
committerMartin Robinson <mrobinson@igalia.com>2014-03-31 15:07:50 -0700
commit1a8a3cc271080b573507cd9ea4ec6c1866a4af99 (patch)
tree821f6ad653b1e2229bffcfa4a8bf3b53ad95d4f8 /src/components/script/script_task.rs
parent83c2d923975e753830238bea175cc674839452d3 (diff)
downloadservo-1a8a3cc271080b573507cd9ea4ec6c1866a4af99.tar.gz
servo-1a8a3cc271080b573507cd9ea4ec6c1866a4af99.zip
Store Window.active_timers in a HashMap
A HashMap allows easily looking up a timer and canceling it in Window.ClearTimeout. Fixes #1477.
Diffstat (limited to 'src/components/script/script_task.rs')
-rw-r--r--src/components/script/script_task.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs
index bbac828cf59..22a03a7b680 100644
--- a/src/components/script/script_task.rs
+++ b/src/components/script/script_task.rs
@@ -16,7 +16,7 @@ use dom::event::Event;
use dom::uievent::UIEvent;
use dom::eventtarget::EventTarget;
use dom::node::{Node, NodeHelpers};
-use dom::window::{TimerData, TimerHandle, Window};
+use dom::window::{TimerData, Window};
use dom::windowproxy::WindowProxy;
use html::hubbub_html_parser::HtmlParserResult;
use html::hubbub_html_parser::{HtmlDiscoveredStyle, HtmlDiscoveredIFrame, HtmlDiscoveredScript};
@@ -645,10 +645,12 @@ impl ScriptTask {
pipeline ID not associated with this script task. This is a bug.").page();
let frame = page.frame();
let mut window = frame.get().get_ref().window.clone();
- if !window.get().active_timers.contains(&TimerHandle { handle: timer_data.handle, cancel_chan: None }) {
+
+ let timer_handle = window.get_mut().active_timers.pop(&timer_data.handle);
+ if timer_handle.is_none() {
return;
}
- window.get_mut().active_timers.remove(&TimerHandle { handle: timer_data.handle, cancel_chan: None });
+
let js_info = page.js_info();
let this_value = if timer_data.args.len() > 0 {
fail!("NYI")