Updating cordova.android.js with File API fixes.

This commit is contained in:
Bryce Curtis 2012-02-28 22:32:30 -06:00
parent f6503f8476
commit 3ebc1d71df

View File

@ -2264,7 +2264,10 @@ DirectoryEntry.prototype.getDirectory = function(path, options, successCallback,
* @param {Function} errorCallback is called with a FileError * @param {Function} errorCallback is called with a FileError
*/ */
DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) { DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) {
exec(successCallback, errorCallback, "File", "removeRecursively", [this.fullPath]); var fail = function(code) {
errorCallback(new FileError(code));
};
exec(successCallback, fail, "File", "removeRecursively", [this.fullPath]);
}; };
/** /**
@ -2326,7 +2329,10 @@ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback)
} }
successCallback(retVal); successCallback(retVal);
}; };
exec(win, errorCallback, "File", "readEntries", [this.path]); var fail = function(code) {
errorCallback(new FileError(code));
};
exec(win, fail, "File", "readEntries", [this.path]);
}; };
module.exports = DirectoryReader; module.exports = DirectoryReader;
@ -2373,8 +2379,10 @@ Entry.prototype.getMetadata = function(successCallback, errorCallback) {
var metadata = new Metadata(lastModified); var metadata = new Metadata(lastModified);
successCallback(metadata); successCallback(metadata);
}; };
var fail = function(code) {
exec(success, errorCallback, "File", "getMetadata", [this.fullPath]); errorCallback(new FileError(code));
};
exec(success, fail, "File", "getMetadata", [this.fullPath]);
}; };
/** /**
@ -2520,7 +2528,10 @@ Entry.prototype.remove = function(successCallback, errorCallback) {
* @param errorCallback {Function} called with a FileError * @param errorCallback {Function} called with a FileError
*/ */
Entry.prototype.getParent = function(successCallback, errorCallback) { Entry.prototype.getParent = function(successCallback, errorCallback) {
exec(successCallback, errorCallback, "File", "getParent", [this.fullPath]); var fail = function(code) {
errorCallback(new FileError(code));
};
exec(successCallback, fail, "File", "getParent", [this.fullPath]);
}; };
module.exports = Entry; module.exports = Entry;
@ -3740,7 +3751,6 @@ var NetworkConnection = function () {
if (info === "none") { if (info === "none") {
// set a timer if still offline at the end of timer send the offline event // set a timer if still offline at the end of timer send the offline event
me._timer = setTimeout(function(){ me._timer = setTimeout(function(){
me.type = type;
cordova.fireWindowEvent("offline"); cordova.fireWindowEvent("offline");
me._timer = null; me._timer = null;
}, me.timeout); }, me.timeout);
@ -3957,7 +3967,10 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) {
errorCallback(new FileError(FileError.NOT_FOUND_ERR)); errorCallback(new FileError(FileError.NOT_FOUND_ERR));
} }
}; };
exec(success, errorCallback, "File", "requestFileSystem", [type, size]); var fail = function(e) {
errorCallback(new FileError(e));
};
exec(success, fail, "File", "requestFileSystem", [type, size]);
} }
}; };