Title: [152897] trunk/Tools
Revision
152897
Author
[email protected]
Date
2013-07-19 05:18:37 -0700 (Fri, 19 Jul 2013)

Log Message

[GTK] Fix regression in DumpRenderTree introduced in r152782 by checking if uri is valid
https://bugs.webkit.org/show_bug.cgi?id=118895

Patch by Simon Pena <[email protected]> on 2013-07-19
Reviewed by Philippe Normand.

In r152782 an uri is used to create an string representation without checking first if it
is valid. That fails later when the string is used to check for existing redirections. This
patch ensures that the uri is valid before using it.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(willSendRequestCallback): Ensure an uri is valid before using it.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (152896 => 152897)


--- trunk/Tools/ChangeLog	2013-07-19 12:11:56 UTC (rev 152896)
+++ trunk/Tools/ChangeLog	2013-07-19 12:18:37 UTC (rev 152897)
@@ -1,3 +1,17 @@
+2013-07-19  Simon Pena  <[email protected]>
+
+        [GTK] Fix regression in DumpRenderTree introduced in r152782 by checking if uri is valid
+        https://bugs.webkit.org/show_bug.cgi?id=118895
+
+        Reviewed by Philippe Normand.
+
+        In r152782 an uri is used to create an string representation without checking first if it
+        is valid. That fails later when the string is used to check for existing redirections. This
+        patch ensures that the uri is valid before using it.
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (willSendRequestCallback): Ensure an uri is valid before using it.
+
 2013-07-18  Timothy Hatcher  <[email protected]>
 
         Add extract-localizable-js-strings and use it for WebInspectorUI.

Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (152896 => 152897)


--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2013-07-19 12:11:56 UTC (rev 152896)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2013-07-19 12:18:37 UTC (rev 152897)
@@ -1288,23 +1288,26 @@
 
     SoupMessage* soupMessage = webkit_network_request_get_message(request);
     SoupURI* uri = soup_uri_new(webkit_network_request_get_uri(request));
-    GOwnPtr<char> uriString(soup_uri_to_string(uri, FALSE));
 
-    if (SOUP_URI_VALID_FOR_HTTP(uri) && g_strcmp0(uri->host, "127.0.0.1")
-        && g_strcmp0(uri->host, "255.255.255.255")
-        && g_ascii_strncasecmp(uri->host, "localhost", 9)) {
-        printf("Blocked access to external URL %s\n", uriString.get());
-        // Cancel load of blocked resource to avoid potential
-        // network-related timeouts in tests.
-        webkit_network_request_set_uri(request, "about:blank");
-        soup_uri_free(uri);
-        return;
+    if (SOUP_URI_IS_VALID(uri)) {
+        GOwnPtr<char> uriString(soup_uri_to_string(uri, FALSE));
+
+        if (SOUP_URI_VALID_FOR_HTTP(uri) && g_strcmp0(uri->host, "127.0.0.1")
+            && g_strcmp0(uri->host, "255.255.255.255")
+            && g_ascii_strncasecmp(uri->host, "localhost", 9)) {
+            printf("Blocked access to external URL %s\n", uriString.get());
+            // Cancel load of blocked resource to avoid potential
+            // network-related timeouts in tests.
+            webkit_network_request_set_uri(request, "about:blank");
+            soup_uri_free(uri);
+            return;
+        }
+
+        const string& destination = gTestRunner->redirectionDestinationForURL(uriString.get());
+        if (!destination.empty())
+            webkit_network_request_set_uri(request, destination.c_str());
     }
 
-    const string& destination = gTestRunner->redirectionDestinationForURL(uriString.get());
-    if (!destination.empty())
-        webkit_network_request_set_uri(request, destination.c_str());
-
     if (uri)
         soup_uri_free(uri);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to