Changeset 223995 in webkit


Ignore:
Timestamp:
Oct 25, 2017 4:39:09 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[Curl] Delete temporally downloaded file when it cancelled
https://bugs.webkit.org/show_bug.cgi?id=134393

Patch by Basuke Suzuki <Basuke Suzuki> on 2017-10-25
Reviewed by Alex Christensen.

  • platform/network/curl/CurlRequest.cpp:

(WebCore::CurlRequest::didCancelTransfer):
(WebCore::CurlRequest::writeDataToDownloadFileIfEnabled):
(WebCore::CurlRequest::closeDownloadFile):
(WebCore::CurlRequest::cleanupDownloadFile):

  • platform/network/curl/CurlRequest.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223994 r223995  
     12017-10-25  Basuke Suzuki  <Basuke.Suzuki@sony.com>
     2
     3        [Curl] Delete temporally downloaded file when it cancelled
     4        https://bugs.webkit.org/show_bug.cgi?id=134393
     5
     6        Reviewed by Alex Christensen.
     7
     8        * platform/network/curl/CurlRequest.cpp:
     9        (WebCore::CurlRequest::didCancelTransfer):
     10        (WebCore::CurlRequest::writeDataToDownloadFileIfEnabled):
     11        (WebCore::CurlRequest::closeDownloadFile):
     12        (WebCore::CurlRequest::cleanupDownloadFile):
     13        * platform/network/curl/CurlRequest.h:
     14
    1152017-10-25  Youenn Fablet  <youenn@apple.com>
    216
  • trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp

    r223838 r223995  
    378378{
    379379    finalizeTransfer();
     380    cleanupDownloadFile();
    380381}
    381382
     
    611612void CurlRequest::writeDataToDownloadFileIfEnabled(const SharedBuffer& buffer)
    612613{
    613     LockHolder locker(m_downloadMutex);
    614 
    615     if (!m_isEnabledDownloadToFile)
    616         return;
    617 
    618     if (m_downloadFilePath.isEmpty())
    619         m_downloadFilePath = openTemporaryFile("download", m_downloadFileHandle);
     614    {
     615        LockHolder locker(m_downloadMutex);
     616
     617        if (!m_isEnabledDownloadToFile)
     618            return;
     619
     620        if (m_downloadFilePath.isEmpty())
     621            m_downloadFilePath = openTemporaryFile("download", m_downloadFileHandle);
     622    }
    620623
    621624    if (m_downloadFileHandle != invalidPlatformFileHandle)
     
    630633        return;
    631634
    632     WebCore::closeFile(m_downloadFileHandle);
     635    closeFile(m_downloadFileHandle);
    633636    m_downloadFileHandle = invalidPlatformFileHandle;
    634637}
    635638
     639void CurlRequest::cleanupDownloadFile()
     640{
     641    LockHolder locker(m_downloadMutex);
     642
     643    if (!m_downloadFilePath.isEmpty()) {
     644        deleteFile(m_downloadFilePath);
     645        m_downloadFilePath = String();
     646    }
     647}
     648
    636649CURLcode CurlRequest::willSetupSslCtxCallback(CURL*, void* sslCtx, void* userData)
    637650{
  • trunk/Source/WebCore/platform/network/curl/CurlRequest.h

    r223838 r223995  
    118118    void writeDataToDownloadFileIfEnabled(const SharedBuffer&);
    119119    void closeDownloadFile();
     120    void cleanupDownloadFile();
    120121
    121122    // Callback functions for curl
Note: See TracChangeset for help on using the changeset viewer.