We are currently writing the downloads directly into the destination, and when a download fails or is cancelled after the destination has been decided, the partial file is left on the disk. Deleting the final file is not safe because there might be a race condition, so we can use an intermediate file like other browsers do, a file in the same directory than the target destination but with .wkdownload suffix, that is removed when the download fails or is cancelled. If the download finishes successfully the intermediate file is renamed to the final destination.
Created attachment 220706 [details] Patch
Comment on attachment 220706 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=220706&action=review > Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDownloads.cpp:313 > +static gboolean writeNextChunkIdle(SoupMessage *message) > +{ > + soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, "chunk", 5); > + return FALSE; > +} > + > +static void writeNextChunk(SoupMessage *message) Asterisks are in the wrong place here.
Committed r161555: <http://trac.webkit.org/changeset/161555>