diff options
author | Paul Joseph Davis <davisp@apache.org> | 2009-12-12 23:43:11 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2009-12-12 23:43:11 +0000 |
commit | f61fbc97b595a52ccd5bddec424d271fe4b8de83 (patch) | |
tree | de1802761c217b624257c3ff2f62aab9f5e70c93 /share | |
parent | 77473d79f5b0d9362fb3b7fb00a5725ad000de12 (diff) |
Create a new sandbox for each reset.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@890008 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r-- | share/server/loop.js | 31 | ||||
-rw-r--r-- | share/server/state.js | 1 |
2 files changed, 19 insertions, 13 deletions
diff --git a/share/server/loop.js b/share/server/loop.js index ff241eed..33e87c98 100644 --- a/share/server/loop.js +++ b/share/server/loop.js @@ -12,19 +12,24 @@ var sandbox = null; -try { - // if possible, use evalcx (not always available) - sandbox = evalcx(''); - sandbox.emit = emit; - sandbox.sum = sum; - sandbox.log = log; - sandbox.toJSON = toJSON; - sandbox.provides = provides; - sandbox.registerType = registerType; - sandbox.start = start; - sandbox.send = send; - sandbox.getRow = getRow; -} catch (e) {} +var init_sandbox = function() { + try { + // if possible, use evalcx (not always available) + sandbox = evalcx(''); + sandbox.emit = emit; + sandbox.sum = sum; + sandbox.log = log; + sandbox.toJSON = toJSON; + sandbox.provides = provides; + sandbox.registerType = registerType; + sandbox.start = start; + sandbox.send = send; + sandbox.getRow = getRow; + } catch (e) { + log(toJSON(e)); + } +}; +init_sandbox(); // Commands are in the form of json arrays: // ["commandname",..optional args...]\n diff --git a/share/server/state.js b/share/server/state.js index aacd8ab1..b9bd87aa 100644 --- a/share/server/state.js +++ b/share/server/state.js @@ -21,6 +21,7 @@ var State = (function() { funs = []; funsrc = []; query_config = config; + init_sandbox(); gc(); print("true"); // indicates success }, |