Skip to content

Commit

Permalink
Don't break strict mode! Fixes #17.
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic committed Feb 12, 2013
1 parent e4355ba commit a543553
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sandboxed_module.js
Expand Up @@ -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' +
Expand Down
5 changes: 5 additions & 0 deletions test/fixture/stayStrict.js
@@ -0,0 +1,5 @@
'use strict';

module.exports = function () {
return this;
};
9 changes: 9 additions & 0 deletions 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);
})();

0 comments on commit a543553

Please sign in to comment.