diff options
author | Jason Carey <jcarey@argv.me> | 2015-09-14 16:19:11 -0400 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2015-09-17 20:13:11 -0400 |
commit | 041e4fe737342bf40a6aedb7a04d8d99ba20e213 (patch) | |
tree | 148c21a538fd93bddf8a1982d463400d73984060 /src/mongo/scripting/mozjs/bson.cpp | |
parent | 8291bbb3a6ec192d177076b1fb0cd28995e48440 (diff) | |
download | mongo-041e4fe737342bf40a6aedb7a04d8d99ba20e213.tar.gz |
SERVER-20375 Constrain JS method thisv
This constrains universal access to wraptype methods by providing a
JS_ATTACH_JS_CONSTRAINED_METHOD() macro which allows for a list of types
that are allowed to call said method.
In this way we can lock down all methods without having to add uasserts
to each individual method body.
Diffstat (limited to 'src/mongo/scripting/mozjs/bson.cpp')
-rw-r--r-- | src/mongo/scripting/mozjs/bson.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/scripting/mozjs/bson.cpp b/src/mongo/scripting/mozjs/bson.cpp index 9c972a6b3fc..2dd1d717dc3 100644 --- a/src/mongo/scripting/mozjs/bson.cpp +++ b/src/mongo/scripting/mozjs/bson.cpp @@ -75,7 +75,7 @@ BSONHolder* getHolder(JSObject* obj) { void BSONInfo::make(JSContext* cx, JS::MutableHandleObject obj, BSONObj bson, bool ro) { auto scope = getScope(cx); - scope->getBsonProto().newObject(obj); + scope->getProto<BSONInfo>().newObject(obj); JS_SetPrivate(obj, new BSONHolder(bson, ro)); } @@ -202,7 +202,7 @@ std::tuple<BSONObj*, bool> BSONInfo::originalBSON(JSContext* cx, JS::HandleObjec return out; } -void BSONInfo::Functions::bsonWoCompare(JSContext* cx, JS::CallArgs args) { +void BSONInfo::Functions::bsonWoCompare::call(JSContext* cx, JS::CallArgs args) { if (args.length() != 2) uasserted(ErrorCodes::BadValue, "bsonWoCompare needs 2 argument"); |