GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src,lib: move `natives` and `constants` to `internalBinding()` by addaleax · Pull Request #23663 · nodejs/node

src,lib: move natives and constants to internalBinding() #23663

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.

Sign up for GitHub

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

Closed
addaleax wants to merge 1 commit into nodejs:master from addaleax:internalbinding-natives

Uh oh!

There was an error while loading. Please reload this page.

Closed

src,lib: move natives and constants to internalBinding() #23663

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
82895b3
src,lib: move `natives` and `constants` to `internalBinding()`
addaleax Oct 14, 2018
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

2 changes: 1 addition & 1 deletion 2 lib/_tls_common.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const {
ERR_INVALID_ARG_TYPE
} = require('internal/errors').codes;

const { SSL_OP_CIPHER_SERVER_PREFERENCE } = process.binding('constants').crypto;
const { SSL_OP_CIPHER_SERVER_PREFERENCE } = internalBinding('constants').crypto;

// Lazily loaded from internal/crypto/util.
let toBuf = null;
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/constants.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// towards using the specific constants exposed by the individual modules on
// which they are most relevant.
// Deprecation Code: DEP0008
const constants = process.binding('constants');
const constants = internalBinding('constants');
Object.assign(exports,
constants.os.dlopen,
constants.os.errno,
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/crypto.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const {
ERR_CRYPTO_FIPS_FORCED,
ERR_CRYPTO_FIPS_UNAVAILABLE
} = require('internal/errors').codes;
const constants = process.binding('constants').crypto;
const constants = internalBinding('constants').crypto;
const { getOptions } = internalBinding('options');
const pendingDeprecation = getOptions('--pending-deprecation');
const {
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/dgram.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const {
defaultTriggerAsyncIdScope,
symbols: { async_id_symbol, owner_symbol }
} = require('internal/async_hooks');
const { UV_UDP_REUSEADDR } = process.binding('constants').os;
const { UV_UDP_REUSEADDR } = internalBinding('constants').os;

const { UDP, SendWrap } = internalBinding('udp_wrap');

Expand Down
2 changes: 1 addition & 1 deletion 2 lib/fs.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

'use strict';

const { fs: constants } = process.binding('constants');
const { fs: constants } = internalBinding('constants');
const {
S_IFIFO,
S_IFLNK,
Expand Down
6 changes: 3 additions & 3 deletions 6 lib/internal/bootstrap/loaders.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
this.script = null; // The ContextifyScript of the module
}

NativeModule._source = getBinding('natives');
NativeModule._source = getInternalBinding('natives');
NativeModule._cache = {};

const config = getBinding('config');
Expand Down Expand Up @@ -256,12 +256,12 @@
// 1. `internalBinding('code_cache_hash')` must be in sync with
// `internalBinding('code_cache')` (same C++ file)
// 2. `internalBinding('natives_hash')` must be in sync with
// `process.binding('natives')` (same C++ file)
// `internalBinding('natives')` (same C++ file)
// 3. If `internalBinding('natives_hash')` is in sync with
// `internalBinding('natives_hash')`, then the (unwrapped)
// code used to generate `internalBinding('code_cache')`
// should be in sync with the (unwrapped) code in
// `process.binding('natives')`
// `internalBinding('natives')`
// There will be, however, false positives if the wrapper used
// to generate the cache is different from the one used at run time,
// and the length of the wrapper somehow stays the same.
Expand Down
4 changes: 3 additions & 1 deletion 4 lib/internal/bootstrap/node.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@
'spawn_sync',
'js_stream',
'zlib',
'buffer']);
'buffer',
'natives',
'constants']);
process.binding = function binding(name) {
return internalBindingWhitelist.has(name) ?
internalBinding(name) :
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/crypto/cipher.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const {
RSA_PKCS1_OAEP_PADDING,
RSA_PKCS1_PADDING
} = process.binding('constants').crypto;
} = internalBinding('constants').crypto;

const {
ERR_CRYPTO_INVALID_STATE,
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/crypto/diffiehellman.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const {
POINT_CONVERSION_COMPRESSED,
POINT_CONVERSION_HYBRID,
POINT_CONVERSION_UNCOMPRESSED
} = process.binding('constants').crypto;
} = internalBinding('constants').crypto;

const DH_GENERATOR = 2;

Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/crypto/sig.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { Sign: _Sign, Verify: _Verify } = internalBinding('crypto');
const {
RSA_PSS_SALTLEN_AUTO,
RSA_PKCS1_PADDING
} = process.binding('constants').crypto;
} = internalBinding('constants').crypto;
const {
getDefaultEncoding,
kHandle,
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/crypto/util.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {

const {
ENGINE_METHOD_ALL
} = process.binding('constants').crypto;
} = internalBinding('constants').crypto;

const {
ERR_CRYPTO_ENGINE_UNKNOWN,
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/fs/promises.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
O_WRONLY,
S_IFMT,
S_IFREG
} = process.binding('constants').fs;
} = internalBinding('constants').fs;
const binding = process.binding('fs');
const { Buffer, kMaxLength } = require('buffer');
const {
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/fs/utils.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const {
UV_DIRENT_SOCKET,
UV_DIRENT_CHAR,
UV_DIRENT_BLOCK
} = process.binding('constants').fs;
} = internalBinding('constants').fs;

const isWindows = process.platform === 'win32';

Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/process/main_thread_only.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function setupPosixMethods(_initgroups, _setegid, _seteuid,

// Worker threads don't receive signals.
function setupSignalHandlers(internalBinding) {
const constants = process.binding('constants').os.signals;
const constants = internalBinding('constants').os.signals;
const signalWraps = Object.create(null);
let Signal;

Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/process/per_thread.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
}
} = require('internal/errors');
const util = require('util');
const constants = process.binding('constants').os.signals;
const constants = internalBinding('constants').os.signals;
const { deprecate } = require('internal/util');

function setupAssert() {
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/util.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const {
ERR_NO_CRYPTO,
ERR_UNKNOWN_SIGNAL
} = require('internal/errors').codes;
const { signals } = process.binding('constants').os;
const { signals } = internalBinding('constants').os;
const {
getHiddenValue,
setHiddenValue,
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/internal/v8_prof_processor.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const scriptFiles = [
var script = '';

scriptFiles.forEach(function(s) {
script += process.binding('natives')[s] + '\n';
script += internalBinding('natives')[s] + '\n';
});

const tickArguments = [];
Expand Down
2 changes: 1 addition & 1 deletion 2 lib/os.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'use strict';

const { pushValToArrayMax, safeGetenv } = internalBinding('util');
const constants = process.binding('constants').os;
const constants = internalBinding('constants').os;
const { deprecate } = require('internal/util');
const isWindows = process.platform === 'win32';

Expand Down
2 changes: 1 addition & 1 deletion 2 lib/tls.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ exports.CLIENT_RENEG_LIMIT = 3;
exports.CLIENT_RENEG_WINDOW = 600;

exports.DEFAULT_CIPHERS =
process.binding('constants').crypto.defaultCipherList;
internalBinding('constants').crypto.defaultCipherList;

exports.DEFAULT_ECDH_CURVE = 'auto';

Expand Down
2 changes: 1 addition & 1 deletion 2 lib/zlib.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const {
} = require('buffer');
const { owner_symbol } = require('internal/async_hooks').symbols;

const constants = process.binding('constants').zlib;
const constants = internalBinding('constants').zlib;
const {
Z_NO_FLUSH, Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH,
Z_MIN_CHUNK, Z_MIN_WINDOWBITS, Z_MAX_WINDOWBITS, Z_MIN_LEVEL, Z_MAX_LEVEL,
Expand Down
16 changes: 8 additions & 8 deletions 16 src/node.cc
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1542,14 +1542,6 @@ static void GetBinding(const FunctionCallbackInfo<Value>& args) {
Local<Object> exports;
if (mod != nullptr) {
exports = InitModule(env, mod, module);
} else if (!strcmp(*module_v, "constants")) {
exports = Object::New(env->isolate());
CHECK(exports->SetPrototype(env->context(),
Null(env->isolate())).FromJust());
DefineConstants(env->isolate(), exports);
} else if (!strcmp(*module_v, "natives")) {
exports = Object::New(env->isolate());
DefineJavaScript(env, exports);
} else {
return ThrowIfNoSuchModule(env, *module_v);
}
Expand All @@ -1569,6 +1561,14 @@ static void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
node_module* mod = get_internal_module(*module_v);
if (mod != nullptr) {
exports = InitModule(env, mod, module);
} else if (!strcmp(*module_v, "constants")) {
exports = Object::New(env->isolate());
CHECK(exports->SetPrototype(env->context(),
Null(env->isolate())).FromJust());
DefineConstants(env->isolate(), exports);
} else if (!strcmp(*module_v, "natives")) {
exports = Object::New(env->isolate());
DefineJavaScript(env, exports);
} else if (!strcmp(*module_v, "code_cache")) {
// internalBinding('code_cache')
exports = Object::New(env->isolate());
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.