summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaichi Hirono <hirono@chromium.org>2014-11-13 16:51:34 +0900
committerDaichi Hirono <hirono@chromium.org>2014-11-13 07:54:01 +0000
commit9aa8420e0f237267a3d612f749872884af378388 (patch)
treeb38a3dd411f61440a405beda39c5b7305b319b37
parent8c9d1ebc4a554fbde1581bebff32e8e6e46bfd33 (diff)
downloadchromium_src-9aa8420e0f237267a3d612f749872884af378388.zip
chromium_src-9aa8420e0f237267a3d612f749872884af378388.tar.gz
chromium_src-9aa8420e0f237267a3d612f749872884af378388.tar.bz2
Files.app: Add guard closure for selectedAsyncData.
The FileTransferController#selectedAsyncData is cache of data that cannot be obtained synchronously. This is needed for assigning the data to DataTransfer in the event handler. The data can be null if the event is dispatched before the data is obtained. BUG=431650 TEST=None TBR=fukino Review URL: https://codereview.chromium.org/704333003 Cr-Commit-Position: refs/heads/master@{#303444} (cherry picked from commit 5bb64a5b8ff45d1326552f70f687f378a76af97f) Review URL: https://codereview.chromium.org/723053002 Cr-Commit-Position: refs/branch-heads/2214@{#24} Cr-Branched-From: 03655fd3f6d72165dc3c9bd2c89807305316fe6c-refs/heads/master@{#303346}
-rw-r--r--ui/file_manager/file_manager/foreground/js/file_transfer_controller.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
index 78d4004..cb0c6b1 100644
--- a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
@@ -200,7 +200,10 @@ FileTransferController.prototype = {
var externalFileUrl;
for (var i = 0; i < this.selectedEntries_.length; i++) {
var url = this.selectedEntries_[i].toURL();
- dataTransfer.items.add(this.selectedAsyncData_[url].file);
+ if (!this.selectedAsyncData_[url])
+ continue;
+ if (this.selectedAsyncData_[url].file)
+ dataTransfer.items.add(this.selectedAsyncData_[url].file);
if (!externalFileUrl)
externalFileUrl = this.selectedAsyncData_[url].externalFileUrl;
}