[Xfce4-commits] <midori:master> Add URI alias test case and fix about:blank behavior

Christian Dywan noreply at xfce.org
Wed Mar 13 20:04:01 CET 2013


Updating branch refs/heads/master
         to 169ac19c84ced184adcac96eef0a802e8577f802 (commit)
       from 66edee1e062e93283a715861bbe9c4097a442a90 (commit)

commit 169ac19c84ced184adcac96eef0a802e8577f802
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Mar 13 19:59:19 2013 +0100

    Add URI alias test case and fix about:blank behavior

 midori/midori-view.c |    9 +++++----
 tests/tab.vala       |   43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/midori/midori-view.c b/midori/midori-view.c
index 079ef17..18991ac 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -4038,6 +4038,7 @@ midori_view_set_uri (MidoriView*  view,
     gchar* data;
 
     g_return_if_fail (MIDORI_IS_VIEW (view));
+    g_return_if_fail (uri != NULL);
 
     if (!gtk_widget_get_parent (GTK_WIDGET (view)))
         g_warning ("Calling %s() before adding the view to a browser. This "
@@ -4046,9 +4047,7 @@ midori_view_set_uri (MidoriView*  view,
     if (!midori_debug ("unarmed"))
     {
         gchar* temporary_uri = NULL;
-        if (uri == NULL || !strcmp (uri, ""))
-            uri = "about:blank";
-        else if (!strcmp (uri, "about:new"))
+        if (!strcmp (uri, "about:new"))
             uri = midori_settings_get_tabhome (MIDORI_SETTINGS (view->settings));
         if (!strcmp (uri, "about:home"))
             uri = midori_settings_get_homepage (MIDORI_SETTINGS (view->settings));
@@ -4238,7 +4237,9 @@ midori_view_set_uri (MidoriView*  view,
 
                 g_free (command_line);
                 g_free (ident);
-           }
+            }
+            else if (!strcmp (uri, "about:blank"))
+                data = g_strdup ("<body></body>");
             else
             {
                 data = g_strdup_printf (
diff --git a/tests/tab.vala b/tests/tab.vala
index 10d7bad..02efc1c 100644
--- a/tests/tab.vala
+++ b/tests/tab.vala
@@ -119,6 +119,48 @@ void tab_special () {
     Midori.Test.release_max_timeout ();
 }
 
+void tab_alias () {
+    Midori.Test.log_set_fatal_handler_for_icons ();
+    var browser = new Midori.Browser ();
+    var settings = new Midori.WebSettings ();
+    browser.set ("settings", settings);
+    var tab = new Midori.View.with_title ();
+    tab.settings = new Midori.WebSettings ();
+    tab.settings.set ("enable-plugins", false);
+    browser.add_tab (tab);
+    var loop = MainContext.default ();
+
+    tab.settings.tabhome = "http://.invalid/";
+    tab.set_uri ("about:new");
+    do { loop.iteration (true); } while (tab.load_status != Midori.LoadStatus.FINISHED);
+    assert (tab.uri == tab.settings.tabhome);
+    // Check that this is the real page, not white page with a URL
+    assert (!tab.web_view.search_text ("about:", true, false, false));
+
+    tab.settings.tabhome = "about:blank";
+    tab.set_uri ("about:new");
+    do { loop.iteration (true); } while (tab.load_status != Midori.LoadStatus.FINISHED);
+    assert (tab.uri == tab.settings.tabhome);
+    // Check that this is the real page, not white page with a URL
+    assert (!tab.web_view.search_text ("about:", true, false, false));
+
+    tab.settings.tabhome = "about:search";
+    tab.settings.location_entry_search = "http://.invalid/";
+    tab.set_uri ("about:new");
+    do { loop.iteration (true); } while (tab.load_status != Midori.LoadStatus.FINISHED);
+    assert (tab.uri == tab.settings.location_entry_search);
+    // Check that this is the real page, not white page with a URL
+    assert (!tab.web_view.search_text ("about:", true, false, false));
+
+    tab.settings.tabhome = "about:home";
+    tab.settings.homepage = "http://.invalid/";
+    tab.set_uri ("about:new");
+    do { loop.iteration (true); } while (tab.load_status != Midori.LoadStatus.FINISHED);
+    assert (tab.uri == tab.settings.homepage);
+    // Check that this is the real page, not white page with a URL
+    assert (!tab.web_view.search_text ("about:", true, false, false));
+}
+
 void tab_http () {
     Midori.Test.grab_max_timeout ();
 
@@ -225,6 +267,7 @@ void main (string[] args) {
     Test.add_func ("/tab/display-title", tab_display_title);
     Test.add_func ("/tab/ellipsize", tab_display_ellipsize);
     Test.add_func ("/tab/special", tab_special);
+    Test.add_func ("/tab/alias", tab_alias);
     Test.add_func ("/tab/http", tab_http);
     Test.add_func ("/tab/movement", tab_movement);
     Test.add_func ("/tab/download", tab_download_dialog);


More information about the Xfce4-commits mailing list