Merge pull request #69 from ispedals/fix-symlink-test

refactor callback chain
This commit is contained in:
Alan K 2013-12-10 09:44:09 -08:00
commit a81f3814f5
1 changed files with 13 additions and 40 deletions

View File

@ -205,35 +205,18 @@ define(["IDBFS"], function(IDBFS) {
that.fs.symlink('/myfile', '/myfilelink1', function(error) { that.fs.symlink('/myfile', '/myfilelink1', function(error) {
if(error) throw error; if(error) throw error;
that.fs.symlink('/myfilelink1', '/myfilelink2', function(error) {
function createSymlinkChain(n) {
if(n>1) {
that.fs.symlink('/myfilelink' + (n-1), '/myfilelink' + n, function(error) {
if(error) throw error; if(error) throw error;
that.fs.symlink('/myfilelink2', '/myfilelink3', function(error) { createSymlinkChain(n-1);
if(error) throw error; });
}
};
that.fs.symlink('/myfilelink3', '/myfilelink4', function(error) { createSymlinkChain(11);
if(error) throw error;
that.fs.symlink('/myfilelink4', '/myfilelink5', function(error) {
if(error) throw error;
that.fs.symlink('/myfilelink5', '/myfilelink6', function(error) {
if(error) throw error;
that.fs.symlink('/myfilelink6', '/myfilelink7', function(error) {
if(error) throw error;
that.fs.symlink('/myfilelink7', '/myfilelink8', function(error) {
if(error) throw error;
that.fs.symlink('/myfilelink8', '/myfilelink9', function(error) {
if(error) throw error;
that.fs.symlink('/myfilelink9', '/myfilelink10', function(error) {
if(error) throw error;
that.fs.symlink('/myfilelink10', '/myfilelink11', function(error) {
if(error) throw error;
that.fs.stat('/myfilelink11', function(error, result) { that.fs.stat('/myfilelink11', function(error, result) {
_error = error; _error = error;
@ -244,16 +227,6 @@ define(["IDBFS"], function(IDBFS) {
}); });
}); });
}); });
});
});
});
});
});
});
});
});
});
});
waitsFor(function() { waitsFor(function() {
return complete; return complete;