-
Notifications
You must be signed in to change notification settings - Fork 81
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
Cosmetic filtering issue with Shadow DOM/tree/root #803
Comments
Well just to be clear, uBO will never be converted to inject minimum of 20K+ CSS rules in every page and every frame of every page. So if a specific filter is the only solution then the resolution is "by design". |
This comment has been minimized.
This comment has been minimized.
Nevermind it's present in the DOM on my end too. |
I am not in a position to check myself... Is this Shadow DOM v1 or v2? |
Personally for me this issue by itself is (partial) solution as the documentation (keywords in title). This page (VirusTotal) is build on Shadow DOM so for testing you can choose any element you want. Picker sees only |
Yes picker cannot dig on that page either beyond |
|
I don't see |
Do you mean "v0 or v1"? I need to learn about it first. |
One solution I can think of is to make use of ABP's semantic, |
Yes. |
This
This is not a solution. Filter authors will be forced to adjust filters, does not matter if they make them specific or modify syntax in different way. Individual cases will need to be found and fixed. It will be rare/surprising now, when not many such cases exist, and eventually later when SD will become popular, all filters will need to be (will be) rewritten. There is no pattern: " |
[oops, finger twitched and closed by mistake] I don't understand your argument. If indeed |
👍, here it will work. And I even see example - content of Twitter widgets (DandelionSprout looked for this DandelionSprout/adfilt#7 (comment)) https://hub.filterlists.com/t/circumvention-via-shadow-root/34 |
Another site using a shadow root DOM: |
Issue can be reproduced using Weeks ago I have investigated a javascript-based solution and it does not work -- there is no way to So back then I locally added code to interpret However, today I realize that |
A specific cosmetic filter of the following form... *##.selector ... will be unconditionally injected into all web pages, whereas a cosmetic filter of the form... ##.selector ... would be injected only when uBO's DOM surveyor finds at least one matching element in a web page. The new specific-generic form will also be disabled when a web page is subject to a `generichide` exception filter, since the filter is essentially a generic one -- the only difference from the usual generic form is that the filter is injected unconditionally instead of through the DOM surveyor. Specific-generic cosmetic filters will NOT be discarded when checking the "Ignore generic cosmetic filters" option in the "Filter lists" pane -- since the purpose of this option is primarily to disable the DOM surveyor. Specific-generic cosmetic filters should be used parcimoniously and only when using a normal specific filter is really impractical. Related issue: - uBlockOrigin/uBlock-issues#803
Can new syntax like |
Please no unfounded speculation of "performance issue", this is not helpful. If you want to make the case of "performance issue", this needs to be done with profiling results. |
By performance issue, I meant the filter is applied on every webpage on every website, doesn't that account for some performance cost ? |
And EasyList / EasyList Cookie (easylist/easylist#4232) will not use:
for uBO only... |
uBO already injects over 750+ selectors unconditionally on every page with default configuration1 -- the "highly generic ones" -- out of a total of nearly 21,000 cosmetic filters. The change here just allows to explicitly force such unconditional injection for some filters which must be injected everywhere but yet can't be injected conditionally through the DOM surveyor. I expect filter list authors will use the new feature intelligently, the same way the use of regex-based network filters are discouraged, yet they are not forbidden and filter list authors know that they should be used only when there is no other solution. Same approach applies here -- though regex-based network filters is a very bad comparison performance-wise, unconditionally injecting extra CSS selectors should be considered a no-op). Also I will likely consider #821 to be solved by the solution implemented here. [1] 1,400+ with Fanboy Social enabled out of a total of 32,600+. |
Still we would have some control if it was specific to a hostname instead of getting applied on every website regardless of whether the element is present in the DOM or not. |
Generic filters which apply everywhere are already supported and unconditional injection is already occurring. There is no good rational reason to worry about the change here. I will leave it at that, I can't prevent people from being unduly anxious about non-issues, I have no control over that. |
@uBlock-user what you are talking about? Specific filters still work. @gorhill how about pont 2:
? |
No visible in logger (on table)? No everyone use dom tree debugger " |
Point 2 is "wontfix" -- this would require to find all nodes with a shadow DOM (which requires traversing all nodes -- there is no native function to get all shadow DOM nodes), then search independently for a match in all these nodes, along with installing a mutation observer for each of those nodes to find out changes withing the shadow DOMs. I decline to make the code more complex than it already is. |
@gwarser It was about |
FWIW you can add pornhub to the list. They have an annoying banner that cannot afaik be blocked because it uses a shadow root. If you're not getting it the banner itself is random. It was for corvid. Probably spent more time then was healthy trying to block it but I was curious wtf they were doing. |
this is good behavior? in legacy try:
|
Not sure. I lean toward yes. Is this an issue in a list? |
IMO possible revert uBlockOrigin/uAssets@0d78532 due easylist/easylist@d3530c0 |
Details
Prerequisites
Description
A specific URL where the issue occurs
https://www.virustotal.com/gui/home/upload
Steps to Reproduce
"Generic" case:
###euConsent
to My filters"Specific" case:
virustotal.com###euConsent
to My filtersExpected behavior:
Cookie notice on the bottom should be hidden with generic filter. Filter should be logged.
Actual behavior:
Notice is hidden only by specific filter. No DOM filters are logged.
Your environment
@krystian3w, it's side effect of uBO performance/memory optimizations. ABP injects all cosmetic filters unconditionally (AFAIK). uBO injects only specific filters. For generic filters, DOM is scanned and only matching ones are injected. Here Shadow DOM is interfering.
The text was updated successfully, but these errors were encountered: