Skip to content
Browse files

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:


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: 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent b707a67 commit 61f10e7590bd352b367ad426a56587cbef3700b6 @davisp davisp committed
Showing with 5 additions and 0 deletions.
  1. +5 −0 share/server/util.js
5 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) {

0 comments on commit 61f10e7

Please sign in to comment.
Something went wrong with that request. Please try again.