diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-05-05 23:08:04 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-05-05 23:08:04 +0200 |
commit | 3a5fc11bb8d734cb9113e5e90cb85c025c778fdb (patch) | |
tree | ec069183d049a44a9d08bcd6f59556a4f336fadd /src/components/script/script_task.rs | |
parent | 0016b1839e929648bb874c9bb02fded08fee9961 (diff) | |
download | servo-3a5fc11bb8d734cb9113e5e90cb85c025c778fdb.tar.gz servo-3a5fc11bb8d734cb9113e5e90cb85c025c778fdb.zip |
Enter a compartment when calling timeout handlers.
Diffstat (limited to 'src/components/script/script_task.rs')
-rw-r--r-- | src/components/script/script_task.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 724d5e194c7..20b0e8d33cc 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -787,12 +787,15 @@ impl ScriptTask { None => return, Some(timer_handle) => { // TODO: Support extra arguments. This requires passing a `*JSVal` array as `argv`. - let rval = NullValue(); - unsafe { - JS_CallFunctionValue(self.get_cx(), this_value, - *timer_handle.data.funval, - 0, ptr::null(), &rval); - } + let cx = self.get_cx(); + with_compartment(cx, this_value, || { + let rval = NullValue(); + unsafe { + JS_CallFunctionValue(cx, this_value, + *timer_handle.data.funval, + 0, ptr::null(), &rval); + } + }); is_interval = timer_handle.data.is_interval; } |