[evolution/wip-webkit2] EWebView - Registering URI scheme more than once is fatal for WK2.



commit f20c9672accd2158b2a9c37e10947cddc5c4ab80
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Nov 8 14:30:26 2013 +0100

    EWebView - Registering URI scheme more than once is fatal for WK2.
    
    As it is probably WK2 bug, we have to temporary avoid it by remembering
    what URIs are already registered.

 e-util/e-web-view.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index ef67ef5..d79dfeb 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -1760,7 +1760,13 @@ e_web_view_register_uri_scheme (EWebView *web_view,
        gpointer callback = NULL;
        const gchar *uri_scheme;
 
-       context = webkit_web_view_get_context (WEBKIT_WEB_VIEW (web_view));
+       static GHashTable *hash_table = NULL;
+
+       if (!hash_table)
+               hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
+
+       context = webkit_web_context_get_default ();
+
        callback = user_callback;
 
        switch (scheme) {
@@ -1770,7 +1776,7 @@ e_web_view_register_uri_scheme (EWebView *web_view,
                                callback = web_view_cid_uri_scheme_appeared_cb;
                        break;
                case FILE_URI_SCHEME:
-                       uri_scheme = "file";
+                       uri_scheme = "evo-file";
                        if (!callback)
                                callback = web_view_file_uri_scheme_appeared_cb;
                        break;
@@ -1798,6 +1804,11 @@ e_web_view_register_uri_scheme (EWebView *web_view,
                        return;
        }
 
+       if (g_hash_table_lookup (hash_table, uri_scheme))
+               return;
+
+       g_hash_table_insert (hash_table, (gpointer) uri_scheme, callback);
+
        webkit_web_context_register_uri_scheme (
                context,
                uri_scheme,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]