Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some unsound JSVal handling in JsTimerTask::invoke. #14864

Merged
merged 1 commit into from Jan 5, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Remove some unsound JSVal handling in JsTimerTask::invoke.

We were using Handles to *copies* of the traced values, rather than the
originals.
  • Loading branch information
Ms2ger committed Jan 5, 2017
commit e2c141179b87097808bbe86ba3d9938ab27837b2
@@ -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);
},
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.