projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5f30377
)
Add 'root' global variable as reference to sandbox
author
Ryan Dahl
<ry@tinyclouds.org>
Wed, 14 Jul 2010 21:22:58 +0000
(14:22 -0700)
committer
Ryan Dahl
<ry@tinyclouds.org>
Thu, 15 Jul 2010 17:35:29 +0000
(10:35 -0700)
lib/module.js
patch
|
blob
|
history
diff --git
a/lib/module.js
b/lib/module.js
index 6ff17e9af33f526004c12e0a55306cf77e42553f..9d041999da6fab52f40b496847cd777400c920f8 100644
(file)
--- a/
lib/module.js
+++ b/
lib/module.js
@@
-400,6
+400,7
@@
Module.prototype._compile = function (content, filename) {
sandbox.__filename = filename;
sandbox.__dirname = dirname;
sandbox.module = self;
+ sandbox.root = sandbox;
Script.runInNewContext(content, sandbox, filename);
@@
-411,6
+412,7
@@
Module.prototype._compile = function (content, filename) {
global.__filename = filename;
global.__dirname = dirname;
global.module = self;
+ global.root = global;
Script.runInThisContext(content, filename);
}