-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Domain block and 1PES integration #10339
Conversation
d57d075
to
f708321
Compare
eda447d
to
2678787
Compare
FROM_HERE, | ||
base::BindOnce(&UrlStorageChecker::StartCheck, | ||
base::MakeRefCounted<UrlStorageChecker>( | ||
context_->GetStoragePartitionForUrl(url, true), url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is deprecated
|
||
#include "base/callback.h" | ||
#include "base/memory/ref_counted.h" | ||
#include "base/memory/scoped_refptr.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used
#include "base/callback.h" | ||
#include "base/memory/ref_counted.h" | ||
#include "base/memory/scoped_refptr.h" | ||
#include "components/services/storage/public/mojom/local_storage_control.mojom.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be moved to .cc ?
// actors. | ||
class EphemeralStorageService | ||
: public KeyedService, | ||
public base::SupportsWeakPtr<EphemeralStorageService> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it used anywhere?
WebContents* first_party_tab = | ||
LoadURLInNewTab(a_site_ephemeral_storage_url_); | ||
EXPECT_TRUE(IsShowingInterstitial(first_party_tab)); | ||
Click(first_party_tab, "dont-warn-again-checkbox"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it needed?
void NavigateToBlockedDomainAndExpectEphemeralEnabled() { | ||
WebContents* first_party_tab = NavigateToBlockedDomain(); | ||
|
||
// After keepalive values should be cleared. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also check that they are NOT cleared while we are keepaliving?
|
discussed in Slack. It works, but if a tab is closed (and no other tabs are opened with the same website), the storage is cleaned up immediately. Keep-alive works for in-tab navigations, for ex. when we navigate away and back; a use-case to remember is an SSO-like authorization (going to an auth website and back).
I think it doesn't matter if this options is checked or not. When it's not checked, any attempt to visit the website will still show the interstitial, and we will enable 1PES anyways (if for some reason we decide to turn it off after each visit). |
f40eb4f
to
ed16116
Compare
base::FEATURE_DISABLED_BY_DEFAULT}; | ||
// When enabled, Brave will attempt to enable 1PES mode in a standard blocking | ||
// mode when a user visists a domain that is present in currently active adblock | ||
// filters. 1PES will be enabled only if nor cookies nor localStorage data is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neither cookies nor localStorage are stored
@@ -32,6 +32,12 @@ enum ControlType { | |||
AGGRESSIVE | |||
}; | |||
|
|||
enum class DomainBlockingType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment?
return DomainBlockingType::kAggressive; | ||
} | ||
|
||
if (base::FeatureList::IsEnabled( | ||
// Block using 1PES if ad blocking is "standard". | ||
if (cosmetic_control_type == BLOCK_THIRD_PARTY && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I understand why it is about cosmetic filters, but that's not relevant to the PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is definitely a bit confusing and we need to consolidate the logic for adblock with its own control type. RIght now we're duplicating checks in BraveShieldsDataController
and presumably in android for the UI setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// filters. 1PES will be enabled only if nor cookies nor localStorage data is | ||
// stored for the website. | ||
const base::Feature kBraveDomainBlock1PES{"BraveDomainBlock1PES", | ||
base::FEATURE_DISABLED_BY_DEFAULT}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entry on brave://flags?
ed16116
to
6aee03d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chromium_src LGTM
6aee03d
to
f3c6d3e
Compare
// Don't block if feature is disabled | ||
if (!base::FeatureList::IsEnabled(brave_shields::features::kBraveDomainBlock)) | ||
return false; | ||
return DomainBlockingType::kNone; | ||
|
||
// Don't block if Brave Shields is down (this also handles cases where | ||
// the URL is not HTTP(S)) | ||
if (!brave_shields::GetBraveShieldsEnabled(map, url)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes against the established pattern of using Get
for the raw value for display in the UI and I think that's a bit confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be clear I'm talking about GetDomainBlockingType
, just commenting here because of the shields check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe absl::optional<DomainBlockingType> ShouldDoDominBlocking(...)
and get rid of kNone
?
Add first party ephemeral storage auto-enable logic when a First Party Ephemeral Storage feature is enabled and a user proceeds a domain block interstitial.
Resolves brave/brave-browser#19099
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: