-
Notifications
You must be signed in to change notification settings - Fork 883
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
Always return light mode in fingerprinting strict mode #8832
Conversation
This looks great, though a few Qs:
cc @pilgrim-brave who's expertise here would be appreciated :) |
7e359a3
to
ce8cb65
Compare
Incorrect. For historical reasons, |
No issues with workers for CSS things. |
Please update the description of this PR to note that we will still respect a page's media feature override. It's just the user's preferred color scheme that is being overridden. |
Also, tests. |
ce8cb65
to
f66f5bf
Compare
Writing the test was a lot trickier than the actual feature 😅 (thanks a lot Mark for the help with figuring out what test dependency to add) and had to run sync again. I took inspiration from the Chromium test. I've updated 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.
Looks good to me (and thanks to @pilgrim-brave for ducking in too)
Are the CI failures unrelated?
I think so, but digging in - these are the failing tests on Linux:
and on Mac:
The latter looks like will be solved by #8883 |
browser/farbling/brave_dark_mode_fingerprint_protection_browsertest.cc
Outdated
Show resolved
Hide resolved
Those are unrelated. |
f66f5bf
to
fe6c1fc
Compare
if (value.IsValid()) | ||
return CSSValueIDToPreferredColorScheme(value.id); | ||
} | ||
+ BRAVE_DARK_MODE_DETECTION_DISABLED |
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 does not require patching, it can be controlled in the browser process in ContentBrowserClient::OverrideWebPreferencesAfterNavigation
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.
preferred color can be changed using web prefs
|
||
bool NavigateToURLUntilLoadStop(const GURL& url) { | ||
ui_test_utils::NavigateToURL(browser(), url); | ||
return WaitForLoadStop(contents()); |
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 should ASSERT_TRUE and vs return since you're not doing anything with the return value anyway
af01a80
to
0668563
Compare
void SetUpOnMainThread() override { | ||
InProcessBrowserTest::SetUpOnMainThread(); | ||
|
||
content_client_.reset(new ChromeContentClient); |
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 doesn't seem necessary for anything
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.
Agreed, I went and removed a bunch of other unnecessary stuff in the test and tried to prune the includes as much as possible.
}; | ||
|
||
IN_PROC_BROWSER_TEST_F(BraveDarkModeFingerprintProtection, DarkModeCheck) { | ||
test_theme_.SetDarkMode(true); |
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.
you should also test with SetDarkMode(false)
to ensure that it isn't affected by this change
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.
Done!
f134807
to
daf0eb3
Compare
daf0eb3
to
15ce4a5
Compare
The CI is failing on the Android build which seems to be failing since yesterday. @mihaiplesa helped me dig up the failures on Android and they don't seem to be connected to my changes (which should have nothing to do with Android).
|
- Override web preference setting in browser process instead of patch - Add tests for dark mode fingerprinting protection - Add deps in brave/browser/farbling
15ce4a5
to
98a2af4
Compare
After rebasing a couple of times, there's only one test crashing on Linux CI: |
This PR adds a patch to `blink/renderer/core/css/media_values.cc` that always returns `mojom::PreferredColorScheme::kLight` if fingerprinting mode is strict. Note that a page's override media feature will still be respected.On @bridiver's recommendation, overriding
BraveContentBrowserClient::OverrideWebPreferencesAfterNavigation
to return light mode if fingerprinting mode = strict instead of patchingblink/renderer/core/css/media_values.cc
.Resolves brave/brave-browser#15265.
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: