Clear JSCContext exceptions after the call
The JSCContext keeps exceptions between multiple calls, thus when one call fails the consecutive calls would reuse the previous exception until it is explicitly cleared, even though the following call succeeded without any issue.
This commit is contained in:
@ -279,8 +279,10 @@ ewv_jsc_call_done_cb (GObject *source,
|
||||
value = webkit_javascript_result_get_js_value (js_result);
|
||||
exception = jsc_context_get_exception (jsc_value_get_context (value));
|
||||
|
||||
if (exception)
|
||||
if (exception) {
|
||||
g_warning ("Failed to call '%s': %s", script, jsc_exception_get_message (exception));
|
||||
jsc_context_clear_exception (jsc_value_get_context (value));
|
||||
}
|
||||
|
||||
webkit_javascript_result_unref (js_result);
|
||||
}
|
||||
@ -513,6 +515,7 @@ ewv_jsc_get_content_finish (WebKitWebView *web_view,
|
||||
|
||||
if (exception) {
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Call failed: %s", jsc_exception_get_message (exception));
|
||||
jsc_context_clear_exception (jsc_value_get_context (value));
|
||||
webkit_javascript_result_unref (js_result);
|
||||
return FALSE;
|
||||
}
|
||||
@ -689,6 +692,7 @@ e_web_view_jsc_get_element_from_point_finish (WebKitWebView *web_view,
|
||||
|
||||
if (exception) {
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Call failed: %s", jsc_exception_get_message (exception));
|
||||
jsc_context_clear_exception (jsc_value_get_context (value));
|
||||
webkit_javascript_result_unref (js_result);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -238,8 +238,10 @@ test_utils_jsc_call_done_cb (GObject *source_object,
|
||||
value = webkit_javascript_result_get_js_value (js_result);
|
||||
exception = jsc_context_get_exception (jsc_value_get_context (value));
|
||||
|
||||
if (exception)
|
||||
if (exception) {
|
||||
g_warning ("Failed to call '%s': %s", script, jsc_exception_get_message (exception));
|
||||
jsc_context_clear_exception (jsc_value_get_context (value));
|
||||
}
|
||||
|
||||
webkit_javascript_result_unref (js_result);
|
||||
}
|
||||
@ -282,10 +284,12 @@ test_utils_jsc_call_sync_done_cb (GObject *source_object,
|
||||
value = webkit_javascript_result_get_js_value (js_result);
|
||||
exception = jsc_context_get_exception (jsc_value_get_context (value));
|
||||
|
||||
if (exception)
|
||||
if (exception) {
|
||||
g_warning ("Failed to call '%s': %s", jcd->script, jsc_exception_get_message (exception));
|
||||
else if (jcd->out_result)
|
||||
jsc_context_clear_exception (jsc_value_get_context (value));
|
||||
} else if (jcd->out_result) {
|
||||
*(jcd->out_result) = value ? g_object_ref (value) : NULL;
|
||||
}
|
||||
|
||||
webkit_javascript_result_unref (js_result);
|
||||
}
|
||||
|
||||
@ -885,8 +885,10 @@ itip_view_get_state_cb (GObject *source_object,
|
||||
value = webkit_javascript_result_get_js_value (js_result);
|
||||
exception = jsc_context_get_exception (jsc_value_get_context (value));
|
||||
|
||||
if (exception)
|
||||
if (exception) {
|
||||
g_warning ("Failed to call 'ItipView.GetState()': %s", jsc_exception_get_message (exception));
|
||||
jsc_context_clear_exception (jsc_value_get_context (value));
|
||||
}
|
||||
|
||||
view->priv->state_rsvp_comment = e_web_view_jsc_get_object_property_string (value, "rsvp-comment", NULL);
|
||||
view->priv->state_rsvp_check = e_web_view_jsc_get_object_property_boolean (value, "rsvp-check", FALSE);
|
||||
|
||||
@ -173,6 +173,8 @@ load_javascript_file (JSCContext *jsc_context,
|
||||
jsc_exception_get_line_number (exception),
|
||||
jsc_exception_get_column_number (exception),
|
||||
jsc_exception_get_message (exception));
|
||||
|
||||
jsc_context_clear_exception (jsc_context);
|
||||
}
|
||||
|
||||
g_clear_object (&result);
|
||||
|
||||
Reference in New Issue
Block a user