diff --git a/src/file/FileUtils.js b/src/file/FileUtils.js index 31386b87bef..dc8e1d649e2 100644 --- a/src/file/FileUtils.js +++ b/src/file/FileUtils.js @@ -45,8 +45,8 @@ define(function (require, exports, module) { * Asynchronously reads a file as UTF-8 encoded text. * @param {!File} file File to read * @return {$.Promise} a jQuery promise that will be resolved with the - * file's text content plus its timestamp, or rejected with a FileSystemError if - * the file can not be read. + * file's text content plus its timestamp, or rejected with a FileSystemError string + * constant if the file can not be read. */ function readAsText(file) { var result = new $.Deferred(); @@ -77,7 +77,7 @@ define(function (require, exports, module) { * errors---which can be triggered if the actual file contents differ from * the FileSystem's last-known contents---should be ignored. * @return {$.Promise} a jQuery promise that will be resolved when - * file writing completes, or rejected with a FileSystemError. + * file writing completes, or rejected with a FileSystemError string constant. */ function writeText(file, text, allowBlindWrite) { var result = new $.Deferred(), diff --git a/src/filesystem/FileSystem.js b/src/filesystem/FileSystem.js index 3300b25ec99..0f6ac31e711 100644 --- a/src/filesystem/FileSystem.js +++ b/src/filesystem/FileSystem.js @@ -46,6 +46,11 @@ * * a File - the contents of the file have changed, and should be reloaded. * * a Directory - an immediate child of the directory has been added, removed, * or renamed/moved. Not triggered for "grandchildren". + * - If the added & removed arguments are null, we don't know what was added/removed: + * clients should assume the whole subtree may have changed. + * - If the added & removed arguments are 0-length, there's no net change in the set + * of files but a file may have been replaced: clients should assume the contents + * of any immediate child file may have changed. * * null - a 'wholesale' change happened, and you should assume everything may * have changed. * For changes made externally, there may be a significant delay before a "change" event @@ -777,9 +782,11 @@ define(function (require, exports, module) { } else { this._handleDirectoryChange(entry, function (added, removed) { entry._stat = stat; - if (!(added && added.length === 0 && removed && removed.length === 0)) { - this._fireChangeEvent(entry, added, removed); - } + + // We send a change even if added & removed are both length zero-length. Something may still have changed, + // e.g. a file may have been quickly removed & re-added before we got a chance to reread the directory + // listing. + this._fireChangeEvent(entry, added, removed); }.bind(this)); } }