mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #11978 - aravind-pg:new-referrer-pols, r=jdm
Add "origin" and "same-origin" referrer policies, replacing "origin-only". <!-- Please describe your changes on the following line: --> --- <!-- 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 #11384 - [X] There are tests for these changes <!-- 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/11978) <!-- Reviewable:end -->
This commit is contained in:
commit
37dbb50208
777 changed files with 17089 additions and 375 deletions
|
@ -333,7 +333,8 @@ pub enum FrameType {
|
|||
pub enum ReferrerPolicy {
|
||||
NoReferrer,
|
||||
NoRefWhenDowngrade,
|
||||
OriginOnly,
|
||||
Origin,
|
||||
SameOrigin,
|
||||
OriginWhenCrossOrigin,
|
||||
UnsafeUrl,
|
||||
}
|
||||
|
|
|
@ -458,7 +458,8 @@ pub fn determine_request_referrer(headers: &mut Headers,
|
|||
let cross_origin = ref_url.origin() != url.origin();
|
||||
return match referrer_policy {
|
||||
Some(ReferrerPolicy::NoReferrer) => None,
|
||||
Some(ReferrerPolicy::OriginOnly) => strip_url(ref_url, true),
|
||||
Some(ReferrerPolicy::Origin) => strip_url(ref_url, true),
|
||||
Some(ReferrerPolicy::SameOrigin) => if cross_origin { None } else { strip_url(ref_url, false) },
|
||||
Some(ReferrerPolicy::UnsafeUrl) => strip_url(ref_url, false),
|
||||
Some(ReferrerPolicy::OriginWhenCrossOrigin) => strip_url(ref_url, cross_origin),
|
||||
Some(ReferrerPolicy::NoRefWhenDowngrade) | None => no_ref_when_downgrade_header(ref_url, url),
|
||||
|
|
|
@ -2832,7 +2832,8 @@ pub fn determine_policy_for_token(token: &str) -> Option<ReferrerPolicy> {
|
|||
return match lower.as_ref() {
|
||||
"never" | "no-referrer" => Some(ReferrerPolicy::NoReferrer),
|
||||
"default" | "no-referrer-when-downgrade" => Some(ReferrerPolicy::NoRefWhenDowngrade),
|
||||
"origin" => Some(ReferrerPolicy::OriginOnly),
|
||||
"origin" => Some(ReferrerPolicy::Origin),
|
||||
"same-origin" => Some(ReferrerPolicy::SameOrigin),
|
||||
"origin-when-cross-origin" => Some(ReferrerPolicy::OriginWhenCrossOrigin),
|
||||
"always" | "unsafe-url" => Some(ReferrerPolicy::UnsafeUrl),
|
||||
"" => Some(ReferrerPolicy::NoReferrer),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue