Commit 94b2fd41 authored by fukino's avatar fukino Committed by Commit bot

Files.app: Skip updating subdirectories of a volume whose display root is not gotten yet.

Now that volumes other than Google Drive can be expanded in the directory tree,
there is a case that subdirectories are queried befor the displayroot of volume is
obtained. In this case, we should skip updating subdirectories. After the displayroot
is obtained, updateSubDirectories will be called.

BUG=459534
TEST=manually check the steps described in the issue.

Review URL: https://codereview.chromium.org/940443003

Cr-Commit-Position: refs/heads/master@{#316994}
parent 8999968b
...@@ -418,7 +418,7 @@ VolumeInfoList.prototype.findIndex = function(volumeId) { ...@@ -418,7 +418,7 @@ VolumeInfoList.prototype.findIndex = function(volumeId) {
/** /**
* Searches the information of the volume that contains the passed entry. * Searches the information of the volume that contains the passed entry.
* @param {Entry|Object} entry Entry on the volume to be found. * @param {!Entry|!Object} entry Entry on the volume to be found.
* @return {VolumeInfo} The volume's information, or null if not found. * @return {VolumeInfo} The volume's information, or null if not found.
*/ */
VolumeInfoList.prototype.findByEntry = function(entry) { VolumeInfoList.prototype.findByEntry = function(entry) {
...@@ -814,7 +814,7 @@ VolumeManager.prototype.getCurrentProfileVolumeInfo = function(volumeType) { ...@@ -814,7 +814,7 @@ VolumeManager.prototype.getCurrentProfileVolumeInfo = function(volumeType) {
/** /**
* Obtains location information from an entry. * Obtains location information from an entry.
* *
* @param {(Entry|Object)} entry File or directory entry. It can be a fake * @param {(!Entry|!Object)} entry File or directory entry. It can be a fake
* entry. * entry.
* @return {EntryLocation} Location information. * @return {EntryLocation} Location information.
*/ */
......
...@@ -589,7 +589,7 @@ Object.freeze(util.EntryChangedKind); ...@@ -589,7 +589,7 @@ Object.freeze(util.EntryChangedKind);
/** /**
* Obtains whether an entry is fake or not. * Obtains whether an entry is fake or not.
* @param {(Entry|Object)} entry Entry or a fake entry. * @param {(!Entry|!Object)} entry Entry or a fake entry.
* @return {boolean} True if the given entry is fake. * @return {boolean} True if the given entry is fake.
*/ */
util.isFakeEntry = function(entry) { util.isFakeEntry = function(entry) {
......
...@@ -1091,7 +1091,7 @@ DirectoryModel.prototype.onVolumeInfoListUpdated_ = function(event) { ...@@ -1091,7 +1091,7 @@ DirectoryModel.prototype.onVolumeInfoListUpdated_ = function(event) {
* Creates directory contents for the entry and query. * Creates directory contents for the entry and query.
* *
* @param {FileListContext} context File list context. * @param {FileListContext} context File list context.
* @param {DirectoryEntry} entry Current directory. * @param {!DirectoryEntry} entry Current directory.
* @param {string=} opt_query Search query string. * @param {string=} opt_query Search query string.
* @return {DirectoryContents} Directory contents. * @return {DirectoryContents} Directory contents.
* @private * @private
......
...@@ -103,7 +103,7 @@ NamingController.prototype.validateFileNameForSaving = function(filename) { ...@@ -103,7 +103,7 @@ NamingController.prototype.validateFileNameForSaving = function(filename) {
if (!isValid) if (!isValid)
return Promise.reject('Invalid filename.'); return Promise.reject('Invalid filename.');
if (util.isFakeEntry(directory)) { if (directory && util.isFakeEntry(directory)) {
// Can't save a file into a fake directory. // Can't save a file into a fake directory.
return Promise.reject('Cannot save into fake entry.'); return Promise.reject('Cannot save into fake entry.');
} }
......
...@@ -223,7 +223,7 @@ DirectoryItem.prototype.handleClick = function(e) { ...@@ -223,7 +223,7 @@ DirectoryItem.prototype.handleClick = function(e) {
*/ */
DirectoryItem.prototype.updateSubDirectories = function( DirectoryItem.prototype.updateSubDirectories = function(
recursive, opt_successCallback, opt_errorCallback) { recursive, opt_successCallback, opt_errorCallback) {
if (util.isFakeEntry(this.entry)) { if (!this.entry || util.isFakeEntry(this.entry)) {
if (opt_errorCallback) if (opt_errorCallback)
opt_errorCallback(); opt_errorCallback();
return; return;
...@@ -445,6 +445,11 @@ function VolumeItem(modelItem, tree) { ...@@ -445,6 +445,11 @@ function VolumeItem(modelItem, tree) {
VolumeItem.prototype = { VolumeItem.prototype = {
__proto__: DirectoryItem.prototype, __proto__: DirectoryItem.prototype,
/**
* Directory entry for the display root, whose initial value is null.
* @type {DirectoryEntry}
* @override
*/
get entry() { get entry() {
return this.volumeInfo_.displayRoot; return this.volumeInfo_.displayRoot;
}, },
......
...@@ -265,7 +265,7 @@ VolumeManagerWrapper.prototype.getDefaultDisplayRoot = ...@@ -265,7 +265,7 @@ VolumeManagerWrapper.prototype.getDefaultDisplayRoot =
/** /**
* Obtains location information from an entry. * Obtains location information from an entry.
* *
* @param {(Entry|Object)} entry File or directory entry. * @param {(!Entry|!Object)} entry File or directory entry.
* @return {EntryLocation} Location information. * @return {EntryLocation} Location information.
*/ */
VolumeManagerWrapper.prototype.getLocationInfo = function(entry) { VolumeManagerWrapper.prototype.getLocationInfo = function(entry) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment