couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1176667 - /couchdb/branches/1.1.x/share/server/util.js
Date Tue, 27 Sep 2011 23:59:12 GMT
Author: davisp
Date: Tue Sep 27 23:59:11 2011
New Revision: 1176667

URL: http://svn.apache.org/viewvc?rev=1176667&view=rev
Log:
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.


Modified:
    couchdb/branches/1.1.x/share/server/util.js

Modified: couchdb/branches/1.1.x/share/server/util.js
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/share/server/util.js?rev=1176667&r1=1176666&r2=1176667&view=diff
==============================================================================
--- couchdb/branches/1.1.x/share/server/util.js (original)
+++ couchdb/branches/1.1.x/share/server/util.js Tue Sep 27 23:59:11 2011
@@ -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) {



Mime
View raw message