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

Cleanup CloseEvent. #5961

Merged
merged 4 commits into from May 6, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Move the CloseEventInit defaults into IDL.

  • Loading branch information
Ms2ger committed May 6, 2015
commit 94b3617629476bd98e3482955b16d6d4b505c025
@@ -15,8 +15,6 @@ use script_task::ScriptChan;

use util::str::DOMString;

use std::borrow::ToOwned;

#[dom_struct]
pub struct CloseEvent {
event: Event,
@@ -57,15 +55,10 @@ impl CloseEvent {
type_: DOMString,
init: &CloseEventBinding::CloseEventInit)
-> Fallible<Temporary<CloseEvent>> {
let clean_status = init.wasClean.unwrap_or(true);
let cd = init.code.unwrap_or(0);
let rsn = match init.reason.as_ref() {
Some(reason) => reason.clone(),
None => "".to_owned(),
};
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable };
Ok(CloseEvent::new(global, type_, bubbles, cancelable, clean_status, cd, rsn))
Ok(CloseEvent::new(global, type_, bubbles, cancelable, init.wasClean,
init.code, init.reason.clone()))
}
}

@@ -11,7 +11,7 @@ interface CloseEvent : Event {
};

dictionary CloseEventInit : EventInit {
boolean wasClean;
unsigned short code;
DOMString reason;
boolean wasClean = true;
unsigned short code = 0;
DOMString reason = "";
};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.