mirror of https://github.com/nodejs/node.git
Add 'root' global variable as reference to sandbox
parent
5f30377bbc
commit
3a00470dbb
|
@ -400,6 +400,7 @@ Module.prototype._compile = function (content, filename) {
|
||||||
sandbox.__filename = filename;
|
sandbox.__filename = filename;
|
||||||
sandbox.__dirname = dirname;
|
sandbox.__dirname = dirname;
|
||||||
sandbox.module = self;
|
sandbox.module = self;
|
||||||
|
sandbox.root = sandbox;
|
||||||
|
|
||||||
Script.runInNewContext(content, sandbox, filename);
|
Script.runInNewContext(content, sandbox, filename);
|
||||||
|
|
||||||
|
@ -411,6 +412,7 @@ Module.prototype._compile = function (content, filename) {
|
||||||
global.__filename = filename;
|
global.__filename = filename;
|
||||||
global.__dirname = dirname;
|
global.__dirname = dirname;
|
||||||
global.module = self;
|
global.module = self;
|
||||||
|
global.root = global;
|
||||||
Script.runInThisContext(content, filename);
|
Script.runInThisContext(content, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue