Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib: move process.binding('zlib') to internalBinding #23307

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/internal/bootstrap/node.js
Expand Up @@ -411,7 +411,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
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
Expand Up @@ -831,4 +831,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
@@ -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