summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/mozjs/implscope.h
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2017-08-29 14:26:07 -0400
committerJason Carey <jcarey@argv.me>2017-08-30 15:05:04 -0400
commit8ef456f89f63ab12941fe6b5352b20cff2522da3 (patch)
tree6c1e5d5bb2f71175297b69013dd00b199b9f053d /src/mongo/scripting/mozjs/implscope.h
parentb39e21c774d0ff3afeac1730f08d8defed38044d (diff)
SERVER-30875 add requireOwnedObjects() to scoper3.4.8-rc1r3.4.8
Add a flag to JS scopes that requires that bson objects bound to the scope be owned. This should allow for more easy auditing of scopes that don't explicitly manage lifetime with advanceGeneration. (cherry picked from commit 79b47945a6aae707d44e05669d991d86b157a14b)
Diffstat (limited to 'src/mongo/scripting/mozjs/implscope.h')
-rw-r--r--src/mongo/scripting/mozjs/implscope.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h
index df37553e181..ea9b35d2cf4 100644
--- a/src/mongo/scripting/mozjs/implscope.h
+++ b/src/mongo/scripting/mozjs/implscope.h
@@ -309,6 +309,10 @@ public:
void advanceGeneration() override;
+ void requireOwnedObjects() override;
+
+ bool requiresOwnedObjects() const;
+
JS::HandleId getInternedStringId(InternedString name) {
return _internedStrings.getInternedString(name);
}
@@ -402,6 +406,7 @@ private:
Status _status;
std::string _parentStack;
std::size_t _generation;
+ bool _requireOwnedObjects;
bool _hasOutOfMemoryException;
WrapType<BinDataInfo> _binDataProto;