diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 001f63f5edb67f..f3f3264f353c24 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -243,6 +243,14 @@ perf.markMilestone(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE); } + const moduleLoadList = []; + Object.defineProperty(process, 'moduleLoadList', { + value: moduleLoadList, + configurable: true, + enumerable: true, + writable: false + }); + { const bindingObj = Object.create(null); @@ -250,8 +258,10 @@ process.binding = function binding(module) { module = String(module); let mod = bindingObj[module]; - if (typeof mod !== 'object') + if (typeof mod !== 'object') { mod = bindingObj[module] = getBinding(module); + moduleLoadList.push(`Binding ${module}`); + } return mod; }; @@ -273,8 +283,10 @@ internalBinding = function internalBinding(module) { let mod = bindingObj[module]; - if (typeof mod !== 'object') + if (typeof mod !== 'object') { mod = bindingObj[module] = getInternalBinding(module); + moduleLoadList.push(`Internal Binding ${module}`); + } return mod; }; } @@ -583,7 +595,7 @@ throw err; } - process.moduleLoadList.push(`NativeModule ${id}`); + moduleLoadList.push(`NativeModule ${id}`); const nativeModule = new NativeModule(id); diff --git a/src/env-inl.h b/src/env-inl.h index 3235626a8c0f32..aea52ff38840f3 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -329,8 +329,6 @@ inline Environment::Environment(IsolateData* isolate_data, v8::Context::Scope context_scope(context); set_as_external(v8::External::New(isolate(), this)); - set_module_load_list_array(v8::Array::New(isolate())); - AssignToContext(context, ContextInfo("")); destroy_async_id_list_.reserve(512); diff --git a/src/env.h b/src/env.h index ffaaf64453d6a9..2dbedce1d06c51 100644 --- a/src/env.h +++ b/src/env.h @@ -285,7 +285,6 @@ class ModuleWrap; V(http2settings_constructor_template, v8::ObjectTemplate) \ V(immediate_callback_function, v8::Function) \ V(inspector_console_api_object, v8::Object) \ - V(module_load_list_array, v8::Array) \ V(pbkdf2_constructor_template, v8::ObjectTemplate) \ V(pipe_constructor_template, v8::FunctionTemplate) \ V(performance_entry_callback, v8::Function) \ diff --git a/src/node.cc b/src/node.cc index 7736217a768d27..7c66d67c4e2b9b 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2556,15 +2556,7 @@ static void Binding(const FunctionCallbackInfo& args) { CHECK(args[0]->IsString()); Local module = args[0].As(); - - // Append a string to process.moduleLoadList - char buf[1024]; node::Utf8Value module_v(env->isolate(), module); - snprintf(buf, sizeof(buf), "Binding %s", *module_v); - - Local modules = env->module_load_list_array(); - uint32_t l = modules->Length(); - modules->Set(l, OneByteString(env->isolate(), buf)); node_module* mod = get_builtin_module(*module_v); Local exports; @@ -2591,15 +2583,7 @@ static void InternalBinding(const FunctionCallbackInfo& args) { CHECK(args[0]->IsString()); Local module = args[0].As(); - - // Append a string to process.moduleLoadList - char buf[1024]; node::Utf8Value module_v(env->isolate(), module); - snprintf(buf, sizeof(buf), "Internal Binding %s", *module_v); - - Local modules = env->module_load_list_array(); - uint32_t l = modules->Length(); - modules->Set(l, OneByteString(env->isolate(), buf)); node_module* mod = get_internal_module(*module_v); if (mod == nullptr) return ThrowIfNoSuchModule(env, *module_v); @@ -2971,11 +2955,6 @@ void SetupProcessObject(Environment* env, "version", FIXED_ONE_BYTE_STRING(env->isolate(), NODE_VERSION)); - // process.moduleLoadList - READONLY_PROPERTY(process, - "moduleLoadList", - env->module_load_list_array()); - // process.versions Local versions = Object::New(env->isolate()); READONLY_PROPERTY(process, "versions", versions);