mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
src: ignore invalid mask values
- Avoiding a TypeError exception @ packValueMask. - Added a test.
This commit is contained in:
parent
ea67111025
commit
76ce6c4141
2 changed files with 21 additions and 6 deletions
|
|
@ -213,13 +213,16 @@ function packValueMask(reqname, values)
|
|||
if (!reqValueMask)
|
||||
throw new Error(reqname + ': no value mask description');
|
||||
|
||||
for (var v in values)
|
||||
for (var value in values)
|
||||
{
|
||||
var valueBit = reqValueMask[v].mask;
|
||||
if (!valueBit)
|
||||
throw new Error(reqname + ': incorrect value param ' + v);
|
||||
masksList.push(valueBit);
|
||||
bitmask |= valueBit;
|
||||
var v = reqValueMask[value];
|
||||
if (v) {
|
||||
var valueBit = v.mask;
|
||||
if (!valueBit)
|
||||
throw new Error(reqname + ': incorrect value param ' + value);
|
||||
masksList.push(valueBit);
|
||||
bitmask |= valueBit;
|
||||
}
|
||||
}
|
||||
|
||||
/* numeric sort */
|
||||
|
|
|
|||
|
|
@ -82,7 +82,19 @@ describe('ConfigureWindow', function() {
|
|||
this.X.LowerWindow(this.wid);
|
||||
});
|
||||
|
||||
it('should ignore invalid mask values', function(done) {
|
||||
this.X.once('event', function(ev) {
|
||||
ev.x.should.equal(0);
|
||||
done();
|
||||
});
|
||||
|
||||
this.X.ConfigureWindow(this.wid, { foo : 3, x : 0 }, function(err) {
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
this.X.removeAllListeners('event');
|
||||
this.X.DestroyWindow(this.wid);
|
||||
this.X.DestroyWindow(this.wid_helper);
|
||||
this.X.on('end', done);
|
||||
|
|
|
|||
Loading…
Reference in a new issue