-
Notifications
You must be signed in to change notification settings - Fork 891
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
Unrevert cosmetic filtering #4269
Conversation
4d72014
to
f1171e9
Compare
f423a6d
to
4a2ee6b
Compare
4a2ee6b
to
444d441
Compare
Just rebased; let's watch CI here. Most importantly, we'll want to watch Linux CI. It was having problems with GLIBC |
@bridiver did you have any other concerns about this? You were an approver for the original work, IIRC. If things look good, go ahead and hit the approve button 😄 |
DEPS
Outdated
@@ -1,7 +1,7 @@ | |||
use_relative_paths = True | |||
|
|||
deps = { | |||
"vendor/adblock_rust_ffi": "https://github.com/brave/adblock-rust-ffi.git@89127a30655eaf54cf73794309846084ea8b91b9", | |||
"vendor/adblock_rust_ffi": "https://github.com/brave/adblock-rust-ffi.git@pes-cosmetic-analysis", |
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.
can we change this to a commit hash?
444d441
to
5e71153
Compare
fdfbb6f
to
e243cfb
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.
This has some tests failing which seem related:
19:01:40 4 tests failed:
19:01:40 CosmeticFilteringEnabledTest.CosmeticFilteringCustomStyle (../../brave/components/brave_shields/browser/ad_block_service_browsertest.cc:906)
19:01:40 CosmeticFilteringEnabledTest.CosmeticFilteringDynamic (../../brave/components/brave_shields/browser/ad_block_service_browsertest.cc:876)
19:01:40 CosmeticFilteringEnabledTest.CosmeticFilteringSimple (../../brave/components/brave_shields/browser/ad_block_service_browsertest.cc:839)
19:01:40 CosmeticFilteringEnabledTest.CosmeticFilteringUnhide (../../brave/components/brave_shields/browser/ad_block_service_browsertest.cc:927)
@petemill just double checking, do @antonok-edm 's new tests address the concern? |
After merge, let's ping @snyderp / @ryanbr to address #4403 (comment) 😄 |
a9e9213
to
805e25b
Compare
I rebased, fixed conflicts and pushed. Let's see what CI does (although tests passed locally). Giving the code another once-over. |
|
||
const handleMutations = function (mutations: any[]) { | ||
for (const aMutation of mutations) { | ||
if (aMutation.type === 'attribute') { |
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 this will work - shouldn't it be checking for attributes
not attribute
? We need to use proper TS types and not pass in any
as the params, which would have caught this. I'm happy to fix this now.
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.
@petemill yes from checking https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver that looks right to me too (i.e. changing to attributes
is correct).
… block component. Reverts the revert of the oringal implementation: "Merge pull request #4255 from brave/bsc-revert-cosmetic-filtering" This reverts commit fcfe38a, reversing changes made to 950778a. Fixes some conflicts as a result of master getting flag features and uses updated adblock-rust-ffi version which provides a slightly different API than for the original implementation.
805e25b
to
538e12e
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.
CI passed. @snyderp @antonok-edm please can you review my additions before merge: d2675a1
Awaiting final code owner review from @bridiver |
…ification and add stronger types
538e12e
to
d2675a1
Compare
@petemill those changes look good to me! |
"allowJs": true, | ||
// convert jsx to react components | ||
"jsx": "react", | ||
"lib": [ | ||
"es6", | ||
"dom", | ||
"DOM.Iterable", |
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.
Prevents Typescript from complaining when we iterate over DomList and provides values()
in DOMTokenList
@antonok-edm @snyderp It's being asked what exactly fixes the issue that made this previously get reverted because of #4255 ? |
base::Optional<base::Value> AdBlockBaseService::HostnameCosmeticResources( | ||
const std::string& hostname) { | ||
return base::JSONReader::Read( | ||
this->ad_block_client_->hostnameCosmeticResources(hostname)); |
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.
Callling this from UI thread was causing this quite nasty family of crashes brave/brave-browser#10907 - just wanted to emphasize that we should super carefully review multithreaded code
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.
@iefremov yikes! Are they sorted out now? What would be helpful for @antonok-edm or I do from here to sort things out?
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.
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.
Gotcha, thanks a million @iefremov !
Closes brave/brave-browser#5381 (again...).
Original, now reverted, PR: #3303
This points to an updated
adblock-rust-ffi
version, which points to an updatedadblock-rust
version that makes CSS selector validation an optional feature. TheGLIBC_2.29
error only occurred because ofadblock-rust
'scssparser
library dependency callingf64::pow
; this is no longer included inbrave-core
builds. It only really needs to be used by the CRX packager when building DAT files.Apart from the original changes from #3303, there are a few additional commits from @snyderp and myself which are used to detect whether matching elements on a page are 1p content tor 3p whitespace before injecting a stylesheet to block them.
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
CI on this PR should pass.
npm run test -- brave_browser_tests --filter="CosmeticFilteringEnabledTest.*"
Reviewer Checklist:
After-merge Checklist:
changes has landed on.