1
0
Fork 0
mirror of https://github.com/servo/servo.git synced 2025-08-04 21:20:23 +01:00

Store Window.active_timers in a HashMap

A HashMap allows easily looking up a timer and canceling it in
Window.ClearTimeout.

Fixes .
This commit is contained in:
Martin Robinson 2014-03-29 16:30:17 -07:00
parent 83c2d92397
commit 1a8a3cc271
2 changed files with 16 additions and 12 deletions
src/components/script

View file

@ -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")