Commit c6b47723 authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Enable IsCookieAccessAllowed(GURL, GURL) DCHECK by default

Enable this DCHECK independently of flags. All current call sites
seem safe and new ones shouldn't be added.

Bug: 967668
Change-Id: Id9fcbfbbd2d76dcc7ac5cfecedc8c15add95741c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819499
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarMartin Šrámek <msramek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705714}
parent 16d77eb3
......@@ -8,6 +8,7 @@
#include "base/debug/task_trace.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "components/content_settings/core/common/features.h"
#include "net/base/net_errors.h"
#include "net/base/static_cookie_policy.h"
......@@ -71,9 +72,11 @@ void CookieSettingsBase::GetCookieSetting(
bool CookieSettingsBase::IsCookieAccessAllowed(
const GURL& url,
const GURL& first_party_url) const {
DCHECK(!base::FeatureList::IsEnabled(kImprovedCookieControls) ||
!first_party_url.is_empty() || url.is_empty())
<< url;
#if !defined(OS_IOS)
// IOS uses this method with an empty |first_party_url| but we don't have
// content settings on IOS, so it does not matter.
DCHECK(!first_party_url.is_empty() || url.is_empty()) << url;
#endif
ContentSetting setting;
GetCookieSetting(url, first_party_url, nullptr, &setting);
return IsAllowed(setting);
......@@ -85,17 +88,15 @@ bool CookieSettingsBase::IsCookieAccessAllowed(
const base::Optional<url::Origin>& top_frame_origin) const {
// TODO(crbug.com/988398): top_frame_origin is not yet always available.
// Ensure that the DCHECK always passes and remove the FeatureList check.
if (!base::FeatureList::IsEnabled(kImprovedCookieControls) &&
!base::FeatureList::IsEnabled(
kImprovedCookieControlsForThirdPartyCookieBlocking)) {
return IsCookieAccessAllowed(url, site_for_cookies);
}
DCHECK(top_frame_origin || site_for_cookies.is_empty())
DCHECK((!base::FeatureList::IsEnabled(kImprovedCookieControls) &&
!base::FeatureList::IsEnabled(
kImprovedCookieControlsForThirdPartyCookieBlocking)) ||
top_frame_origin || site_for_cookies.is_empty())
<< url << " " << site_for_cookies;
ContentSetting setting;
GetCookieSettingInternal(
url, top_frame_origin ? top_frame_origin->GetURL() : GURL(),
url, top_frame_origin ? top_frame_origin->GetURL() : site_for_cookies,
IsThirdPartyRequest(url, site_for_cookies), nullptr, &setting);
return IsAllowed(setting);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment