-
Notifications
You must be signed in to change notification settings - Fork 885
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
Fix shields setting in private is weird #1097
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Will remove WIP tag after tests are added. |
pilgrim-brave
previously approved these changes
Dec 14, 2018
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 if tests are added
@pilgrim-brave Test cases are added. Please check again. Thanks! |
simonhong
changed the title
WIP: Fix shields setting in private is weird
Fix shields setting in private is weird
Dec 15, 2018
simonhong
force-pushed
the
fix_shields_settings_in_private
branch
from
December 15, 2018 04:53
0bd58c7
to
985a492
Compare
pilgrim-brave
previously approved these changes
Dec 17, 2018
When content setting's IncognitoBehavior is INHERIT_IF_LESS_PERMISSIVe, normal profiles setting is modified when incognito profile's content settings are initialized. Because of this behavior, sometimes shields are off and shields's default configurations are different with normal window. With INHERIT_IN_INCOGNITO, private windows uses normal windows' configuration w/o modification.
simonhong
force-pushed
the
fix_shields_settings_in_private
branch
from
December 31, 2018 00:45
985a492
to
468fa7c
Compare
Rebased on latest mater. Please check again. |
bbondy
approved these changes
Dec 31, 2018
simonhong
added a commit
that referenced
this pull request
Jan 1, 2019
Fix shields setting in private is weird
This was referenced Nov 1, 2022
This was referenced Nov 1, 2022
Merged
Merged
This was referenced Nov 8, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When content setting's IncognitoBehavior is INHERIT_IF_LESS_PERMISSIVE,
normal profiles setting is modified when incognito profile's content settings
are initialized. Because of this behavior, sometimes shields are off and shields's
default configurations are different with normal window.
With INHERIT_IN_INCOGNITO, private windows uses normal windows' configuration w/o
modification.
Fix brave/brave-browser#1373
Fix brave/brave-browser#1897
Below is the reason why some users have private window with shields is always off.
Some times ago, the way of brave's default content settings is refactored.(#622)
Before this refactoring, shields content setting is stored to prefs like this.
With this, user data stores allow value for brave shields with wildcard in
./BraveSoftware/Brave-browser/Default/Preferences
file. When private windows are open with this normal windows' value, private window changes it from allow to block. If prefs doesn't have that value, private window uses it w/o modification. So, user can see shields is on in private window with clean profile.Why private window modifies when normal windows' prefs is inherited? The reason is plugins content setting's incognito behavior is
INHERIT_IF_LESS_PERMISSIVE
. When normal window has stored content setting value, it is modified byProcessIncognitoInheritanceBehavior()
inhost_content_settings_map.cc
. If there is no value in prefs, private window uses default value.We can see brave's default plugin value by
GetDefaultFromResourceIdentifier()
inbrave_shields_util.cc
So, we can expect below scenario for plugins type of
kBraveShields
.Above table can explain current behavior.
In conclusion, deleting default wildcard rule can't solve current issue because when user changes shields settings, its value is stored in user data explicitly. In this case, private window will get block setting. So, I think changing to
INHERIT_IN_INCOGNITO
is the solution.Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests
) ongit rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
yarn test brave_browser_tests --filter=BraveContentSettingsRegistryBrowserTest.*
Reviewer Checklist: