diff options
Diffstat (limited to 'utils/platforms/rhino/lib/sandbox-platform.js')
-rwxr-xr-x | utils/platforms/rhino/lib/sandbox-platform.js | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/utils/platforms/rhino/lib/sandbox-platform.js b/utils/platforms/rhino/lib/sandbox-platform.js deleted file mode 100755 index 552853f..0000000 --- a/utils/platforms/rhino/lib/sandbox-platform.js +++ /dev/null @@ -1,70 +0,0 @@ - -/* shared, sealed global context */ - -var blacklist = [ - 'Packages', - 'java', - 'javax', - 'org', - 'net', - 'com', - 'edu', - 'JavaAdapter', - 'JavaImporter', - 'getClass' -]; - -var whitelist = [ - 'Array', - 'Boolean', - 'Date', - 'Error', - 'EvalError', - 'Function', - 'Math', - 'Number', - 'Object', - 'RangeError', - 'ReferenceError', - 'InternalError', - 'RegExp', - 'String', - 'SyntaxError', - 'TypeError', - 'URIError', - 'Infinity', - 'NaN', - 'undefined', - 'decodeURI', - 'decodeURIComponent', - 'encodeURI', - 'encodeURIComponent', - 'eval', - 'isFinite', - 'isNaN', - 'parseFloat', - 'parseInt' -]; - -var context = new Packages.org.mozilla.javascript.Context(); -var global = context.initStandardObjects(null, true); -for (var i = 0; i < blacklist.length; i++) - delete global[blacklist[i]]; -seal(global); - - -/* create module factories */ - -exports.evaluate = function (text, id) { - // verify that the script is a program by compiling it as such - context.compileString(text, id, 1, null); - // return a module factory function instead though. - return context.compileFunction( - global, - "function(require,exports,module,system,print){"+text+"}", - id, - 1, - null - ); -}; - |