mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
Use RootedTraceableBox for dictionaries.
This commit is contained in:
parent
f1605ab149
commit
f7e2f0e641
11 changed files with 75 additions and 24 deletions
|
@ -11,6 +11,7 @@ use dom::bindings::inheritance::Castable;
|
|||
use dom::bindings::js::{MutHeapJSVal, Root};
|
||||
use dom::bindings::reflector::reflect_dom_object;
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::bindings::trace::RootedTraceableBox;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use js::jsapi::{HandleValue, JSContext};
|
||||
|
@ -72,7 +73,8 @@ impl ErrorEvent {
|
|||
|
||||
pub fn Constructor(global: &GlobalScope,
|
||||
type_: DOMString,
|
||||
init: &ErrorEventBinding::ErrorEventInit) -> Fallible<Root<ErrorEvent>>{
|
||||
init: RootedTraceableBox<ErrorEventBinding::ErrorEventInit>)
|
||||
-> Fallible<Root<ErrorEvent>>{
|
||||
let msg = match init.message.as_ref() {
|
||||
Some(message) => message.clone(),
|
||||
None => DOMString::new(),
|
||||
|
@ -91,9 +93,6 @@ impl ErrorEvent {
|
|||
|
||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||
|
||||
// Dictionaries need to be rooted
|
||||
// https://github.com/servo/servo/issues/6381
|
||||
rooted!(in(global.get_cx()) let error = init.error.get());
|
||||
let event = ErrorEvent::new(
|
||||
global,
|
||||
Atom::from(type_),
|
||||
|
@ -103,7 +102,7 @@ impl ErrorEvent {
|
|||
file_name,
|
||||
line_num,
|
||||
col_num,
|
||||
error.handle());
|
||||
init.error.handle());
|
||||
Ok(event)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue