-
Notifications
You must be signed in to change notification settings - Fork 909
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
Expose way for sites to determine if browser is Brave #4721
Conversation
chromium_src/third_party/blink/renderer/core/frame/navigator_user_agent_browsertest.cc
Outdated
Show resolved
Hide resolved
chromium_src/third_party/blink/renderer/core/frame/navigator_user_agent_browsertest.cc
Outdated
Show resolved
Hide resolved
chromium_src/third_party/blink/renderer/core/frame/navigator_user_agent_browsertest.cc
Outdated
Show resolved
Hide resolved
patches/third_party-blink-renderer-core-frame-navigator_user_agent.idl.patch
Outdated
Show resolved
Hide resolved
Note to self - this would require updating https://github.com/brave/brave-browser/wiki/Deviations-from-Chromium-(features-we-disable-or-remove) |
chromium_src/third_party/blink/renderer/core/frame/navigator_user_agent_browsertest.cc
Outdated
Show resolved
Hide resolved
chromium_src/third_party/blink/renderer/core/frame/navigator_user_agent_browsertest.cc
Outdated
Show resolved
Hide resolved
Two questions: I'm running a build to confirm
|
@jumde answers:
|
chromium_src/third_party/blink/renderer/core/frame/navigator_user_agent_browsertest.cc
Outdated
Show resolved
Hide resolved
Needs some patch cleanup and need to modify test plan (will do that later tonite) |
89ce4e0
to
baab04b
Compare
patches/third_party-blink-renderer-core-frame-navigator.cc.patch
Outdated
Show resolved
Hide resolved
patches/third_party-blink-renderer-core-core_idl_files.gni.patch
Outdated
Show resolved
Hide resolved
@bsclifton sure happy to help. What would be most helpful? |
@pes10k mostly just looking at the code to see if the approach taken looks good 😄 I guess we went over it together, so you can share some notes and approve/deny based on that (just to have something formal on GitHub) |
@bsclifton made a tiny suggestion, hope its helpful. Otherwise, LGTM! |
patches/third_party-blink-renderer-modules-modules_idl_files.gni.patch
Outdated
Show resolved
Hide resolved
@@ -4,3 +4,4 @@ | |||
import("//brave/brave_repack_locales.gni") | |||
import("//brave/build/features.gni") | |||
import("//brave/net/sources.gni") | |||
import("//brave/third_party/blink/renderer/includes.gni") |
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 modules.gni
?
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.
considered that- but it also includes core
changes
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.
but its purpose is to make modules work. If nothing else config.gni
would be a better choice, but it can be a follow-up
e72e10f
to
753313f
Compare
Ready for re-review 😄👍 |
wunderbar, lgtm! |
753313f
to
beb5435
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.
lgtm!
Only CI failure was during All builds / tests / create_dists / etc worked great 😄👍 |
ui_test_utils::NavigateToURL(browser(), url); | ||
content::WebContents* contents = | ||
browser()->tab_strip_model()->GetActiveWebContents(); | ||
EXPECT_EQ(true, EvalJs( |
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.
EXPECT_TRUE(EvalJs(contents, "getBraveDetected()"));
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 tried to do this when you had shared feedback before; it's causing a problem though:
../../third_party/googletest/src/googletest/include/gtest/gtest.h:299:9: error: no viable conversion from 'const content::EvalJsResult' to 'bool'
Not sure why comparison with EXPECT_EQ
is handled differently than EXPECT_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.
From browser_test_utils.h
:
// For boolean results, note that EXPECT_TRUE(..) and EXPECT_FALSE()
// won't compile; use EXPECT_EQ(true, ...) instead. This is intentional,
// since EXPECT_TRUE() could be read ambiguously as either "expect
// successful execution", "expect truthy value of any type", or "expect
// boolean value '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.
ah- thanks, @zenparsing! 😄
third_party/blink/renderer/modules/brave/navigator_browsertest.cc
Outdated
Show resolved
Hide resolved
Verification PASSED on
|
How could this be disabled? |
We have discussed some options including that it may be disabled when shields are down and I would personally be in favor of a feature flag or pref. Cc @pes10k |
Agreed. A feature flag would be more modular and obvious to configure. Using a feature flag would also allow for the feature to be disabled by default too. |
Fixes brave/brave-browser#8216
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
npm run test -- brave_browser_tests --filter=NavigatorGetBraveDetectedTest.*
Reviewer Checklist:
After-merge Checklist:
changes has landed on.