forked from mirrors/gecko-dev
Bug 1873490, part 1 - Refactor the only external call to StorageDisabledByAntiTracking - r=anti-tracking-reviewers,timhuang
I'm considering dropping this if statement entirely because this is only hit when we disable network state partitioning. According to code coverage, we only see the ""_ns as the result of this ternary in our testing too. But, if you disable network state partitioning and then block cookies from a given domain, then we would still want to partition network state I suppose, so I'll leave it like this.. Differential Revision: https://phabricator.services.mozilla.com/D198034
This commit is contained in:
parent
dab5862bde
commit
5bd36b24b1
3 changed files with 4 additions and 21 deletions
|
|
@ -143,9 +143,10 @@ nsCString ImageCacheKey::GetIsolationKey(Document* aDocument, nsIURI* aURI) {
|
||||||
nullptr)) {
|
nullptr)) {
|
||||||
uint32_t rejectedReason = 0;
|
uint32_t rejectedReason = 0;
|
||||||
Unused << rejectedReason;
|
Unused << rejectedReason;
|
||||||
return StorageDisabledByAntiTracking(aDocument, aURI, rejectedReason)
|
return ShouldAllowAccessFor(aDocument->GetInnerWindow(), aURI,
|
||||||
? aDocument->GetBaseDomain()
|
&rejectedReason)
|
||||||
: ""_ns;
|
? ""_ns
|
||||||
|
: aDocument->GetBaseDomain();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Another scenario is if this image is a 3rd party resource loaded by a
|
// Another scenario is if this image is a 3rd party resource loaded by a
|
||||||
|
|
|
||||||
|
|
@ -374,17 +374,6 @@ bool StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
|
||||||
return disabled;
|
return disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StorageDisabledByAntiTracking(dom::Document* aDocument, nsIURI* aURI,
|
|
||||||
uint32_t& aRejectedReason) {
|
|
||||||
aRejectedReason = 0;
|
|
||||||
// Note that GetChannel() below may return null, but that's OK, since the
|
|
||||||
// callee is able to deal with a null channel argument, and if passed null,
|
|
||||||
// will only fail to notify the UI in case storage gets blocked.
|
|
||||||
return StorageDisabledByAntiTracking(
|
|
||||||
aDocument->GetInnerWindow(), aDocument->GetChannel(),
|
|
||||||
aDocument->NodePrincipal(), aURI, aRejectedReason);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ShouldPartitionStorage(StorageAccess aAccess) {
|
bool ShouldPartitionStorage(StorageAccess aAccess) {
|
||||||
return aAccess == StorageAccess::ePartitionTrackersOrDeny ||
|
return aAccess == StorageAccess::ePartitionTrackersOrDeny ||
|
||||||
aAccess == StorageAccess::ePartitionForeignOrDeny;
|
aAccess == StorageAccess::ePartitionForeignOrDeny;
|
||||||
|
|
|
||||||
|
|
@ -105,13 +105,6 @@ bool StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
|
||||||
nsIPrincipal* aPrincipal, nsIURI* aURI,
|
nsIPrincipal* aPrincipal, nsIURI* aURI,
|
||||||
uint32_t& aRejectedReason);
|
uint32_t& aRejectedReason);
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns true if this document should disable storages because of the
|
|
||||||
* anti-tracking feature.
|
|
||||||
*/
|
|
||||||
bool StorageDisabledByAntiTracking(dom::Document* aDocument, nsIURI* aURI,
|
|
||||||
uint32_t& aRejectedReason);
|
|
||||||
|
|
||||||
bool ShouldPartitionStorage(StorageAccess aAccess);
|
bool ShouldPartitionStorage(StorageAccess aAccess);
|
||||||
|
|
||||||
bool ShouldPartitionStorage(uint32_t aRejectedReason);
|
bool ShouldPartitionStorage(uint32_t aRejectedReason);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue