mirror of https://github.com/nodejs/node.git
Make test-global work with NODE_MODULE_CONTEXTS.
parent
6789ab16d8
commit
71651bf8b2
|
@ -433,6 +433,7 @@ var module = (function () {
|
|||
sandbox.__filename = filename;
|
||||
sandbox.__dirname = dirname;
|
||||
sandbox.module = self;
|
||||
sandbox.global = sandbox;
|
||||
sandbox.root = root;
|
||||
|
||||
Script.runInNewContext(content, sandbox, filename);
|
||||
|
|
|
@ -212,6 +212,7 @@ template <node::Script::EvalInputFlags iFlag,
|
|||
for (i = 0; i < keys->Length(); i++) {
|
||||
Handle<String> key = keys->Get(Integer::New(i))->ToString();
|
||||
Handle<Value> value = sandbox->Get(key);
|
||||
if (value == sandbox) { value = context->Global(); }
|
||||
context->Global()->Set(key, value);
|
||||
}
|
||||
}
|
||||
|
@ -264,6 +265,7 @@ template <node::Script::EvalInputFlags iFlag,
|
|||
for (i = 0; i < keys->Length(); i++) {
|
||||
Handle<String> key = keys->Get(Integer::New(i))->ToString();
|
||||
Handle<Value> value = context->Global()->Get(key);
|
||||
if (value == context->Global()) { value = sandbox; }
|
||||
sandbox->Set(key, value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue