Title: [213062] trunk
Revision
213062
Author
[email protected]
Date
2017-02-27 06:48:43 -0800 (Mon, 27 Feb 2017)

Log Message

[GTK] Downloads attributes tests are failing
https://bugs.webkit.org/show_bug.cgi?id=168871

Reviewed by Michael Catanzaro.

Source/WebCore:

Use libsoup to get the suggested filename from the Content-Disposition header instead of buggy
filenameFromHTTPContentDisposition().

Fixes: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
       fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html

* platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::platformSuggestedFilename):

LayoutTests:

Remove passing tests and add new baseline for
fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html because libsoup handles slashes
differently but download succeeds.

* platform/gtk/TestExpectations:
* platform/gtk/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (213061 => 213062)


--- trunk/LayoutTests/ChangeLog	2017-02-27 14:42:08 UTC (rev 213061)
+++ trunk/LayoutTests/ChangeLog	2017-02-27 14:48:43 UTC (rev 213062)
@@ -1,3 +1,17 @@
+2017-02-27  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Downloads attributes tests are failing
+        https://bugs.webkit.org/show_bug.cgi?id=168871
+
+        Reviewed by Michael Catanzaro.
+
+        Remove passing tests and add new baseline for
+        fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html because libsoup handles slashes
+        differently but download succeeds.
+
+        * platform/gtk/TestExpectations:
+        * platform/gtk/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes-expected.txt: Added.
+
 2017-02-27  Antoine Quint  <[email protected]>
 
         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (213061 => 213062)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2017-02-27 14:42:08 UTC (rev 213061)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2017-02-27 14:48:43 UTC (rev 213062)
@@ -2914,10 +2914,6 @@
 
 webkit.org/b/168719 fast/css/paint-order-shadow.html [ ImageOnlyFailure ]
 
-webkit.org/b/168871 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html [ Failure ]
-webkit.org/b/168871 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html [ Failure ]
-webkit.org/b/168871 fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html [ Timeout ]
-
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of non-crashing, non-flaky tests failing
 #////////////////////////////////////////////////////////////////////////////////////////

Added: trunk/LayoutTests/platform/gtk/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes-expected.txt (0 => 213062)


--- trunk/LayoutTests/platform/gtk/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes-expected.txt	2017-02-27 14:48:43 UTC (rev 213062)
@@ -0,0 +1,6 @@
+Download started.
+Downloading URL with suggested filename "test2\abe.png"
+Download completed.
+The suggested filename above should NOT include slashes or backslashes and the download should succeed.
+
+File backed blob URL

Modified: trunk/Source/WebCore/ChangeLog (213061 => 213062)


--- trunk/Source/WebCore/ChangeLog	2017-02-27 14:42:08 UTC (rev 213061)
+++ trunk/Source/WebCore/ChangeLog	2017-02-27 14:48:43 UTC (rev 213062)
@@ -1,3 +1,19 @@
+2017-02-27  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Downloads attributes tests are failing
+        https://bugs.webkit.org/show_bug.cgi?id=168871
+
+        Reviewed by Michael Catanzaro.
+
+        Use libsoup to get the suggested filename from the Content-Disposition header instead of buggy
+        filenameFromHTTPContentDisposition().
+
+        Fixes: fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html
+               fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html
+
+        * platform/network/soup/ResourceResponseSoup.cpp:
+        (WebCore::ResourceResponse::platformSuggestedFilename):
+
 2017-02-27  Antoine Quint  <[email protected]>
 
         [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls

Modified: trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp (213061 => 213062)


--- trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp	2017-02-27 14:42:08 UTC (rev 213061)
+++ trunk/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp	2017-02-27 14:48:43 UTC (rev 213062)
@@ -96,8 +96,14 @@
 
 String ResourceResponse::platformSuggestedFilename() const
 {
+    SoupMessageHeaders* soupHeaders = soup_message_headers_new(SOUP_MESSAGE_HEADERS_RESPONSE);
     String contentDisposition(httpHeaderField(HTTPHeaderName::ContentDisposition));
-    return filenameFromHTTPContentDisposition(String::fromUTF8WithLatin1Fallback(contentDisposition.characters8(), contentDisposition.length()));
+    soup_message_headers_append(soupHeaders, "Content-Disposition", contentDisposition.utf8().data());
+    GRefPtr<GHashTable> params;
+    soup_message_headers_get_content_disposition(soupHeaders, nullptr, &params.outPtr());
+    soup_message_headers_free(soupHeaders);
+    char* filename = params ? static_cast<char*>(g_hash_table_lookup(params.get(), "filename")) : nullptr;
+    return filename ? String::fromUTF8(filename) : String();
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to