Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b9136c0

Browse filesBrowse files
jasnellMyles Borins
authored andcommitted
src: add process.binding('config')
It turns out that userland likes to override process.config with their own stuff. If we want to be able to depend on it in any way, we need our own internal mechanism. This adds a new private process.binding('config') that is intended to serve as a container for internal flags and compile time configs that need to be passed on to the JS layer. PR-URL: #6266 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 9121e94 commit b9136c0
Copy full SHA for b9136c0

File tree

Expand file treeCollapse file tree

2 files changed

+37
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+37
-0
lines changed
Open diff view settings
Collapse file

‎node.gyp‎

Copy file name to clipboardExpand all lines: node.gyp
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
'src/js_stream.cc',
125125
'src/node.cc',
126126
'src/node_buffer.cc',
127+
'src/node_config.cc',
127128
'src/node_constants.cc',
128129
'src/node_contextify.cc',
129130
'src/node_file.cc',
Collapse file

‎src/node_config.cc‎

Copy file name to clipboard
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include "node.h"
2+
#include "env.h"
3+
#include "env-inl.h"
4+
#include "util.h"
5+
#include "util-inl.h"
6+
7+
8+
namespace node {
9+
10+
using v8::Context;
11+
using v8::Local;
12+
using v8::Object;
13+
using v8::Value;
14+
using v8::ReadOnly;
15+
16+
// The config binding is used to provide an internal view of compile or runtime
17+
// config options that are required internally by lib/*.js code. This is an
18+
// alternative to dropping additional properties onto the process object as
19+
// has been the practice previously in node.cc.
20+
21+
#define READONLY_BOOLEAN_PROPERTY(str) \
22+
do { \
23+
target->DefineOwnProperty(env->context(), \
24+
OneByteString(env->isolate(), str), \
25+
True(env->isolate()), ReadOnly).FromJust(); \
26+
} while (0)
27+
28+
void InitConfig(Local<Object> target,
29+
Local<Value> unused,
30+
Local<Context> context) {
31+
// Environment* env = Environment::GetCurrent(context);
32+
}
33+
34+
} // namespace node
35+
36+
NODE_MODULE_CONTEXT_AWARE_BUILTIN(config, node::InitConfig)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.