You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WryCookieManager.getCookies always throw WrongThread exception on Windows. #25
Remove withContext(Dispatchers.IO) from here can resolve the issue. I've tested on my Windows PC.
A workaround is to use WebViewState.nativeWebView.getCookiesForUrl
It requires EDT. So I modified the getCookies to use SwingUtilities.invokeAndWait and it seems to fix the problem on Windows and the demo application actually is successfully get the cookies instead of just returning an emptyList
classWryWebViewPanel(...){
// ... other stufffungetCookiesForUrl(url:String): List<WebViewCookie> {
var result:List<WebViewCookie> = emptyList()
val id = webviewId ?:run {
log("getCookiesForUrl webviewId is null")
return result
}
val action = {
result = runCatching { NativeBindings.getCookiesForUrl(id, url) }
.onFailure { log("getCookiesForUrl failed: ${it.message}"); it.printStackTrace() }
.getOrDefault(emptyList())
}
if (SwingUtilities.isEventDispatchThread()) action() elseSwingUtilities.invokeAndWait(
action
)
return result
}
fungetCookies(): List<WebViewCookie> {
var result:List<WebViewCookie> = emptyList()
val id = webviewId ?:run {
log("getCookies webviewId is null")
return result
}
val action = {
result = runCatching { NativeBindings.getCookies(id) }
.onFailure { log("getCookies failed: ${it.message}"); it.printStackTrace() }
.getOrDefault(emptyList())
}
if (SwingUtilities.isEventDispatchThread()) action() elseSwingUtilities.invokeAndWait(
action
)
return result
}
// ... other stuff
}
Activity
kdroidFilter commentedon Feb 26, 2026
Does #26 fix this?
Tlaster commentedon Feb 26, 2026
No, #26 is a different feature request.
KRTirtho commentedon Apr 30, 2026
It requires EDT. So I modified the
getCookiesto useSwingUtilities.invokeAndWaitand it seems to fix the problem on Windows and the demo application actually is successfully get the cookies instead of just returning anemptyListKRTirtho commentedon Apr 30, 2026
I'll create a PR with the fix soon once I confirm other platforms are also working