[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

xan at webkit.org xan at webkit.org
Thu Oct 29 20:33:33 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 0b11106464d3cf0792bcc0da59ad1c848aa274f6
Author: xan at webkit.org <xan at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 24 12:54:14 2009 +0000

    2009-09-24  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by Gustavo Noronha and Jan Alonzo.
            [GTK] Add WEBKIT_LOAD_ERROR status
            https://bugs.webkit.org/show_bug.cgi?id=29644
    
            Add a new load-status enum value, WEBKIT_LOAD_FAILED, emitted when
            there's an error during the load process. This is needed if we
            want notify::load-status to be able to handle all situations,
            since WEBKIT_LOAD_FINISHED is not emitted when there's an error
            and we are lacking a notification of the load being stopped.
    
            * WebCoreSupport/FrameLoaderClientGtk.cpp:
            (WebKit::FrameLoaderClient::dispatchDidFailLoad):
            * tests/testloading.c:
            (web_loading_fixture_setup):
            (load_error_status_changed_cb):
            (load_error_cb):
            (test_loading_error):
            (load_cancelled_cb):
            (stop_load):
            (load_cancelled_status_changed_cb):
            (test_loading_cancelled):
            (main):
            * webkit/webkitwebframe.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48719 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 8414c63..ed38818 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,5 +1,31 @@
 2009-09-24  Xan Lopez  <xlopez at igalia.com>
 
+        Reviewed by Gustavo Noronha and Jan Alonzo.
+        [GTK] Add WEBKIT_LOAD_ERROR status
+        https://bugs.webkit.org/show_bug.cgi?id=29644
+
+        Add a new load-status enum value, WEBKIT_LOAD_FAILED, emitted when
+        there's an error during the load process. This is needed if we
+        want notify::load-status to be able to handle all situations,
+        since WEBKIT_LOAD_FINISHED is not emitted when there's an error
+        and we are lacking a notification of the load being stopped.
+
+        * WebCoreSupport/FrameLoaderClientGtk.cpp:
+        (WebKit::FrameLoaderClient::dispatchDidFailLoad):
+        * tests/testloading.c:
+        (web_loading_fixture_setup):
+        (load_error_status_changed_cb):
+        (load_error_cb):
+        (test_loading_error):
+        (load_cancelled_cb):
+        (stop_load):
+        (load_cancelled_status_changed_cb):
+        (test_loading_cancelled):
+        (main):
+        * webkit/webkitwebframe.h:
+
+2009-09-24  Xan Lopez  <xlopez at igalia.com>
+
         Revert r48697, since it broke key handling notification to GTK+.
 
         * WebCoreSupport/EditorClientGtk.cpp:
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index eb42dd9..29ee09e 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -894,6 +894,8 @@ void FrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& erro
 
 void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
 {
+    notifyStatus(m_frame, WEBKIT_LOAD_FAILED);
+
     WebKitWebView* webView = getViewFromFrame(m_frame);
     GError* webError = g_error_new_literal(g_quark_from_string(error.domain().utf8().data()),
                                            error.errorCode(),
diff --git a/WebKit/gtk/tests/testloading.c b/WebKit/gtk/tests/testloading.c
index 291cbfb..c1f0fac 100644
--- a/WebKit/gtk/tests/testloading.c
+++ b/WebKit/gtk/tests/testloading.c
@@ -30,7 +30,8 @@ typedef struct {
     gboolean has_been_committed;
     gboolean has_been_first_visually_non_empty_layout;
     gboolean has_been_finished;
-    gboolean has_been_error;
+    gboolean has_been_failed;
+    gboolean has_been_load_error;
 } WebLoadingFixture;
 
 static void web_loading_fixture_setup(WebLoadingFixture* fixture, gconstpointer data)
@@ -42,7 +43,8 @@ static void web_loading_fixture_setup(WebLoadingFixture* fixture, gconstpointer
     fixture->has_been_committed = FALSE;
     fixture->has_been_first_visually_non_empty_layout = FALSE;
     fixture->has_been_finished = FALSE;
-    fixture->has_been_error = FALSE;
+    fixture->has_been_failed = FALSE;
+    fixture->has_been_load_error = FALSE;
 }
 
 static void web_loading_fixture_teardown(WebLoadingFixture* fixture, gconstpointer data)
@@ -117,17 +119,23 @@ static void load_error_status_changed_cb(GObject* object, GParamSpec* pspec, Web
 
     switch(status) {
     case WEBKIT_LOAD_PROVISIONAL:
-        g_assert(!fixture->has_been_provisional);
-        g_assert(!fixture->has_been_error);
+        /* We are going to go through here twice, so don't assert
+         * anything */
         fixture->has_been_provisional = TRUE;
         break;
     case WEBKIT_LOAD_FINISHED:
         g_assert(fixture->has_been_provisional);
-        g_assert(fixture->has_been_error);
+        g_assert(fixture->has_been_load_error);
+        g_assert(fixture->has_been_failed);
         /* We are checking that only one FINISHED is received in the
            whole cycle, so assert it's FALSE */
         g_assert(!fixture->has_been_finished);
         fixture->has_been_finished = TRUE;
+        g_main_loop_quit(fixture->loop);
+        break;
+    case WEBKIT_LOAD_FAILED:
+        g_assert(!fixture->has_been_failed);
+        fixture->has_been_failed = TRUE;
         break;
     default:
         break;
@@ -137,8 +145,8 @@ static void load_error_status_changed_cb(GObject* object, GParamSpec* pspec, Web
 static gboolean load_error_cb(WebKitWebView* webView, WebKitWebFrame* frame, const char* uri, GError *error, WebLoadingFixture* fixture)
 {
     g_assert(fixture->has_been_provisional);
-    g_assert(!fixture->has_been_error);
-    fixture->has_been_error = TRUE;
+    g_assert(!fixture->has_been_load_error);
+    fixture->has_been_load_error = TRUE;
 
     return FALSE;
 }
@@ -151,6 +159,65 @@ static void test_loading_error(WebLoadingFixture* fixture, gconstpointer data)
     g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_error_status_changed_cb), fixture);
 
     webkit_web_view_load_uri(fixture->webView, "http://snoetuhsetuhseoutoeutc.com/");
+    g_main_loop_run(fixture->loop);
+}
+
+/* Cancelled load */
+
+static gboolean load_cancelled_cb(WebKitWebView* webView, WebKitWebFrame* frame, const char* uri, GError *error, WebLoadingFixture* fixture)
+{
+    g_assert(fixture->has_been_provisional);
+    g_assert(fixture->has_been_failed);
+    g_assert(!fixture->has_been_load_error);
+    g_assert(error->code == WEBKIT_NETWORK_ERROR_CANCELLED);
+    fixture->has_been_load_error = TRUE;
+
+    return TRUE;
+}
+
+static gboolean stop_load (gpointer data)
+{
+    webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(data));
+    return FALSE;
+}
+
+static void load_cancelled_status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture)
+{
+    WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object));
+
+    switch(status) {
+    case WEBKIT_LOAD_PROVISIONAL:
+        g_assert(!fixture->has_been_provisional);
+        g_assert(!fixture->has_been_failed);
+        fixture->has_been_provisional = TRUE;
+        break;
+    case WEBKIT_LOAD_COMMITTED:
+        g_idle_add (stop_load, object);
+        break;
+    case WEBKIT_LOAD_FAILED:
+        g_assert(fixture->has_been_provisional);
+        g_assert(!fixture->has_been_failed);
+        g_assert(!fixture->has_been_load_error);
+        fixture->has_been_failed = TRUE;
+        g_main_loop_quit(fixture->loop);
+        break;
+    case WEBKIT_LOAD_FINISHED:
+        g_assert_not_reached();
+        break;
+    default:
+        break;
+    }
+}
+
+static void test_loading_cancelled(WebLoadingFixture* fixture, gconstpointer data)
+{
+    g_test_bug("29644");
+
+    g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_cancelled_cb), fixture);
+    g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_cancelled_status_changed_cb), fixture);
+
+    webkit_web_view_load_uri(fixture->webView, "http://google.com/");
+    g_main_loop_run(fixture->loop);
 }
 
 int main(int argc, char** argv)
@@ -169,6 +236,11 @@ int main(int argc, char** argv)
                web_loading_fixture_setup,
                test_loading_error,
                web_loading_fixture_teardown);
+    g_test_add("/webkit/loading/cancelled",
+               WebLoadingFixture, NULL,
+               web_loading_fixture_setup,
+               test_loading_cancelled,
+               web_loading_fixture_teardown);
     return g_test_run();
 }
 
diff --git a/WebKit/gtk/webkit/webkitwebframe.h b/WebKit/gtk/webkit/webkitwebframe.h
index 3dff2c2..620c4d3 100644
--- a/WebKit/gtk/webkit/webkitwebframe.h
+++ b/WebKit/gtk/webkit/webkitwebframe.h
@@ -75,12 +75,17 @@ struct _WebKitWebFrameClass {
  * because the data available at the time was not significant enough.
  * @WEBKIT_LOAD_FINISHED: This state means that everything that was
  * required to display the page has been loaded.
+ * @WEBKIT_LOAD_FAILED: This state means that some error occurred
+ * during the page load that prevented it from being completed. You
+ * can connect to the #WebKitWebView::load-error signal if you want to
+ * know precisely what kind of error occurred.
  */
 typedef enum {
     WEBKIT_LOAD_PROVISIONAL,
     WEBKIT_LOAD_COMMITTED,
     WEBKIT_LOAD_FINISHED,
-    WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT
+    WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT,
+    WEBKIT_LOAD_FAILED
 } WebKitLoadStatus;
 
 WEBKIT_API GType

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list