mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 16:58:38 +09:00
ported from mozilla: Bug 1264792 - Update request'referrer policy when redirect.r=bkelly,dragana. (763507de3e)
This commit is contained in:
parent
ed16ab739e
commit
97fb5d7f9b
16 changed files with 244 additions and 91 deletions
|
|
@ -1345,12 +1345,19 @@ public:
|
|||
httpChannel->GetRequestHeader(NS_LITERAL_CSTRING("Referer"), referrer);
|
||||
if (!referrer.IsEmpty()) {
|
||||
mReferrer = referrer;
|
||||
} else {
|
||||
// If there's no referrer Header, means the header was omitted for
|
||||
// security/privacy reason.
|
||||
mReferrer = EmptyCString();
|
||||
}
|
||||
|
||||
uint32_t referrerPolicy = 0;
|
||||
rv = httpChannel->GetReferrerPolicy(&referrerPolicy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
switch (referrerPolicy) {
|
||||
case nsIHttpChannel::REFERRER_POLICY_UNSET:
|
||||
mReferrerPolicy = ReferrerPolicy::_empty;
|
||||
break;
|
||||
case nsIHttpChannel::REFERRER_POLICY_NO_REFERRER:
|
||||
mReferrerPolicy = ReferrerPolicy::No_referrer;
|
||||
break;
|
||||
|
|
@ -1366,6 +1373,15 @@ public:
|
|||
case nsIHttpChannel::REFERRER_POLICY_UNSAFE_URL:
|
||||
mReferrerPolicy = ReferrerPolicy::Unsafe_url;
|
||||
break;
|
||||
case nsIHttpChannel::REFERRER_POLICY_SAME_ORIGIN:
|
||||
mReferrerPolicy = ReferrerPolicy::Same_origin;
|
||||
break;
|
||||
case nsIHttpChannel::REFERRER_POLICY_STRICT_ORIGIN_WHEN_XORIGIN:
|
||||
mReferrerPolicy = ReferrerPolicy::Strict_origin_when_cross_origin;
|
||||
break;
|
||||
case nsIHttpChannel::REFERRER_POLICY_STRICT_ORIGIN:
|
||||
mReferrerPolicy = ReferrerPolicy::Strict_origin;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid Referrer Policy enum value?");
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue