diff options
author | Paul Joseph Davis <davisp@apache.org> | 2011-09-27 23:59:11 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2011-09-27 23:59:11 +0000 |
commit | 61f10e7590bd352b367ad426a56587cbef3700b6 (patch) | |
tree | 0d77823590ea4090a0cf640501f7d4d5124030b9 /share | |
parent | b707a67d13060ef9723cd685280b4e47f71c2ac6 (diff) |
Fix function evaluation by newer SpiderMonkey's.
Found this error using the Debian package for SM 1.8.5 and have since
had reports of users seeing it as well. The basic error is that some
versions of SpiderMonkey appear to dislike this call to eval:
eval("function(){}");
The fix is simply to wrap the function source in parenthesis so that
SM is convinced that it knows how to evaluate a function.
Backport of r1176666 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1176667 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r-- | share/server/util.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/share/server/util.js b/share/server/util.js index e4386701..6afb38b6 100644 --- a/share/server/util.js +++ b/share/server/util.js @@ -63,6 +63,11 @@ var Couch = { }, compileFunction : function(source, ddoc) { if (!source) throw(["error","not_found","missing function"]); + // Some newer SpiderMonkey's appear to not like evaluating + // an anonymous function at global scope. Simple fix just + // wraps the source with parens so the function object is + // returned correctly. + source = "(" + source + ")"; try { if (sandbox) { if (ddoc) { |