aboutsummaryrefslogtreecommitdiffstats
path: root/components/webdriver_server
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-07-26 18:13:39 +0200
committerGitHub <noreply@github.com>2024-07-26 16:13:39 +0000
commitb6f1e3b22d076a9b52691bf641fe4ba55df4470f (patch)
treec6c8bb8926090dae0ccbfa81a28747abc01af867 /components/webdriver_server
parent8f377a0cb144b32182938f2210360a9a124e2b16 (diff)
downloadservo-b6f1e3b22d076a9b52691bf641fe4ba55df4470f.tar.gz
servo-b6f1e3b22d076a9b52691bf641fe4ba55df4470f.zip
dependencies: Upgrade `cookie` and rename Servo's `Cookie` to `ServoCookie` (#32861)
This changes updates to the new version of the `cookie` crate in Servo which no longer uses the old `time@0.1` data types. This requires using a new version of `time` while we transition off of the old one. This is the first step in that process. In addition, the overloading of the `cookie::Cookie` name was causing a great deal of confusion, so I've renamed the Servo wrapper to `ServoCookie` like we do with `ServoUrl`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/webdriver_server')
-rw-r--r--components/webdriver_server/lib.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs
index 6bdfb645c4e..1d6041e2ad1 100644
--- a/components/webdriver_server/lib.rs
+++ b/components/webdriver_server/lib.rs
@@ -20,6 +20,7 @@ use base::id::{BrowsingContextId, TopLevelBrowsingContextId};
use base64::Engine;
use capabilities::ServoCapabilities;
use compositing_traits::ConstellationMsg;
+use cookie::{CookieBuilder, Expiration};
use crossbeam_channel::{after, select, unbounded, Receiver, Sender};
use euclid::{Rect, Size2D};
use http::method::Method;
@@ -92,9 +93,10 @@ fn cookie_msg_to_cookie(cookie: cookie::Cookie) -> Cookie {
value: cookie.value().to_owned(),
path: cookie.path().map(|s| s.to_owned()),
domain: cookie.domain().map(|s| s.to_owned()),
- expiry: cookie
- .expires()
- .map(|time| Date(time.to_timespec().sec as u64)),
+ expiry: cookie.expires().and_then(|expiration| match expiration {
+ Expiration::DateTime(date_time) => Some(Date(date_time.unix_timestamp() as u64)),
+ Expiration::Session => None,
+ }),
secure: cookie.secure().unwrap_or(false),
http_only: cookie.http_only().unwrap_or(false),
same_site: cookie.same_site().map(|s| s.to_string()),
@@ -1254,19 +1256,19 @@ impl Handler {
) -> WebDriverResult<WebDriverResponse> {
let (sender, receiver) = ipc::channel().unwrap();
- let cookie = cookie::Cookie::build(params.name.to_owned(), params.value.to_owned())
+ let cookie_builder = CookieBuilder::new(params.name.to_owned(), params.value.to_owned())
.secure(params.secure)
.http_only(params.httpOnly);
- let cookie = match params.domain {
- Some(ref domain) => cookie.domain(domain.to_owned()),
- _ => cookie,
+ let cookie_builder = match params.domain {
+ Some(ref domain) => cookie_builder.domain(domain.to_owned()),
+ _ => cookie_builder,
};
- let cookie = match params.path {
- Some(ref path) => cookie.path(path.to_owned()).finish(),
- _ => cookie.finish(),
+ let cookie_builder = match params.path {
+ Some(ref path) => cookie_builder.path(path.to_owned()),
+ _ => cookie_builder,
};
- let cmd = WebDriverScriptCommand::AddCookie(cookie, sender);
+ let cmd = WebDriverScriptCommand::AddCookie(cookie_builder.build(), sender);
self.browsing_context_script_command(cmd)?;
match receiver.recv().unwrap() {
Ok(_) => Ok(WebDriverResponse::Void),