From e2c141179b87097808bbe86ba3d9938ab27837b2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 5 Jan 2017 17:49:01 +0100 Subject: [PATCH] Remove some unsound JSVal handling in JsTimerTask::invoke. We were using Handles to *copies* of the traced values, rather than the originals. --- components/script/timers.rs | 9 ++------- 1 file 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(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 = 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); }, };