Bug 1483765 - Fix the image cache key computation logic to only consider first-party storage access for third-party windows; r=smaug

This commit is contained in:
Ehsan Akhgari
2018-08-16 16:44:37 -04:00
parent d628743d4d
commit c8c56a9525
5 changed files with 84 additions and 4 deletions

View File

@@ -141,10 +141,11 @@ ImageCacheKey::GetSpecialCaseDocumentToken(nsIDocument* aDocument, nsIURI* aURI)
return aDocument;
}
// If we must disable the storage, we want to create a unique cache key for
// this image.
if (nsContentUtils::StorageDisabledByAntiTracking(aDocument, aURI)) {
return aDocument;
// If the window is 3rd party resource, let's see if first-party storage
// access is granted for this image.
if (nsContentUtils::IsTrackingResourceWindow(aDocument->GetInnerWindow())) {
return nsContentUtils::StorageDisabledByAntiTracking(aDocument, aURI) ?
aDocument : nullptr;
}
// Another scenario is if this image is a 3rd party resource loaded by a