Diff
Modified: trunk/ChangeLog (294076 => 294077)
--- trunk/ChangeLog 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/ChangeLog 2022-05-11 21:57:56 UTC (rev 294077)
@@ -1,3 +1,12 @@
+2022-05-11 Yury Semikhatsky <[email protected]>
+
+ [WinCairo] Support file downloads
+ https://bugs.webkit.org/show_bug.cgi?id=240293
+
+ Reviewed by Fujii Hironori.
+
+ * Source/cmake/OptionsWin.cmake: enable DOWNLOAD_ATTRIBUTE by default in WinCairo.
+
2022-05-11 Jonathan Bedard <[email protected]>
Remove Subversion references from ReadMe
Modified: trunk/LayoutTests/ChangeLog (294076 => 294077)
--- trunk/LayoutTests/ChangeLog 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/LayoutTests/ChangeLog 2022-05-11 21:57:56 UTC (rev 294077)
@@ -1,3 +1,12 @@
+2022-05-11 Yury Semikhatsky <[email protected]>
+
+ [WinCairo] Support file downloads
+ https://bugs.webkit.org/show_bug.cgi?id=240293
+
+ Reviewed by Fujii Hironori.
+
+ * platform/wincairo/TestExpectations: enable downloads tests.
+
2022-05-11 Antti Koivisto <[email protected]>
REGRESSION (r291788): MotionMark Suits subtest is 9% regressed
Modified: trunk/LayoutTests/platform/wincairo/TestExpectations (294076 => 294077)
--- trunk/LayoutTests/platform/wincairo/TestExpectations 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/LayoutTests/platform/wincairo/TestExpectations 2022-05-11 21:57:56 UTC (rev 294077)
@@ -54,23 +54,15 @@
fast/dom/DeviceMotion [ Skip ]
fast/dom/Window/window-properties-device-orientation.html [ Skip ]
-# DOWNLOAD_ATTRIBUTE is disabled
-fast/dom/HTMLAnchorElement/anchor-download.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-download-synthetic-click.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-base-target-popup-not-allowed.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target-popup-not-allowed.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-blank-target.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-unicode.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html [ Skip ]
-fast/dom/HTMLAnchorElement/anchor-nodownload-set.html [ Skip ]
+# Unexpected suggested file name.
+fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html [ Failure ]
+fast/dom/HTMLAnchorElement/anchor-download.html [ Failure ]
+fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-async-delegate.html [ Failure ]
+fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html [ Failure ]
+fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-backslash.html [ Failure ]
+fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-doublequote.html [ Failure ]
+fast/dom/HTMLAnchorElement/anchor-file-blob-download-includes-slashes.html [ Failure ]
+fast/dom/HTMLAnchorElement/anchor-nodownload-set.html [ Failure ]
# ENABLE_INPUT_TYPE_* are disabled.
# See: webkit.org/b/29359
@@ -765,6 +757,9 @@
http/tests/cache/partitioned-cache.html [ Failure ]
http/tests/cache/willsendrequest-returns-null-for-memory-cache-load.html [ Failure ]
+# Second link click interrupts current download
+http/tests/download/anchor-load-after-download.html [ Skip ]
+
http/tests/cache-storage [ Skip ]
http/tests/canvas [ Skip ]
http/tests/contentdispositionattachmentsandbox [ Skip ]
@@ -788,7 +783,6 @@
http/tests/css/cross-fade-reload.html [ Timeout Pass ]
http/tests/dom [ Skip ]
-http/tests/download [ Skip ]
http/tests/eventsource [ Skip ]
http/tests/events/touch/ios [ Skip ]
http/tests/fileapi [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (294076 => 294077)
--- trunk/Source/WebCore/ChangeLog 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/Source/WebCore/ChangeLog 2022-05-11 21:57:56 UTC (rev 294077)
@@ -1,3 +1,17 @@
+2022-05-11 Yury Semikhatsky <[email protected]>
+
+ [WinCairo] Support file downloads
+ https://bugs.webkit.org/show_bug.cgi?id=240293
+
+ Reviewed by Fujii Hironori.
+
+ Properly convert suggested file name to utf8.
+
+ Coverred by LayoutTests/http/tests/download/literal-utf-8.html.
+
+ * platform/network/curl/ResourceResponseCurl.cpp:
+ (WebCore::ResourceResponse::platformSuggestedFilename const):
+
2022-05-11 Antti Koivisto <[email protected]>
REGRESSION (r291788): MotionMark Suits subtest is 9% regressed
Modified: trunk/Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp (294076 => 294077)
--- trunk/Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp 2022-05-11 21:57:56 UTC (rev 294077)
@@ -151,7 +151,10 @@
String ResourceResponse::platformSuggestedFilename() const
{
- return filenameFromHTTPContentDisposition(httpHeaderField(HTTPHeaderName::ContentDisposition)).toString();
+ StringView contentDisposition = filenameFromHTTPContentDisposition(httpHeaderField(HTTPHeaderName::ContentDisposition));
+ if (contentDisposition.is8Bit())
+ return String::fromUTF8WithLatin1Fallback(contentDisposition.characters8(), contentDisposition.length());
+ return contentDisposition.toString();
}
bool ResourceResponse::shouldRedirect()
Modified: trunk/Source/WebKit/ChangeLog (294076 => 294077)
--- trunk/Source/WebKit/ChangeLog 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/Source/WebKit/ChangeLog 2022-05-11 21:57:56 UTC (rev 294077)
@@ -1,3 +1,22 @@
+2022-05-11 Yury Semikhatsky <[email protected]>
+
+ [WinCairo] Support file downloads
+ https://bugs.webkit.org/show_bug.cgi?id=240293
+
+ Reviewed by Fujii Hironori.
+
+ Hooked up Curl calls to Download callbacks. Added basic support for
+ file downloads in Curl.
+
+ * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
+ (WebKit::NetworkDataTaskCurl::cancel):
+ (WebKit::NetworkDataTaskCurl::curlDidReceiveData):
+ (WebKit::NetworkDataTaskCurl::curlDidComplete):
+ (WebKit::NetworkDataTaskCurl::deleteDownloadFile):
+ (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
+ (WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse):
+ * NetworkProcess/curl/NetworkDataTaskCurl.h:
+
2022-05-11 Michael Saboff <[email protected]>
Need to add DYLD_LIBRARY_PATH for XPC services
Modified: trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp (294076 => 294077)
--- trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp 2022-05-11 21:57:56 UTC (rev 294077)
@@ -26,8 +26,12 @@
#include "config.h"
#include "NetworkDataTaskCurl.h"
+#include "APIError.h"
#include "AuthenticationChallengeDisposition.h"
#include "AuthenticationManager.h"
+#include "DataReference.h"
+#include "Download.h"
+#include "NetworkProcess.h"
#include "NetworkSessionCurl.h"
#include "PrivateRelayed.h"
#include <WebCore/AuthenticationChallenge.h>
@@ -42,6 +46,7 @@
#include <WebCore/ShouldRelaxThirdPartyCookieBlocking.h>
#include <WebCore/SynchronousLoaderClient.h>
#include <pal/text/TextEncoding.h>
+#include <wtf/FileSystem.h>
namespace WebKit {
@@ -108,6 +113,9 @@
if (m_curlRequest)
m_curlRequest->cancel();
+
+ if (isDownload())
+ deleteDownloadFile();
}
void NetworkDataTaskCurl::invalidateAndCancel()
@@ -180,6 +188,23 @@
if (state() == State::Canceling || state() == State::Completed || (!m_client && !isDownload()))
return;
+ if (isDownload()) {
+ auto* download = m_session->networkProcess().downloadManager().download(m_pendingDownloadID);
+ RELEASE_ASSERT(download);
+ uint64_t bytesWritten = 0;
+ for (auto& segment : buffer) {
+ if (-1 == FileSystem::writeToFile(m_downloadDestinationFile, segment.segment->data(), segment.segment->size())) {
+ download->didFail(ResourceError::httpError(CURLE_WRITE_ERROR, m_response.url()), IPC::DataReference());
+ invalidateAndCancel();
+ return;
+ }
+
+ bytesWritten += segment.segment->size();
+ }
+ download->didReceiveData(bytesWritten, 0, 0);
+ return;
+ }
+
m_client->didReceiveData(buffer);
}
@@ -188,9 +213,27 @@
if (state() == State::Canceling || state() == State::Completed || (!m_client && !isDownload()))
return;
+ if (isDownload()) {
+ auto* download = m_session->networkProcess().downloadManager().download(m_pendingDownloadID);
+ RELEASE_ASSERT(download);
+ FileSystem::closeFile(m_downloadDestinationFile);
+ m_downloadDestinationFile = FileSystem::invalidPlatformFileHandle;
+ download->didFinish();
+ return;
+ }
+
m_client->didCompleteWithError({ }, WTFMove(networkLoadMetrics));
}
+void NetworkDataTaskCurl::deleteDownloadFile()
+{
+ if (FileSystem::isHandleValid(m_downloadDestinationFile)) {
+ FileSystem::closeFile(m_downloadDestinationFile);
+ FileSystem::deleteFile(m_pendingDownloadLocation);
+ m_downloadDestinationFile = FileSystem::invalidPlatformFileHandle;
+ }
+}
+
void NetworkDataTaskCurl::curlDidFailWithError(CurlRequest& request, ResourceError&& resourceError, CertificateInfo&& certificateInfo)
{
if (state() == State::Canceling || state() == State::Completed || (!m_client && !isDownload()))
@@ -201,6 +244,14 @@
return;
}
+ if (isDownload()) {
+ deleteDownloadFile();
+ auto* download = m_session->networkProcess().downloadManager().download(m_pendingDownloadID);
+ RELEASE_ASSERT(download);
+ download->didFail(resourceError, IPC::DataReference());
+ return;
+ }
+
m_client->didCompleteWithError(resourceError);
}
@@ -238,6 +289,24 @@
case PolicyAction::Ignore:
invalidateAndCancel();
break;
+ case PolicyAction::Download: {
+ m_downloadDestinationFile = FileSystem::openFile(m_pendingDownloadLocation, FileSystem::FileOpenMode::Write);
+ if (!FileSystem::isHandleValid(m_downloadDestinationFile)) {
+ if (m_client)
+ m_client->didCompleteWithError(ResourceError::httpError(CURLE_WRITE_ERROR, m_response.url()));
+ invalidateAndCancel();
+ return;
+ }
+
+ auto& downloadManager = m_session->networkProcess().downloadManager();
+ auto download = makeUnique<Download>(downloadManager, m_pendingDownloadID, *this, *m_session, suggestedFilename());
+ auto* downloadPtr = download.get();
+ downloadManager.dataTaskBecameDownloadTask(m_pendingDownloadID, WTFMove(download));
+ downloadPtr->didCreateDestination(m_pendingDownloadLocation);
+ if (m_curlRequest)
+ m_curlRequest->completeDidReceiveResponse();
+ break;
+ }
default:
notImplemented();
break;
Modified: trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.h (294076 => 294077)
--- trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.h 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.h 2022-05-11 21:57:56 UTC (rev 294077)
@@ -32,6 +32,7 @@
#include <WebCore/ProtectionSpace.h>
#include <WebCore/ResourceResponse.h>
#include <WebCore/ShouldRelaxThirdPartyCookieBlocking.h>
+#include <wtf/FileSystem.h>
#include <wtf/MonotonicTime.h>
namespace WebCore {
@@ -93,6 +94,7 @@
void unblockCookies();
String suggestedFilename() const override;
+ void deleteDownloadFile();
State m_state { State::Suspended };
@@ -104,6 +106,8 @@
WebCore::FrameIdentifier m_frameID;
WebCore::PageIdentifier m_pageID;
+ FileSystem::PlatformFileHandle m_downloadDestinationFile { FileSystem::invalidPlatformFileHandle };
+
bool m_blockingCookies { false };
WebCore::ShouldRelaxThirdPartyCookieBlocking m_shouldRelaxThirdPartyCookieBlocking { WebCore::ShouldRelaxThirdPartyCookieBlocking::No };
Modified: trunk/Source/cmake/OptionsWin.cmake (294076 => 294077)
--- trunk/Source/cmake/OptionsWin.cmake 2022-05-11 21:57:24 UTC (rev 294076)
+++ trunk/Source/cmake/OptionsWin.cmake 2022-05-11 21:57:56 UTC (rev 294077)
@@ -64,6 +64,7 @@
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_CONIC_GRADIENTS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DARK_MODE_CSS PRIVATE ON)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS_LEVEL_2 PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PUBLIC OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)