From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Mon, 6 Mar 2017 10:42:34 -0300 Subject: Expose `get_linked_module` function This is a requirement for electron/electron#8815, which exposes some linked modules to sandboxed renderers. TODO(codebytere): remove and replace with a public facing API. diff --git a/src/node_binding.cc b/src/node_binding.cc index 60b5eea61cf05344de9862a028165fecdb63fd35..5093c3e53cee6d0ad9a9100b487549c3b4e7ae46 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -609,6 +609,10 @@ void GetInternalBinding(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(exports); } +node_module* get_linked_module(const char* name) { + return FindModule(modlist_linked, name, NM_F_LINKED); +} + void GetLinkedBinding(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); diff --git a/src/node_binding.h b/src/node_binding.h index 13681bac67c64f5b9c81a034f0be1eeb2b346bb1..76898adc448c48715d8b9dc4aa782217a4fc7e05 100644 --- a/src/node_binding.h +++ b/src/node_binding.h @@ -91,6 +91,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo& args); void GetLinkedBinding(const v8::FunctionCallbackInfo& args); void DLOpen(const v8::FunctionCallbackInfo& args); +NODE_EXTERN node_module* get_linked_module(const char *name); + } // namespace binding } // namespace node