Add 'root' global variable as reference to sandbox

v0.7.4-release
Ryan Dahl 2010-07-14 14:22:58 -07:00
parent 5f30377bbc
commit 3a00470dbb
1 changed files with 2 additions and 0 deletions

View File

@ -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);
} }