Enter a compartment when calling timeout handlers.

This commit is contained in:
Ms2ger 2014-05-05 23:08:04 +02:00
parent 0016b1839e
commit 3a5fc11bb8

View file

@ -787,12 +787,15 @@ impl ScriptTask {
None => return, None => return,
Some(timer_handle) => { Some(timer_handle) => {
// TODO: Support extra arguments. This requires passing a `*JSVal` array as `argv`. // TODO: Support extra arguments. This requires passing a `*JSVal` array as `argv`.
let rval = NullValue(); let cx = self.get_cx();
unsafe { with_compartment(cx, this_value, || {
JS_CallFunctionValue(self.get_cx(), this_value, let rval = NullValue();
*timer_handle.data.funval, unsafe {
0, ptr::null(), &rval); JS_CallFunctionValue(cx, this_value,
} *timer_handle.data.funval,
0, ptr::null(), &rval);
}
});
is_interval = timer_handle.data.is_interval; is_interval = timer_handle.data.is_interval;
} }