mozilla-mobile / firefox-tv

Firefox for Amazon's Fire TV
https://blog.mozilla.org/blog/2017/12/20/firefox-is-now-on-amazon-fire-tv-happy-holiday-watching/
Mozilla Public License 2.0
255 stars 109 forks source link

WebView fails to load any content after hitting back on initial website (white screen) #1216

Closed AaronMT closed 6 years ago

AaronMT commented 6 years ago

Running e869530c2be44344627723c83defdf3af395a2be on a FireTV Cube in the office.

Reproduced also via:

dnarcese commented 6 years ago

The log error:


2018-09-27 13:43:38.060 6172-6172/org.mozilla.tv.firefox.debug W/cr_AwContents: Application attempted to call on a destroyed WebView
    java.lang.Throwable
        at org.chromium.android_webview.AwContents.isDestroyed(AwContents.java:1262)
        at org.chromium.android_webview.AwContents.isDestroyedOrNoOperation(AwContents.java:1192)
        at org.chromium.android_webview.AwContents.evaluateJavaScript(AwContents.java:2259)
        at com.android.webview.chromium.WebViewChromium.evaluateJavaScript(WebViewChromium.java:592)
        at com.android.webview.chromium.WebViewExtAmazon.evaluateJavaScript(WebViewExtAmazon.java:56)
        at android.webkit.WebView.evaluateJavascript(WebView.java:1053)
        at org.mozilla.focus.ext.EngineViewKt.evalJS(EngineView.kt:107)
        at org.mozilla.focus.browser.FocusedDOMElementCache.restore(FocusedDOMElementCache.kt:22)
        at org.mozilla.focus.ext.EngineViewKt$setupForApp$3$1.run(EngineView.kt:95)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6188)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:801)
mcomella commented 6 years ago

I don't see the log error but I was able to reproduce. Here's the layout inspector at the time of the white screen: screen shot 2018-09-27 at 12 00 21

Looks like the WebView has the focus but for some reason the menu button isn't working to show the overlay.

mcomella commented 6 years ago

I'm getting the same log statements on dpad keypress as #1142 and #1202.

2018-09-27 12:02:18.971 3567-3842/? W/bt_btif: bta_hh_co_is_peer_amazon_remote: result = 1, vid = 0x1949, pid = 0x410
2018-09-27 12:02:18.971 3567-3842/? W/bt_btif: bta_hh_co_is_no_unsniff_amazon_remote: result = 1, vid = 0x1949, pid = 0x410
2018-09-27 12:02:18.974 3567-3842/? W/bt_btif: bta_hh_co_is_peer_amazon_remote: result = 1, vid = 0x1949, pid = 0x410
2018-09-27 12:02:18.974 3567-3842/? W/bt_btif: bta_hh_co_is_no_unsniff_amazon_remote: result = 1, vid = 0x1949, pid = 0x410
2018-09-27 12:02:18.975 3450-3100/? E/AmazonInputManagerService: Toggle bit button map has not been initialized!
mcomella commented 6 years ago

I added a breakpoint to the dispatchKeyEvent method and determined the menu button is getting called but maybeBrowserFragment?.dispatchKeyEvent returned false, I think. Unfortunately, Android killed my process for ANR though. :( (maybe I started from the device UI instead of IDE)

Next steps would be to continue investigated what happens in maybeBrowserFragment.dispatchKeyEvent. ^

mcomella commented 6 years ago

I just reproduced a similar but different bug. I found two states:

mcomella commented 6 years ago

I noticed the progress bar sometimes says, "" and sometimes it says, "firefox:home". I wonder if WebView gets grumpy when we press back before the URL has changed (though then again that's on components to pass us the URL at the appropriate time...).

mcomella commented 6 years ago

And similarly, in one of these states, the progress bar is stuck on the screen but is not animating: this is a weird state!

severinrudie commented 6 years ago

RCA: