Skip to content

Commit

Permalink
[linux] remove deprecated version of webkit callback handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tmclane committed Nov 9, 2023
1 parent 412c3a5 commit 6f197f6
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions v3/pkg/application/linux_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,24 +1115,10 @@ func sendMessageToBackend(contentManager *C.WebKitUserContentManager, result *C.
data unsafe.Pointer) {

var msg string
if C.webkit_get_major_version() >= 2 &&
C.webkit_get_minor_version() >= 22 {
value := C.webkit_javascript_result_get_js_value(result)
message := C.jsc_value_to_string(value)
msg = C.GoString(message)
defer C.g_free(C.gpointer(message))
} else {
// FIXME: This isn't very nice. Should use build tags
context := C.webkit_javascript_result_get_global_context(result)
value := C.webkit_javascript_result_get_value(result)
js := C.JSValueToStringCopy(context, value, nil)
messageSize := C.JSStringGetMaximumUTF8CStringSize(js)
message := (*C.char)(C.g_malloc(messageSize))
C.JSStringGetUTF8CString(js, message, messageSize)
msg = C.GoString(message)
C.JSStringRelease(js)
}

value := C.webkit_javascript_result_get_js_value(result)
message := C.jsc_value_to_string(value)
msg = C.GoString(message)
defer C.g_free(C.gpointer(message))
windowMessageBuffer <- &windowMessage{
windowId: uint(windowID),
message: msg,
Expand Down

0 comments on commit 6f197f6

Please sign in to comment.