From commits-return-6964-apmail-couchdb-commits-archive=couchdb.apache.org@couchdb.apache.org Wed Sep 28 01:13:10 2011 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 5FB3B93F8 for ; Wed, 28 Sep 2011 01:13:10 +0000 (UTC) Received: (qmail 64967 invoked by uid 500); 28 Sep 2011 01:13:10 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 64924 invoked by uid 500); 28 Sep 2011 01:13:10 -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 64913 invoked by uid 99); 28 Sep 2011 01:13:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2011 01:13:10 +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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2011 01:13:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 99EF623889E3 for ; Wed, 28 Sep 2011 01:12:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1176677 - /couchdb/trunk/share/server/util.js Date: Wed, 28 Sep 2011 01:12:46 -0000 To: commits@couchdb.apache.org From: davisp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110928011246.99EF623889E3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davisp Date: Wed Sep 28 01:12:46 2011 New Revision: 1176677 URL: http://svn.apache.org/viewvc?rev=1176677&view=rev Log: Allow CommonJS modules to be an empty string. We were making a typical JavaScript mistake testing a module for truthiness instead of checking that it was undefined. Fixes COUCHDB-1223 Modified: couchdb/trunk/share/server/util.js Modified: couchdb/trunk/share/server/util.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/util.js?rev=1176677&r1=1176676&r2=1176677&view=diff ============================================================================== --- couchdb/trunk/share/server/util.js (original) +++ couchdb/trunk/share/server/util.js Wed Sep 28 01:12:46 2011 @@ -46,7 +46,7 @@ var resolveModule = function(names, mod, } else if (root) { mod = {current : root}; } - if (!mod.current[n]) { + if (mod.current[n] === undefined) { throw ["error", "invalid_require_path", 'Object has no property "'+n+'". '+JSON.stringify(mod.current)]; } return resolveModule(names, {