Ensure that the length
property won't be *accidentally* accessed on a DecodeStream
-instance
For these streams, compared to `Stream` and `ChunkedStream`, there's no well defined concept of length and consequently no `length` getter.[1] However, attempting to access the non-existent `length` won't currently error, but just return `undefined`, which could thus easily lead to bugs elsewhere in the code-base. --- [1] However, note that *all* stream implementations have an `isEmpty` getter which can be used instead.
This commit is contained in:
parent
aef3fedc29
commit
a11b7341a1
@ -167,6 +167,11 @@ var DecodeStream = (function DecodeStreamClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DecodeStream.prototype = {
|
DecodeStream.prototype = {
|
||||||
|
// eslint-disable-next-line getter-return
|
||||||
|
get length() {
|
||||||
|
unreachable("Should not access DecodeStream.length");
|
||||||
|
},
|
||||||
|
|
||||||
get isEmpty() {
|
get isEmpty() {
|
||||||
while (!this.eof && this.bufferLength === 0) {
|
while (!this.eof && this.bufferLength === 0) {
|
||||||
this.readBlock();
|
this.readBlock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user