From e97a198e980bdac81747cbff8ca72cc836ba013c Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 11 Oct 2009 23:28:37 +0200 Subject: [PATCH] Cache scriptcode generated by adblock instead of generating on load --- extensions/adblock.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/adblock.c b/extensions/adblock.c index 67deed61..5ffc3c5c 100644 --- a/extensions/adblock.c +++ b/extensions/adblock.c @@ -24,6 +24,7 @@ static GHashTable* pattern; static gchar* blockcss = NULL; +static gchar* blockscript = NULL; static void adblock_parse_file (gchar* path); @@ -423,8 +424,7 @@ adblock_window_object_cleared_cb (GtkWidget* web_view, JSContextRef js_context, JSObjectRef js_window) { - webkit_web_view_execute_script (WEBKIT_WEB_VIEW (web_view), - adblock_build_js (blockcss)); + webkit_web_view_execute_script (WEBKIT_WEB_VIEW (web_view), blockscript); } static void @@ -432,11 +432,10 @@ adblock_add_tab_cb (MidoriBrowser* browser, MidoriView* view) { GtkWidget* web_view = gtk_bin_get_child (GTK_BIN (view)); - if (blockcss && *blockcss) - g_signal_connect (web_view, "window-object-cleared", - G_CALLBACK (adblock_window_object_cleared_cb), 0); + g_signal_connect (web_view, "window-object-cleared", + G_CALLBACK (adblock_window_object_cleared_cb), 0); g_signal_connect (web_view, "resource-request-starting", - G_CALLBACK (adblock_resource_request_starting_cb), view); + G_CALLBACK (adblock_resource_request_starting_cb), view); } static void @@ -541,6 +540,7 @@ adblock_parse_file (gchar* path) else g_hash_table_insert (pattern, parsed, regex); } + katze_assign (blockscript, adblock_build_js (blockcss)); fclose (file); } } -- 2.39.5