Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-12-02 19:49:12 +0300
committerJoyee Cheung <joyeec9h3@gmail.com>2018-12-11 01:40:09 +0300
commit44a5fe145759a2fa43247da2f40a55df23572944 (patch)
tree74c346b396e14f5da4fbc85d4a48bd974b2a3432 /src/node_binding.cc
parent9fb4fa8ded0504f63c89ed969640e5a2df8d0d59 (diff)
process: specialize building and storage of process.config
Instead of treating config.gypi as a JavaScript file, specialize the processing in js2c and make the serialized result a real JSON string (with 'true' and 'false' converted to boolean values) so we don't have to use a custom deserializer during bootstrap. In addition, store the JSON string separately in NativeModuleLoader, and keep it separate from the map of the builtin source code, so we don't have to put it onto `NativeModule._source` and delete it later, though we still preserve it in `process.binding('natives')`, which we don't use anymore. This patch also makes the map of builtin source code and the config.gypi string available through side-effect-free getters in C++. PR-URL: https://github.com/nodejs/node/pull/24816 Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src/node_binding.cc')
-rw-r--r--src/node_binding.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/node_binding.cc b/src/node_binding.cc
index 6d70d0a501e..bdfb74e2744 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -412,6 +412,13 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
DefineConstants(env->isolate(), exports);
} else if (!strcmp(*module_v, "natives")) {
exports = per_process_loader.GetSourceObject(env->context());
+ // Legacy feature: process.binding('natives').config contains stringified
+ // config.gypi
+ CHECK(exports
+ ->Set(env->context(),
+ env->config_string(),
+ per_process_loader.GetConfigString(env->isolate()))
+ .FromJust());
} else {
return ThrowIfNoSuchModule(env, *module_v);
}