aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/timers.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-01-05 14:00:50 -0800
committerGitHub <noreply@github.com>2017-01-05 14:00:50 -0800
commitc3cf4386b04dd3609ada0824c32b0517f840d185 (patch)
tree3d82b050d60791b66eb944bd5c98fa4e0c15e0e4 /components/script/timers.rs
parent42e28bf7e59e0c7fab7163326d7374d1c4e268d1 (diff)
parente2c141179b87097808bbe86ba3d9938ab27837b2 (diff)
downloadservo-c3cf4386b04dd3609ada0824c32b0517f840d185.tar.gz
servo-c3cf4386b04dd3609ada0824c32b0517f840d185.zip
Auto merge of #14864 - servo:timers, r=jdm
Remove some unsound JSVal handling in JsTimerTask::invoke. We were using Handles to *copies* of the traced values, rather than the originals. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14864) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/timers.rs')
-rw-r--r--components/script/timers.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs
index b86bdc17aae..881fe9b6034 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -483,7 +483,6 @@ fn clamp_duration(nesting_level: u32, unclamped: MsDuration) -> MsDuration {
impl JsTimerTask {
// see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps
- #[allow(unsafe_code)]
pub fn invoke<T: DomObject>(self, this: &T, timers: &JsTimers) {
// step 4.1 can be ignored, because we proactively prevent execution
// of this task when its scheduled execution is canceled.
@@ -492,7 +491,7 @@ impl JsTimerTask {
timers.nesting_level.set(self.nesting_level);
// step 4.2
- match *&self.callback {
+ match self.callback {
InternalTimerCallback::StringTimerCallback(ref code_str) => {
let global = this.global();
let cx = global.get_cx();
@@ -502,11 +501,7 @@ impl JsTimerTask {
code_str, rval.handle_mut());
},
InternalTimerCallback::FunctionTimerCallback(ref function, ref arguments) => {
- let arguments: Vec<JSVal> = arguments.iter().map(|arg| arg.get()).collect();
- let arguments = arguments.iter().by_ref().map(|arg| unsafe {
- HandleValue::from_marked_location(arg)
- }).collect();
-
+ let arguments = arguments.iter().map(|arg| arg.handle()).collect();
let _ = function.Call_(this, arguments, Report);
},
};