inspector: move process.binding to internalBinding
In places of process.binding('inspector'), migrate code to adapt internalBinding. PR-URL: https://github.com/nodejs/node/pull/24931 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
a1b283c2ca
commit
0500237317
@ -11,7 +11,7 @@ const {
|
|||||||
} = require('internal/errors').codes;
|
} = require('internal/errors').codes;
|
||||||
const { validateString } = require('internal/validators');
|
const { validateString } = require('internal/validators');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const { Connection, open, url } = process.binding('inspector');
|
const { Connection, open, url } = internalBinding('inspector');
|
||||||
|
|
||||||
if (!Connection)
|
if (!Connection)
|
||||||
throw new ERR_INSPECTOR_NOT_AVAILABLE();
|
throw new ERR_INSPECTOR_NOT_AVAILABLE();
|
||||||
|
@ -90,6 +90,7 @@ const internalBindingWhitelist = [
|
|||||||
'fs_event_wrap',
|
'fs_event_wrap',
|
||||||
'http_parser',
|
'http_parser',
|
||||||
'icu',
|
'icu',
|
||||||
|
'inspector',
|
||||||
'js_stream',
|
'js_stream',
|
||||||
'natives',
|
'natives',
|
||||||
'pipe_wrap',
|
'pipe_wrap',
|
||||||
|
@ -4,7 +4,7 @@ const path = require('path');
|
|||||||
const CJSModule = require('internal/modules/cjs/loader');
|
const CJSModule = require('internal/modules/cjs/loader');
|
||||||
const { makeRequireFunction } = require('internal/modules/cjs/helpers');
|
const { makeRequireFunction } = require('internal/modules/cjs/helpers');
|
||||||
const { tryGetCwd } = require('internal/util');
|
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
|
// Wrap a console implemented by Node.js with features from the VM inspector
|
||||||
function addInspectorApis(consoleFromNode, consoleFromVM) {
|
function addInspectorApis(consoleFromNode, consoleFromVM) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const inspector = process.binding('inspector');
|
const inspector = internalBinding('inspector');
|
||||||
|
|
||||||
if (!inspector || !inspector.asyncTaskScheduled) {
|
if (!inspector || !inspector.asyncTaskScheduled) {
|
||||||
exports.setup = function() {};
|
exports.setup = function() {};
|
||||||
|
@ -108,7 +108,7 @@ if (getOptionValue('--experimental-worker')) {
|
|||||||
builtinLibs.sort();
|
builtinLibs.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof process.binding('inspector').open === 'function') {
|
if (typeof internalBinding('inspector').open === 'function') {
|
||||||
builtinLibs.push('inspector');
|
builtinLibs.push('inspector');
|
||||||
builtinLibs.sort();
|
builtinLibs.sort();
|
||||||
}
|
}
|
||||||
|
@ -703,7 +703,7 @@ Module.prototype._compile = function(content, filename) {
|
|||||||
// Set breakpoint on module start
|
// Set breakpoint on module start
|
||||||
if (filename === resolvedArgv) {
|
if (filename === resolvedArgv) {
|
||||||
delete process._breakFirstLine;
|
delete process._breakFirstLine;
|
||||||
inspectorWrapper = process.binding('inspector').callAndPauseOnStart;
|
inspectorWrapper = internalBinding('inspector').callAndPauseOnStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var dirname = path.dirname(filename);
|
var dirname = path.dirname(filename);
|
||||||
|
@ -73,7 +73,7 @@ class ModuleJob {
|
|||||||
try {
|
try {
|
||||||
if (this.isMain && process._breakFirstLine) {
|
if (this.isMain && process._breakFirstLine) {
|
||||||
delete process._breakFirstLine;
|
delete process._breakFirstLine;
|
||||||
const initWrapper = process.binding('inspector').callAndPauseOnStart;
|
const initWrapper = internalBinding('inspector').callAndPauseOnStart;
|
||||||
initWrapper(this.module.instantiate, this.module);
|
initWrapper(this.module.instantiate, this.module);
|
||||||
} else {
|
} else {
|
||||||
this.module.instantiate();
|
this.module.instantiate();
|
||||||
|
@ -51,7 +51,7 @@ function disableAllAsyncHooks() {
|
|||||||
exports.writeCoverage = writeCoverage;
|
exports.writeCoverage = writeCoverage;
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
const { Connection } = process.binding('inspector');
|
const { Connection } = internalBinding('inspector');
|
||||||
if (!Connection) {
|
if (!Connection) {
|
||||||
console.warn('inspector not enabled');
|
console.warn('inspector not enabled');
|
||||||
return;
|
return;
|
||||||
|
@ -315,5 +315,5 @@ void Initialize(Local<Object> target, Local<Value> unused,
|
|||||||
} // namespace inspector
|
} // namespace inspector
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
|
||||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector,
|
NODE_MODULE_CONTEXT_AWARE_INTERNAL(inspector,
|
||||||
node::inspector::Initialize);
|
node::inspector::Initialize);
|
||||||
|
@ -2145,5 +2145,5 @@ int Start(int argc, char** argv) {
|
|||||||
#if !HAVE_INSPECTOR
|
#if !HAVE_INSPECTOR
|
||||||
void Initialize() {}
|
void Initialize() {}
|
||||||
|
|
||||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, Initialize)
|
NODE_MODULE_CONTEXT_AWARE_INTERNAL(inspector, Initialize)
|
||||||
#endif // !HAVE_INSPECTOR
|
#endif // !HAVE_INSPECTOR
|
||||||
|
@ -17,3 +17,4 @@ assert(process.binding('spawn_sync'));
|
|||||||
assert(process.binding('js_stream'));
|
assert(process.binding('js_stream'));
|
||||||
assert(process.binding('buffer'));
|
assert(process.binding('buffer'));
|
||||||
assert(process.binding('fs'));
|
assert(process.binding('fs'));
|
||||||
|
assert(process.binding('inspector'));
|
||||||
|
@ -291,7 +291,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
|
|||||||
|
|
||||||
if (process.config.variables.v8_enable_inspector !== 0 &&
|
if (process.config.variables.v8_enable_inspector !== 0 &&
|
||||||
common.isMainThread) {
|
common.isMainThread) {
|
||||||
const binding = process.binding('inspector');
|
const binding = internalBinding('inspector');
|
||||||
const handle = new binding.Connection(() => {});
|
const handle = new binding.Connection(() => {});
|
||||||
testInitialized(handle, 'Connection');
|
testInitialized(handle, 'Connection');
|
||||||
handle.disconnect();
|
handle.disconnect();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user