Skip to content
  • jhoneycutt@apple.com's avatar
    Downloads in WK2 on Windows should write resume data to bundle · e22c1afe
    jhoneycutt@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=53282
    <rdar://problem/8753077>
    
    Reviewed by Alice Liu.
    
    Source/WebCore:
    
    * WebCore.vcproj/WebCore.vcproj:
    Added new files to project.
    
    * platform/network/cf/DownloadBundle.h: Added.
    * platform/network/win/DownloadBundleWin.cpp: Added.
    (WebCore::DownloadBundle::magicNumber):
    Moved from WebKit's WebDownload so that WebKit and WebKit2 can share
    it.
    (WebCore::DownloadBundle::fileExtension):
    Ditto.
    (WebCore::DownloadBundle::appendResumeData):
    Ditto - but modified to return bool rather than HRESULT and to clean up
    whitespace.
    (WebCore::DownloadBundle::extractResumeData):
    Ditto - modified to clean up whitespace.
    
    Source/WebKit/win:
    
    * WebDownload.cpp:
    (WebDownload::bundlePathForTargetPath):
    Use the new WebCore::DownloadBundle function.
    (WebDownload::request):
    
    * WebDownload.h:
    Removed declarations for functions that were moved to a new location.
    
    * WebDownloadCFNet.cpp:
    (WebDownload::initToResumeWithBundle):
    Use the new WebCore::DownloadBundle function.
    (WebDownload::cancelForResume):
    Fix a leak of the resume data CFDataRef by using adoptCF(). Use the new
    WebCore::DownloadBundle function.
    
    Source/WebKit2:
    
    * WebProcess/Downloads/Download.cpp:
    (WebKit::Download::decideDestinationWithSuggestedFilename):
    Call didDecideDestination(), now that the destination is decided.
    
    * WebProcess/Downloads/Download.h:
    Declare didDecideDestination(). Added member variables to hold the
    destination file path and the download bundle path.
    (WebKit::Download::destination):
    Return the path to the final destination for this download.
    
    * WebProcess/Downloads/cf/DownloadCFNet.cpp:
    (WebKit::Download::start):
    Remove the name of an unused param.
    (WebKit::Download::startWithHandle):
    Ditto.
    (WebKit::Download::cancel):
    Tell CFNetwork not to delete the file upon failure, and tell it to
    cancel the download. Copy the resume data for the download, and append
    it to the download bundle. Call didCancel() with an empty
    DataReference, since we have written our own resume data.
    (WebKit::decideDestinationWithSuggestedObjectNameCallback):
    Remove some unused param names. Removed the call to
    CFURLDownloadSetDestination() - this is now handled in
    Download::didDecideDestination().
    (WebKit::didCreateDestinationCallback):
    Report that the final destination was created, rather than the download
    bundle, matching old WebKit.
    (WebKit::Download::didDecideDestination):
    Store the final destination and the download bundle paths, and call
    CFURLDownloadSetDestination(), passing the path to the download bundle.
    
    * WebProcess/Downloads/curl/DownloadCurl.cpp:
    (WebKit::Download::didDecideDestination):
    Stubbed.
    
    * WebProcess/Downloads/mac/DownloadMac.mm:
    (WebKit::Download::didDecideDestination):
    Stubbed - unneeded on the Mac.
    
    * WebProcess/Downloads/qt/DownloadQt.cpp:
    (WebKit::Download::didDecideDestination):
    Stubbed.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77055 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    e22c1afe