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

christian at webkit.org christian at webkit.org
Thu Apr 8 00:38:54 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 573d868ab90c571a6388ccb2e02a5922a6c1d444
Author: christian at webkit.org <christian at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 16 21:15:34 2009 +0000

    2009-12-16  Christian Dywan  <christian at twotoasts.de>
    
            Reviewed by Gustavo Noronha Silva.
    
            Deprecate the old loading signals load-started, load-committed,
            load-finished, load-progress-changed and change unit tests to use
            load-status instead.
    
            * tests/testmimehandling.c:
            (idle_quit_loop_cb):
            (test_mime_type): use notify::load-status
            * tests/testwebdatasource.c:
            (notify_load_status_unreachable_cb):
            (notify_load_status_cb):
            (test_webkit_web_data_source):
            (test_webkit_web_data_source_unreachable_uri): Remove uses of
            g_main_loop_is_running. It's an error if the loop is wrongly terminated.
            * tests/testwebresource.c:
            (notify_load_status_cb):
            (test_web_resource_loading):
            (notify_load_status_sub_cb):
            (test_web_resource_sub_resource_loading): use notify::load-status
            * tests/testwebview.c:
            (idle_quit_loop_cb):
            (test_webkit_web_view_icon_uri):
            * tests/testwindow.c:
            (notify_load_status_cb):
            (test_webkit_window_scrollbar_policy): use notify::load-status
            * webkit/webkitwebframe.cpp:
            (webkit_web_frame_class_init):
            * webkit/webkitwebview.cpp:
            (webkit_web_view_class_init): Deprecate old load signals.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52215 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index e66cf0e..cf13c7f 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -13,6 +13,39 @@
 
         Reviewed by Gustavo Noronha Silva.
 
+        Deprecate the old loading signals load-started, load-committed,
+        load-finished, load-progress-changed and change unit tests to use
+        load-status instead.
+
+        * tests/testmimehandling.c:
+        (idle_quit_loop_cb):
+        (test_mime_type): use notify::load-status
+        * tests/testwebdatasource.c:
+        (notify_load_status_unreachable_cb):
+        (notify_load_status_cb):
+        (test_webkit_web_data_source):
+        (test_webkit_web_data_source_unreachable_uri): Remove uses of
+        g_main_loop_is_running. It's an error if the loop is wrongly terminated.
+        * tests/testwebresource.c:
+        (notify_load_status_cb):
+        (test_web_resource_loading):
+        (notify_load_status_sub_cb):
+        (test_web_resource_sub_resource_loading): use notify::load-status
+        * tests/testwebview.c:
+        (idle_quit_loop_cb):
+        (test_webkit_web_view_icon_uri):
+        * tests/testwindow.c:
+        (notify_load_status_cb):
+        (test_webkit_window_scrollbar_policy): use notify::load-status
+        * webkit/webkitwebframe.cpp:
+        (webkit_web_frame_class_init):
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_class_init): Deprecate old load signals.
+
+2009-12-16  Christian Dywan  <christian at twotoasts.de>
+
+        Reviewed by Gustavo Noronha Silva.
+
         Take into account favicon.ico in the webresource test.
 
         * tests/testwebresource.c:
diff --git a/WebKit/gtk/tests/testmimehandling.c b/WebKit/gtk/tests/testmimehandling.c
index e68dcdf..5887348 100644
--- a/WebKit/gtk/tests/testmimehandling.c
+++ b/WebKit/gtk/tests/testmimehandling.c
@@ -87,10 +87,11 @@ server_callback(SoupServer *server, SoupMessage *msg,
     soup_message_body_complete(msg->response_body);
 }
 
-static gboolean idle_quit_loop_cb(gpointer data)
+static void idle_quit_loop_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
 {
-    g_main_loop_quit(loop);
-    return FALSE;
+    if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED ||
+        webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FAILED)
+        g_main_loop_quit(loop);
 }
 
 static gboolean mime_type_policy_decision_requested_cb(WebKitWebView* view, WebKitWebFrame* frame,
@@ -138,7 +139,7 @@ static void test_mime_type(const char* name)
     loop = g_main_loop_new(NULL, TRUE);
 
     g_object_connect(G_OBJECT(view),
-                     "signal::load-finished", idle_quit_loop_cb, NULL,
+                     "signal::notify::load-status", idle_quit_loop_cb, NULL,
                      "signal::mime-type-policy-decision-requested", mime_type_policy_decision_requested_cb, g_strdup(name),
                      NULL);
 
diff --git a/WebKit/gtk/tests/testwebdatasource.c b/WebKit/gtk/tests/testwebdatasource.c
index fe5c62f..5c0568e 100644
--- a/WebKit/gtk/tests/testwebdatasource.c
+++ b/WebKit/gtk/tests/testwebdatasource.c
@@ -55,35 +55,45 @@ static void test_webkit_web_data_source_get_initial_request()
     g_object_unref(view);
 }
 
-static void load_finished_unreachable_cb(WebKitWebView* view, WebKitWebFrame* frame, GMainLoop* loop)
+static void notify_load_status_unreachable_cb(WebKitWebView* view, GParamSpec* pspec, GMainLoop* loop)
 {
+    WebKitLoadStatus status = webkit_web_view_get_load_status (view);
+    WebKitWebFrame* frame = webkit_web_view_get_main_frame(view);
+
+    if (status != WEBKIT_LOAD_FINISHED)
+        return;
+
     if (waitTimer) {
         g_source_remove(waitTimer);
         waitTimer = 0;
     }
 
-    WebKitWebDataSource* datasource;
-    frame = webkit_web_view_get_main_frame(view);
-    datasource = webkit_web_frame_get_data_source(frame);
+    WebKitWebDataSource* datasource = webkit_web_frame_get_data_source(frame);
 
     g_assert_cmpstr("http://this.host.does.not.exist/doireallyexist.html", ==,
                     webkit_web_data_source_get_unreachable_uri(datasource));
 
-    if (g_main_loop_is_running(loop))
-        g_main_loop_quit(loop);
+    g_main_loop_quit(loop);
 }
 
-static void load_finished_cb(WebKitWebView* view, WebKitWebFrame* frame, GMainLoop* loop)
+static void notify_load_status_cb(WebKitWebView* view, GParamSpec* pspec, GMainLoop* loop)
 {
+    WebKitLoadStatus status = webkit_web_view_get_load_status (view);
+    WebKitWebFrame* frame = webkit_web_view_get_main_frame(view);
+    WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(frame);
+
+    if (status == WEBKIT_LOAD_COMMITTED) {
+        g_assert(webkit_web_data_source_is_loading(dataSource));
+        return;
+    }
+    else if (status != WEBKIT_LOAD_FINISHED)
+        return;
+
     if (waitTimer) {
         g_source_remove(waitTimer);
         waitTimer = 0;
     }
 
-    WebKitWebDataSource* dataSource;
-    frame = webkit_web_view_get_main_frame(view);
-    dataSource = webkit_web_frame_get_data_source(frame);
-
     /* Test get_request */
     g_test_message("Testing webkit_web_data_source_get_request");
     WebKitNetworkRequest* request = webkit_web_data_source_get_request(dataSource);
@@ -102,21 +112,13 @@ static void load_finished_cb(WebKitWebView* view, WebKitWebFrame* frame, GMainLo
 
     /* FIXME: Add test for get_encoding */
 
-    if (g_main_loop_is_running(loop))
-        g_main_loop_quit(loop);
-}
-
-static void load_committed_cb(WebKitWebView* view, WebKitWebFrame* frame)
-{
-    WebKitWebDataSource* dataSource = webkit_web_frame_get_data_source(frame);
-    g_assert(webkit_web_data_source_is_loading(dataSource));
+    g_main_loop_quit(loop);
 }
 
 static gboolean wait_timer_fired(GMainLoop* loop)
 {
     waitTimer = 0;
-    if (g_main_loop_is_running(loop))
-        g_main_loop_quit(loop);
+    g_main_loop_quit(loop);
 
     return FALSE;
 }
@@ -129,8 +131,7 @@ static void test_webkit_web_data_source()
     view = WEBKIT_WEB_VIEW(webkit_web_view_new());
     g_object_ref_sink(view);
     loop = g_main_loop_new(NULL, TRUE);
-    g_signal_connect(view, "load-committed", G_CALLBACK(load_committed_cb), loop);
-    g_signal_connect(view, "load-finished", G_CALLBACK(load_finished_cb), loop);
+    g_signal_connect(view, "notify::load-status", G_CALLBACK(notify_load_status_cb), loop);
     webkit_web_view_load_uri(view, "http://webkit.org");
 
     if (!waitTimer)
@@ -148,7 +149,7 @@ static void test_webkit_web_data_source_unreachable_uri()
     view = WEBKIT_WEB_VIEW(webkit_web_view_new());
     g_object_ref_sink(view);
     loop = g_main_loop_new(NULL, TRUE);
-    g_signal_connect(view, "load-finished", G_CALLBACK(load_finished_unreachable_cb), loop);
+    g_signal_connect(view, "notify::load-status", G_CALLBACK(notify_load_status_unreachable_cb), loop);
     webkit_web_view_load_uri(view, "http://this.host.does.not.exist/doireallyexist.html");
 
     if (!waitTimer)
diff --git a/WebKit/gtk/tests/testwebresource.c b/WebKit/gtk/tests/testwebresource.c
index e134281..81457a4 100644
--- a/WebKit/gtk/tests/testwebresource.c
+++ b/WebKit/gtk/tests/testwebresource.c
@@ -163,14 +163,16 @@ static void resource_request_starting_cb(WebKitWebView* web_view, WebKitWebFrame
     }
 }
 
-static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data)
+static void notify_load_status_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
 {
-    gboolean* been_there = data;
-    *been_there = TRUE;
+    if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED) {
+        gboolean* been_there = data;
+        *been_there = TRUE;
 
-    g_assert_cmpstr(webkit_web_view_get_uri(web_view), ==, "about:blank");
+        g_assert_cmpstr(webkit_web_view_get_uri(web_view), ==, "about:blank");
 
-    g_main_loop_quit(loop);
+        g_main_loop_quit(loop);
+    }
 }
 
 static void test_web_resource_loading()
@@ -189,8 +191,8 @@ static void test_web_resource_loading()
                      G_CALLBACK(resource_request_starting_cb),
                      &been_to_resource_request_starting);
 
-    g_signal_connect(web_view, "load-finished",
-                     G_CALLBACK(load_finished_cb),
+    g_signal_connect(web_view, "notify::load-status",
+                     G_CALLBACK(notify_load_status_cb),
                      &been_to_load_finished);
 
     webkit_web_view_load_uri(web_view, base_uri);
@@ -220,9 +222,10 @@ static void resource_request_starting_sub_cb(WebKitWebView* web_view, WebKitWebF
         sub_resource = g_object_ref(web_resource);
 }
 
-static void load_finished_sub_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data)
+static void notify_load_status_sub_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
 {
-    g_main_loop_quit(loop);
+    if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED)
+        g_main_loop_quit(loop);
 }
 
 static gboolean idle_quit_loop_cb(gpointer data)
@@ -249,8 +252,8 @@ static void test_web_resource_sub_resource_loading()
                      G_CALLBACK(resource_request_starting_sub_cb),
                      NULL);
 
-    g_signal_connect(web_view, "load-finished",
-                     G_CALLBACK(load_finished_sub_cb),
+    g_signal_connect(web_view, "notify::load-status",
+                     G_CALLBACK(notify_load_status_sub_cb),
                      NULL);
 
     webkit_web_view_load_uri(web_view, uri);
diff --git a/WebKit/gtk/tests/testwebview.c b/WebKit/gtk/tests/testwebview.c
index e0921c0..6a1c5ec 100644
--- a/WebKit/gtk/tests/testwebview.c
+++ b/WebKit/gtk/tests/testwebview.c
@@ -63,10 +63,11 @@ server_callback(SoupServer* server, SoupMessage* msg,
     soup_message_body_complete(msg->response_body);
 }
 
-static gboolean idle_quit_loop_cb(gpointer data)
+static void idle_quit_loop_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
 {
-    g_main_loop_quit(loop);
-    return FALSE;
+    if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED ||
+        webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FAILED)
+        g_main_loop_quit(loop);
 }
 
 static void icon_uri_changed_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
@@ -105,7 +106,7 @@ static void test_webkit_web_view_icon_uri()
     loop = g_main_loop_new(NULL, TRUE);
 
     g_object_connect(G_OBJECT(view),
-                     "signal::load-finished", idle_quit_loop_cb, NULL,
+                     "signal::notify::progress", idle_quit_loop_cb, NULL,
                      "signal::notify::icon-uri", icon_uri_changed_cb, &been_to_uri_changed,
                      "signal::icon-loaded", icon_loaded_cb, &been_to_icon_loaded,
                      NULL);
diff --git a/WebKit/gtk/tests/testwindow.c b/WebKit/gtk/tests/testwindow.c
index 41ff323..106f934 100644
--- a/WebKit/gtk/tests/testwindow.c
+++ b/WebKit/gtk/tests/testwindow.c
@@ -22,11 +22,13 @@
 
 #if GLIB_CHECK_VERSION(2, 16, 0) && GTK_CHECK_VERSION(2, 14, 0)
 
-static void load_finished_cb(WebKitWebView* web_view, WebKitWebFrame* web_frame, gpointer data)
+static void notify_load_status_cb(WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
 {
-    GMainLoop* loop = (GMainLoop*)data;
+    if (webkit_web_view_get_load_status(web_view) == WEBKIT_LOAD_FINISHED) {
+        GMainLoop* loop = (GMainLoop*)data;
 
-    g_main_loop_quit(loop);
+        g_main_loop_quit(loop);
+    }
 }
 
 static void test_webkit_window_scrollbar_policy(void)
@@ -47,8 +49,8 @@ static void test_webkit_window_scrollbar_policy(void)
     webView = webkit_web_view_new();
     g_object_ref_sink(webView);
 
-    g_signal_connect(webView, "load-finished",
-                     G_CALLBACK(load_finished_cb), loop);
+    g_signal_connect(webView, "notify::load-status",
+                     G_CALLBACK(notify_load_status_cb), loop);
 
     gtk_container_add(GTK_CONTAINER(scrolledWindow), webView);
 
diff --git a/WebKit/gtk/webkit/webkitwebframe.cpp b/WebKit/gtk/webkit/webkitwebframe.cpp
index f3e74a7..0abfe7a 100644
--- a/WebKit/gtk/webkit/webkitwebframe.cpp
+++ b/WebKit/gtk/webkit/webkitwebframe.cpp
@@ -184,6 +184,14 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
             g_cclosure_marshal_VOID__VOID,
             G_TYPE_NONE, 0);
 
+    /**
+     * WebKitWebFrame::load-done
+     * @web_frame: the object on which the signal is emitted
+     *
+     * Emitted when frame loading is done.
+     *
+     * Deprecated: Use the "load-status" property instead.
+     */
     webkit_web_frame_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
             G_TYPE_FROM_CLASS(frameClass),
             (GSignalFlags)G_SIGNAL_RUN_LAST,
@@ -199,7 +207,7 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
      *
      * Emitted when frame loading is done.
      *
-     * Deprecated: Use WebKitWebView::load-finished instead, and/or
+     * Deprecated: Use the "load-status" property instead, and/or
      * WebKitWebView::load-error to be notified of load errors
      */
     webkit_web_frame_signals[LOAD_DONE] = g_signal_new("load-done",
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 790d088..3350999 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -1578,6 +1578,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
      * @frame: the frame going to do the load
      *
      * When a #WebKitWebFrame begins to load this signal is emitted.
+     *
+     * Deprecated: Use the "load-status" property instead.
      */
     webkit_web_view_signals[LOAD_STARTED] = g_signal_new("load-started",
             G_TYPE_FROM_CLASS(webViewClass),
@@ -1595,6 +1597,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
      * @frame: the main frame that received the first data
      *
      * When a #WebKitWebFrame loaded the first data this signal is emitted.
+     *
+     * Deprecated: Use the "load-status" property instead.
      */
     webkit_web_view_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
             G_TYPE_FROM_CLASS(webViewClass),
@@ -1611,6 +1615,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
      * WebKitWebView::load-progress-changed:
      * @web_view: the #WebKitWebView
      * @progress: the global progress
+     *
+     * Deprecated: Use the "progress" property instead.
      */
     webkit_web_view_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load-progress-changed",
             G_TYPE_FROM_CLASS(webViewClass),
@@ -1647,6 +1653,13 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
             G_TYPE_STRING,
             G_TYPE_POINTER);
 
+    /**
+     * WebKitWebView::load-finished:
+     * @web_view: the #WebKitWebView
+     * @frame: the #WebKitWebFrame
+     *
+     * Deprecated: Use the "load-status" property instead.
+     */
     webkit_web_view_signals[LOAD_FINISHED] = g_signal_new("load-finished",
             G_TYPE_FROM_CLASS(webViewClass),
             (GSignalFlags)G_SIGNAL_RUN_LAST,
@@ -2389,6 +2402,8 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
     *
     * Determines the current status of the load.
     *
+    * Connect to "notify::load-status" to monitor loading.
+    *
     * Since: 1.1.7
     */
     g_object_class_install_property(objectClass, PROP_LOAD_STATUS,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list