Modified: trunk/Source/WebCore/ChangeLog (280421 => 280422)
--- trunk/Source/WebCore/ChangeLog 2021-07-29 11:21:58 UTC (rev 280421)
+++ trunk/Source/WebCore/ChangeLog 2021-07-29 14:56:22 UTC (rev 280422)
@@ -1,3 +1,24 @@
+2021-07-29 Michael Catanzaro <mcatanz...@gnome.org>
+
+ [WPE][GTK] .asc file extension is appended to filename of text/plain downloads
+ https://bugs.webkit.org/show_bug.cgi?id=228566
+
+ Reviewed by Adrian Perez de Castro.
+
+ Our MIMETypeRegistry::preferredExtensionForMIMEType returns "asc" for text/plain, possibly
+ because "asc" sorts alphabetically ahead of all other possible file extensions for
+ text/plain, and we just pick the first one. So if the text file does not contain any file
+ extension, we give it a file extension for a GPG signature. Ouch.
+
+ I don't know how to fix it, but we don't need to, because we don't really want to append any
+ file extension for text/plain anyway. That's just annoying. If I download a file named
+ "backtrace" then I don't want it renamed to "backtrace.txt". That would be expected on
+ Windows, but certainly not from WebKitGTK. So I think it's reasonable to have a special case
+ for text/plain.
+
+ * platform/xdg/MIMETypeRegistryXdg.cpp:
+ (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType):
+
2021-07-29 Youenn Fablet <you...@apple.com>
RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer should update m_currentRotationSessionAngle
Modified: trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp (280421 => 280422)
--- trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp 2021-07-29 11:21:58 UTC (rev 280421)
+++ trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp 2021-07-29 14:56:22 UTC (rev 280422)
@@ -56,6 +56,9 @@
if (mimeType.isEmpty())
return String();
+ if (mimeType.startsWith("text/plain"))
+ return String();
+
String returnValue;
char* extension;
if (xdg_mime_get_simple_globs(mimeType.utf8().data(), &extension, 1)) {
Modified: trunk/Tools/ChangeLog (280421 => 280422)
--- trunk/Tools/ChangeLog 2021-07-29 11:21:58 UTC (rev 280421)
+++ trunk/Tools/ChangeLog 2021-07-29 14:56:22 UTC (rev 280422)
@@ -1,3 +1,16 @@
+2021-07-29 Michael Catanzaro <mcatanz...@gnome.org>
+
+ [WPE][GTK] .asc file extension is appended to filename of text/plain downloads
+ https://bugs.webkit.org/show_bug.cgi?id=228566
+
+ Reviewed by Adrian Perez de Castro.
+
+ * TestWebKitAPI/Tests/WebKitGLib/TestDownloads.cpp:
+ (serverCallback):
+ (testDownloadTextPlainMIMEType):
+ (beforeAll):
+ * TestWebKitAPI/Tests/WebKitGLib/resources/text: Added.
+
2021-07-28 Ryosuke Niwa <rn...@webkit.org>
makeWeakPtr should support Ref and RefPtr as the argument
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestDownloads.cpp (280421 => 280422)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestDownloads.cpp 2021-07-29 11:21:58 UTC (rev 280421)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestDownloads.cpp 2021-07-29 14:56:22 UTC (rev 280422)
@@ -444,6 +444,8 @@
if (g_str_equal(path, "/unknown") || g_str_equal(path, "/ua-test"))
path = "/test.pdf";
+ else if (g_str_equal(path, "/text"))
+ path = "/text";
GUniquePtr<char> filePath(g_build_filename(Test::getResourcesDir().data(), path, nullptr));
char* contents;
@@ -745,6 +747,23 @@
test->checkDestinationAndDeleteFile(download.get(), expectedFilename.get());
}
+static void testDownloadTextPlainMIMEType(DownloadTest* test, gconstpointer)
+{
+ GRefPtr<WebKitDownload> download = test->downloadURIAndWaitUntilFinishes(kServer->getURIForPath("/text"));
+ g_assert_null(webkit_download_get_web_view(download.get()));
+
+ WebKitURIRequest* request = webkit_download_get_request(download.get());
+ g_assert_true(WEBKIT_IS_URI_REQUEST(request));
+ ASSERT_CMP_CSTRING(webkit_uri_request_get_uri(request), ==, kServer->getURIForPath("/text"));
+
+ WebKitURIResponse* response = webkit_download_get_response(download.get());
+ g_assert_true(WEBKIT_IS_URI_RESPONSE(response));
+ g_assert_cmpstr(webkit_uri_response_get_mime_type(response), ==, "text/plain");
+ g_assert_nonnull(webkit_download_get_destination(download.get()));
+ g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), ==, 1);
+ test->checkDestinationAndDeleteFile(download.get(), kServerSuggestedFilename);
+}
+
static void testDownloadUserAgent(DownloadTest* test, gconstpointer)
{
s_userAgentMap.clear();
@@ -892,6 +911,7 @@
PolicyResponseDownloadTest::add("Downloads", "policy-decision-download", testPolicyResponseDownload);
PolicyResponseDownloadTest::add("Downloads", "policy-decision-download-cancel", testPolicyResponseDownloadCancel);
DownloadTest::add("Downloads", "mime-type", testDownloadMIMEType);
+ DownloadTest::add("Downloads", "text-plain-mime-type", testDownloadTextPlainMIMEType);
DownloadTest::add("Downloads", "user-agent", testDownloadUserAgent);
Test::add("Downloads", "ephemeral-context", testDownloadEphemeralContext);
// FIXME: Implement keyStroke in WPE.
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/resources/text (0 => 280422)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/resources/text (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/resources/text 2021-07-29 14:56:22 UTC (rev 280422)
@@ -0,0 +1 @@
+This is a text/plain document!