-
Notifications
You must be signed in to change notification settings - Fork 921
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
Use extension for data file updates #76
Conversation
@@ -0,0 +1,150 @@ | |||
// Copyright 2014 The Chromium Authors. All rights reserved. | |||
// Use of this source code is governed by a BSD-style license that can be | |||
// found in the LICENSE file. |
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.
MPL-2.0 headers for new files
using component_updater::ComponentUpdateService; | ||
|
||
namespace { | ||
|
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.
nit: remove extra newline
#include "brave/components/brave_shields/browser/base_brave_shields_service.h" | ||
#include "content/public/common/resource_type.h" | ||
|
||
class AdBlockClient; | ||
class AdBlockServiceTest; | ||
|
||
const uint8_t kAdBlockPlusUpdaterPublicKey[294] = { |
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.
Pls move this directly to an encoded string.
IIUC, |
@simonhong Thanks for pointing that out, I didn't realize that. I assume you're referring to my use of |
Referring
We should add dependency check rules to modules that we created. |
I always viewed src/brave/* as equivalent to something that would be in src/chrome/* and then browser files can use browser and common chrome files. Renderer can use renderer and common files. |
void OnComponentReady( | ||
const std::string& extension_id, | ||
const base::FilePath& install_dir); | ||
|
||
friend class ::AdBlockServiceTest; | ||
static GURL g_ad_block_url; |
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 think you can just get rid of this g_ad_block_url
now
} | ||
// scoped_refptr<base::SequencedTaskRunner> GetTaskRunner() { | ||
// return task_runner_; | ||
// } |
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 used by the browser tests but those will need to be updated anyway. You can just remove the code for it.
bool initialized_; | ||
std::unique_ptr<DATFileWebRequest> web_request_; | ||
std::mutex init_mutex_; |
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 don't think you'll need the init_mutex
@bbondy If we think |
I think we should use |
For anything outside of this, just post a new issue and we can start to move thing that apply to |
882afd0
to
08c2492
Compare
"VwIDAQAB"; | ||
|
||
const std::string kAdBlockPlusUpdaterId("cffkpbalmllkdoenhmdmpbkajipdjfam"); | ||
const std::string kAdBlockPlusUpdaterName("AdBlock Plus Updater"); |
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.
The filter syntax that this library uses is AdBlockPlus Filter syntax, but the actual library it uses has nothing to do with AdBlockPlus so please call this:
Brave Ad Block Updater
static void SetAdBlockURLForTest(const GURL& url); | ||
void OnComponentRegistered(const std::string& extension_id); | ||
void OnComponentReady(const std::string& extension_id, | ||
const base::FilePath& install_dir); |
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.
Let's make these overrides here, and in the base virtual.
base::Unretained(this), kAdBlockPlusUpdaterId); | ||
brave::RegisterComponent(g_browser_process->component_updater(), | ||
kAdBlockPlusUpdaterName, kAdBlockPlusUpdaterBase64PublicKey, | ||
registered_callback, ready_callback); |
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.
Pls handle all of this in the base, and then pass kAdBlockPlusUpdaterName
, kAdBlockPlusUpdaterBase64PublicKey
, and kAdBlockPlusUpdaterId
to the base class.
brave::RegisterComponent(g_browser_process->component_updater(), | ||
kHTTPSEverywhereUpdaterName, kHTTPSEverywhereUpdaterBase64PublicKey, | ||
registered_callback, ready_callback); | ||
return 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.
Per above, this will be removed after that change.
} | ||
|
||
bool HTTPSEverywhereService::GetHTTPSURL( | ||
const GURL* url, const uint64_t& request_identifier, | ||
std::string& new_url) { | ||
base::AssertBlockingAllowed(); | ||
if (!IsInitialized() || url->scheme() == "https") { | ||
if (!IsInitialized() || url->scheme() == url::kHttpsScheme) { |
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.
nice.
brave::RegisterComponent(g_browser_process->component_updater(), | ||
kTrackingProtectionUpdaterName, kTrackingProtectionUpdaterBase64PublicKey, | ||
registered_callback, ready_callback); | ||
return 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.
Ditto above, this will be common code.
@@ -0,0 +1,7 @@ | |||
{ |
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.
Pls ensure that the keys here are for a different public key than we use in prod. You might need a hack similar to SetAdBlockURLForTest
for the tests.
"manifest_version": 2, | ||
"name": "HTTPS Everywhere updater", | ||
"version": "1.0.0" | ||
} |
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.
Would you mind also doing a test for tracking-protection at this point? Ask Serg if he can give you a test case example that will be blocked by tracking protection library but not the ad-block library.
Great work so far, looks very close. |
238b201
to
20df890
Compare
@@ -12,6 +14,6 @@ const char kTwitterReferrer[] = "https://twitter.com/*"; | |||
const char kTwitterRedirectURL[] = "https://mobile.twitter.com/i/nojs_router*"; | |||
|
|||
const char kCookieHeader[] = "Cookie"; | |||
// Intentional mispelling on referrer to match HTTP spec | |||
// Intentional misspelling on referrer to match HTTP spec |
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.
😆 LOL! This is too good.
"eclbkhjphkhalklhipiicaldjbnhdfkc"); | ||
|
||
const std::string kTrackingProtectionComponentTestBase64PublicKey = | ||
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsleoSxQ3DN+6xym2P1uX" |
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 like the test manifest is still referencing the non-test public key.
20df890
to
52c516f
Compare
"importer/brave_external_process_importer_client.cc", | ||
"importer/brave_external_process_importer_client.h", | ||
"importer/brave_external_process_importer_host.cc", | ||
"importer/brave_external_process_importer_host.h", | ||
"importer/brave_in_process_importer_bridge.cc", | ||
"importer/brave_in_process_importer_bridge.h", | ||
"importer/brave_profile_writer.cc", | ||
"importer/brave_profile_writer.h", | ||
"importer/brave_profile_writer.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.
trailing commas are OK for future ref in .gn files.
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.
not just ok, trailing commas are preferred
🎉 |
Package updates to fix security issues
symbol_level is set to 1 for x86 Linux
symbol_level is set to 1 for x86 Linux
symbol_level is set to 1 for x86 Linux
Submitter Checklist:
git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist: