Skip to content

Conversation

Copy link

Copilot AI commented Dec 9, 2025

Sessions exported from Vanadium WebView fail to restore in official WebView (and vice versa), leaving users with empty tabs. WebView.restoreState() returns null on binary incompatibility but was never checked.

Changes

  • Check restoreState() return value: Detect when WebView state restoration fails
  • Fallback to URL loading: When restore fails, extract URL from session bundle and load directly
  • Add diagnostic logging: Log restoration failures and fallback behavior for debugging

Implementation

Modified BundleInitializer.initialize() in TabInitializer.kt:

override fun initialize(webView: WebView, headers: Map<String, String>) {
    bundle?.let { 
        val backForwardList = webView.restoreState(it)
        if (backForwardList == null) {
            // Restore failed - fall back to loading URL
            Timber.w("WebView.restoreState() failed - likely incompatible WebView. Fallback to URL: ${url()}")
            if (url().isNotEmpty()) {
                webView.loadUrl(url(), headers)
            }
        }
    }
}

Trade-offs

Navigation history is lost on fallback, but tabs recover with correct URLs instead of remaining empty. Users can now switch between WebView implementations (Vanadium ↔ Official) without losing all tab content.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:&#43;HeapDumpOnOutOfMemoryError -Xmx4096M -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Fail to import vanadium sessions into official WebView</issue_title>
<issue_description># Description
I frequently back up my sessions, and recently had to switch phones. No worries, I thought, I have a backup! Turns out, after restoring the session was empty.
I started testing and found out that identical versions of Fulguris cannot backup and restore sessions on different Android distributions (maybe due to different webviews?), in my case between Lineage OS and Graphene OS.

Environment

  • Device: Poco F4 (munch), Pixel 9 Pro Fold (comet)
  • OS munch: Lineage OS 22.2 (A15) munch
  • OS comet: Graphene OS 16 comet
  • WebView munch: com.android.webview v142.0.7444.138
  • WebView comet: com.vanadium.webview v143.0.7499.52.0

To reproduce

Steps to reproduce the behaviour:

  1. go to settings - backup - export - <session name>
  2. export to anywhere (tested with local storage and connected nextcloud webdav)
  3. on the other device go to settings - backup - sessions import and select the file
  4. open the session - it only has 1 empty tab

Expected behaviour

  1. open the session - all previous tabs are restored

Additional context

Attached are 2 test exports, test-lineage and test-graphene

session-export-tests.zip
</issue_description>

Comments on the Issue (you are @copilot in this section)

@Slion Indeed there is not guarantee a session can be imported in anything else other than the exact same WebView it was exported from. Though in practice I've only seen this break once, years ago, probably due to breaking changes in WebView back then.

I could import your com.android.webview session on my stock Android 15 - HONOR Magic V2 - WebView com.google.andoid.webview v142.0.7444.171. You've got Ycombinator.com and Amazon.com tabs in there.

The com.vanadium.webview session however comes out empty, meaning it could not restore the WebView.

Looks like the guys producing com.vanadium.webview have been a bit heavy-handed and broke binary compatibility.
I'd say your best bet would be to get them to take a look at it and hope they are kind enough to take the time to fix it.
In theory they should be able to produce an update that would be able to load their broken bundles and output a fixed bundle that's loadable from an official WebView distribution. All you would need to do is open that session in Fulguris using their fixed WebView and then go do a new export. Though you may have to visit every tab too before doing the export.

I believe the APIs involved are:

  • WebView.saveState
  • WebView.restoreState

On the Fulguris side we could try support other export formats that do not rely on WebView binary format but that's a complete new feature and should be tracked on another ticket.

Thanks for the detailed bug report. I'll close it as this is by design and there is nothing we can do about it. Feel free to discuss further though.</comment_new>
<comment_new>@Slion

Vanadium has no changes which would break binary compatibility for this. You can look over our patches and see we definitely don't change anything which would do that.

Interesting, so maybe there is some breaking changes from v142 to v143. That would be most unfortunate.
What else could it be? Architecture differences between the OP's devices?</comment_new>
<comment_new>@Slion

Maybe it doesn't restore if the package name or signing key is different. It seems problematic if it did try to restore across that difference.

Not sure about any signing but I could import the OP session from different package name.</comment_new>
<comment_new>@Slion

I mean the package name and signing key of the WebView.

Yes, #738 (comment):

I could import your com.android.webview session on my stock Android 15 - HONOR Magic V2 - WebView com.google.andoid.webview v142.0.7444.171. You've got Ycombinator.com and Amazon.com tabs in there.

But then again those are two official WebView distributions, albeit with different package name, maybe they do have some kind of signing in place that could prevent restoring for some reason. I find it odd though.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 9, 2025 14:33
- Check WebView.restoreState() return value for null (failure)
- Fall back to loading URL when restore fails
- Add logging to help diagnose WebView compatibility issues
- Fixes Vanadium WebView sessions failing to restore in official WebView

Co-authored-by: Slion <6508892+Slion@users.noreply.github.com>
Co-authored-by: Slion <6508892+Slion@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue importing vanadium sessions into official WebView Handle WebView.restoreState() failure when importing sessions across incompatible WebView implementations Dec 9, 2025
Copilot AI requested a review from Slion December 9, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebView v143 breaks sessions?

2 participants