Page.stopLoading doesn't work on first try |
|||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Steps to reproduce the problem: 1. Load some google query in chrome-remote-interface (e.g. https://www.google.com/search?q=foobar) 2. Keep refreshing it until it stuck on loading some resource according to the presense of top button in the browser UI. 3. Call Page.stopLoading(), observe still loading. 4. Call Page.stopLoading() second time, observe loading stopped. Also, no completion event of any sort generated: no, Page.loadEventFired, no Page.frameStoppedLoading. What is the expected behavior? Browser stops loading on the first invocation of Page.stopLoading() as if it's done from the UI. Also DevTools protocol should inform about this somehow. What went wrong? Had to call Page.stopLoading() to actually stop loading. No event is fired to inform about this kind of situation. Did this work before? N/A Chrome version: 63.0.3203.0 Channel: n/a OS Version: Flash Version:
,
Sep 4 2017
,
Sep 6 2017
Would you mind providing us with a sample testcase for repro?
,
Sep 7 2017
,
Nov 15 2017
Hi, I have similar problem which I'm able to reproduce using system WebView
I make small test application to reproduce this problem:
```
package com.example.alex.myapplication;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewGroup vg = findViewById(R.id.main_activity);
final WebView wv = new WebView(this);
wv.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
System.out.println("onProgressChanged: " + newProgress);
}
});
vg.addView(wv);
wv.loadUrl("https://www.washingtonpost.com/");
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
System.out.println("StopLoading");
wv.stopLoading();
}
}, 1000);
}
}
```
On Android Emulator with Network type: GPRS and signal strength: Poor (to slow down loading process) I have the following output:
```
11-15 11:11:31.475 20426-20426/com.example.alex.myapplication I/System.out: onProgressChanged: 10
11-15 11:11:31.755 20426-20426/com.example.alex.myapplication I/System.out: onProgressChanged: 10
11-15 11:11:32.050 20426-20426/com.example.alex.myapplication I/System.out: onProgressChanged: 21
11-15 11:11:32.084 20426-20426/com.example.alex.myapplication I/System.out: StopLoading
11-15 11:11:32.173 20426-20426/com.example.alex.myapplication I/System.out: onProgressChanged: 70
11-15 11:11:32.173 20426-20426/com.example.alex.myapplication I/System.out: onProgressChanged: 100
11-15 11:11:32.173 20426-20426/com.example.alex.myapplication I/System.out: onProgressChanged: 100
```
As you can see, StopLoading was called before 70%, but WebView continued to load.
This is just smallest example, in real life I got this problem from time to time on different sites (most often on heavy sites, which tends to load a long while
,
Nov 15 2017
Have you tried to call stopLoading twice? I've noticed that it always works on the second call.
,
Nov 16 2017
Well, it looks like, that if I call stopLoading twice it work better, but seems still it doesn't work on _some_ sites (with lots of redirects or something else - not sure I understand which sites work and which are not)
,
Dec 14 2017
StopLoading is equivalent to pressing Stop next to the address bar. I'll schedule stop action, but due to asynchronous nature of loading, its effect is not immediate. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by dats@google.com
, Sep 4 2017