You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2008/08/08 19:46:49 UTC

svn commit: r684023 - in /incubator/couchdb/trunk/share: server/main.js www/script/couch_tests.js

Author: damien
Date: Fri Aug  8 10:46:48 2008
New Revision: 684023

URL: http://svn.apache.org/viewvc?rev=684023&view=rev
Log:
COUCHDB-103 Fixed incompatibilty with new javascript (1.8) that no longer supports sealing document, making them immutable. The problem is arrays can no longer be sealed, and an error is generated when it is attempted. The fix here is to simply remove the document sealing, and map function placed in the same design document will have to be trustworthy that they don't modify the document (the same document is passed to multiple map functions). Non-trustworthy map functions can be placed in their own design documents, they will be run in isolation.

Modified:
    incubator/couchdb/trunk/share/server/main.js
    incubator/couchdb/trunk/share/www/script/couch_tests.js

Modified: incubator/couchdb/trunk/share/server/main.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/server/main.js?rev=684023&r1=684022&r2=684023&view=diff
==============================================================================
--- incubator/couchdb/trunk/share/server/main.js [utf-8] (original)
+++ incubator/couchdb/trunk/share/server/main.js [utf-8] Fri Aug  8 10:46:48 2008
@@ -74,7 +74,19 @@
         // ]
         //
         var doc = cmd[1];
+        /*
+        Immutable document support temporarily removed.
+        
+        Removed because the seal function no longer works on JS 1.8 arrays,
+        instead returning an error. The sealing is meant to prevent map
+        functions from modifying the same document that is passed to other map
+        functions. However, only map functions in the same design document are
+        run together, so we have a reasonable expectation they can trust each
+        other. Any map fun that can't be trusted can be placed in its own
+        design document, and it cannot affect other map functions.
+        
         recursivelySeal(doc); // seal to prevent map functions from changing doc
+        */
         var buf = [];
         for (var i = 0; i < funs.length; i++) {
           map_results = [];

Modified: incubator/couchdb/trunk/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/www/script/couch_tests.js?rev=684023&r1=684022&r2=684023&view=diff
==============================================================================
--- incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original)
+++ incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] Fri Aug  8 10:46:48 2008
@@ -1072,7 +1072,7 @@
 
     var doc = {integer: 1, string: "1", array: [1, 2, 3]};
     T(db.save(doc).ok);
-
+/*
     // make sure that attempting to change the document throws an error
     var results = db.query(function(doc) {
       doc.integer = 2;
@@ -1085,7 +1085,7 @@
       emit(null, doc);
     });
     T(results.total_rows == 0);
-
+*/
     // make sure that a view cannot invoke interpreter internals such as the
     // garbage collector
     var results = db.query(function(doc) {