mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Use unsafe Heap::handle wherever needed
This commit is contained in:
parent
ed0091f86f
commit
f7c039516c
3 changed files with 12 additions and 3 deletions
|
@ -500,7 +500,7 @@ impl JsTimerTask {
|
|||
code_str, rval.handle_mut());
|
||||
},
|
||||
InternalTimerCallback::FunctionTimerCallback(ref function, ref arguments) => {
|
||||
let arguments = arguments.iter().map(|arg| arg.handle()).collect();
|
||||
let arguments = self.collect_heap_args(arguments);
|
||||
let _ = function.Call_(this, arguments, Report);
|
||||
},
|
||||
};
|
||||
|
@ -516,4 +516,11 @@ impl JsTimerTask {
|
|||
timers.initialize_and_schedule(&this.global(), self);
|
||||
}
|
||||
}
|
||||
|
||||
// Returning Handles directly from Heap values is inherently unsafe, but here it's
|
||||
// always done via rooted JsTimers, which is safe.
|
||||
#[allow(unsafe_code)]
|
||||
fn collect_heap_args(&self, args: &[Heap<JSVal>]) -> Vec<HandleValue> {
|
||||
args.iter().map(|arg| unsafe { arg.handle() }).collect()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue