summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-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
}
/**