aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/tests
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/net/tests
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/net/tests')
-rw-r--r--components/net/tests/cookie.rs212
-rw-r--r--components/net/tests/cookie_http_state.rs5
-rw-r--r--components/net/tests/http_loader.rs12
3 files changed, 114 insertions, 115 deletions
diff --git a/components/net/tests/cookie.rs b/components/net/tests/cookie.rs
index 3b14ba1ceb1..7868e57d0e6 100644
--- a/components/net/tests/cookie.rs
+++ b/components/net/tests/cookie.rs
@@ -2,53 +2,53 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use net::cookie::Cookie;
+use net::cookie::ServoCookie;
use net::cookie_storage::CookieStorage;
use net_traits::CookieSource;
use servo_url::ServoUrl;
#[test]
fn test_domain_match() {
- assert!(Cookie::domain_match("foo.com", "foo.com"));
- assert!(Cookie::domain_match("bar.foo.com", "foo.com"));
- assert!(Cookie::domain_match("baz.bar.foo.com", "foo.com"));
-
- assert!(!Cookie::domain_match("bar.foo.com", "bar.com"));
- assert!(!Cookie::domain_match("bar.com", "baz.bar.com"));
- assert!(!Cookie::domain_match("foo.com", "bar.com"));
-
- assert!(!Cookie::domain_match("bar.com", "bbar.com"));
- assert!(Cookie::domain_match("235.132.2.3", "235.132.2.3"));
- assert!(!Cookie::domain_match("235.132.2.3", "1.1.1.1"));
- assert!(!Cookie::domain_match("235.132.2.3", ".2.3"));
+ assert!(ServoCookie::domain_match("foo.com", "foo.com"));
+ assert!(ServoCookie::domain_match("bar.foo.com", "foo.com"));
+ assert!(ServoCookie::domain_match("baz.bar.foo.com", "foo.com"));
+
+ assert!(!ServoCookie::domain_match("bar.foo.com", "bar.com"));
+ assert!(!ServoCookie::domain_match("bar.com", "baz.bar.com"));
+ assert!(!ServoCookie::domain_match("foo.com", "bar.com"));
+
+ assert!(!ServoCookie::domain_match("bar.com", "bbar.com"));
+ assert!(ServoCookie::domain_match("235.132.2.3", "235.132.2.3"));
+ assert!(!ServoCookie::domain_match("235.132.2.3", "1.1.1.1"));
+ assert!(!ServoCookie::domain_match("235.132.2.3", ".2.3"));
}
#[test]
fn test_path_match() {
- assert!(Cookie::path_match("/", "/"));
- assert!(Cookie::path_match("/index.html", "/"));
- assert!(Cookie::path_match("/w/index.html", "/"));
- assert!(Cookie::path_match("/w/index.html", "/w/index.html"));
- assert!(Cookie::path_match("/w/index.html", "/w/"));
- assert!(Cookie::path_match("/w/index.html", "/w"));
-
- assert!(!Cookie::path_match("/", "/w/"));
- assert!(!Cookie::path_match("/a", "/w/"));
- assert!(!Cookie::path_match("/", "/w"));
- assert!(!Cookie::path_match("/w/index.html", "/w/index"));
- assert!(!Cookie::path_match("/windex.html", "/w/"));
- assert!(!Cookie::path_match("/windex.html", "/w"));
+ assert!(ServoCookie::path_match("/", "/"));
+ assert!(ServoCookie::path_match("/index.html", "/"));
+ assert!(ServoCookie::path_match("/w/index.html", "/"));
+ assert!(ServoCookie::path_match("/w/index.html", "/w/index.html"));
+ assert!(ServoCookie::path_match("/w/index.html", "/w/"));
+ assert!(ServoCookie::path_match("/w/index.html", "/w"));
+
+ assert!(!ServoCookie::path_match("/", "/w/"));
+ assert!(!ServoCookie::path_match("/a", "/w/"));
+ assert!(!ServoCookie::path_match("/", "/w"));
+ assert!(!ServoCookie::path_match("/w/index.html", "/w/index"));
+ assert!(!ServoCookie::path_match("/windex.html", "/w/"));
+ assert!(!ServoCookie::path_match("/windex.html", "/w"));
}
#[test]
fn test_default_path() {
- assert_eq!(&*Cookie::default_path("/foo/bar/baz/"), "/foo/bar/baz");
- assert_eq!(&*Cookie::default_path("/foo/bar/baz"), "/foo/bar");
- assert_eq!(&*Cookie::default_path("/foo/"), "/foo");
- assert_eq!(&*Cookie::default_path("/foo"), "/");
- assert_eq!(&*Cookie::default_path("/"), "/");
- assert_eq!(&*Cookie::default_path(""), "/");
- assert_eq!(&*Cookie::default_path("foo"), "/");
+ assert_eq!(&*ServoCookie::default_path("/foo/bar/baz/"), "/foo/bar/baz");
+ assert_eq!(&*ServoCookie::default_path("/foo/bar/baz"), "/foo/bar");
+ assert_eq!(&*ServoCookie::default_path("/foo/"), "/foo");
+ assert_eq!(&*ServoCookie::default_path("/foo"), "/");
+ assert_eq!(&*ServoCookie::default_path("/"), "/");
+ assert_eq!(&*ServoCookie::default_path(""), "/");
+ assert_eq!(&*ServoCookie::default_path("foo"), "/");
}
#[test]
@@ -59,33 +59,33 @@ fn fn_cookie_constructor() {
let gov_url = &ServoUrl::parse("http://gov.ac/foo").unwrap();
// cookie name/value test
- assert!(cookie_rs::Cookie::parse(" baz ").is_err());
- assert!(cookie_rs::Cookie::parse(" = bar ").is_err());
- assert!(cookie_rs::Cookie::parse(" baz = ").is_ok());
+ assert!(cookie::Cookie::parse(" baz ").is_err());
+ assert!(cookie::Cookie::parse(" = bar ").is_err());
+ assert!(cookie::Cookie::parse(" baz = ").is_ok());
// cookie domains test
- let cookie = cookie_rs::Cookie::parse(" baz = bar; Domain = ").unwrap();
- assert!(Cookie::new_wrapped(cookie.clone(), url, CookieSource::HTTP).is_some());
- let cookie = Cookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
+ let cookie = cookie::Cookie::parse(" baz = bar; Domain = ").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie.clone(), url, CookieSource::HTTP).is_some());
+ let cookie = ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
assert_eq!(&**cookie.cookie.domain().as_ref().unwrap(), "example.com");
// cookie public domains test
- let cookie = cookie_rs::Cookie::parse(" baz = bar; Domain = gov.ac").unwrap();
- assert!(Cookie::new_wrapped(cookie.clone(), url, CookieSource::HTTP).is_none());
- assert!(Cookie::new_wrapped(cookie, gov_url, CookieSource::HTTP).is_some());
+ let cookie = cookie::Cookie::parse(" baz = bar; Domain = gov.ac").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie.clone(), url, CookieSource::HTTP).is_none());
+ assert!(ServoCookie::new_wrapped(cookie, gov_url, CookieSource::HTTP).is_some());
// cookie domain matching test
- let cookie = cookie_rs::Cookie::parse(" baz = bar ; Secure; Domain = bazample.com").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse(" baz = bar ; Secure; Domain = bazample.com").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
- let cookie = cookie_rs::Cookie::parse(" baz = bar ; Secure; Path = /foo/bar/").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_some());
+ let cookie = cookie::Cookie::parse(" baz = bar ; Secure; Path = /foo/bar/").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_some());
- let cookie = cookie_rs::Cookie::parse(" baz = bar ; HttpOnly").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::NonHTTP).is_none());
+ let cookie = cookie::Cookie::parse(" baz = bar ; HttpOnly").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::NonHTTP).is_none());
- let cookie = cookie_rs::Cookie::parse(" baz = bar ; Secure; Path = /foo/bar/").unwrap();
- let cookie = Cookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
+ let cookie = cookie::Cookie::parse(" baz = bar ; Secure; Path = /foo/bar/").unwrap();
+ let cookie = ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
assert_eq!(cookie.cookie.value(), "bar");
assert_eq!(cookie.cookie.name(), "baz");
assert!(cookie.cookie.secure().unwrap_or(false));
@@ -94,77 +94,75 @@ fn fn_cookie_constructor() {
assert!(cookie.host_only);
let u = &ServoUrl::parse("http://example.com/foobar").unwrap();
- let cookie = cookie_rs::Cookie::parse("foobar=value;path=/").unwrap();
- assert!(Cookie::new_wrapped(cookie, u, CookieSource::HTTP).is_some());
+ let cookie = cookie::Cookie::parse("foobar=value;path=/").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, u, CookieSource::HTTP).is_some());
}
#[test]
fn test_cookie_secure_prefix() {
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Secure-SID=12345").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Secure-SID=12345").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("http://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Secure-SID=12345; Secure").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Secure-SID=12345; Secure").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Secure-SID=12345; Secure").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_some());
+ let cookie = cookie::Cookie::parse("__Secure-SID=12345; Secure").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_some());
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Secure-SID=12345; Domain=example.com").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Secure-SID=12345; Domain=example.com").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("http://example.com").unwrap();
- let cookie =
- cookie_rs::Cookie::parse("__Secure-SID=12345; Secure; Domain=example.com").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Secure-SID=12345; Secure; Domain=example.com").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie =
- cookie_rs::Cookie::parse("__Secure-SID=12345; Secure; Domain=example.com").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_some());
+ let cookie = cookie::Cookie::parse("__Secure-SID=12345; Secure; Domain=example.com").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_some());
}
#[test]
fn test_cookie_host_prefix() {
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Host-SID=12345").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Host-SID=12345").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("http://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Host-SID=12345; Secure").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Host-SID=12345; Secure").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Host-SID=12345; Secure").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Host-SID=12345; Secure").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Host-SID=12345; Domain=example.com").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Host-SID=12345; Domain=example.com").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Host-SID=12345; Domain=example.com; Path=/").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Host-SID=12345; Domain=example.com; Path=/").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("http://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Host-SID=12345; Secure; Domain=example.com").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Host-SID=12345; Secure; Domain=example.com").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Host-SID=12345; Secure; Domain=example.com").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ let cookie = cookie::Cookie::parse("__Host-SID=12345; Secure; Domain=example.com").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("https://example.com").unwrap();
let cookie =
- cookie_rs::Cookie::parse("__Host-SID=12345; Secure; Domain=example.com; Path=/").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
+ cookie::Cookie::parse("__Host-SID=12345; Secure; Domain=example.com; Path=/").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_none());
let url = &ServoUrl::parse("https://example.com").unwrap();
- let cookie = cookie_rs::Cookie::parse("__Host-SID=12345; Secure; Path=/").unwrap();
- assert!(Cookie::new_wrapped(cookie, url, CookieSource::HTTP).is_some());
+ let cookie = cookie::Cookie::parse("__Host-SID=12345; Secure; Path=/").unwrap();
+ assert!(ServoCookie::new_wrapped(cookie, url, CookieSource::HTTP).is_some());
}
#[cfg(target_os = "windows")]
@@ -185,12 +183,12 @@ fn test_sort_order() {
use std::cmp::Ordering;
let url = &ServoUrl::parse("http://example.com/foo").unwrap();
- let a_wrapped = cookie_rs::Cookie::parse("baz=bar; Path=/foo/bar/").unwrap();
- let a = Cookie::new_wrapped(a_wrapped.clone(), url, CookieSource::HTTP).unwrap();
+ let a_wrapped = cookie::Cookie::parse("baz=bar; Path=/foo/bar/").unwrap();
+ let a = ServoCookie::new_wrapped(a_wrapped.clone(), url, CookieSource::HTTP).unwrap();
delay_to_ensure_different_timestamp();
- let a_prime = Cookie::new_wrapped(a_wrapped, url, CookieSource::HTTP).unwrap();
- let b = cookie_rs::Cookie::parse("baz=bar;Path=/foo/bar/baz/").unwrap();
- let b = Cookie::new_wrapped(b, url, CookieSource::HTTP).unwrap();
+ let a_prime = ServoCookie::new_wrapped(a_wrapped, url, CookieSource::HTTP).unwrap();
+ let b = cookie::Cookie::parse("baz=bar;Path=/foo/bar/baz/").unwrap();
+ let b = ServoCookie::new_wrapped(b, url, CookieSource::HTTP).unwrap();
assert!(b.cookie.path().as_ref().unwrap().len() > a.cookie.path().as_ref().unwrap().len());
assert_eq!(CookieStorage::cookie_comparator(&a, &b), Ordering::Greater);
@@ -208,8 +206,8 @@ fn test_sort_order() {
fn add_cookie_to_storage(storage: &mut CookieStorage, url: &ServoUrl, cookie_str: &str) {
let source = CookieSource::HTTP;
- let cookie = cookie_rs::Cookie::parse(cookie_str.to_owned()).unwrap();
- let cookie = Cookie::new_wrapped(cookie, url, source).unwrap();
+ let cookie = cookie::Cookie::parse(cookie_str.to_owned()).unwrap();
+ let cookie = ServoCookie::new_wrapped(cookie, url, source).unwrap();
storage.push(cookie, url, source);
}
@@ -220,13 +218,13 @@ fn test_insecure_cookies_cannot_evict_secure_cookie() {
let source = CookieSource::HTTP;
let mut cookies = Vec::new();
- cookies.push(cookie_rs::Cookie::parse("foo=bar; Secure; Domain=home.example.org").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo2=bar; Secure; Domain=.example.org").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo3=bar; Secure; Path=/foo").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo4=bar; Secure; Path=/foo/bar").unwrap());
+ cookies.push(cookie::Cookie::parse("foo=bar; Secure; Domain=home.example.org").unwrap());
+ cookies.push(cookie::Cookie::parse("foo2=bar; Secure; Domain=.example.org").unwrap());
+ cookies.push(cookie::Cookie::parse("foo3=bar; Secure; Path=/foo").unwrap());
+ cookies.push(cookie::Cookie::parse("foo4=bar; Secure; Path=/foo/bar").unwrap());
for bare_cookie in cookies {
- let cookie = Cookie::new_wrapped(bare_cookie, &secure_url, source).unwrap();
+ let cookie = ServoCookie::new_wrapped(bare_cookie, &secure_url, source).unwrap();
storage.push(cookie, &secure_url, source);
}
@@ -275,13 +273,13 @@ fn test_secure_cookies_eviction() {
let source = CookieSource::HTTP;
let mut cookies = Vec::new();
- cookies.push(cookie_rs::Cookie::parse("foo=bar; Secure; Domain=home.example.org").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo2=bar; Secure; Domain=.example.org").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo3=bar; Secure; Path=/foo").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo4=bar; Secure; Path=/foo/bar").unwrap());
+ cookies.push(cookie::Cookie::parse("foo=bar; Secure; Domain=home.example.org").unwrap());
+ cookies.push(cookie::Cookie::parse("foo2=bar; Secure; Domain=.example.org").unwrap());
+ cookies.push(cookie::Cookie::parse("foo3=bar; Secure; Path=/foo").unwrap());
+ cookies.push(cookie::Cookie::parse("foo4=bar; Secure; Path=/foo/bar").unwrap());
for bare_cookie in cookies {
- let cookie = Cookie::new_wrapped(bare_cookie, &url, source).unwrap();
+ let cookie = ServoCookie::new_wrapped(bare_cookie, &url, source).unwrap();
storage.push(cookie, &url, source);
}
@@ -317,13 +315,13 @@ fn test_secure_cookies_eviction_non_http_source() {
let source = CookieSource::NonHTTP;
let mut cookies = Vec::new();
- cookies.push(cookie_rs::Cookie::parse("foo=bar; Secure; Domain=home.example.org").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo2=bar; Secure; Domain=.example.org").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo3=bar; Secure; Path=/foo").unwrap());
- cookies.push(cookie_rs::Cookie::parse("foo4=bar; Secure; Path=/foo/bar").unwrap());
+ cookies.push(cookie::Cookie::parse("foo=bar; Secure; Domain=home.example.org").unwrap());
+ cookies.push(cookie::Cookie::parse("foo2=bar; Secure; Domain=.example.org").unwrap());
+ cookies.push(cookie::Cookie::parse("foo3=bar; Secure; Path=/foo").unwrap());
+ cookies.push(cookie::Cookie::parse("foo4=bar; Secure; Path=/foo/bar").unwrap());
for bare_cookie in cookies {
- let cookie = Cookie::new_wrapped(bare_cookie, &url, source).unwrap();
+ let cookie = ServoCookie::new_wrapped(bare_cookie, &url, source).unwrap();
storage.push(cookie, &url, source);
}
@@ -363,7 +361,7 @@ fn add_retrieve_cookies(
// Add all cookies to the store
for str_cookie in set_cookies {
- let cookie = Cookie::from_cookie_string(str_cookie.to_owned(), &url, source).unwrap();
+ let cookie = ServoCookie::from_cookie_string(str_cookie.to_owned(), &url, source).unwrap();
storage.push(cookie, &url, source);
}
diff --git a/components/net/tests/cookie_http_state.rs b/components/net/tests/cookie_http_state.rs
index 0a03dbc81b8..9ab492c5d9b 100644
--- a/components/net/tests/cookie_http_state.rs
+++ b/components/net/tests/cookie_http_state.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use net::cookie::Cookie;
+use net::cookie::ServoCookie;
use net::cookie_storage::CookieStorage;
use net_traits::CookieSource;
use servo_url::ServoUrl;
@@ -14,7 +14,8 @@ fn run(set_location: &str, set_cookies: &[&str], final_location: &str) -> String
// Add all cookies to the store
for str_cookie in set_cookies {
- if let Some(cookie) = Cookie::from_cookie_string(str_cookie.to_owned().into(), &url, source)
+ if let Some(cookie) =
+ ServoCookie::from_cookie_string(str_cookie.to_owned().into(), &url, source)
{
storage.push(cookie, &url, source);
}
diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs
index f1a4d789c2f..e514eabebf3 100644
--- a/components/net/tests/http_loader.rs
+++ b/components/net/tests/http_loader.rs
@@ -12,7 +12,7 @@ use std::sync::{Arc, Mutex, RwLock};
use std::time::Duration;
use base::id::TEST_PIPELINE_ID;
-use cookie_rs::Cookie as CookiePair;
+use cookie::Cookie as CookiePair;
use crossbeam_channel::{unbounded, Receiver};
use devtools_traits::{
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest,
@@ -30,7 +30,7 @@ use http::{Method, StatusCode};
use hyper::{Body, Request as HyperRequest, Response as HyperResponse};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
-use net::cookie::Cookie;
+use net::cookie::ServoCookie;
use net::cookie_storage::CookieStorage;
use net::http_loader::determine_requests_referrer;
use net::resource_thread::AuthCacheEntry;
@@ -648,7 +648,7 @@ fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_re
{
let mut cookie_jar = context.state.cookie_jar.write().unwrap();
- let cookie = Cookie::new_wrapped(
+ let cookie = ServoCookie::new_wrapped(
CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned()),
&url,
CookieSource::HTTP,
@@ -694,7 +694,7 @@ fn test_load_sends_cookie_if_nonhttp() {
{
let mut cookie_jar = context.state.cookie_jar.write().unwrap();
- let cookie = Cookie::new_wrapped(
+ let cookie = ServoCookie::new_wrapped(
CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned()),
&url,
CookieSource::NonHTTP,
@@ -1192,7 +1192,7 @@ fn test_redirect_from_x_to_y_provides_y_cookies_from_y() {
let mut context = new_fetch_context(None, None, None);
{
let mut cookie_jar = context.state.cookie_jar.write().unwrap();
- let cookie_x = Cookie::new_wrapped(
+ let cookie_x = ServoCookie::new_wrapped(
CookiePair::new("mozillaIsNot".to_owned(), "dotOrg".to_owned()),
&url_x,
CookieSource::HTTP,
@@ -1201,7 +1201,7 @@ fn test_redirect_from_x_to_y_provides_y_cookies_from_y() {
cookie_jar.push(cookie_x, &url_x, CookieSource::HTTP);
- let cookie_y = Cookie::new_wrapped(
+ let cookie_y = ServoCookie::new_wrapped(
CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned()),
&url_y,
CookieSource::HTTP,