diff options
author | Guillaume Bort <guillaume.bort@gmail.com> | 2014-11-19 12:06:36 +0100 |
---|---|---|
committer | Guillaume Bort <guillaume.bort@gmail.com> | 2015-01-07 11:39:15 +0100 |
commit | 5fe3a3e54f2d94c33ca84c54521aab4bd6b98c1e (patch) | |
tree | b00df282e3464c87308642eb6e765762418ba09c /components/script/dom/workerglobalscope.rs | |
parent | ca876edc051c9b105747252155d0f11c31189646 (diff) | |
download | servo-5fe3a3e54f2d94c33ca84c54521aab4bd6b98c1e.tar.gz servo-5fe3a3e54f2d94c33ca84c54521aab4bd6b98c1e.zip |
Fix #3936 – {Window,WorkerGlobalScope}.set{Timeout,Interval}(DOMString)
Diffstat (limited to 'components/script/dom/workerglobalscope.rs')
-rw-r--r-- | components/script/dom/workerglobalscope.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 3cec2779de9..648cded28a8 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -17,7 +17,7 @@ use dom::workerlocation::WorkerLocation; use dom::workernavigator::WorkerNavigator; use dom::window::{base64_atob, base64_btoa}; use script_task::{ScriptChan, TimerSource}; -use timers::{IsInterval, TimerId, TimerManager}; +use timers::{IsInterval, TimerId, TimerManager, TimerCallback}; use servo_net::resource_task::{ResourceTask, load_whole_resource}; use servo_util::str::DOMString; @@ -143,7 +143,16 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> { } fn SetTimeout(self, _cx: *mut JSContext, callback: Function, timeout: i32, args: Vec<JSVal>) -> i32 { - self.timers.set_timeout_or_interval(callback, + self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback), + args, + timeout, + IsInterval::NonInterval, + TimerSource::FromWorker, + self.script_chan()) + } + + fn SetTimeout_(self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<JSVal>) -> i32 { + self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback), args, timeout, IsInterval::NonInterval, @@ -156,7 +165,16 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> { } fn SetInterval(self, _cx: *mut JSContext, callback: Function, timeout: i32, args: Vec<JSVal>) -> i32 { - self.timers.set_timeout_or_interval(callback, + self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback), + args, + timeout, + IsInterval::Interval, + TimerSource::FromWorker, + self.script_chan()) + } + + fn SetInterval_(self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<JSVal>) -> i32 { + self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback), args, timeout, IsInterval::Interval, |