diff options
author | mtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-16 02:26:23 +0000 |
---|---|---|
committer | mtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-16 02:26:23 +0000 |
commit | c8174da71d9fb39bff0169280fedb13ec04278ee (patch) | |
tree | 9cf396ef3c6247f19c051ac70d2c743682430f9a | |
parent | 2be821cb82fd34fd96c1e5f626f41ad4d9cf1b87 (diff) | |
download | chromium_src-c8174da71d9fb39bff0169280fedb13ec04278ee.zip chromium_src-c8174da71d9fb39bff0169280fedb13ec04278ee.tar.gz chromium_src-c8174da71d9fb39bff0169280fedb13ec04278ee.tar.bz2 |
Merge 195825 "Fix problems with deleting files in Files.app."
> Fix problems with deleting files in Files.app.
>
> Sometimes, especially when having more than one window open, Files.app was failing while deleting files. This was caused by an Event serialization and deserialization. A delete status event contains an array of urls. This array of urls is passed to the metadata cache, which were failing on checking if the argument is an array using the instanceof operator. The instanceof Array operator was returning false. This patch solves this issue by rebuilding the array received from an event using splice.
>
> TEST=Open two windows of Files.app, try to delete in any of them. Should succeed on both Drive and in Downloads.
> BUG=222068
>
> Review URL: https://chromiumcodereview.appspot.com/14069020
TBR=mtomasz@chromium.org
Review URL: https://codereview.chromium.org/14744018
git-svn-id: svn://svn.chromium.org/chrome/branches/1453/src@200418 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/file_manager/js/butter_bar.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/chrome/browser/resources/file_manager/js/butter_bar.js b/chrome/browser/resources/file_manager/js/butter_bar.js index 158fd92..195373f 100644 --- a/chrome/browser/resources/file_manager/js/butter_bar.js +++ b/chrome/browser/resources/file_manager/js/butter_bar.js @@ -339,21 +339,22 @@ ButterBar.prototype.onCopyProgress_ = function(event) { * @private */ ButterBar.prototype.onDelete_ = function(event) { + var urls = Array.prototype.slice.call(event.urls); switch (event.reason) { case 'BEGIN': if (this.currentMode_ != ButterBar.Mode.DELETE) this.totalDeleted_ = 0; case 'PROGRESS': var props = []; - for (var i = 0; i < event.urls.length; i++) { + for (var i = 0; i < urls.length; i++) { props[i] = { deleted: true }; } - this.metadataCache_.set(event.urls, 'internal', props); + this.metadataCache_.set(urls, 'internal', props); - this.totalDeleted_ += event.urls.length; + this.totalDeleted_ += urls.length; var title = strf('DELETED_MESSAGE_PLURAL', this.totalDeleted_); if (this.totalDeleted_ == 1) { - var fullPath = util.extractFilePath(event.urls[0]); + var fullPath = util.extractFilePath(urls[0]); var fileName = PathUtil.split(fullPath).pop(); title = strf('DELETED_MESSAGE', fileName); } @@ -366,10 +367,10 @@ ButterBar.prototype.onDelete_ = function(event) { case 'SUCCESS': var props = []; - for (var i = 0; i < event.urls.length; i++) { + for (var i = 0; i < urls.length; i++) { props[i] = { deleted: false }; } - this.metadataCache_.set(event.urls, 'internal', props); + this.metadataCache_.set(urls, 'internal', props); this.hide_(); break; |