Skip to content

Commit

Permalink
bug: remove non-standard behavior
Browse files Browse the repository at this point in the history
> The style can be either a string containing a CSS color, or a CanvasGradient or CanvasPattern object. Invalid values are ignored
  • Loading branch information
zbjornson committed Jul 17, 2020
1 parent 4ce04af commit bf5126b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -24,6 +24,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
* Fix compile errors with cairo
* Fix Image#complete if the image failed to load.
* Upgrade node-pre-gyp to v0.15.0 to use latest version of needle to fix error when downloading prebuilds.
* Don't throw if `fillStyle` or `strokeStyle` is set to an object, but that object is not a Gradient or Pattern. (This behavior was non-standard: invalid inputs are supposed to be ignored.)

2.6.1
==================
Expand Down
6 changes: 0 additions & 6 deletions src/CanvasRenderingContext2d.cc
Expand Up @@ -1844,9 +1844,6 @@ NAN_SETTER(Context2d::SetFillStyle) {
context->_fillStyle.Reset(value);
Pattern *pattern = Nan::ObjectWrap::Unwrap<Pattern>(obj);
context->state->fillPattern = pattern->pattern();
} else {
// TODO this is non-standard
Nan::ThrowTypeError("Gradient or Pattern expected");
}
}
}
Expand Down Expand Up @@ -1890,9 +1887,6 @@ NAN_SETTER(Context2d::SetStrokeStyle) {
context->_strokeStyle.Reset(value);
Pattern *pattern = Nan::ObjectWrap::Unwrap<Pattern>(obj);
context->state->strokePattern = pattern->pattern();
} else {
// TODO this is non-standard
return Nan::ThrowTypeError("Gradient or Pattern expected");
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions test/canvas.test.js
Expand Up @@ -1766,10 +1766,6 @@ describe('Canvas', function () {
else
assert.strictEqual(byte, 255);
});

assert.throws(function () {
ctx.fillStyle = Object.create(null);
});
});

});

0 comments on commit bf5126b

Please sign in to comment.