[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

Gustavo Noronha Silva gns at gnome.org
Thu Apr 8 02:24:51 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit d761a31dc66f6584b6e926351b5c53dec8291ae0
Author: kov at webkit.org <kov at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Apr 1 16:07:08 2010 +0000

    2010-04-01  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
    
            Reviewed by Holger Freyther.
    
            [GTK] webkit_get_default_session() should make sure webkit_init() is called
            https://bugs.webkit.org/show_bug.cgi?id=36754
    
            Make sure global functions that do not require a WebKitWebView to
            be created call webkit_init() before doing their job. Also add an
            API test to check for that.
    
            * tests/testglobals.c: Added.
            (test_globals_default_session):
            (main):
            * webkit/webkitwebview.cpp:
            (webkit_get_default_session):
            (webkit_set_cache_model):
            (webkit_get_cache_model):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56916 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/ChangeLog b/ChangeLog
index 7f008fa..2bb41da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-04-01  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
+
+        Reviewed by Holger Freyther.
+
+        [GTK] webkit_get_default_session() should make sure webkit_init() is called
+        https://bugs.webkit.org/show_bug.cgi?id=36754
+
+        New API test.
+
+        * GNUmakefile.am:
+
 2010-03-16  Xan Lopez  <xlopez at igalia.com>
 
         Rubber-stamped by Gustavo Noronha.
diff --git a/GNUmakefile.am b/GNUmakefile.am
index 399f7a4..3bdfe53 100644
--- a/GNUmakefile.am
+++ b/GNUmakefile.am
@@ -565,6 +565,7 @@ webkit_tests_ldflags = \
 
 TEST_PROGS += Programs/unittests/testhttpbackend \
 	Programs/unittests/testloading \
+	Programs/unittests/testglobals \
 	Programs/unittests/testmimehandling \
 	Programs/unittests/testnetworkrequest \
 	Programs/unittests/testnetworkresponse \
@@ -587,6 +588,11 @@ Programs_unittests_testhttpbackend_CFLAGS = $(webkit_tests_cflags)
 Programs_unittests_testhttpbackend_LDADD = $(webkit_tests_ldadd)
 Programs_unittests_testhttpbackend_LDFLAGS = $(webkit_tests_ldflags)
 
+Programs_unittests_testglobals_SOURCES = WebKit/gtk/tests/testglobals.c
+Programs_unittests_testglobals_CFLAGS = $(webkit_tests_cflags)
+Programs_unittests_testglobals_LDADD = $(webkit_tests_ldadd)
+Programs_unittests_testglobals_LDFLAGS = $(webkit_tests_ldflags)
+
 Programs_unittests_testloading_SOURCES = WebKit/gtk/tests/testloading.c
 Programs_unittests_testloading_CFLAGS = $(webkit_tests_cflags)
 Programs_unittests_testloading_LDADD = $(webkit_tests_ldadd)
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 7c76716..880cca0 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,22 @@
+2010-04-01  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
+
+        Reviewed by Holger Freyther.
+
+        [GTK] webkit_get_default_session() should make sure webkit_init() is called
+        https://bugs.webkit.org/show_bug.cgi?id=36754
+
+        Make sure global functions that do not require a WebKitWebView to
+        be created call webkit_init() before doing their job. Also add an
+        API test to check for that.
+
+        * tests/testglobals.c: Added.
+        (test_globals_default_session):
+        (main):
+        * webkit/webkitwebview.cpp:
+        (webkit_get_default_session):
+        (webkit_set_cache_model):
+        (webkit_get_cache_model):
+
 2010-03-23  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Reviewed by Holger Freyther.
diff --git a/WebKit/gtk/tests/testglobals.c b/WebKit/gtk/tests/testglobals.c
new file mode 100644
index 0000000..e53edf4
--- /dev/null
+++ b/WebKit/gtk/tests/testglobals.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gtk/gtk.h>
+#include <libsoup/soup.h>
+#include <webkit/webkit.h>
+
+#if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0)
+
+// Make sure the session is initialized properly when webkit_get_default_session() is called.
+static void test_globals_default_session()
+{
+    g_test_bug("36754");
+
+    SoupSession* session = webkit_get_default_session();
+    soup_session_remove_feature_by_type(session, WEBKIT_TYPE_SOUP_AUTH_DIALOG);
+
+    // This makes sure our initialization ran.
+    g_assert(soup_session_get_feature(session, SOUP_TYPE_CONTENT_DECODER) != NULL);
+
+    // Creating a WebView should make sure the session is
+    // initialized, and not mess with our changes.
+    WebKitWebView* web_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
+    g_object_ref_sink(web_view);
+    g_object_unref(web_view);
+
+    // These makes sure our modification was kept.
+    g_assert(soup_session_get_feature(session, SOUP_TYPE_CONTENT_DECODER) != NULL);
+    g_assert(soup_session_get_feature(session, WEBKIT_TYPE_SOUP_AUTH_DIALOG) == NULL);
+}
+
+int main(int argc, char** argv)
+{
+    g_thread_init(NULL);
+    gtk_test_init(&argc, &argv, NULL);
+
+    g_test_bug_base("https://bugs.webkit.org/");
+    g_test_add_func("/webkit/globals/default_session",
+                    test_globals_default_session);
+    return g_test_run();
+}
+
+#else
+int main(int argc, char** argv)
+{
+    g_critical("You will need at least glib-2.16.0 and gtk-2.14.0 to run the unit tests. Doing nothing now.");
+    return 0;
+}
+
+#endif
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index b9fd283..903edba 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -3944,6 +3944,7 @@ void webkit_web_view_set_full_content_zoom(WebKitWebView* webView, gboolean zoom
  */
 SoupSession* webkit_get_default_session ()
 {
+    webkit_init();
     return ResourceHandle::defaultSession();
 }
 
@@ -4359,6 +4360,8 @@ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView)
  */
 void webkit_set_cache_model(WebKitCacheModel model)
 {
+    webkit_init();
+
     if (cacheModel == model)
         return;
 
@@ -4407,5 +4410,6 @@ void webkit_set_cache_model(WebKitCacheModel model)
  */
 WebKitCacheModel webkit_get_cache_model()
 {
+    webkit_init();
     return cacheModel;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list