You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v8.0.0 — zlib.DeflateRaw only extensible via class keyword #13358
changed the title [-]zlib.deflateRaw only extensible via class keyword[/-][+]v8.0.0 — zlib.deflateRaw only extensible via class keyword[/+]on Jun 1, 2017
changed the title [-]v8.0.0 — zlib.deflateRaw only extensible via class keyword[/-][+]v8.0.0 — zlib.DeflateRaw only extensible via class keyword[/+]on Jun 1, 2017
This seems to be happening because zlib.DeflateRaw now returns a new object instead of mutating this. While technically valid, it breaks common inheritance patterns. (As seen above.)
<pre><s>
var extend = require('util')._extend
function NotInitialized (options) {
var stream = zlib.DeflateRaw.call(this, options);
if (stream) extend(this, stream)
this.prop = true
}
inherits(NotInitialized, zlib.DeflateRaw);
</s></pre>
Yeah, that doesn't actually work. If `NotInitailized`'s constructor just mutated and returned `stream` then it should be fine, though ofc you don't need the inherits then since you aren't doing any.
I'm just getting going this morning so I'll have a look a bit more in depth soon, but does this break an existing module or does it just not work as it was expected?
Activity
[-]zlib.deflateRaw not extensible via[/-][+]zlib.deflateRaw only extensible via class keyword[/+][-]zlib.deflateRaw only extensible via class keyword[/-][+]v8.0.0 — zlib.deflateRaw only extensible via class keyword[/+][-]v8.0.0 — zlib.deflateRaw only extensible via class keyword[/-][+]v8.0.0 — zlib.DeflateRaw only extensible via class keyword[/+]iarna commentedon Jun 1, 2017
This seems to be happening because
zlib.DeflateRawnow returns a new object instead of mutatingthis. While technically valid, it breaks common inheritance patterns. (As seen above.)mscdex commentedon Jun 1, 2017
/cc @jasnell
jasnell commentedon Jun 1, 2017
I'm just getting going this morning so I'll have a look a bit more in depth soon, but does this break an existing module or does it just not work as it was expected?
mcollina commentedon Jun 1, 2017
Yes, completely. I have a quick fix ready to go, a PR is coming soon.
jasnell commentedon Jun 1, 2017
Ok. Sigh, we should get those into citgm then.
mcollina commentedon Jun 1, 2017
PR with a fix in #13370.
@iarna I have not verified this with the affected module, I just checked that the example you provided passes.
iarna commentedon Jun 1, 2017
@mcollina I'll give the module I was using a go with the PR in a few hours.
jasnell commentedon Jun 1, 2017
@iarna ... I think #13374 is the direction we're most likely to go on fixing this.
zlib: revert back to Functions
zlib: revert back to Functions