mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add mach command to update public domain list and use a HashSet instead of a Vec to lookup public domains
This commit is contained in:
parent
04b682195d
commit
dbef65129f
8 changed files with 8134 additions and 5962 deletions
|
@ -975,7 +975,6 @@ fn test_domain0016() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic] // Look at cookie_http_state_utils.py if this test fails
|
||||
fn test_domain0017() {
|
||||
let r = run("http://home.example.org:8888/cookie-parser?domain0017",
|
||||
&["foo=bar; domain=.org"],
|
||||
|
|
|
@ -27,7 +27,6 @@ FAILING_TESTS = [
|
|||
"attribute0005", # Waiting for issue 46 of alexcrichton/cookie-rs
|
||||
"attribute0007", # Waiting for issue 46 of alexcrichton/cookie-rs
|
||||
"attribute0008", # Waiting for issue 46 of alexcrichton/cookie-rs
|
||||
"domain0017", # Waiting for issue 11216 of servo/servo
|
||||
"0003", # Waiting for a way to clean expired cookies
|
||||
"0006", # Waiting for a way to clean expired cookies
|
||||
"mozilla0001", # Waiting for a way to clean expired cookies
|
||||
|
|
|
@ -27,6 +27,7 @@ extern crate util;
|
|||
#[cfg(test)] mod file_loader;
|
||||
#[cfg(test)] mod fetch;
|
||||
#[cfg(test)] mod mime_classifier;
|
||||
#[cfg(test)] mod pub_domains;
|
||||
#[cfg(test)] mod resource_thread;
|
||||
#[cfg(test)] mod hsts;
|
||||
#[cfg(test)] mod http_loader;
|
||||
|
|
38
tests/unit/net/pub_domains.rs
Normal file
38
tests/unit/net/pub_domains.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use net::pub_domains::is_pub_domain;
|
||||
|
||||
#[test]
|
||||
fn test_is_pub_domain_plain() {
|
||||
assert!(is_pub_domain("com"));
|
||||
assert!(is_pub_domain(".org"));
|
||||
assert!(is_pub_domain("za.org"));
|
||||
assert!(is_pub_domain("xn--od0alg.hk"));
|
||||
assert!(is_pub_domain("xn--krdsherad-m8a.no"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_pub_domain_wildcard() {
|
||||
assert!(is_pub_domain("hello.bd"));
|
||||
assert!(is_pub_domain("world.jm"));
|
||||
assert!(is_pub_domain("toto.kobe.jp"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_pub_domain_exception() {
|
||||
assert_eq!(is_pub_domain("www.ck"), false);
|
||||
assert_eq!(is_pub_domain("city.kawasaki.jp"), false);
|
||||
assert_eq!(is_pub_domain("city.nagoya.jp"), false);
|
||||
assert_eq!(is_pub_domain("teledata.mz"), false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_pub_domain_not() {
|
||||
assert_eq!(is_pub_domain(".servo.org"), false);
|
||||
assert_eq!(is_pub_domain("www.mozilla.org"), false);
|
||||
assert_eq!(is_pub_domain("publicsuffix.org"), false);
|
||||
assert_eq!(is_pub_domain("hello.world.jm"), false);
|
||||
assert_eq!(is_pub_domain("toto.toto.kobe.jp"), false);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue