Opened 3 years ago

Closed 3 years ago

#4473 closed defect (invalid)

AA is hidden with elemhide selectors

Reported by: asmirnov Assignee:
Priority: P2 Milestone:
Module: Core Keywords:
Cc: sergz Blocked By:
Blocking: #4399 Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by asmirnov)

Environment

I've found this while testing AdblockWebView component for Android that inherits Android WebView class and adds ad-filtering (both filtering resource loading using filterEngine.matches(..) and element hiding using filterEngine.getElementHidingSelectors(..)). I'm configuring AA by adding/removing subscription to https://easylist-downloads.adblockplus.org/exceptionrules.txt (actually it's filterEngine.getPref("subscriptions_exceptionsurl")).

How to reproduce

  1. disable AA exceptions subscription (the link above)
  2. invoke filterEngine.getElementHidingSelectors(..) for "google.ru" and get 17387 selectors. make sure ads is NOT shown for "iphone 6 plus" request in google.ru
  3. enable AA by adding subscription (the link above)
  4. invoke filterEngine.getElementHidingSelectors(..) for "google.ru" and get 17388 selectors. make sure ads is NOT shown for the request above.

I've expected selectors count to be significantly lower or modified while AA enabled but in fact the lists are pretty equal. Note that the lists have the same items but the order is different. This may (but less likely) be affected by previous loading (i'm typing "http://google.com" then it's redirected to "https://google.com", then to "https://google.ru".

...

Observed behaviour

AA banners are NOT shown in both cases. More: i can see the resources are loaded and shown for a short period of time and then hidden. It's flickering because DOM "DOMContentLoaded" event is fired not immediately and then hiding rules are applied and the banners are hidden.

Expected behaviour

AA banners ARE shown when subscribed to exceptions subscription.

---

Testing with the latest libadblockplus (hg revision 96e9bae77a24) - recompiled for x86 and testing with android emulator on mac.
"patterns.ini" looks ok and the subscription is downloaded (see attached archive)
Log file attached.

Attachments (3)

aa.zip (3.7 MB) - added by asmirnov 3 years ago.
app fs dump
aa.log (7.1 KB) - added by asmirnov 3 years ago.
app log file
Снимок экрана 2016-09-27 в 16.59.56.png (116.9 KB) - added by asmirnov 3 years ago.
app scr

Download all attachments as: .zip

Change History (11)

Changed 3 years ago by asmirnov

app fs dump

Changed 3 years ago by asmirnov

app log file

comment:1 Changed 3 years ago by asmirnov

  • Summary changed from AA is filtered out to AA is hidden with elemhide selectors

comment:2 Changed 3 years ago by asmirnov

  • Description modified (diff)

comment:3 Changed 3 years ago by asmirnov

  • Cc sergz added

comment:4 Changed 3 years ago by asmirnov

  • Description modified (diff)

comment:5 Changed 3 years ago by asmirnov

  • Description modified (diff)

Changed 3 years ago by asmirnov

app scr

comment:6 Changed 3 years ago by asmirnov

  • Description modified (diff)

comment:7 Changed 3 years ago by asmirnov

i've continued the research and found that referrers makes sense in this particular case.

A brief note: Android does not provide referrer until Android 21 since https://developer.android.com/reference/android/webkit/WebViewClient.html#shouldInterceptRequest(android.webkit.WebView, android.webkit.WebResourceRequest) is available starting Android 21 only.

So filterEngine.isElemhideWhitelisted(url, null) was used instead of passing referrers list.

I've modified the sources to use Android API 21 and used request header "Referer" to get referer and trying filterEngine.isElemhideWhitelisted(url, new String[] { referer }).

url: https://www.google.ru/search?newwindow=1&site=&source=hp&ei=RMDsV7H_IcHzsAGvrpnYBQ&q=iphone+6+plus&oq=iphone+6+plus&gs_l=mobile-gws-hp.12..0i131k1j0l4.19001.24085.0.25189.13.6.0.7.7.0.233.882.0j5j1.6.0....0...1c.1j4.64.mobile-gws-hp..0.13.1025.I7V0dEpm3k8
referrer: https://www.google.ru/?gfe_rd=cr&ei=Q8DsV_3KMdTEtAG2lr-wBQ&gws_rd=ssl

filterEngine.isElemhideWhitelisted(url, referers);
returns true

filterEngine.isElemhideWhitelisted(url, null)
returns false

So now it's working as expected - AA banners are not hidden if AA checkbox is checked.

comment:8 Changed 3 years ago by asmirnov

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.