From 43952508ebd93008a08db4a7aa0dea86a541cf14 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Sat, 7 Jan 2012 19:58:52 -0400 Subject: [PATCH] JS backend compilation fix + warnings fixes --- .../formhistory/formhistory-js-frontend.c | 7 +++++-- extensions/formhistory/formhistory.c | 18 +++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/extensions/formhistory/formhistory-js-frontend.c b/extensions/formhistory/formhistory-js-frontend.c index 067f1e37..c1c85ead 100644 --- a/extensions/formhistory/formhistory-js-frontend.c +++ b/extensions/formhistory/formhistory-js-frontend.c @@ -84,6 +84,9 @@ formhistory_setup_suggestions (WebKitWebView* web_view, FormHistoryPriv* priv; static sqlite3_stmt* stmt; const char* sqlcmd; + const unsigned char* key; + const unsigned char* value; + gint result, pos; priv = g_object_get_data (G_OBJECT (extension), "priv"); @@ -111,8 +114,8 @@ formhistory_setup_suggestions (WebKitWebView* web_view, while (result == SQLITE_ROW) { pos++; - const unsigned char* value = sqlite3_column_text (stmt, 0); - const unsigned char* key = sqlite3_column_text (stmt, 1); + value = sqlite3_column_text (stmt, 0); + key = sqlite3_column_text (stmt, 1); if (value) { g_string_append_printf (suggestions, " arr[\"%s\"] = [\"%s\"]; ", diff --git a/extensions/formhistory/formhistory.c b/extensions/formhistory/formhistory.c index b1f71cbe..b0f165dc 100644 --- a/extensions/formhistory/formhistory.c +++ b/extensions/formhistory/formhistory.c @@ -52,6 +52,10 @@ formhistory_navigation_decision_cb (WebKitWebView* web_view, WebKitWebPolicyDecision* decision, MidoriExtension* extension) { + FormHistoryPriv* priv; + JSContextRef js_context; + gchar* value; + /* The script returns form data in the form "field_name|,|value|,|field_type". We are handling only input fields with 'text' or 'password' type. The field separator is "|||" */ @@ -75,9 +79,9 @@ formhistory_navigation_decision_cb (WebKitWebView* web_view, if (webkit_web_navigation_action_get_reason (action) != WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED) return FALSE; - FormHistoryPriv* priv = g_object_get_data (G_OBJECT (extension), "priv"); - JSContextRef js_context = webkit_web_frame_get_global_context (web_frame); - gchar* value = sokoke_js_script_eval (js_context, script, NULL); + priv = g_object_get_data (G_OBJECT (extension), "priv"); + js_context = webkit_web_frame_get_global_context (web_frame); + value = sokoke_js_script_eval (js_context, script, NULL); formhistory_suggestions_hide_cb (NULL, NULL, priv); if (value && *value) @@ -130,8 +134,6 @@ formhistory_add_tab_cb (MidoriBrowser* browser, MidoriView* view, MidoriExtension* extension) { - g_return_if_fail (MIDORI_IS_VIEW (view)); - g_return_if_fail (MIDORI_IS_EXTENSION (extension)); GtkWidget* web_view = midori_view_get_web_view (view); g_signal_connect (web_view, "window-object-cleared", @@ -144,7 +146,6 @@ static void formhistory_add_tab_foreach_cb (MidoriView* view, MidoriExtension* extension) { - g_return_if_fail (MIDORI_IS_VIEW (view)); formhistory_add_tab_cb (NULL, view, extension); } @@ -153,9 +154,6 @@ formhistory_app_add_browser_cb (MidoriApp* app, MidoriBrowser* browser, MidoriExtension* extension) { - g_return_if_fail (MIDORI_IS_APP (app)); - g_return_if_fail (MIDORI_IS_BROWSER (browser)); - g_return_if_fail (MIDORI_IS_EXTENSION (extension)); GtkAccelGroup* acg = gtk_accel_group_new (); GtkActionGroup* action_group = midori_browser_get_action_group (browser); @@ -188,8 +186,6 @@ static void formhistory_deactivate_tab (MidoriView* view, MidoriExtension* extension) { - g_return_if_fail (MIDORI_IS_VIEW (view)); - g_return_if_fail (MIDORI_IS_EXTENSION (extension)); GtkWidget* web_view = midori_view_get_web_view (view); g_signal_handlers_disconnect_by_func ( -- 2.39.5