-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zlib: fix inheritance of DeflateRaw without class
Fixes internal/util createClassWrapper to support inheritance without using classes. The constructor now needs to be defined using a Symbol. Fixes: #13358
- Loading branch information
Showing
4 changed files
with
108 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const zlib = require('zlib'); | ||
const inherits = require('util').inherits; | ||
const { Readable } = require('stream'); | ||
|
||
// validates that zlib.DeflateRaw can be inherited | ||
// with util.inherits | ||
|
||
function NotInitialized(options) { | ||
zlib.DeflateRaw.call(this, options); | ||
this.prop = true; | ||
} | ||
inherits(NotInitialized, zlib.DeflateRaw); | ||
|
||
const dest = new NotInitialized(); | ||
|
||
const read = new Readable({ | ||
read() { | ||
this.push(Buffer.from('a test string')); | ||
this.push(null); | ||
} | ||
}); | ||
|
||
read.pipe(dest); | ||
dest.resume(); |