[libgepub] Use new JavaScriptCore GLib API instead of DOM API
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgepub] Use new JavaScriptCore GLib API instead of DOM API
- Date: Mon, 8 Apr 2019 06:41:42 +0000 (UTC)
commit 7d4bb8821d03e9bc3b7bbaa0120f719a8d7b8dcd
Author: Eddy Castillo <dyskette gmail com>
Date: Wed Apr 3 23:40:37 2019 -0600
Use new JavaScriptCore GLib API instead of DOM API
libgepub/gepub-widget.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/libgepub/gepub-widget.c b/libgepub/gepub-widget.c
index 41b9986..f6d5003 100644
--- a/libgepub/gepub-widget.c
+++ b/libgepub/gepub-widget.c
@@ -89,8 +89,7 @@ pagination_initialize_finished (GObject *object,
gpointer user_data)
{
WebKitJavascriptResult *js_result;
- JSValueRef value;
- JSGlobalContextRef context;
+ JSCValue *value;
GError *error = NULL;
GepubWidget *widget = GEPUB_WIDGET (user_data);
@@ -101,12 +100,11 @@ pagination_initialize_finished (GObject *object,
return;
}
- context = webkit_javascript_result_get_global_context (js_result);
- value = webkit_javascript_result_get_value (js_result);
- if (JSValueIsNumber (context, value)) {
+ value = webkit_javascript_result_get_js_value (js_result);
+ if (jsc_value_is_number (value)) {
double n;
- n = JSValueToNumber (context, value, NULL);
+ n = jsc_value_to_double (value);
widget->chapter_length = (int)n;
if (widget->init_chapter_pos) {
@@ -132,8 +130,7 @@ get_length_finished (GObject *object,
gpointer user_data)
{
WebKitJavascriptResult *js_result;
- JSValueRef value;
- JSGlobalContextRef context;
+ JSCValue *value;
GError *error = NULL;
GepubWidget *widget = GEPUB_WIDGET (user_data);
@@ -144,12 +141,11 @@ get_length_finished (GObject *object,
return;
}
- context = webkit_javascript_result_get_global_context (js_result);
- value = webkit_javascript_result_get_value (js_result);
- if (JSValueIsNumber (context, value)) {
+ value = webkit_javascript_result_get_js_value (js_result);
+ if (jsc_value_is_number (value)) {
double n;
- n = JSValueToNumber (context, value, NULL);
+ n = jsc_value_to_double (value);
widget->length = (int)n;
} else {
g_warning ("Error running javascript: unexpected return value");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]