mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 1483604 - Part 2: Make all of the external consumers of nsContentUtils::StorageDisabledByAntiTracking() pass a channel if available; r=smaug
This commit is contained in:
parent
0ef6860e9a
commit
99d839224e
@ -2950,6 +2950,22 @@ public:
|
||||
*/
|
||||
static StorageAccess StorageAllowedForPrincipal(nsIPrincipal* aPrincipal);
|
||||
|
||||
/*
|
||||
* Returns true if this document should disable storages because of the anti-tracking feature.
|
||||
*/
|
||||
static bool StorageDisabledByAntiTracking(nsIDocument* aDocument,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
private:
|
||||
/*
|
||||
* Returns true if this window/channel/aPrincipal should disable storages
|
||||
* because of the anti-tracking feature.
|
||||
@ -2962,6 +2978,7 @@ public:
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIURI* aURI);
|
||||
|
||||
public:
|
||||
/*
|
||||
* Returns true if this window/channel is a 3rd party context.
|
||||
*/
|
||||
|
@ -1106,8 +1106,7 @@ nsHTMLDocument::GetCookie(nsAString& aCookie, ErrorResult& rv)
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsContentUtils::StorageDisabledByAntiTracking(GetInnerWindow(), nullptr,
|
||||
NodePrincipal(), nullptr)) {
|
||||
if (nsContentUtils::StorageDisabledByAntiTracking(this, nullptr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1161,8 +1160,7 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie, ErrorResult& rv)
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsContentUtils::StorageDisabledByAntiTracking(GetInnerWindow(), nullptr,
|
||||
NodePrincipal(), nullptr)) {
|
||||
if (nsContentUtils::StorageDisabledByAntiTracking(this, nullptr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -143,10 +143,7 @@ ImageCacheKey::GetSpecialCaseDocumentToken(nsIDocument* aDocument, nsIURI* aURI)
|
||||
|
||||
// If we must disable the storage, we want to create a unique cache key for
|
||||
// this image.
|
||||
if (nsContentUtils::StorageDisabledByAntiTracking(aDocument->GetInnerWindow(),
|
||||
nullptr,
|
||||
aDocument->NodePrincipal(),
|
||||
aURI)) {
|
||||
if (nsContentUtils::StorageDisabledByAntiTracking(aDocument, aURI)) {
|
||||
return aDocument;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user