From b57c1f84623214d54b2b558cb813efcc147790fb Mon Sep 17 00:00:00 2001 From: solebox <5013box@gmail.com> Date: Tue, 1 Nov 2016 01:11:18 +0200 Subject: [PATCH 1/2] zlib: name every function Ref: #8913 --- lib/zlib.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/zlib.js b/lib/zlib.js index 42dd561623cb75..ea9d5cfac16642 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -347,7 +347,7 @@ function Zlib(opts, mode) { var self = this; this._hadError = false; - this._handle.onerror = function(message, errno) { + this._handle.onerror = (message, errno) => { // there is no way to cleanly recover. // continuing only obscures problems. _close(self); @@ -402,7 +402,7 @@ Zlib.prototype.params = function(level, strategy, callback) { if (this._level !== level || this._strategy !== strategy) { var self = this; - this.flush(constants.Z_SYNC_FLUSH, function() { + this.flush(constants.Z_SYNC_FLUSH, function flushCallback() { assert(self._handle, 'zlib binding closed'); self._handle.params(level, strategy); if (!self._hadError) { @@ -443,7 +443,8 @@ Zlib.prototype.flush = function(kind, callback) { this.once('end', callback); } else if (ws.needDrain) { if (callback) { - this.once('drain', () => this.flush(kind, callback)); + const drainHandler = () => this.flush(kind, callback); + this.once('drain', drainHandler); } } else { this._flushFlag = kind; From 0aade16fbe4a3c24ac3c842567cd34b6a96404a6 Mon Sep 17 00:00:00 2001 From: solebox <5013box@gmail.com> Date: Wed, 2 Nov 2016 19:35:06 +0200 Subject: [PATCH 2/2] zlib: name every function Ref: #8913 --- lib/zlib.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zlib.js b/lib/zlib.js index ea9d5cfac16642..d8c41659c54c43 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -347,7 +347,7 @@ function Zlib(opts, mode) { var self = this; this._hadError = false; - this._handle.onerror = (message, errno) => { + this._handle.onerror = function onErrorHandler(message, errno) { // there is no way to cleanly recover. // continuing only obscures problems. _close(self);