Skip to content

Fix Windows cookie crash after composewebview alpha-13 bump#1852

Merged
Tlaster merged 3 commits intodependabot/gradle/io.github.kdroidfilter-composewebview-1.0.0-alpha-13from
copilot/sub-pr-1851
Mar 9, 2026
Merged

Fix Windows cookie crash after composewebview alpha-13 bump#1852
Tlaster merged 3 commits intodependabot/gradle/io.github.kdroidfilter-composewebview-1.0.0-alpha-13from
copilot/sub-pr-1851

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

composewebview 1.0.0-alpha-13 removed WebViewState.nativeWebView. The initial fix used state.cookieManager.getCookies(), but WryCookieManager dispatches to Dispatchers.IO, which crashes on Windows because WebView2 requires cookie access on the main thread.

Changes

  • WebViewLoginScreen.kt: Replace state.cookieManager calls with direct WryWebViewPanel access via state.webView?.nativeWebView as? WryWebViewPanel, calling the non-suspend getCookiesForUrl() and clearAllCookies() on the main thread.
// before (crashes on Windows — Dispatchers.IO)
state.cookieManager.removeAllCookies()
val cookies = state.cookieManager.getCookies(actualUrl)

// after (runs on main thread, safe for WebView2)
(state.webView?.nativeWebView as? WryWebViewPanel)?.clearAllCookies()
val cookies = (state.webView?.nativeWebView as? WryWebViewPanel)
    ?.getCookiesForUrl(actualUrl)
    .orEmpty()

💡 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.

…okies API

Co-authored-by: Tlaster <8370277+Tlaster@users.noreply.github.com>
Copilot AI changed the title [WIP] Update io.github.kdroidfilter:composewebview to alpha-13 Fix desktop build break after composewebview bump to 1.0.0-alpha-13 Mar 9, 2026
… suspend cookie manager

Co-authored-by: Tlaster <8370277+Tlaster@users.noreply.github.com>
Copilot AI changed the title Fix desktop build break after composewebview bump to 1.0.0-alpha-13 Fix Windows cookie crash after composewebview alpha-13 bump Mar 9, 2026
@Tlaster Tlaster marked this pull request as ready for review March 9, 2026 08:17
@Tlaster Tlaster merged commit 65f6999 into dependabot/gradle/io.github.kdroidfilter-composewebview-1.0.0-alpha-13 Mar 9, 2026
1 check passed
@Tlaster Tlaster deleted the copilot/sub-pr-1851 branch March 9, 2026 08:17
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.

2 participants