Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1DFE873F5 for ; Wed, 26 Oct 2011 18:08:41 +0000 (UTC) Received: (qmail 35962 invoked by uid 500); 26 Oct 2011 18:08:41 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 35926 invoked by uid 500); 26 Oct 2011 18:08:40 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 35906 invoked by uid 99); 26 Oct 2011 18:08:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2011 18:08:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.114] (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2011 18:08:37 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 93CE4544A1; Wed, 26 Oct 2011 18:05:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kocolosk@apache.org To: commits@couchdb.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [34/50] git commit: Fix function evaluation by newer SpiderMonkey's. Message-Id: <20111026180533.93CE4544A1@tyr.zones.apache.org> Date: Wed, 26 Oct 2011 18:05:33 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org 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 Authored: Tue Sep 27 23:55:09 2011 +0000 Committer: Paul Joseph Davis 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") {