diff options
author | Phillip Kovalev <twilightfeel@gmail.com> | 2016-02-20 11:30:43 +0300 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2016-02-20 14:48:47 +0300 |
commit | 5c14efbbe91b69bf835d2d2cff0d0aa8d165edaa (patch) | |
tree | 2b034ac34779030c5235d6a458e8d0a13a373f0e /src | |
parent | 91f6bc0bd6cf91ab4119c86c54d00f29dd83a193 (diff) |
module: return correct exports from linked binding
Method `LinkedBinding` must return the same "exports" property
of the module as cached, because property can be overridden
by an initialization function.
PR-URL: https://github.com/nodejs/node/pull/5337
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/node.cc b/src/node.cc index 05984745de0..e11562af1ac 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2450,9 +2450,10 @@ static void LinkedBinding(const FunctionCallbackInfo<Value>& args) { return env->ThrowError("Linked module has no declared entry point."); } - cache->Set(module_name, module->Get(exports_prop)); + auto effective_exports = module->Get(exports_prop); + cache->Set(module_name, effective_exports); - args.GetReturnValue().Set(exports); + args.GetReturnValue().Set(effective_exports); } static void ProcessTitleGetter(Local<String> property, |