summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/engine_v8.cpp
diff options
context:
space:
mode:
authorLaszlo Boszormenyi (GCS) <gcs@debian.org>2015-06-30 16:27:06 +0000
committerLaszlo Boszormenyi (GCS) <gcs@debian.org>2015-06-30 16:27:06 +0000
commitb19ca2d7025ec90a916906e912f3c97113da38b2 (patch)
treef9d00c2c444eb8d5acfccd0c3b30a37b171e9162 /src/mongo/scripting/engine_v8.cpp
parent65585c90b12d6523bea75a2aebaae2a2fdf9e641 (diff)
Imported Upstream version 2.4.14upstream/2.4.14
Diffstat (limited to 'src/mongo/scripting/engine_v8.cpp')
-rw-r--r--src/mongo/scripting/engine_v8.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/scripting/engine_v8.cpp b/src/mongo/scripting/engine_v8.cpp
index 5aa40b1abf0..1ad61ae9907 100644
--- a/src/mongo/scripting/engine_v8.cpp
+++ b/src/mongo/scripting/engine_v8.cpp
@@ -603,8 +603,7 @@ namespace mongo {
// execution terminated
return v8::Undefined();
- v8::Local<v8::External> f =
- v8::External::Cast(*args.Callee()->Get(scope->strLitToV8("_v8_function")));
+ v8::Local<v8::External> f = v8::Local<v8::External>::Cast(args.Data());
v8Function function = (v8Function)(f->Value());
v8::Handle<v8::Value> ret;
string exceptionText;
@@ -1163,8 +1162,9 @@ namespace mongo {
}
v8::Handle<v8::FunctionTemplate> V8Scope::createV8Function(v8Function func) {
- v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(v8Callback);
- ft->Set(strLitToV8("_v8_function"), v8::External::New(reinterpret_cast<void*>(func)),
+ v8::Handle<v8::Value> funcHandle = v8::External::New(reinterpret_cast<void*>(func));
+ v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(v8Callback, funcHandle);
+ ft->Set(strLitToV8("_v8_function"), v8::Boolean::New(true),
static_cast<v8::PropertyAttribute>(v8::DontEnum | v8::ReadOnly));
return ft;
}
@@ -1514,11 +1514,11 @@ namespace mongo {
verify(BinDataFT()->HasInstance(obj));
verify(obj->InternalFieldCount() == 1);
- int len = obj->Get(strLitToV8("len"))->ToInt32()->Value();
+ std::string binData(base64::decode(toSTLString(obj->GetInternalField(0))));
b.appendBinData(elementName,
- len,
+ binData.size(),
mongo::BinDataType(obj->Get(strLitToV8("type"))->ToInt32()->Value()),
- base64::decode(toSTLString(obj->GetInternalField(0))).c_str());
+ binData.c_str());
}
OID V8Scope::v8ToMongoObjectID(v8::Handle<v8::Object> obj) {