Throwing error on FileWriter.abort() if writer is not in the correct state. Lining up with iPhone and BlackBerry

This commit is contained in:
macdonst 2011-02-03 02:22:00 +08:00
parent a0c761664d
commit 7952668cf7

View File

@ -425,6 +425,11 @@ FileWriter.DONE = 2;
* Abort writing file. * Abort writing file.
*/ */
FileWriter.prototype.abort = function() { FileWriter.prototype.abort = function() {
// check for invalid state
if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) {
throw FileError.INVALID_STATE_ERR;
}
// set error // set error
var error = new FileError(); var error = new FileError();
error.code = error.ABORT_ERR; error.code = error.ABORT_ERR;