Skip to content

Commit

Permalink
zlib: move process.binding('zlib') to internalBinding
Browse files Browse the repository at this point in the history
PR-URL: #23307
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
addaleax authored and jasnell committed Oct 17, 2018
1 parent 37e40e3 commit 4f48ddb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) :
Expand Down
2 changes: 1 addition & 1 deletion lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const {
isArrayBufferView
}
} = require('util');
const binding = process.binding('zlib');
const binding = internalBinding('zlib');
const assert = require('assert').ok;
const {
Buffer,
Expand Down
2 changes: 1 addition & 1 deletion src/node_zlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -850,4 +850,4 @@ void DefineZlibConstants(Local<Object> target) {

} // namespace node

NODE_BUILTIN_MODULE_CONTEXT_AWARE(zlib, node::Initialize)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(zlib, node::Initialize)
4 changes: 3 additions & 1 deletion test/async-hooks/test-zlib.zlib-binding.deflate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Flags: --expose-internals
'use strict';

const common = require('../common');
Expand All @@ -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);
Expand Down

0 comments on commit 4f48ddb

Please sign in to comment.