Skip to content

Commit

Permalink
Make ErrorEvent::new take cancelable and bubbling enums
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagopnts committed Dec 15, 2014
1 parent 2e34125 commit 60ba4a9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions components/script/dom/errorevent.rs
Expand Up @@ -13,7 +13,7 @@ use js::jsapi::JSContext;
use dom::bindings::trace::JSTraceable;

use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, EventTypeId, ErrorEventTypeId};
use dom::event::{Event, EventTypeId, ErrorEventTypeId, EventBubbles, Bubbles, DoesNotBubble, EventCancelable, Cancelable, NotCancelable};
use servo_util::str::DOMString;

use dom::bindings::cell::DOMRefCell;
Expand Down Expand Up @@ -56,16 +56,16 @@ impl ErrorEvent {

pub fn new(global: &GlobalRef,
type_: DOMString,
can_bubble: bool,
cancelable: bool,
bubbles: EventBubbles,
cancelable: EventCancelable,
message: DOMString,
filename: DOMString,
lineno: u32,
colno: u32,
error: JSVal) -> Temporary<ErrorEvent> {
let ev = ErrorEvent::new_uninitialized(global).root();
let event: JSRef<Event> = EventCast::from_ref(*ev);
event.InitEvent(type_, can_bubble, cancelable);
event.InitEvent(type_, bubbles == Bubbles, cancelable == Cancelable);
*ev.message.borrow_mut() = message;
*ev.filename.borrow_mut() = filename;
ev.lineno.set(lineno);
Expand All @@ -91,8 +91,12 @@ impl ErrorEvent {

let col_num = init.colno.unwrap_or(0);

let bubbles = if init.parent.bubbles { Bubbles } else { DoesNotBubble };

let cancelable = if init.parent.cancelable { Cancelable } else { NotCancelable };

let event = ErrorEvent::new(global, type_,
init.parent.bubbles, init.parent.cancelable,
bubbles, cancelable,
msg, file_name,
line_num, col_num, init.error);
Ok(event)
Expand Down

5 comments on commit 60ba4a9

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from Ms2ger
at thiagopnts@60ba4a9

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging thiagopnts/servo/errorevent = 60ba4a9 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thiagopnts/servo/errorevent = 60ba4a9 merged ok, testing candidate = 1bc2c8a

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 1bc2c8a

Please sign in to comment.