uBlockOrigin / uBlock-issues

This is the community-maintained issue tracker for uBlock Origin
https://github.com/gorhill/uBlock
950 stars 81 forks source link

Some cosmetic rules don't appear up in the logger or appear occasionally even if they are applied always #521

Open kulfoon opened 5 years ago

kulfoon commented 5 years ago

Prerequisites

Description

Not sure whether this is a bug / enhancement / something to address / duplicate or it's just the way uBO works, but I've encountered a real case...

Some cosmetic rules are always applied, but don't appear in the logger or appear occasionally, what makes it very difficult to troubleshoot some filter issues. I had to resort to much trial-and-error and manual searching through the filter lists, to find the rule and override it https://github.com/MajkiIT/polish-ads-filter/issues/12017#issuecomment-481764041

This specific example of the issue occurs at PL website and is related to uBO's PL regional filtes lists, which are not enabled by default in uBO for non-PL users, so to reproduce the issue, make sure you've got other uBO's regional filters lists disabled + these 2 PL lists enabled instead: POL: Oficjalne Polskie Filtry do AdBlocka, uBlocka Origin i AdGuarda​​​​​ POL: Oficjalne polskie filtry przeciwko alertom o Adblocku​

In case the PL lists will be modified/updated in the meantime, which might break the reproducibility of the issue, use these archived timestamps instead: https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/2c564b8ed7a45da69707b4f6754ec84737210497/polish-adblock-filters/adblock.txt https://raw.githubusercontent.com/olegwukr/polish-privacy-filters/c794c52dce07398250972a21ff4fd6666ff4b430/anti-adblock.txt

Notice: admins of the website often change something at their side in the webpage's code, as they often fix/override our filters every several days, which might break the reproducibility of the issue soon.

Screenshoots/logs (with DOM label active):

Logger output ![ss552](https://user-images.githubusercontent.com/43844449/55948263-68637b80-5c50-11e9-9f91-87d4dd7ef454.png) | | | | | | | | |:--- |:--- |:--- |:--- |:--- |:--- |:--- | | +1 | ##body[class]:not(.rodo):style(overflow: auto !important;) | | `www.filmweb.pl` | | dom | `https://www.filmweb.pl/Gladiator` | | +1 | ##.ws__wrapper:style(visibility: hidden !important;) | | `www.filmweb.pl` | | dom | `https://www.filmweb.pl/Gladiator` | | +0 | ##+js(set-constant.js, pp_adblock_is_off, trueFunc) | | `www.filmweb.pl` | | dom | `https://www.filmweb.pl/Gladiator` | | +0 | ##+js(remove-attr.js, style, #skyBanner) | | `www.filmweb.pl` | | dom | `https://www.filmweb.pl/Gladiator` | | +0 | #@#+js(abort-current-inline-script.js, decodeURIComponent, newAdblockBoardDisplayed) | | `www.filmweb.pl` | | dom | `https://www.filmweb.pl/Gladiator` | | +0 | #@#+js(setTimeout-defuser.js, notDetected) | | `www.filmweb.pl` | | dom | `https://www.filmweb.pl/Gladiator` | | +0 | ##^div[class^="pageBox"] ~ style | | `www.filmweb.pl` | | dom | `https://www.filmweb.pl/Gladiator` |

Related/similiar issues (from the newest to the oldest): https://github.com/uBlockOrigin/uBlock-issues/issues/385 https://github.com/uBlockOrigin/uAssets/issues/4660 https://github.com/uBlockOrigin/uBlock-issues/issues/102 https://github.com/gorhill/uBlock/issues/2749 https://github.com/gorhill/uBlock/issues/2666 https://github.com/gorhill/uBlock/issues/876 https://github.com/gorhill/uBlock/issues/435

A specific URL where the issue occurs

Example movie subsite: https://www.filmweb.pl/Gladiator

Steps to Reproduce

  1. Open the logger.
  2. Visit the website - the anti-adblock will appear at the bottom of the website, because this rule: filmweb.pl###advertBar-pl_PL, #jezevcoidni_sas44747, .fwPlusBtn from POL: Oficjalne Polskie Filtry do AdBlocka, uBlocka Origin i AdGuarda filter list, triggers the anti-adblock.
  3. Switch back to the logger and notice that the rule doesn't appear here, despite the fact it has got applied on the website because it has triggered the anti-adblock.
  4. Reload the website several times and each time notice the anti-adblock gets triggered but the rule doesn't appear in the logger or appear occasionally.
  5. Add an exception filmweb.pl#@##advertBar-pl_PL, #jezevcoidni_sas44747, .fwPlusBtn to My Filters, reload the webpage, and observe that the anti-adblock is gone.
  6. The fact the exception rule doesn't appear in the logger as well, is another known similiar issue as well: https://github.com/gorhill/uBlock/issues/127 ...

Expected behavior:

The rule should always appear in the logger, if it's always applied.

Actual behavior:

The rule does not appear in the logger or appear occasionally, even if it's always applied.

Your environment

gwarser commented 5 years ago

I see anti-adblock even without Polish list.

Filter will not be logged if not applied to the page.

mapx- commented 5 years ago

I can reproduce the issue. Enable polish lists, anti adb message visible for me add filmweb.pl#@##advertBar-pl_PL, #jezevcoidni_sas44747, .fwPlusBtn => no anti adb message

The filter filmweb.pl###advertBar-pl_PL, #jezevcoidni_sas44747, .fwPlusBtn isn't reported in the logger like OP said

mapx- commented 5 years ago

@gwarser you get the anti adb even without polish lists because gfx.filmweb.pl/adbetween/adx.js is blocked (and polish lists whitelisted it)

gwarser commented 5 years ago

This script is not even served to me.

mapx- commented 5 years ago

or other scripts, whitelisted in the polish lists

image

gorhill commented 5 years ago

How does the anti-blocker look? I don't seem to get any on my side. There is no match for ##advertBar-pl_PL, #jezevcoidni_sas44747, .fwPlusBtn when I try with the picker.

mapx- commented 5 years ago

anti adb (without polish lists): image

with polish lists: image

gorhill commented 5 years ago

Thanks, so this is at the bottom, I get your first screenshot with both Polish lists enabled.

I get no hit in element picker with ###advertBar-pl_PL, #jezevcoidni_sas44747, .fwPlusBtn, hence not seeing this filter reported in the logger is expected?

gwarser commented 5 years ago

Probably this code:

Details ```JS ```

Appers in DOM when paused in debugger on <body> node modidfication and then "Step Over" few times.

gorhill commented 5 years ago

Appers in DOM when paused in debugger on node modidfication and then "Step Over" few times.

Ok, so the issue is quite probably that by the time the cosmetic filter logger code scans the DOM, the matches have been removed from the DOM. Not sure what could be done in that case. Maybe also scanning within removed nodes, not sure whether this is trivial though, it has been a long time since I play with that code (which I also have to revisit due to the "monster DOM" issue).

kulfoon commented 5 years ago

Another real fresh case: https://github.com/MajkiIT/polish-ads-filter/issues/12890 (www.elektroda.pl)

(In the logger a DOM label active so that only DOM filters are shown)

the logger: ![elektroda](https://user-images.githubusercontent.com/43844449/56084027-60146780-5e2d-11e9-8d9b-4a6435432282.png) `##div[id^="div-gpt-ad"]` `##a[href^="https://bs.serving-sys.com"]` `###WelcomeAd`
the logger after manually whitelisting all the cosmetic filters: ![elektroda_2](https://user-images.githubusercontent.com/43844449/56084033-8c2fe880-5e2d-11e9-8df1-0108110696bb.png)

The anti-adblock message is still here.

I've had to add @@||elektroda.pl^$generichide to whitelist the invisible generic cosmetic filter/s and to make the anti-adblock message go away and to determine that cosmetic filters which trigger the anti-adblock are generic cosmetic filters, but this still doesn't tell me which filters lists / generic cosmetic filters trigger the anti-adblock (so that I can whitelist these only, another thing is that perhaps in this specific case it might be better to just put the generichide filter anyway, but it might be not, and this doesn't change the fact that the issue does exist, and I wanted to show the case).

If for some reason in this or other case one wouldn't want or couldn't stay with the generichide solution, the one would have to:

PS. BTW the anti-adblock can be blocked by enabling Nano Defender as well, as an alternative non-uBO solution).

PS. 2 A reproducibility notice: the generichide filter solution has been now added to ==> POL: Oficjalne polskie filtry przeciwko alertom o Adblocku ==> https://github.com/MajkiIT/polish-ads-filter/issues/12890#issuecomment-482940192 ==> https://github.com/olegwukr/polish-privacy-filters/commit/25c195857e7e05853aa766b1b211c52a003e93d0 so please be aware of that while trying to reproduce the case - with this list/filter enabled the anti-adblock message won't appear.