Bug 997364 - Make fileAppender chain promises on file creation.; r=irving

This commit is contained in:
Chris Manchester 2014-05-16 19:45:04 -04:00
parent fb0b5848d3
commit af38d16c1f
2 changed files with 6 additions and 6 deletions

View File

@ -893,14 +893,9 @@ FileAppender.prototype = {
_getFile: function() {
if (!this._fileReadyPromise) {
this._fileReadyPromise = this._openFile();
return this._fileReadyPromise;
}
return this._fileReadyPromise.then(_ => {
if (!this._file) {
return this._openFile();
}
});
return this._fileReadyPromise;
},
doAppend: function (formatted) {

View File

@ -288,6 +288,11 @@ add_task(function test_FileAppender() {
add_task(function test_BoundedFileAppender() {
let dir = OS.Path.join(do_get_profile().path, "test_Log");
if (!(yield OS.File.exists(dir))) {
yield OS.File.makeDir(dir);
}
let path = OS.Path.join(dir, "test_BoundedFileAppender");
// This appender will hold about two lines at a time.
let appender = new Log.BoundedFileAppender(path, testFormatter, 40);