diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2019-01-30 16:35:10 +0000 |
---|---|---|
committer | Gabriel Russell <gabriel.russell@mongodb.com> | 2019-01-30 19:06:17 +0000 |
commit | d80755651cbd268c7db03ebba914051428fedeb4 (patch) | |
tree | edeef955820a96d615876729dfa6e03ff021ea16 /src/mongo/scripting/mozjs/bson.cpp | |
parent | 6dc4072453b4ba17fed636f049c10cf1316357bb (diff) | |
download | mongo-d80755651cbd268c7db03ebba914051428fedeb4.tar.gz |
SERVER-29286 import and use mozjs-60
Diffstat (limited to 'src/mongo/scripting/mozjs/bson.cpp')
-rw-r--r-- | src/mongo/scripting/mozjs/bson.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/scripting/mozjs/bson.cpp b/src/mongo/scripting/mozjs/bson.cpp index 7ce68bf1a77..e3a24a94e23 100644 --- a/src/mongo/scripting/mozjs/bson.cpp +++ b/src/mongo/scripting/mozjs/bson.cpp @@ -126,7 +126,7 @@ void BSONInfo::make( JS_SetPrivate(obj, scope->trackedNew<BSONHolder>(bson, parent, scope, ro)); } -void BSONInfo::finalize(JSFreeOp* fop, JSObject* obj) { +void BSONInfo::finalize(js::FreeOp* fop, JSObject* obj) { auto holder = static_cast<BSONHolder*>(JS_GetPrivate(obj)); if (!holder) @@ -163,21 +163,24 @@ void BSONInfo::enumerate(JSContext* cx, if (!JS_ValueToId(cx, val, &id)) uasserted(ErrorCodes::JSInterpreterFailure, "Failed to invoke JS_ValueToId"); - properties.append(id); + if (!properties.append(id)) + uasserted(ErrorCodes::JSInterpreterFailure, "Failed to append property"); } } void BSONInfo::setProperty(JSContext* cx, + JS::HandleObject obj, JS::HandleId id, - JS::MutableHandleValue vp, + JS::HandleValue vp, + JS::HandleValue receiver, JS::ObjectOpResult& result) { + auto holder = getValidHolder(cx, obj); if (holder) { if (holder->_readOnly) { uasserted(ErrorCodes::BadValue, "Read only object"); - return; } auto iter = holder->_removed.find(IdWrapper(cx, id).toString()); |