couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject [34/50] git commit: Fix function evaluation by newer SpiderMonkey's.
Date Wed, 26 Oct 2011 18:05:33 GMT
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.



git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1176666 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/293ae223
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/293ae223
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/293ae223

Branch: refs/heads/1319-large-headers-are-corrupted
Commit: 293ae2236859629a6dabc3727d0ccca977b8a8f8
Parents: 7fe255e
Author: Paul Joseph Davis <davisp@apache.org>
Authored: Tue Sep 27 23:55:09 2011 +0000
Committer: Paul Joseph Davis <davisp@apache.org>
Committed: Tue Sep 27 23:55:09 2011 +0000

----------------------------------------------------------------------
 share/server/util.js |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/293ae223/share/server/util.js
----------------------------------------------------------------------
diff --git a/share/server/util.js b/share/server/util.js
index e9a3f33..476f283 100644
--- a/share/server/util.js
+++ b/share/server/util.js
@@ -63,7 +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 + ")";
     var evaluate_function_source = function(source, evalFunction, sandbox) {
       sandbox = sandbox || {};
       if(typeof CoffeeScript === "undefined") {


Mime
View raw message