mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
Auto merge of #11513 - fduraffourg:pr11216, r=jdm
Add mach command to update public domain list and use a HashSet for matching <!-- Please describe your changes on the following line: --> Add a `mach update-pub-domains` command that update the public domain list used by servo. Replace the Vec matching with a HashSet which is way quicker. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11216 <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11513) <!-- Reviewable:end -->
This commit is contained in:
commit
4dbba2dcab
8 changed files with 8134 additions and 5962 deletions
|
@ -7,7 +7,7 @@
|
|||
|
||||
use cookie_rs;
|
||||
use net_traits::CookieSource;
|
||||
use pub_domains::PUB_DOMAINS;
|
||||
use pub_domains::is_pub_domain;
|
||||
use std::borrow::ToOwned;
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
use time::{Tm, now, at, Duration};
|
||||
|
@ -45,10 +45,12 @@ impl Cookie {
|
|||
let mut domain = cookie.domain.clone().unwrap_or("".to_owned());
|
||||
|
||||
// Step 5
|
||||
match PUB_DOMAINS.iter().find(|&x| domain == *x) {
|
||||
Some(val) if *val == url_host => domain = "".to_owned(),
|
||||
Some(_) => return None,
|
||||
None => {}
|
||||
if is_pub_domain(&domain) {
|
||||
if domain == url_host {
|
||||
domain = "".to_owned();
|
||||
} else {
|
||||
return None
|
||||
}
|
||||
}
|
||||
|
||||
// Step 6
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue