uBlockOrigin / uBOL-home

uBO Lite home (MV3)
GNU General Public License v3.0
1.22k stars 50 forks source link

eurointegration.com.ua: ads #166

Closed dportvine closed 3 months ago

dportvine commented 3 months ago

Open this link in a new tab https://www.eurointegration.com.ua/news/2024/08/5/7191539/ Wait 10 seconds and click on the tab, the empty space at the top is not hidden. In uBOL i see ads. You need clear cache after reload page.

Google Chrome 127.0.6533.89, uBOL 2024.8.5.925

Video uBOL https://github.com/user-attachments/assets/5dab6a0a-84bb-43d4-9153-abf0053e3316

Also https://github.com/uBlockOrigin/uAssets/issues/24781

gorhill commented 3 months ago

Just lowering the filtering mode to Basic/Optimal then back to Complete causes the ads to show up afterward, but then, not always. Looks like a timing issue, this needs more investigation.


When the following error appears at the console, ads are blocked, if not, ads are not blocked:

image


Possibly related to this filter:

##script[onerror*="error-report.com"]:watch-attr(onerror):remove-attr(onerror)
stephenhawk8054 commented 3 months ago

This site looks like related to ad-shield so there might be some side-effects with the filters related to it.

gorhill commented 3 months ago

It's definitely a timing issue, oftentimes the target script won't be found in the DOM, hence its onerror handler can't be removed.

The only way I found to address the issue is to instead use a filter based on ra.js scriptlet, along with some modifications to the scriptlet to allow for "remove attribute asap":

eurointegration.com.ua##+js(ra, onerror, script[onerror*="error-report.com"], asap stay)

When asap is present, the scriptlet will not only find the target element immediately upon injection, but also immediately when the mutation observer is triggered. This results in a much more reliable filtering, though sometimes a placeholder can be left at the top -- possibly addressable with a cosmetic filter.

gorhill commented 3 months ago

Solution has been to improve ra.js to make it possible to remove attribute without delay when DOM changes are detected, and to add a filter using ra.js as a reliable replacement for the procedural cosmetic filter ##script[onerror*="error-report.com"]:watch-attr(onerror):remove-attr(onerror).

I have verified that I could not reproduce the issue with the new ra.js filter.

stephenhawk8054 commented 3 months ago

cc @JobcenterTycoon

For some ad-shield websites in uBOL

gorhill commented 3 months ago

Probably that filter is also more reliable in uBO.

stephenhawk8054 commented 3 months ago

Probably that filter is also more reliable in uBO.

You mean this one?

##+js(ra, onerror, script[onerror*="error-report.com"], asap stay)
uBlock-user commented 3 months ago

So, ra.js will not be removed eventually into the future ?

dportvine commented 3 months ago

How can I get a version of uBOL with these latest changes?

stephenhawk8054 commented 3 months ago

You have to build it yourself I think.

gorhill commented 3 months ago

So, ra.js will not be removed eventually into the future ?

Can't remove it for now since it's the only one that can reliably remove on... handlers in Firefox, remove-attr() doesn't work because it's executed in isolated world. Now with the improvment here, it has become more reliable for removing on... handlers in any browser since cosmetic procedural filters always execute in a lazy way by design.

gorhill commented 3 months ago

How can I get a version of uBOL with these latest changes?

Is eurointegration.com.ua considered a high traffic site? If so, I could release a new version of uBOL.

dportvine commented 3 months ago

Is eurointegration.com.ua considered a high traffic site? If so, I could release a new version of uBOL.

The problem is only in the new tab, the new version is not needed.

JobcenterTycoon commented 3 months ago

Changed here https://github.com/uBlockOrigin/uAssets/commit/bc288a8396afbd94879a6b023c5b864d1ec66583

stephenhawk8054 commented 3 months ago

@JobcenterTycoon I think asap is not available for uBO stable yet, so we might still need :remove-attribute() ?

JobcenterTycoon commented 3 months ago

Yes sorry i forgot there was a latest scriptlet change.