-
Notifications
You must be signed in to change notification settings - Fork 899
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 #17462: Refactor component-updater URL overwrites #9933
Conversation
dedf0a7
to
2a7d689
Compare
test/BUILD.gn
Outdated
@@ -146,6 +147,7 @@ test("brave_unit_tests") { | |||
] | |||
|
|||
defines = brave_service_key_defines | |||
defines += brave_updater_defines |
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 shouldn't do this. brave_updater_defines
and brave_service_key_defines
should either go in a public config of the component updater target or go in //brave/build:compiler
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.
resolved!
@@ -11,6 +11,8 @@ static_library("browser") { | |||
"switches.h", | |||
] | |||
|
|||
configs += [ "//brave/common:updater_config" ] |
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 is not correct, this should be automatically inherited as a public config or from build:compiler as specified below https://github.com/brave/brave-core/pull/9933/files#r700430714
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.
resolved!
@@ -27,8 +27,8 @@ | |||
#include "base/task_runner_util.h" | |||
#include "base/values.h" | |||
#include "base/version.h" | |||
#include "brave/components/brave_component_updater/browser/features.h" | |||
#include "brave/components/brave_component_updater/browser/switches.h" | |||
#include "brave/common/brave_features.h" |
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 change seems backwards, why would we move something component updater specific from components -> common? That creates a layering violation where none existed before
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.
resolved!
aa65ca2
to
923a127
Compare
923a127
to
85ffaeb
Compare
83b9167
to
9cd313f
Compare
7e7c71f
to
4cca4ed
Compare
namespace extension_urls { | ||
|
||
GURL GetDefaultWebstoreUpdateUrl() { | ||
return GURL(brave_component_updater::GetUpdateURLHost()); |
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 creates a dep on //brave/components/brave_component_updater for //extensions which does not currently exist and is not necessary to change the updater url. Subclass ChromeExtensionsClient and override GetWebstoreUpdateURL
@@ -19,6 +19,8 @@ class PrefService; | |||
|
|||
namespace brave_component_updater { | |||
|
|||
std::string GetUpdateURLHost(); |
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 is not a good place to put this, we should be able to have a dep for GetUpdateURLHost
without including all of components/brave_component_updater/browser
292f826
to
3163090
Compare
3163090
to
61fcb3c
Compare
bc61f08
to
804785b
Compare
@@ -86,6 +89,17 @@ const char kBraveOriginTrialsPublicKey[] = | |||
|
|||
const char kDummyUrl[] = "https://no-thanks.invalid"; | |||
|
|||
std::string GetUpdateURLHost() { |
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 belong to the anonymous namespace, together we some other vars above
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!
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.
resolved!
app/brave_main_delegate.cc
Outdated
@@ -165,6 +179,12 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { | |||
command_line.AppendSwitch(switches::kEnableDomDistiller); | |||
command_line.AppendSwitch(switches::kNoPings); | |||
|
|||
auto update_url = GetUpdateURLHost(); |
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'd rather use std::string instead of auto, because it's not clear whether this is GURL or string
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.
resolved!
|
||
const base::CommandLine& command_line = | ||
*base::CommandLine::ForCurrentProcess(); | ||
if (!command_line.HasSwitch(brave_component_updater::kUseGoUpdateDev) && |
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.
command_line.h
feature_list.h
extensions/buildflags/buildflags.h
are not used now, pls check other includes
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.
resolved!
@@ -11,7 +11,6 @@ | |||
#include "base/command_line.h" | |||
#include "brave/browser/net/url_context.h" | |||
#include "brave/common/network_constants.h" | |||
#include "brave/components/brave_component_updater/browser/switches.h" |
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.
component_updater_url_constants
not used?
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.
resolved!
|
||
namespace extensions { | ||
|
||
class ChromeExtensionsClient : public ChromeExtensionsClient_ChromiumImpl { |
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.
why not we add a fully-functioning BraveExtensionsClient
and override only instantiation spot? @bridiver
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.
options, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | ||
|
||
for (const auto& flag : flags) { | ||
if (flag.empty()) { |
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.
it can't be empty
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.
resolved
|
||
void BraveExtensionsClient::InitializeWebStoreUrls( | ||
base::CommandLine* command_line) { | ||
webstore_update_url_ = GURL(ParseUpdateUrlHost( |
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 wonder whether there is a step somewhere on CI that validates that the URL is correct...
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.
npm run network-audit
verifies the URL
d729bc4
to
76d21cd
Compare
76d21cd
to
b3802c6
Compare
Resolves brave/brave-browser#17462
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:
Specified here: https://github.com/brave/internal/issues/802