Skip to content

Commit

Permalink
lib: move process.binding('js_stream') to internalBinding
Browse files Browse the repository at this point in the history
PR-URL: #22239
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
antsmartian authored and addaleax committed Sep 18, 2018
1 parent 9ccf5c8 commit dcc0c2c
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,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

0 comments on commit dcc0c2c

Please sign in to comment.