Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Issue 2923163002: [abandoned] Remove the destination file after CopyTask cancelation. (Closed)

Created:
3 years, 6 months ago by tetsui
Modified:
3 years, 6 months ago
Reviewers:
fukino
CC:
chromium-reviews, oka+watch_chromium.org, rginda+watch_chromium.org, mtomasz+watch_chromium.org, yamaguchi+watch_chromium.org, fukino+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove the destination file after CopyTask cancelation. Prviously, when CopyTask was canceled, the destination file under copying at the point was kept with empty or broken content. Operations to files in general are not atomic, so there is no guarantee either it always successfully deletes the destination file or the deleted file is the file intended. However, in this specific case, it should be highly safe. BUG=729529 TEST=Canceled single file copy, multiple file copy, and single directory copy and confirmed that the incomplete file(s) were actually created and successfully deleted. Used fileSystemProvider extension to artificially reproduce slow filesystem. CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Patch Set 1 #

Patch Set 2 : Only delete the destination file when AbortError is returned. #

Patch Set 3 : Delete directory #

Total comments: 4

Patch Set 4 : Resolve review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -2 lines) Patch
M ui/file_manager/file_manager/background/js/file_operation_util.js View 1 2 3 2 chunks +28 lines, -2 lines 0 comments Download

Messages

Total messages: 24 (17 generated)
tetsui
fukino@: PTAL. Thanks!
3 years, 6 months ago (2017-06-06 07:10:47 UTC) #7
fukino
* Title/Description says that we will remove the files on cancellation, but in the code, ...
3 years, 6 months ago (2017-06-06 08:43:58 UTC) #8
tetsui
On 2017/06/06 08:43:58, fukino wrote: > * Title/Description says that we will remove the files ...
3 years, 6 months ago (2017-06-07 01:39:41 UTC) #12
fukino
> Sorry I forgot the most important part... I have to be more careful. > ...
3 years, 6 months ago (2017-06-07 04:26:54 UTC) #15
tetsui
On 2017/06/07 04:26:54, fukino wrote: > > Sorry I forgot the most important part... I ...
3 years, 6 months ago (2017-06-07 06:32:01 UTC) #19
fukino
https://codereview.chromium.org/2923163002/diff/40001/ui/file_manager/file_manager/background/js/file_operation_util.js File ui/file_manager/file_manager/background/js/file_operation_util.js (right): https://codereview.chromium.org/2923163002/diff/40001/ui/file_manager/file_manager/background/js/file_operation_util.js#newcode362 ui/file_manager/file_manager/background/js/file_operation_util.js:362: if (error.name === 'TypeMismatchError') { You don't need to ...
3 years, 6 months ago (2017-06-07 07:32:17 UTC) #22
tetsui
3 years, 6 months ago (2017-06-07 09:21:23 UTC) #23
https://codereview.chromium.org/2923163002/diff/40001/ui/file_manager/file_ma...
File ui/file_manager/file_manager/background/js/file_operation_util.js (right):

https://codereview.chromium.org/2923163002/diff/40001/ui/file_manager/file_ma...
ui/file_manager/file_manager/background/js/file_operation_util.js:362: if
(error.name === 'TypeMismatchError') {
On 2017/06/07 07:32:17, fukino wrote:
> You don't need to try getFile first and handle the error.
> source.isFile can be used to distinguish file vs directory (see #404)

Done.

https://codereview.chromium.org/2923163002/diff/40001/ui/file_manager/file_ma...
ui/file_manager/file_manager/background/js/file_operation_util.js:364:
entry.removeRecursively(function() {
On 2017/06/07 07:32:17, fukino wrote:
> Hmm... I'm not sure if we should remove all files in the directory...
> Is it possible to remove only incomplete file(s)?

onCopyProgress supplies copy start and end event for individual files. However,
status.type === 'begin_copy_entry' does not contain status.destinationUrl, so at
least we need path.join equivalent to do so (and it's not clean.)

Powered by Google App Engine
This is Rietveld 408576698