| ... |
... |
@@ -41,6 +41,7 @@ |
|
41
|
41
|
#include "mozilla/StaticPrefs_browser.h"
|
|
42
|
42
|
#include "mozilla/StaticPrefs_docshell.h"
|
|
43
|
43
|
#include "mozilla/StaticPrefs_fission.h"
|
|
|
44
|
+#include "mozilla/StaticPrefs_network.h"
|
|
44
|
45
|
#include "mozilla/StaticPrefs_security.h"
|
|
45
|
46
|
#include "mozilla/glean/DomMetrics.h"
|
|
46
|
47
|
#include "nsILayoutHistoryState.h"
|
| ... |
... |
@@ -3695,6 +3696,10 @@ void CanonicalBrowsingContext::CreateRedactedAncestorOriginsList( |
|
3695
|
3696
|
// 11. Let masked be false.
|
|
3696
|
3697
|
bool masked = false;
|
|
3697
|
3698
|
|
|
|
3699
|
+ // Tor-specific, not in spec:
|
|
|
3700
|
+ // we want to redact cross-origin onions if hideOnionSource is true.
|
|
|
3701
|
+ bool redactOnions = StaticPrefs::network_http_referer_hideOnionSource();
|
|
|
3702
|
+
|
|
3698
|
3703
|
if (referrerPolicy == ReferrerPolicy::No_referrer) {
|
|
3699
|
3704
|
// 12. If referrerPolicy is "no-referrer", then set masked to true.
|
|
3700
|
3705
|
masked = true;
|
| ... |
... |
@@ -3705,6 +3710,12 @@ void CanonicalBrowsingContext::CreateRedactedAncestorOriginsList( |
|
3705
|
3710
|
// origin is not same origin with innerDoc's origin, then set masked to
|
|
3706
|
3711
|
// true.
|
|
3707
|
3712
|
masked = true;
|
|
|
3713
|
+ } else if (redactOnions && ancestorWGP->DocumentPricipal()->GetIsOnion() &&
|
|
|
3714
|
+ !ancestorWGP->DocumentPrincipal()->Equals(
|
|
|
3715
|
+ aThisDocumentPrincipal)) {
|
|
|
3716
|
+ // Tor-specific, not in spec:
|
|
|
3717
|
+ // mask parent origin if it's an onion it's different than this document's.
|
|
|
3718
|
+ masked = true;
|
|
3708
|
3719
|
}
|
|
3709
|
3720
|
|
|
3710
|
3721
|
if (masked) {
|
| ... |
... |
@@ -3721,6 +3732,13 @@ void CanonicalBrowsingContext::CreateRedactedAncestorOriginsList( |
|
3721
|
3732
|
|
|
3722
|
3733
|
// 16. For each ancestorOrigin of ancestorOrigins:
|
|
3723
|
3734
|
for (const auto& ancestorOrigin : parentAncestorOriginsList) {
|
|
|
3735
|
+ // Tor-specific, not in spec:
|
|
|
3736
|
+ // Redact any ancestor onion origin different than this document's origin.
|
|
|
3737
|
+ if (redactOnions && ancestorOrigin && ancestorOrigin->GetIsOnion() &&
|
|
|
3738
|
+ !ancestorOrigin->Equals(aThisDocumentPrincipal)) {
|
|
|
3739
|
+ ancestorPrincipals.AppendElement(nullptr);
|
|
|
3740
|
+ continue;
|
|
|
3741
|
+ }
|
|
3724
|
3742
|
// 16.1 if masked is true
|
|
3725
|
3743
|
if (masked && ancestorOrigin &&
|
|
3726
|
3744
|
ancestorOrigin->Equals(ancestorWGP->DocumentPrincipal())) {
|