aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/script_task.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-06-10 15:20:01 +0200
committerMs2ger <ms2ger@gmail.com>2014-06-11 19:51:07 +0200
commite9b64dc361db2b068a0079e599ad0725c2eb8a0c (patch)
treef45388bfbb633aa5ae7d42c9448c9875f7094d46 /src/components/script/script_task.rs
parent07c67a1d5a1aacd5422b4f1968b6e103e75a9d0a (diff)
downloadservo-e9b64dc361db2b068a0079e599ad0725c2eb8a0c.tar.gz
servo-e9b64dc361db2b068a0079e599ad0725c2eb8a0c.zip
Use internal mutability for Window::{active_timers, next_timer_handle}.
Diffstat (limited to 'src/components/script/script_task.rs')
-rw-r--r--src/components/script/script_task.rs32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs
index 1b7fc2d1241..adcbd050ee8 100644
--- a/src/components/script/script_task.rs
+++ b/src/components/script/script_task.rs
@@ -817,31 +817,27 @@ impl ScriptTask {
let page = page.find(id).expect("ScriptTask: received fire timer msg for a
pipeline ID not associated with this script task. This is a bug.");
let frame = page.frame();
- let mut window = frame.get_ref().window.root();
+ let window = frame.get_ref().window.root();
let this_value = window.deref().reflector().get_jsobject();
- let is_interval;
- match window.deref().active_timers.find(&timer_id) {
+ let data = match window.deref().active_timers.deref().borrow().find(&timer_id) {
None => return,
- Some(timer_handle) => {
- // TODO: Support extra arguments. This requires passing a `*JSVal` array as `argv`.
- let cx = self.get_cx();
- with_compartment(cx, this_value, || {
- let mut rval = NullValue();
- unsafe {
- JS_CallFunctionValue(cx, this_value,
- *timer_handle.data.funval,
- 0, ptr::mut_null(), &mut rval);
- }
- });
+ Some(timer_handle) => timer_handle.data,
+ };
- is_interval = timer_handle.data.is_interval;
+ // TODO: Support extra arguments. This requires passing a `*JSVal` array as `argv`.
+ let cx = self.get_cx();
+ with_compartment(cx, this_value, || {
+ let mut rval = NullValue();
+ unsafe {
+ JS_CallFunctionValue(cx, this_value, *data.funval,
+ 0, ptr::mut_null(), &mut rval);
}
- }
+ });
- if !is_interval {
- window.deref_mut().active_timers.remove(&timer_id);
+ if !data.is_interval {
+ window.deref().active_timers.deref().borrow_mut().remove(&timer_id);
}
}