mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
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 -->
This commit is contained in:
commit
c3cf4386b0
1 changed files with 2 additions and 7 deletions
|
@ -483,7 +483,6 @@ fn clamp_duration(nesting_level: u32, unclamped: MsDuration) -> MsDuration {
|
||||||
|
|
||||||
impl JsTimerTask {
|
impl JsTimerTask {
|
||||||
// see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps
|
// see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps
|
||||||
#[allow(unsafe_code)]
|
|
||||||
pub fn invoke<T: DomObject>(self, this: &T, timers: &JsTimers) {
|
pub fn invoke<T: DomObject>(self, this: &T, timers: &JsTimers) {
|
||||||
// step 4.1 can be ignored, because we proactively prevent execution
|
// step 4.1 can be ignored, because we proactively prevent execution
|
||||||
// of this task when its scheduled execution is canceled.
|
// of this task when its scheduled execution is canceled.
|
||||||
|
@ -492,7 +491,7 @@ impl JsTimerTask {
|
||||||
timers.nesting_level.set(self.nesting_level);
|
timers.nesting_level.set(self.nesting_level);
|
||||||
|
|
||||||
// step 4.2
|
// step 4.2
|
||||||
match *&self.callback {
|
match self.callback {
|
||||||
InternalTimerCallback::StringTimerCallback(ref code_str) => {
|
InternalTimerCallback::StringTimerCallback(ref code_str) => {
|
||||||
let global = this.global();
|
let global = this.global();
|
||||||
let cx = global.get_cx();
|
let cx = global.get_cx();
|
||||||
|
@ -502,11 +501,7 @@ impl JsTimerTask {
|
||||||
code_str, rval.handle_mut());
|
code_str, rval.handle_mut());
|
||||||
},
|
},
|
||||||
InternalTimerCallback::FunctionTimerCallback(ref function, ref arguments) => {
|
InternalTimerCallback::FunctionTimerCallback(ref function, ref arguments) => {
|
||||||
let arguments: Vec<JSVal> = arguments.iter().map(|arg| arg.get()).collect();
|
let arguments = arguments.iter().map(|arg| arg.handle()).collect();
|
||||||
let arguments = arguments.iter().by_ref().map(|arg| unsafe {
|
|
||||||
HandleValue::from_marked_location(arg)
|
|
||||||
}).collect();
|
|
||||||
|
|
||||||
let _ = function.Call_(this, arguments, Report);
|
let _ = function.Call_(this, arguments, Report);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue