Skip to content

Commit

Permalink
webdriver: Merge pull request mozilla#29 from danlrobertson/expiry
Browse files Browse the repository at this point in the history
AddCookieParameters expiry should accept a date

Source-Repo: https://github.com/mozilla/webdriver-rust
Source-Revision: 86372d85c7bbf3e3f2520994b72a77f0c9eb23b4
  • Loading branch information
dlrobertson committed Apr 27, 2016
1 parent 2ce7421 commit ac9e218
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
17 changes: 0 additions & 17 deletions testing/webdriver/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ pub struct AddCookieParameters {
pub path: Nullable<String>,
pub domain: Nullable<String>,
pub expiry: Nullable<Date>,
pub maxAge: Nullable<Date>,
pub secure: bool,
pub httpOnly: bool
}
Expand Down Expand Up @@ -752,7 +751,6 @@ impl Parameters for AddCookieParameters {
None => Nullable::Null
};

//TODO: This is supposed to support some text format
let expiry = match data.get("expiry") {
Some(expiry_json) => {
try!(Nullable::from_json(
Expand All @@ -766,19 +764,6 @@ impl Parameters for AddCookieParameters {
None => Nullable::Null
};

let max_age = match data.get("maxAge") {
Some(max_age_json) => {
try!(Nullable::from_json(
max_age_json,
|x| {
Ok(Date::new(try_opt!(x.as_u64(),
ErrorStatus::InvalidArgument,
"Failed to convert expiry to Date")))
}))
},
None => Nullable::Null
};

let secure = match data.get("secure") {
Some(x) => try_opt!(x.as_boolean(),
ErrorStatus::InvalidArgument,
Expand All @@ -799,7 +784,6 @@ impl Parameters for AddCookieParameters {
path: path,
domain: domain,
expiry: expiry,
maxAge: max_age,
secure: secure,
httpOnly: http_only
})
Expand All @@ -814,7 +798,6 @@ impl ToJson for AddCookieParameters {
data.insert("path".to_string(), self.path.to_json());
data.insert("domain".to_string(), self.domain.to_json());
data.insert("expiry".to_string(), self.expiry.to_json());
data.insert("maxAge".to_string(), self.maxAge.to_json());
data.insert("secure".to_string(), self.secure.to_json());
data.insert("httpOnly".to_string(), self.httpOnly.to_json());
Json::Object(data)
Expand Down
4 changes: 1 addition & 3 deletions testing/webdriver/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,19 @@ pub struct Cookie {
pub path: Nullable<String>,
pub domain: Nullable<String>,
pub expiry: Nullable<Date>,
pub maxAge: Nullable<Date>,
pub secure: bool,
pub httpOnly: bool
}

impl Cookie {
pub fn new(name: String, value: String, path: Nullable<String>, domain: Nullable<String>,
expiry: Nullable<Date>, max_age: Nullable<Date>, secure: bool, http_only: bool) -> Cookie {
expiry: Nullable<Date>, secure: bool, http_only: bool) -> Cookie {
Cookie {
name: name,
value: value,
path: path,
domain: domain,
expiry: expiry,
maxAge: max_age,
secure: secure,
httpOnly: http_only
}
Expand Down

0 comments on commit ac9e218

Please sign in to comment.