Skip to content

Private window Shields toggle doesn't update panel #46186

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

Open
antonok-edm opened this issue May 19, 2025 · 4 comments · May be fixed by brave/brave-core#29237
Open

Private window Shields toggle doesn't update panel #46186

antonok-edm opened this issue May 19, 2025 · 4 comments · May be fixed by brave/brave-core#29237
Assignees
Labels
bug feature/private-browsing feature/shields The overall Shields feature in Brave. feature/user-interface All UI related priority/P4 Planned work. We expect to get to it "soon". privacy

Comments

@antonok-edm
Copy link
Collaborator

STR:

  1. Visit https://example.com or any other site in a normal tab
  2. Open the Shields panel
  3. Turn Shields down
  4. Open a new Private window
  5. Visit the same website in the Private window
  6. Open the Shields panel
  7. Toggle Shields a few times
  8. Observe that the panel text and appearance does not change whenever Shields is up
@antonok-edm antonok-edm added bug feature/shields The overall Shields feature in Brave. feature/user-interface All UI related labels May 19, 2025
@ShivanKaul ShivanKaul added privacy feature/private-browsing priority/P4 Planned work. We expect to get to it "soon". labels May 19, 2025
@boocmp
Copy link

boocmp commented May 21, 2025

Well....

When enabling shields on a page, it triggers a call to brave_shields::ResetBraveShieldsEnabled, which sets the CONTENT_SETTING_DEFAULT value in HostContentSettingsMap.

For normal profiles, this works fine because when BRAVE_SHIELDS content setting contains CONTENT_SETTING_DEFAULT (indicating no explicit value is set), GetBraveShieldsEnabled returns true - the expected default value.

However, for off-the-record HostContentSettingsMap, the behavior differs. If no value exists in the off-the-record copy, it falls back to the normal profile's value, leading to unexpected behavior with the default setting.

To fix this, we should explicitly set the value (even if it matches the default) in the incognito HostContentSettingsMap.

A review of brave_shields_util.cc reveals many settings using this same logic. It seems all such instances will need to be updated for consistency.

@ShivanKaul
Copy link
Collaborator

If no value exists in the off-the-record copy, it falls back to the normal profile's value, leading to unexpected behavior with the default setting.

Why can't it fall back to the default value? And then be toggled separately? I think I'm missing something.

A review of brave_shields_util.cc reveals many settings using this same logic. It seems all such instances will need to be updated for consistency.

Which other ones? The fingerprint toggle for e.g. looks like it works correctly in Regular vs Private Window.

@boocmp
Copy link

boocmp commented May 22, 2025

It's a content settings logic, default values for incognito defined as values in original content settings, we just keep it in mind in future.

It may looks like it works correctly, but we need to write the concrete test to be sure.

@boocmp
Copy link

boocmp commented May 26, 2025

I found other settings that could fail to be set in incognito for some values in the regular profile. But these values are not accessible from UI, so I've added DCHECK-s into the corresponding setters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feature/private-browsing feature/shields The overall Shields feature in Brave. feature/user-interface All UI related priority/P4 Planned work. We expect to get to it "soon". privacy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants