Move WebIDL methods to traits implemented by JSRef types.

This commit is contained in:
Josh Matthews 2014-04-10 21:29:54 -04:00
parent dfdda0098a
commit 76783b029e
106 changed files with 3644 additions and 1912 deletions

View file

@ -34,104 +34,134 @@ impl Location {
window,
LocationBinding::Wrap)
}
}
pub fn Assign(&self, _url: DOMString) {
pub trait LocationMethods {
fn Assign(&self, _url: DOMString);
fn Replace(&self, _url: DOMString);
fn Reload(&self);
fn Href(&self) -> DOMString;
fn SetHref(&self, _href: DOMString) -> Fallible<()>;
fn Origin(&self) -> DOMString;
fn Protocol(&self) -> DOMString;
fn SetProtocol(&self, _protocol: DOMString);
fn Username(&self) -> DOMString;
fn SetUsername(&self, _username: DOMString);
fn Password(&self) -> DOMString;
fn SetPassword(&self, _password: DOMString);
fn Host(&self) -> DOMString;
fn SetHost(&self, _host: DOMString);
fn Hostname(&self) -> DOMString;
fn SetHostname(&self, _hostname: DOMString);
fn Port(&self) -> DOMString;
fn SetPort(&self, _port: DOMString);
fn Pathname(&self) -> DOMString;
fn SetPathname(&self, _pathname: DOMString);
fn Search(&self) -> DOMString;
fn SetSearch(&self, _search: DOMString);
fn Hash(&self) -> DOMString;
fn SetHash(&self, _hash: DOMString);
}
impl<'a> LocationMethods for JSRef<'a, Location> {
fn Assign(&self, _url: DOMString) {
}
pub fn Replace(&self, _url: DOMString) {
fn Replace(&self, _url: DOMString) {
}
pub fn Reload(&self) {
fn Reload(&self) {
}
pub fn Href(&self) -> DOMString {
fn Href(&self) -> DOMString {
self.page.get_url().to_str()
}
pub fn SetHref(&self, _href: DOMString) -> Fallible<()> {
fn SetHref(&self, _href: DOMString) -> Fallible<()> {
Ok(())
}
pub fn Origin(&self) -> DOMString {
fn Origin(&self) -> DOMString {
~""
}
pub fn Protocol(&self) -> DOMString {
fn Protocol(&self) -> DOMString {
~""
}
pub fn SetProtocol(&self, _protocol: DOMString) {
fn SetProtocol(&self, _protocol: DOMString) {
}
pub fn Username(&self) -> DOMString {
fn Username(&self) -> DOMString {
~""
}
pub fn SetUsername(&self, _username: DOMString) {
fn SetUsername(&self, _username: DOMString) {
}
pub fn Password(&self) -> DOMString {
fn Password(&self) -> DOMString {
~""
}
pub fn SetPassword(&self, _password: DOMString) {
fn SetPassword(&self, _password: DOMString) {
}
pub fn Host(&self) -> DOMString {
fn Host(&self) -> DOMString {
~""
}
pub fn SetHost(&self, _host: DOMString) {
fn SetHost(&self, _host: DOMString) {
}
pub fn Hostname(&self) -> DOMString {
fn Hostname(&self) -> DOMString {
~""
}
pub fn SetHostname(&self, _hostname: DOMString) {
fn SetHostname(&self, _hostname: DOMString) {
}
pub fn Port(&self) -> DOMString {
fn Port(&self) -> DOMString {
~""
}
pub fn SetPort(&self, _port: DOMString) {
fn SetPort(&self, _port: DOMString) {
}
pub fn Pathname(&self) -> DOMString {
fn Pathname(&self) -> DOMString {
~""
}
pub fn SetPathname(&self, _pathname: DOMString) {
fn SetPathname(&self, _pathname: DOMString) {
}
pub fn Search(&self) -> DOMString {
fn Search(&self) -> DOMString {
~""
}
pub fn SetSearch(&self, _search: DOMString) {
fn SetSearch(&self, _search: DOMString) {
}
pub fn Hash(&self) -> DOMString {
fn Hash(&self) -> DOMString {
~""
}
pub fn SetHash(&self, _hash: DOMString) {
fn SetHash(&self, _hash: DOMString) {
}
}
impl Reflectable for Location {
fn reflector<'a>(&'a self) -> &'a Reflector {
&self.reflector_