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

js_stream: move process.binding('js_stream') to internalBinding #22239

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@
'util',
'async_wrap',
'url',
'spawn_sync']);
'spawn_sync',
'js_stream']);
process.binding = function binding(name) {
return internalBindingWhitelist.has(name) ?
internalBinding(name) :
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/wrap_js_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const assert = require('assert');
const util = require('util');
const { Socket } = require('net');
const { JSStream } = process.binding('js_stream');
const { internalBinding } = require('internal/bootstrap/loaders');
const { JSStream } = internalBinding('js_stream');
const uv = internalBinding('uv');
const debug = util.debuglog('stream_wrap');
const { owner_symbol } = require('internal/async_hooks').symbols;
Expand Down
2 changes: 1 addition & 1 deletion src/js_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ void JSStream::Initialize(Local<Object> target,

} // namespace node

NODE_BUILTIN_MODULE_CONTEXT_AWARE(js_stream, node::JSStream::Initialize)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(js_stream, node::JSStream::Initialize)
5 changes: 4 additions & 1 deletion test/parallel/test-js-stream-call-properties.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Flags: --expose-internals

'use strict';

require('../common');
const util = require('util');
const JSStream = process.binding('js_stream').JSStream;
const { internalBinding } = require('internal/test/binding');
const { JSStream } = internalBinding('js_stream');

// Testing if will abort when properties are printed.
util.inspect(new JSStream());
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ assert(process.binding('signal_wrap'));
assert(process.binding('contextify'));
assert(process.binding('url'));
assert(process.binding('spawn_sync'));
assert(process.binding('js_stream'));
3 changes: 2 additions & 1 deletion test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

// Flags: --expose-internals
'use strict';
const common = require('../common');
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
const JSStream = process.binding('js_stream').JSStream;
const { JSStream } = internalBinding('js_stream');
const util = require('util');
const vm = require('vm');
const { previewEntries } = internalBinding('util');
Expand Down
5 changes: 3 additions & 2 deletions test/parallel/test-util-types.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Flags: --experimental-vm-modules
// Flags: --experimental-vm-modules --expose-internals
'use strict';
require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const { types, inspect } = require('util');
const vm = require('vm');
const { JSStream } = process.binding('js_stream');
const { internalBinding } = require('internal/test/binding');
const { JSStream } = internalBinding('js_stream');

const external = (new JSStream())._externalStream;
const wasmBuffer = fixtures.readSync('test.wasm');
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-v8-serdes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Flags: --expose-gc --expose-internals

'use strict';

const { internalBinding } = require('internal/test/binding');
const common = require('../common');
const assert = require('assert');
const v8 = require('v8');
Expand All @@ -20,7 +23,7 @@ const objects = [
circular
];

const hostObject = new (process.binding('js_stream').JSStream)();
const hostObject = new (internalBinding('js_stream').JSStream)();

const serializerTypeError =
/^TypeError: Class constructor Serializer cannot be invoked without 'new'$/;
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-async-wrap-getasyncid.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function testInitialized(req, ctor_name) {


{
const JSStream = process.binding('js_stream').JSStream;
const JSStream = internalBinding('js_stream').JSStream;
testInitialized(new JSStream(), 'JSStream');
}

Expand Down