SERVER-1749 guard all v8 function callbacks

This commit is contained in:
Aaron
2010-09-07 21:32:14 -07:00
parent 296ddbb6b8
commit e53c867908
5 changed files with 72 additions and 53 deletions

View File

@@ -52,15 +52,15 @@ namespace mongo {
_this = Persistent< v8::Object >::New( v8::Object::New() );
_global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print)->GetFunction() );
_global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version)->GetFunction() );
_global->Set(v8::String::New("print"), newV8Function< Print >()->GetFunction() );
_global->Set(v8::String::New("version"), newV8Function< Version >()->GetFunction() );
_global->Set(v8::String::New("load"),
v8::FunctionTemplate::New(loadCallback, v8::External::New(this))->GetFunction() );
v8::FunctionTemplate::New( v8Callback< loadCallback >, v8::External::New(this))->GetFunction() );
_wrapper = Persistent< v8::Function >::New( getObjectWrapperTemplate()->GetFunction() );
_global->Set(v8::String::New("gc"), v8::FunctionTemplate::New(GCV8)->GetFunction() );
_global->Set(v8::String::New("gc"), newV8Function< GCV8 >()->GetFunction() );
installDBTypes( _global );
@@ -388,7 +388,7 @@ namespace mongo {
void V8Scope::injectNative( const char *field, NativeFunction func ){
V8_SIMPLE_HEADER
Handle< FunctionTemplate > f( v8::FunctionTemplate::New( nativeCallback ) );
Handle< FunctionTemplate > f( newV8Function< nativeCallback >() );
f->Set( v8::String::New( "_native_function" ), External::New( (void*)func ) );
_global->Set( v8::String::New( field ), f->GetFunction() );
}