From 4f48ddb72f3322c5d5b42649736e1e02b19790c0 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 6 Oct 2018 18:09:45 -0700 Subject: [PATCH] zlib: move process.binding('zlib') to internalBinding PR-URL: https://github.com/nodejs/node/pull/23307 Reviewed-By: Colin Ihrig Reviewed-By: Gus Caplan Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat Reviewed-By: Weijia Wang Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani --- lib/internal/bootstrap/node.js | 3 ++- lib/zlib.js | 2 +- src/node_zlib.cc | 2 +- test/async-hooks/test-zlib.zlib-binding.deflate.js | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 3770c71fe21f96..d3bd5d74e08095 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -412,7 +412,8 @@ 'async_wrap', 'url', 'spawn_sync', - 'js_stream']); + 'js_stream', + 'zlib']); process.binding = function binding(name) { return internalBindingWhitelist.has(name) ? internalBinding(name) : diff --git a/lib/zlib.js b/lib/zlib.js index 97b12410f121ef..6ec1d680d8aa8d 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -36,7 +36,7 @@ const { isArrayBufferView } } = require('util'); -const binding = process.binding('zlib'); +const binding = internalBinding('zlib'); const assert = require('assert').ok; const { Buffer, diff --git a/src/node_zlib.cc b/src/node_zlib.cc index aef5e3e40ffa80..0935d3f731ded4 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -850,4 +850,4 @@ void DefineZlibConstants(Local target) { } // namespace node -NODE_BUILTIN_MODULE_CONTEXT_AWARE(zlib, node::Initialize) +NODE_MODULE_CONTEXT_AWARE_INTERNAL(zlib, node::Initialize) diff --git a/test/async-hooks/test-zlib.zlib-binding.deflate.js b/test/async-hooks/test-zlib.zlib-binding.deflate.js index ddcba9d89630f7..972052b2d570a5 100644 --- a/test/async-hooks/test-zlib.zlib-binding.deflate.js +++ b/test/async-hooks/test-zlib.zlib-binding.deflate.js @@ -1,3 +1,4 @@ +// Flags: --expose-internals 'use strict'; const common = require('../common'); @@ -8,7 +9,8 @@ const { checkInvocations } = require('./hook-checks'); const hooks = initHooks(); hooks.enable(); -const Zlib = process.binding('zlib').Zlib; +const { internalBinding } = require('internal/test/binding'); +const { Zlib } = internalBinding('zlib'); const constants = process.binding('constants').zlib; const handle = new Zlib(constants.DEFLATE);