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): |
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
- Go to baidu.com
- Open any article
- Return back
- go to #2 and repeat until you see white screen.
...
Observed behaviour
White screen
Expected behaviour
Webpage rendered
Attachments (3)
Change History (10)
Changed on 06/08/2017 at 06:00:12 AM by asmirnov
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
comment:2 Changed on 06/08/2017 at 06:02:19 AM by asmirnov
- Ready set
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
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
no issue at baidu.com