Bug 1371405: Update Cookie handling code to align with WebDriver crate; r=ato

Details of changes to WebDriver Crate can be found at
48e436df3f

MozReview-Commit-ID: 9rie1uA0JYO

--HG--
extra : rebase_source : 5457741bd94dc013a12c1bdd5446dfe988b65938
This commit is contained in:
David Burns 2017-06-19 14:43:06 +01:00
Родитель 0d131ff39e
Коммит 8cc37ae802
1 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -40,8 +40,9 @@ use webdriver::command::{
SwitchToFrameParameters, LocatorParameters, JavascriptCommandParameters,
GetNamedCookieParameters, AddCookieParameters, TimeoutsParameters,
ActionsParameters, TakeScreenshotParameters};
use webdriver::response::{CloseWindowResponse, Cookie, CookieResponse, RectResponse,
NewSessionResponse, TimeoutsResponse, ValueResponse, WebDriverResponse};
use webdriver::response::{CloseWindowResponse, Cookie, CookieResponse, CookiesResponse,
RectResponse, NewSessionResponse, TimeoutsResponse, ValueResponse,
WebDriverResponse};
use webdriver::common::{
Date, Nullable, WebElement, FrameId, ELEMENT_KEY};
use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult};
@ -736,7 +737,7 @@ impl MarionetteSession {
WebDriverResponse::ElementRect(RectResponse::new(x, y, width, height))
},
FullscreenWindow | MaximizeWindow | GetWindowRect |
MaximizeWindow | SetWindowRect(_) => {
SetWindowRect(_) => {
let width = try_opt!(
try_opt!(resp.result.find("width"),
ErrorStatus::UnknownError,
@ -769,12 +770,12 @@ impl MarionetteSession {
},
GetCookies => {
let cookies = try!(self.process_cookies(&resp.result));
WebDriverResponse::Cookie(CookieResponse::new(cookies))
WebDriverResponse::Cookies(CookiesResponse {value: cookies})
},
GetNamedCookie(ref name) => {
let mut cookies = try!(self.process_cookies(&resp.result));
cookies.retain(|x| x.name == *name);
WebDriverResponse::Cookie(CookieResponse::new(cookies))
WebDriverResponse::Cookies(CookiesResponse { value : cookies })
}
FindElement(_) | FindElementElement(_, _) => {
let element = try!(self.to_web_element(
@ -903,11 +904,11 @@ impl MarionetteSession {
x.find("secure").map_or(Some(false), |x| x.as_boolean()),
ErrorStatus::UnknownError,
"Failed to interpret secure as boolean");
let http_only = try_opt!(
let httpOnly = try_opt!(
x.find("httpOnly").map_or(Some(false), |x| x.as_boolean()),
ErrorStatus::UnknownError,
"Failed to interpret httpOnly as boolean");
Ok(Cookie::new(name, value, path, domain, expiry, secure, http_only))
Ok(Cookie {name, value, path, domain, expiry, secure, httpOnly})
}).collect::<Result<Vec<_>, _>>()
}