-
Notifications
You must be signed in to change notification settings - Fork 82
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
Prevent uBO from hiding html or body when matched by a generic cosmetic filter #1692
Comments
@felix-22 thanks for links! Yeah adding |
The best thing to do is to adjust blockers not to block |
I hope so: https://github.com/AdguardTeam/AdguardBrowserExtension/issues/1845 |
Majority of CSS selector-based cosmetic filters are enforced through user styles, this means internally each of those filters would need to be suffixed with |
What if this is taken care of at the DOM surveyor level? - pendingNodes.add(document.querySelectorAll('[id],[class]'));
+ pendingNodes.add(document.querySelectorAll(':not(html):not(body)[id],:not(html):not(body)[class]')); I'm guessing that this would cause issues for selectors containing descendant and child combinators. |
If this were to be implemented, it still should be possible to be able e.g. to target |
The way I see it the automatic exclusion of |
This is an interesting idea. The issue of combinators maybe could be solved by having a separate reporting for ids/classes taken directly from |
To clarify, let's say there's a document like this: <body>
<article></article>
</body> And a filter like The document uses JS to add the If the DOM surveyor ignores the |
When I say "separate reporting", I mean the ids/classes of |
Related issue: - uBlockOrigin/uBlock-issues#1692 The ids/classes from html/body elements will leave out looking up lowly generic cosmetic filters made of a single identifier. This does not absolutely guarantee that html/body elements will never be targeted, but it should greatly mitigate the probability that this erroneously happens.
There are some generics that have multiple values (samples from Fanboy's Annoyances):
Though I agree that they are not very common. |
Installed 1.37.3b15 and tested with the site ( |
Thanks to @mjethani, this was a good idea to look at the content script angle -- until then I was looking at the background process angle which required a whole lot of changes -- it turns out the changes ended up being relatively trivial. |
If I enable that list with the generic filter you posted, the issue can be repro'd again.. |
Yep, strange... I can reproduce too. |
If both of these:
Are present, the site goes blank. |
Investigating. Ok, I figured why this happens, investigating best fix. |
Tested v.16, works without an issue! |
Wait... This form still blanks the site:
Imo it would be safer to ignore also rules that match to the Sample rules from Fanboy's Annoyances:
|
Only simple |
Regarding the current solution, there are at least three ways to do it:
|
Aside from higher CPU usage, this also causes a very high amount of memory usage. The last time I checked, using ABP causes your system to use more memory than if you didn't use an ad blocker. |
Filter list author would disagree with this, there are cases of sites injecting elements as child of
Not sure what you mean, the rules are injected as user styles, JS is of no use in such case. I did consider having user styles to unhide As far as uBO is concerned, I know roughly the path to implement this, but for the second part of dealing with highly generic cosmetic filters, this will have to wait for the next dev cycle. At least for now the most likely to cause false positives are being mitigated. |
Right, I tweeted about this a few months ago: https://twitter.com/gorhill/status/1345042527171325953. I do not worry using |
I was referring to the current solution with
+1 |
Using |
This is what I meant: <html>
<body>
<div class="bar">
Hello.
</div>
<script>
setTimeout(() => {
document.body.className = 'foo';
},
3000);
</script>
</body>
</html> Now I've added the filter The filter |
I thought about this too. Aside from not knowing what value to use for the |
@kiboke if it's really outside <html>
<body>
Body.
</body>
<script>
setTimeout(() => {
let e = document.createElement('p');
e.innerText = 'Hi!';
document.documentElement.appendChild(e);
},
1000);
</script>
</html> |
Yes, but this is an edge case for uBO because its mutation observer does not listen to attribute changes. This is why
|
I looked at Suppose this is the user style sheet: .consent-summary-shown {
display: none !important;
}
body.consent-summary-shown {
display: revert !important;
} I suspect that It's also not clear how this would work with multiple user style sheets. |
Then webmasters maybe start promote legacy
IMO this is better implementation that oldie So can break flexbox/grid pages too.
this explains part of the situations when on my PC the filter didn't hide the |
Maybe Now possible use E.g.:
on page no longer works these generic filter:
or have very Race Conditon in uBO 1.37.3rc0, but 1.37.2 injected filter almost immediately. |
High profile case involving highly generic cosmetic filter: uBlockOrigin/uAssets#11244. |
Highly generic cosmetic filters should not longer affect
|
I would propose to add article tag to html and body. Should I open a new issue? |
No, doing what you suggest would just allow advertisers to use |
Prerequisites
I tried to reproduce the issue when...
Description
There have been numerous occasions where Annoyance lists have blanked out websites because either
html
orbody
have contained values that have been matched by a generic cosmetic filter. This is a pretty common issue for Annoyance lists, though there have been a few occasions in normal adblocking as well.Usually these issues have been fixed by adding
:not(html)
or:not(body)
exception to the problematic generic filter.I was wondering if it would be reasonable to add a safeguard measure to uBO: to prevent it from applying cosmetic filters, that have a match in
html
orbody
in websites where an user is visiting. I think that neitherhtml
orbody
should ever be blocked as that will result in a blank website.One recent issue: easylist/easylist#8431 -
https://webshop.elektroskandia.no/
was blanked out becausebody
in that website had a value of.consent-summary-shown
. It was matched by this generic GDPR banner filter:##.consent-summary-shown
. (It was later fixed by adding an exception:##.consent-summary-shown:not(body)
).But that wasn't the only case. In Fanboy's Annoyance list, there are currently:
:not(html)
exceptions:not(body)
exceptionsAdguard Annoyance:
:not(html)
exceptions:not(body)
exceptionsEasylist:
:not(html)
exceptions:not(body)
exceptionsI know these website blanking issues are mainly related to Annoyance lists that are not turned on by default in uBO, but they are still available and people use them. Not all issues get reported to filter list maintainers and there could be many unreported issues relating to these lists. Each
:not(html)
or:not(body)
exception that currently exists, are related to fixing blank websites.A specific URL where the issue occurs
https://webshop.elektroskandia.no/
(fixed now but this one is a recent case so I'll use it as a sample)Steps to Reproduce
##.consent-summary-shown
to custom filtershttps://webshop.elektroskandia.no/
Expected behavior
uBO would ignore this generic filter for this website, because it matches to the
body
element.Actual behavior
Website is blanked, due to a match to the
body
element.uBlock Origin version
1.37.3b13
Browser name and version
Firefox 91.0.1
Operating System and version
Windows 10
The text was updated successfully, but these errors were encountered: