New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 809883 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Blank page in WebView

Reported by hir...@netstar-inc.com, Feb 7 2018

Issue description

THIS TEMPLATE IS FOR FILING BUGS ON THE ANDROID SYSTEM WEBVIEW. GENERAL WEB
BUGS SHOULD BE FILED USING A DIFFERENT TEMPLATE!

Device name:Nexus 6P
Android version:8.1.0
WebView version (from system settings -> Apps -> Android System WebView):disable(Chrome version:64.0.3282.137)
Application:custom webview
Application version:

URLs (if applicable):https://m.yahoo.co.jp/



Steps to reproduce:
(1)Create empty android project.

(2)Add the following code to onCreate() of MainActivity.

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        WebView wv = (WebView) findViewById(R.id.webView);

        wv.setWebViewClient(new WebViewClient() {

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                Map<String, String> addHeaders = new HashMap<String, String>();
                addHeaders.put("X-SAMPLEHEADER", url);

                view.loadUrl(url, addHeaders);

                return false;
            }
        });

        wv.loadUrl("https://m.yahoo.co.jp");

(3)Perform an arbitrary search on the displayed page.

(4)Tap any tab.


Expected result:
Content is displayed correctly.

Actual result:
A blank page is displayed.

It will be reproduced even if it is executed with the next shouldOverrideUrlLoading().
・boolean shouldOverrideUrlLoading (WebView view, WebResourceRequest request)

It can also be reproduced by executing loadUrl(String url) without passing a header.

Even if Android System WebView is enabled, the result will not change.

 
Cc: sandeepkumars@chromium.org
Labels: Needs-triage-Mobile WV-Triaged
@hirose: Thanks for the report!!

Could you please help us with a sample file .apk where you're seeing this issue, and if possible attach a screencast as well for triaging of the issue.

Thanks!!
Labels: Needs-Feedback
Thank you for your reply.
Please refer to the attached file.
app-debug.apk
104 KB Download
device-2018-02-08-171028.mp4
4.2 MB View Download
Project Member

Comment 4 by sheriffbot@chromium.org, Feb 8 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "sandeepkumars@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 5 by boliu@chromium.org, Feb 8 2018

Status: WontFix (was: Unconfirmed)
your apk doesn't work. looks like it's a multi-dex apk, and you only provided the main one.

but the main problem is your shouldOverrideUrlLoading implementation.

You should
1) return true from shouldOverrideUrlLoading (only if you actually want to stop that load and replace it with a different one, which are doing in that code snippet at least)
2) post the loadUrl call instead of calling it directly from shouldOverrideUrlLoading
I'm sorry.
return false of shouldOverrideUrlLoading is a typo.

I changed shouldOverrideUrlLoading as below, but the result does not change.
I attach an apk.

- -
            @Override
            public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
                view.post(new Runnable() {
                    @Override
                    public void run() {
                        Map<String, String> addHeaders = new HashMap<String, String>();
                        addHeaders.put("X-SAMPLEHEADER", url);
                        view.loadUrl(url, addHeaders);
                    }
                });
                return true;
            }
- -

Although postDelayed delayed for 1 second will work correctly, I think this 1 second delay should be avoided for every load.


app-release.apk
74.7 KB Download
I can confirm that I am seeing the same issue with 65.0.3325.109.

@boliu regarding #c5.

I am using loadUrl correctly within shouldOverrideUrlLoading().

1. Calling loadUrl() within shouldOverrideUrlLoading() is the only currently-supported way to pass extra HTTP headers.

2. Simply post()’ing it doesn’t make a difference, as #c6 says. The delay has to be long enough, which makes every navigation slow, and is unacceptable.

Please re-open this bug for a complete investigation.

Comment 8 by boliu@chromium.org, Mar 12 2018

I said post, not post with delay. The problem is that shouldOverrideUrlLoading is called directly from navigation code (since the navigation depends on the return value), so calling loadUrl again is re-entering into navigation code, which is really undefined what happens in that case.

Sign in to add a comment