зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1475697 - Part 3: Update the security UI when blocking 3rd party cookies from trackers; r=baku
This commit is contained in:
Родитель
ac25ec44da
Коммит
16d186f4ec
|
@ -8855,18 +8855,17 @@ nsContentUtils::IsTrackingResourceWindow(nsPIDOMWindowInner* aWindow)
|
|||
return httpChannel->GetIsTrackingResource();
|
||||
}
|
||||
|
||||
// static public
|
||||
bool
|
||||
nsContentUtils::StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
|
||||
nsIChannel* aChannel,
|
||||
nsIURI* aURI)
|
||||
static bool
|
||||
StorageDisabledByAntiTrackingInternal(nsPIDOMWindowInner* aWindow,
|
||||
nsIChannel* aChannel,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
if (!StaticPrefs::privacy_restrict3rdpartystorage_enabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Let's check if this is a 3rd party context.
|
||||
if (!IsThirdPartyWindowOrChannel(aWindow, aChannel, aURI)) {
|
||||
if (!nsContentUtils::IsThirdPartyWindowOrChannel(aWindow, aChannel, aURI)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -8904,6 +8903,33 @@ nsContentUtils::StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
|
|||
uri);
|
||||
}
|
||||
|
||||
// static public
|
||||
bool
|
||||
nsContentUtils::StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
|
||||
nsIChannel* aChannel,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
bool disabled =
|
||||
StorageDisabledByAntiTrackingInternal(aWindow, aChannel, aURI);
|
||||
if (disabled &&
|
||||
StaticPrefs::privacy_restrict3rdpartystorage_ui_enabled()) {
|
||||
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
|
||||
if (!thirdPartyUtil) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIDOMWindowProxy> win;
|
||||
nsresult rv = thirdPartyUtil->GetTopWindowForChannel(aChannel,
|
||||
getter_AddRefs(win));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
auto* pwin = nsPIDOMWindowOuter::From(win);
|
||||
|
||||
pwin->NotifyContentBlockingState(
|
||||
nsIWebProgressListener::STATE_BLOCKED_TRACKING_COOKIES, aChannel);
|
||||
}
|
||||
return disabled;
|
||||
}
|
||||
|
||||
// static, private
|
||||
nsContentUtils::StorageAccess
|
||||
nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
|
||||
|
|
|
@ -1120,6 +1120,12 @@ VARCACHE_PREF(
|
|||
RelaxedAtomicBool, false
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
"privacy.restrict3rdpartystorage.ui.enabled",
|
||||
privacy_restrict3rdpartystorage_ui_enabled,
|
||||
RelaxedAtomicBool, false
|
||||
)
|
||||
|
||||
// Anti-tracking permission expiration
|
||||
VARCACHE_PREF(
|
||||
"privacy.restrict3rdpartystorage.expiration",
|
||||
|
|
Загрузка…
Ссылка в новой задаче