src/document/DocumentCommandHandlers.js
function _doRevert(doc, suppressError) {
        var result = new $.Deferred();

        FileUtils.readAsText(doc.file)
            .done(function (text, readTimestamp) {
                doc.refreshText(text, readTimestamp);
                result.resolve();
            })
            .fail(function (error) {
                if (suppressError) {
                    result.resolve();
                } else {
                    showFileOpenError(error, doc.file.fullPath)
                        .done(function () {
                            result.reject(error);
                        });
                }
            });

        return result.promise();
    }
function _doRevert(doc, suppressError) {
        var result = new $.Deferred();

        FileUtils.readAsText(doc.file)
            .done(function (text, readTimestamp) {
                doc.refreshText(text, readTimestamp);
                result.resolve();
            })
            .fail(function (error) {
                if (suppressError) {
                    result.resolve();
                } else {
                    showFileOpenError(error, doc.file.fullPath)
                        .done(function () {
                            result.reject(error);
                        });
                }
            });

        return result.promise();
    }
function _doRevert ( doc , suppressError ) { var result = new $ . Deferred ( ) ; FileUtils . readAsText ( doc . file ) . done ( function ( text , readTimestamp ) { doc . refreshText ( text , readTimestamp ) ; result . resolve ( ) ; } ) . fail ( function ( error ) { if ( suppressError ) { result . resolve ( ) ; } else { showFileOpenError ( error , doc . file . fullPath ) . done ( function ( ) { result . reject ( error ) ; } ) ; } } ) ; return result . promise ( ) ; }
Reverts the Document to the current contents of its file on disk. Discards any unsaved changes
in the Document.
@private
@param {Document} doc
@param {boolean=} suppressError If true, then a failure to read the file will be ignored and the
resulting promise will be resolved rather than rejected.
@return {$.Promise} a Promise that's resolved when done, or (if suppressError is false)
rejected with a FileSystemError if the file cannot be read (after showing an error
dialog to the user).
Reverts the Document to the current contents of its file on disk . Discards any unsaved changes in the Document .