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

Issue 775385 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug


Participants' hotlists:
Hotlist-1
Hotlist-2
Hotlist-3


Sign in to add a comment

multi-process webview can't load second webpage

Reported by greatx...@gmail.com, Oct 17 2017

Issue description

Example URL:

Steps to reproduce the problem:
1.  use android device above N, make sure multi-process webview enabled
2. load ("http://www.baidu.com"), everything is ok
3. press another website in the urlbar, inject any javascript(loadurl("javascript: XXXX")) in the early period of loading (e.g onLoadResource, onPageStarted), the new page won‘t  be loaded, the content remain the previous page(www.baidu.com)

What is the expected behavior?
the new page content can be loaded and displayed

What went wrong?
onProgressChanged report 100 immediately but the new page content didn't show. 

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 61.0.3163.100  Channel: stable
OS Version: 7.1.1 API 25
Flash Version:
 
Labels: Needs-triage-Mobile

Comment 2 Deleted

Comment 3 by greatx...@gmail.com, Oct 18 2017

any devices above N is reproducible. make sure enable multiprocess webview , set chromium webview as system webview.
Cc: msrchandra@chromium.org nyerramilli@chromium.org sandeepkumars@chromium.org
Labels: Triaged-Mobile Needs-Feedback
Tested the issue in Android. Could not reproduce the issue.

Steps Followed:
1. Multi-process webview enabled
2. Launched Browser
3. Navigated to (www.baidu.com)
4. Navigated to some other website
5. Did not observe such behavior

Chrome versions tested:
61.0.3163.98

OS
Android 7.1.2

Android Devices
7.1.2 Pixel XL Build/N2G48E

@greatxuhl: Could you please provide us a sample screencast of the exact issue you'e facing. That would help us in further triaging of the issue.

Thanks!!

Comment 5 by greatx...@gmail.com, Oct 19 2017

Thank you for your attention!

I override onLoadResource function followed: 

  @Override public void onLoadResource(WebView view, String s) {
    view.loadUrl("javascript: var i = 1;");
  }

I found:

1. Disable multi-process webview, everything goes well

2. enable multi-process webview, inject javascript in onPageFinished function(or other recall in later period of webpage loading), everything goes well, too.

a screen record is attached as followed
Project Member

Comment 6 by sheriffbot@chromium.org, Oct 19 2017

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 7 Deleted

Comment 8 Deleted

Components: -Blink Mobile>WebView
Labels: nee
Could you try to call WebView.stopLoading() before call view.loadUrl("javascript: var i = 1;")?
Labels: Needs-Feedback
I need inject in early period of loading page, the page will stay in white when stopLoading is called.
Project Member

Comment 13 by sheriffbot@chromium.org, Oct 26 2017

Cc: michaelbai@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "michaelbai@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 14 by torne@chromium.org, Oct 31 2017

Labels: -nee
OK, so it sounds like the in-progress navigation is being cancelled here. I'm not sure what the expectation is around loading a javascript: URL and whether that will stop pending navigations or not; multiprocess changes the timing/synchronisation of how some events occur, and so it's possible that the only difference here is the timing, and that it would also do the same in single-process if the timing happened to work out similarly. We should check if there's actually a behaviour change here or just a timing difference.

However, I'm a bit puzzled by "inject in early period of loading page" here: you have no way of knowing how far WebView has gotten with loading the page at the time you call loadUrl the second time because loading is asynchronous (even in single-process mode), so there's no guarantee that it will be injected at any particular time; the page might well have been fully loaded by the time your javascript code is executed in any case. What's your actual use case here? Maybe there's a better way to achieve what you're trying to do in the first place that won't run into this issue?

Comment 15 Deleted

Cc: torne@chromium.org
Labels:  -Needs-Feedback

Thank you for your attention!

I inject javascript to change webview's css style. 

like that:

void onprogresschanged(WebView w, int newprogress){
   w.loadurl("javascript: XXXXXX");
}

I inject javascript when the progress is 20 or less so that I can change css style during loading period. 

If I inject javascript when the progress is 40 or more(DOM tree seems resolved),everything goes well expect webview flash white.

You're dealing with an inherently asynchronous process, and so none of your solutions are currently correct in all cases. The only way to be sure that your JS was processed at the right time would be to inject it into the page content before WebView receives it.

Having said that, have you checked whether this reproduces if you call evaluateJavascript, rather than loading a javascript: URL?
Thank you for your attention!

Everything is ok if using evaluateJavascript instead of loadurl. :)

I found that function evaluateJavascript asynchronously evaluates JavaScript in the context of the currently displayed page. But I don't know why multiprocess webview affects the performance of javascript.
Status: WontFix (was: Unconfirmed)
Closing as the main issue here has been sufficiently addressed. I believe #18 is the asynchronous behavior we're talking about.

Sign in to add a comment