summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-05-20 16:43:43 -0400
committerEliot Horowitz <eliot@10gen.com>2009-05-20 16:43:43 -0400
commit0bcbdbc3ec2b82a69255c91253f57a9b3544c5c7 (patch)
treea5c658c4fe8567f24a578ccf191e0a68a29c3802 /scripting
parent7155f7aa558dd6241179a5d3aff6200d1836ec7f (diff)
downloadmongo-0bcbdbc3ec2b82a69255c91253f57a9b3544c5c7.tar.gz
some js safety stuff MINOR
Diffstat (limited to 'scripting')
-rw-r--r--scripting/engine_spidermonkey.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp
index ba3832af351..08d98e15bd8 100644
--- a/scripting/engine_spidermonkey.cpp
+++ b/scripting/engine_spidermonkey.cpp
@@ -17,14 +17,20 @@ namespace mongo {
public:
BSONHolder( BSONObj obj ){
- _obj = obj;
+ _obj = obj.getOwned();
_inResolve = false;
+ _magic = 17;
}
+ void check(){
+ uassert( "holder magic value is wrong" , _magic == 17 );
+ }
+
BSONFieldIterator * it();
BSONObj _obj;
bool _inResolve;
+ char _magic;
list<string> _extra;
};
@@ -527,6 +533,8 @@ namespace mongo {
Convertor c( cx );
BSONHolder * holder = GETHOLDER( cx , obj );
+ holder->check();
+
string s = c.toString( id );
BSONElement e = holder->_obj[ s.c_str() ];