Skip to content

Commit

Permalink
inspector: move process.binding to internalBinding
Browse files Browse the repository at this point in the history
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: nodejs#24931
Refs: nodejs#22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
BeniCheni authored and refack committed Jan 10, 2019
1 parent e956147 commit d7eb1a5
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
} = require('internal/errors').codes;
const { validateString } = require('internal/validators');
const util = require('util');
const { Connection, open, url } = process.binding('inspector');
const { Connection, open, url } = internalBinding('inspector');

if (!Connection)
throw new ERR_INSPECTOR_NOT_AVAILABLE();
Expand Down
1 change: 1 addition & 0 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const internalBindingWhitelist = [
'fs_event_wrap',
'http_parser',
'icu',
'inspector',
'js_stream',
'natives',
'pipe_wrap',
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/console/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path');
const CJSModule = require('internal/modules/cjs/loader');
const { makeRequireFunction } = require('internal/modules/cjs/helpers');
const { tryGetCwd } = require('internal/util');
const { addCommandLineAPI, consoleCall } = process.binding('inspector');
const { addCommandLineAPI, consoleCall } = internalBinding('inspector');

// Wrap a console implemented by Node.js with features from the VM inspector
function addInspectorApis(consoleFromNode, consoleFromVM) {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/inspector_async_hook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const inspector = process.binding('inspector');
const inspector = internalBinding('inspector');

if (!inspector || !inspector.asyncTaskScheduled) {
exports.setup = function() {};
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if (getOptionValue('--experimental-worker')) {
builtinLibs.sort();
}

if (typeof process.binding('inspector').open === 'function') {
if (typeof internalBinding('inspector').open === 'function') {
builtinLibs.push('inspector');
builtinLibs.sort();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ Module.prototype._compile = function(content, filename) {
// Set breakpoint on module start
if (filename === resolvedArgv) {
delete process._breakFirstLine;
inspectorWrapper = process.binding('inspector').callAndPauseOnStart;
inspectorWrapper = internalBinding('inspector').callAndPauseOnStart;
}
}
var dirname = path.dirname(filename);
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/module_job.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ModuleJob {
try {
if (this.isMain && process._breakFirstLine) {
delete process._breakFirstLine;
const initWrapper = process.binding('inspector').callAndPauseOnStart;
const initWrapper = internalBinding('inspector').callAndPauseOnStart;
initWrapper(this.module.instantiate, this.module);
} else {
this.module.instantiate();
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/process/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function disableAllAsyncHooks() {
exports.writeCoverage = writeCoverage;

function setup() {
const { Connection } = process.binding('inspector');
const { Connection } = internalBinding('inspector');
if (!Connection) {
console.warn('inspector not enabled');
return;
Expand Down
2 changes: 1 addition & 1 deletion src/inspector_js_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,5 +315,5 @@ void Initialize(Local<Object> target, Local<Value> unused,
} // namespace inspector
} // namespace node

NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector,
NODE_MODULE_CONTEXT_AWARE_INTERNAL(inspector,
node::inspector::Initialize);
2 changes: 1 addition & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2145,5 +2145,5 @@ int Start(int argc, char** argv) {
#if !HAVE_INSPECTOR
void Initialize() {}

NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, Initialize)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(inspector, Initialize)
#endif // !HAVE_INSPECTOR
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ assert(process.binding('spawn_sync'));
assert(process.binding('js_stream'));
assert(process.binding('buffer'));
assert(process.binding('fs'));
assert(process.binding('inspector'));
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 @@ -291,7 +291,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check

if (process.config.variables.v8_enable_inspector !== 0 &&
common.isMainThread) {
const binding = process.binding('inspector');
const binding = internalBinding('inspector');
const handle = new binding.Connection(() => {});
testInitialized(handle, 'Connection');
handle.disconnect();
Expand Down

0 comments on commit d7eb1a5

Please sign in to comment.