-
Notifications
You must be signed in to change notification settings - Fork 981
Fixed brave shiels panel in incognito. #29237
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
Conversation
primary_pattern, ContentSettingsPattern::Wildcard(), | ||
ContentSettingsType::BRAVE_SHIELDS, setting); | ||
|
||
RecordShieldsToggled(local_state); |
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.
please ensure RecordShieldsToggled
is not called for OTR profiles
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.
PTAL this commit, may be we can use the same approach for other components
bc90289
to
97d497a
Compare
I'm going to move the P3A changes into the separate PR. |
#define P3A_LAZY_CALLS(stream, is_enabled) \ | ||
!(is_enabled) ? (void)0 : ::brave_shields::P3ACallStream::Voidify() & (stream) | ||
|
||
#define P3A(context) \ |
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.
very clever, but imo this may be overkill given the relatively small amount of call sites. wdyt about just passing the map into the relevant "Record" functions and performing a simple OTR check inside each function?
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.
I've moved this to a separate Draft PR. This PR only adds an explicit check for RecordShieldsToggled
.
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.
LGTM
Released in v1.81.45 |
Resolves brave/brave-browser#46186
There were two functions,
SetBraveShieldsEnabled
andResetBraveShieldsEnabled
. The second function setCONTENT_SETTING_DEFAULT
for the content settings when shields were enabled on the page, whileSetBraveShieldsEnabled
would setCONTENT_SETTING_ALLOW
in the same case. I've merged the logic ofResetBraveShieldsEnabled
intoSetBraveShieldsEnabled
.Now:
SetBraveShieldsEnabled
setsCONTENT_SETTING_DEFAULT
when the user enables shields on the page in a regular profileSetBraveShieldsEnabled
setsCONTENT_SETTING_ALLOW
when the user enables shields on the page in an off-the-record profile, becauseBRAVE_SHIELDS
content settings are registered to inherit values from the regular profile. Without explicitly settingALLOW
in off-the-record profiles, the getter would fall back to the regular profile's settings, which cause incorrect behavior described in the issue.Other functions were also checked for similar issues. In cases where a problem arises, it has been confirmed that such a state cannot be reached from the UI, and
DCHECK
s have been added for values that are unused (and should not be used).