mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
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>
This commit is contained in:
parent
8f377a0cb1
commit
b6f1e3b22d
16 changed files with 203 additions and 199 deletions
|
@ -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!(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!(!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!(!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!(!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("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!(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!(!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("/", "/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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue