From bd078ed1dd34040991ab08ce306091c7bf589e6c Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 27 Dec 2009 16:54:34 +0100 Subject: [PATCH] Print error on console if script execution failed --- midori/sokoke.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index 643848ce..d46de804 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -80,16 +80,23 @@ sokoke_js_script_eval (JSContextRef js_context, JSValueRef js_exception = NULL; JSValueRef js_value = JSEvaluateScript (js_context, js_script, JSContextGetGlobalObject (js_context), NULL, 0, &js_exception); - if (!js_value && exception) + JSStringRelease (js_script); + + if (!js_value) { JSStringRef js_message = JSValueToStringCopy (js_context, js_exception, NULL); + value = sokoke_js_string_utf8 (js_message); if (exception) - *exception = sokoke_js_string_utf8 (js_message); + *exception = value; + else + { + g_warning ("%s", value); + g_free (value); + } JSStringRelease (js_message); - js_value = JSValueMakeNull (js_context); + return NULL; } - JSStringRelease (js_script); js_value_string = JSValueToStringCopy (js_context, js_value, NULL); value = sokoke_js_string_utf8 (js_value_string); -- 2.39.5