Opened on 06/08/2017 at 05:58:12 AM

Closed on 07/07/2017 at 01:00:43 PM

#5303 closed defect (fixed)

White screen instead of webpage is shown

Reported by: asmirnov Assignee:
Priority: P3 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: Blocked By:
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29459555/

Description (last modified by asmirnov)

AdblockWebView uses element hiding to hide empty ad blocks (the resource loading for them was prevented). Js script (https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android-webview/assets/inject.js) is injected (https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java#L564) in the very beginning of page loading that subscribes to DOMContentLoaded event (https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android-webview/assets/inject.js#L38 and similar events) and is executed when fired.

However sometimes on some devices (not sure what's the same on them) it's not executed. The problem is that we use some workaround to prevent ad flickering: when ad block is shown and hidden immediately after loading. The trick is to prevent drawing View in onDraw(): https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java#L1301
We stop preventing drawing when the script finished working and invoked https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java#L1266 with false (see addDomListener=false in the log). After that we stop prevent loading https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java#L1340 and a user can see webpage rendered.

So, no script is fired and the flagallowDraw is still true and a user can see only white page.
We can workaround it by setting the flag to true in onProgressChanged() with 100% and it will help in this case, but the root case is that the script was not executed. It means that the user will see empty ad blocks, which is not desired.

In general it seems to Chromium or particular devices issue.
Since evaluateJavascript (https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java#L231) does not return boolean (https://developer.android.com/reference/android/webkit/WebView.html#evaluateJavascript(java.lang.String, android.webkit.ValueCallback<java.lang.String>)) there is no way to check if the script was actually invoked (it's placed in scripts queue and invoked much later). Probably we could return any value from the script and check if in onProgressChanged with 100% but it's a kind of workaround and not the fix for the issue.

Environment

Vivo x9 device

How to reproduce

  1. Go to baidu.com
  2. Open any article
  3. Return back
  4. go to #2 and repeat until you see white screen.

...

Observed behaviour

White screen

Expected behaviour

Webpage rendered

Attachments (3)

baidu.com.zip (7.5 KB) - added by asmirnov on 06/08/2017 at 06:00:12 AM.
no issue at baidu.com
google.ru.zip (2.0 KB) - added by asmirnov on 06/08/2017 at 06:00:29 AM.
no issue at google.ru
issue-baidu.com.zip (111.9 KB) - added by asmirnov on 06/08/2017 at 06:00:52 AM.
issue happened on baidu.com

Download all attachments as: .zip

Change History (10)

Changed on 06/08/2017 at 06:00:12 AM by asmirnov

no issue at baidu.com

Changed on 06/08/2017 at 06:00:29 AM by asmirnov

no issue at google.ru

Changed on 06/08/2017 at 06:00:52 AM by asmirnov

issue happened on baidu.com

comment:1 Changed on 06/08/2017 at 06:02:11 AM by asmirnov

see the comments in attached logs, starting with /*. eg:

/* M #6 : the page is finished but injected script is not executed */

or:

/* ABP #5: injected script actually executed */

comment:2 Changed on 06/08/2017 at 06:02:19 AM by asmirnov

  • Ready set

comment:3 Changed on 06/08/2017 at 06:11:00 AM by asmirnov

  • Description modified (diff)

comment:4 Changed on 06/08/2017 at 06:23:42 AM by asmirnov

BTW reRunning the script in inProgressChanged with 100% does not help:

06-07 17:24:52.920 11492 11492 I MxWebClientView: onProgressChanged 100
06-07 17:24:52.920 11492 11492 V MxWebChromeClient: ⇠ onProgressChanged [0ms]
06-07 17:24:52.920 11492 11492 D AdBlockWebView: Loading progress=100%,allowDraw=false,loading=true,loadError.null=true,injectJs.isnotnull=true,getAddDomListener()=true
06-07 17:24:52.920 11492 11492 D AdBlockWebView: Injecting script
06-07 17:24:52.920 11492 11492 D AdBlockWebView: runScript started
06-07 17:24:52.920 11492 11492 D AdBlockWebView: runScript finished

and it was not invoked anyway

Last edited on 06/08/2017 at 06:43:12 AM by asmirnov

comment:5 Changed on 06/08/2017 at 06:30:17 AM by asmirnov

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:6 Changed on 07/07/2017 at 01:00:15 PM by abpbot

A commit referencing this issue has landed:
Issue 5303 - White screen instead of webpage is shown

comment:7 Changed on 07/07/2017 at 01:00:43 PM by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none).
 
Note: See TracTickets for help on using tickets.