Skip to content

Android: a renderer crash recovers the page but loses the tab's back stack #94

Description

@joemasilotti

0.12.0 taught both platforms to survive a renderer crash: when the system reclaims a page's memory, iOS reloads in place and Android rebuilds the tab, instead of the old behavior where Android crashed outright and iOS sat on a blank page until relaunch. That much shipped and is device-verified.

What it does not do on Android is preserve where the user was. The rebuilt tab comes back at the page it was showing, but the back stack behind it is gone, so a user four screens deep into a tab loses the trail back out. iOS keeps its stack because it reloads the same web view rather than replacing it.

Accepted as a limitation for 0.12.0 rather than blind-fixed, because the fix needs its own device pass.

Sketched fix

Chromium's session history lives in the app process, not the renderer, so it should outlive a renderer death. WebView.saveState(Bundle) on the dead web view, then restoreState into the replacement, should carry the stack across the rebuild. Worth confirming that saveState returns non-null after the renderer is gone, since that is the whole premise.

The rebuild path is in RubyNativeApp.kt.

Reproducing

Load chrome://crash in a tab that already has a few screens of history, then check whether the back button walks back out. Normal Mode; Advanced Mode recovers through Hotwire's own navigator and is not affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidiOS implements this but Android does not.bugSomething isn't working

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions