Closed tristanls closed 11 years ago
Hmm yeah so obviously we have a bug; if the original module is strict, the sandboxed one should be also. But this is not the correct solution.
I guess the issue is the line:
'global = GLOBAL = root = (function() { return this; })();' +
which is interfering with the pragma's positioning rules.
You should be able to move global
, GLOBAL
, and root
(is that a real thing?) into localVariables
instead, to get the desired behavior.
Also, a test would be nice :).
Thanks!
Fair enough, I did take the shortest path :D. At least it's documented now.
This is my solution to a problem where I wanted to sandbox a module that used ES6 Harmony features such as
let
.I can now enable v8 "extended mode" by running tests using
--harmony
flag and requiring sandboxed modules with"use strict";
by providingstrictMode : true
options when requiring.