diff --git a/jstests/mr_comments.js b/jstests/mr_comments.js index 77e0f75faa1..f6a06994f55 100644 --- a/jstests/mr_comments.js +++ b/jstests/mr_comments.js @@ -14,7 +14,7 @@ res = db.runCommand( }, out: "mr_comments_out" }); -printjson( res ); +assert.eq( 3 , res.counts.emit ) res = db.runCommand( { mapreduce : "mr_comments", @@ -24,5 +24,5 @@ res = db.runCommand( }, out: "mr_comments_out" }); -printjson( res ); +assert.eq( 3 , res.counts.emit ) diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp index d351f14e21f..fd3094a4c43 100644 --- a/scripting/engine_spidermonkey.cpp +++ b/scripting/engine_spidermonkey.cpp @@ -419,9 +419,17 @@ namespace mongo { JSFunction * _compileFunction( const char * raw , JSObject * assoc , const char *& gcName ){ if ( ! assoc ) assoc = JS_GetGlobalObject( _context ); + + while ( raw[0] ){ + while (isspace(*raw)) { + raw++; + } - while (isspace(*raw)) { - raw++; + if ( raw[0] != '/' || raw[1] != '/' ) + break; + + while ( raw[0] && raw[0] != '\n' ) + raw++; } //cout << "RAW\n---\n" << raw << "\n---" << endl;