removed comments and patched parameter name and potential undefined error

This commit is contained in:
Barry Tulchinsky 2014-01-13 20:03:54 -05:00
parent b08a8d15dd
commit d31d33651c
2 changed files with 8 additions and 15 deletions

View File

@ -227,7 +227,7 @@ define(function(require) {
* set extended attribute (refactor)
*/
function set_extended_attribute (context, path, name, value, flag, callback) {
function set_extended_attribute (context, path_or_fd, name, value, flag, callback) {
function set_xattr (error, node) {
var xattr = (node ? node.xattrs[name] : null);
@ -246,11 +246,11 @@ define(function(require) {
}
}
if (typeof path == 'string') {
find_node(context, path, set_xattr);
if (typeof path_or_fd == 'string') {
find_node(context, path_or_fd, set_xattr);
}
else if (typeof path.id == 'string') {
context.get(path.id, set_xattr);
else if (typeof path_or_fd == 'object' && typeof path_or_fd.id == 'string') {
context.get(path_or_fd.id, set_xattr);
}
else {
callback(new EInvalid('path or file descriptor of wrong type'));

View File

@ -15,18 +15,11 @@ define(["IDBFS"], function(IDBFS) {
});
it('should be a function', function () {
// that = this;
// that.fs.writeFile('/testfile/this/is/a/dir/tmp', function (error) {
// if (error) throw error;
// that.fs.setxattr('/testfile/this/is/a/dir/tmp', 'test', 'value', function (error) {
// });
// });
expect(typeof this.fs.setxattr).toEqual('function');
expect(typeof this.fs.getxattr).toEqual('function');
expect(typeof this.fs.removexattr).toEqual('function');
expect(typeof this.fs.fsetxattr).toEqual('function');
expect(typeof this.fs.fgetxattr).toEqual('function');
});
it('should error when setting with a name that is not a string', function () {