Permalink
Browse files

SERVER-446 clean up whitespace when creating js function in v8 engine

  • Loading branch information...
1 parent 80bd8d1 commit 556a55420536d63159c762e377d4d1f640e54340 @astaple astaple committed Dec 22, 2009
Showing with 3 additions and 5 deletions.
  1. +1 −1 jstests/where2.js
  2. +1 −0 scripting/engine_v8.cpp
  3. +1 −4 scripting/v8_wrapper.cpp
View
@@ -1,5 +1,5 @@
-t = db.getCollection( "where1" );
+t = db.getCollection( "where2" );
t.drop();
t.save( { a : 1 } );
View
@@ -212,6 +212,7 @@ namespace mongo {
ScriptingFunction V8Scope::_createFunction( const char * raw ){
+ for(; isspace( *raw ); ++raw ); // skip whitespace
string code = raw;
if ( code.find( "function" ) == string::npos ){
if ( code.find( "\n" ) == string::npos &&
View
@@ -365,10 +365,7 @@ namespace mongo {
void v8ToMongoElement( BSONObjBuilder & b , v8::Handle<v8::String> name , const string sname , v8::Handle<v8::Value> value ){
if ( value->IsString() ){
- if ( sname == "$where" )
- b.appendCode( sname.c_str() , toSTLString( value ).c_str() );
- else
- b.append( sname.c_str() , toSTLString( value ).c_str() );
+ b.append( sname.c_str() , toSTLString( value ).c_str() );
return;
}

0 comments on commit 556a554

Please sign in to comment.