Skip to content

Commit 610aae6

Browse files
committed
Don't run evaluateJavascript inside the webView.post callback
Calling WebView#post requires the WebView to be attached to the window making it impossible to use AndroidWebView in headless mode (without UI). The caller should use an appropriate thread to call evaluateJavaScript on.
1 parent 4f5df17 commit 610aae6

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

webview/src/androidMain/kotlin/com/multiplatform/webview/web/AndroidWebView.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ class AndroidWebView(
105105
KLogger.d {
106106
"evaluateJavaScript: $androidScript"
107107
}
108-
webView.post {
109-
webView.evaluateJavascript(androidScript, callback)
110-
}
108+
webView.evaluateJavascript(androidScript, callback)
111109
}
112110

113111
override fun injectJsBridge() {

0 commit comments

Comments
 (0)