diff --git a/lib/sandboxed_module.js b/lib/sandboxed_module.js index ff5bd23..5e06cb7 100644 --- a/lib/sandboxed_module.js +++ b/lib/sandboxed_module.js @@ -141,8 +141,8 @@ SandboxedModule.prototype._getCompileInfo = function() { } var source = - '(function(' + localVariables.join(', ') + ') { ' + 'global = GLOBAL = root = (function() { return this; })();' + + '(function(' + localVariables.join(', ') + ') { ' + sourceToWrap + '\n' + 'return global;\n' + diff --git a/test/fixture/stayStrict.js b/test/fixture/stayStrict.js new file mode 100644 index 0000000..2434122 --- /dev/null +++ b/test/fixture/stayStrict.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function () { + return this; +}; diff --git a/test/integration/test-stay-strict.js b/test/integration/test-stay-strict.js new file mode 100644 index 0000000..e7163ba --- /dev/null +++ b/test/integration/test-stay-strict.js @@ -0,0 +1,9 @@ +var common = require('../common'); +var assert = common.assert; +var SandboxedModule = require(common.dir.lib + '/sandboxed_module'); + +(function testStayStrict() { + var exports = SandboxedModule.load(common.dir.fixture + '/stayStrict').exports; + + assert(exports() === undefined); +})();