summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2022-12-21 14:58:55 +0100
committerRafael Marçalo <raroma09@gmail.com>2023-01-03 15:08:45 +0000
commite3d87e8e0c703369226947a91ce0cd1fe1ef26d1 (patch)
tree535952d5566db316878e733b63797fc8ea8a4067
parent9190b2a455ffa6f95d9396bb699b2aaa67b08e64 (diff)
util.c: Convert deprecated use of JSValueRef
The JSValueRef interface has been deprecated in WebKit 2.22.0. Convert the code to use the modern `JSCValue` interface instead.
-rw-r--r--src/util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index e5d7195..2f07981 100644
--- a/src/util.c
+++ b/src/util.c
@@ -635,6 +635,13 @@ gboolean util_filename_fill_completion(GtkListStore *store, const char *input)
*/
char *util_js_result_as_string(WebKitJavascriptResult *result)
{
+#if WEBKIT_CHECK_VERSION(2, 22, 0)
+ JSCValue *value;
+
+ value = webkit_javascript_result_get_js_value(result);
+
+ return jsc_value_to_string(value);
+#else
JSValueRef value;
JSStringRef string;
size_t len;
@@ -652,14 +659,23 @@ char *util_js_result_as_string(WebKitJavascriptResult *result)
JSStringRelease(string);
return retval;
+#endif
}
double util_js_result_as_number(WebKitJavascriptResult *result)
{
+#if WEBKIT_CHECK_VERSION(2, 22, 0)
+ JSCValue *value;
+
+ value = webkit_javascript_result_get_js_value(result);
+
+ return jsc_value_to_double(value);
+#else
JSValueRef value = webkit_javascript_result_get_value(result);
return JSValueToNumber(webkit_javascript_result_get_global_context(result), value,
NULL);
+#endif
}
/**