Bug 833396 - Fix some rooting issues found by static analysis r=sphink

This commit is contained in:
Jon Coppeard
2013-01-21 17:41:49 +00:00
parent ecde34505e
commit f416dc4f7a
12 changed files with 89 additions and 78 deletions

View File

@@ -55,6 +55,8 @@ using namespace js::gc;
using mozilla::ArrayLength;
typedef Rooted<PropertyIteratorObject*> RootedPropertyIteratorObject;
static const gc::AllocKind ITERATOR_FINALIZE_KIND = gc::FINALIZE_OBJECT2;
void
@@ -1074,7 +1076,7 @@ template<typename StringPredicate>
static bool
SuppressDeletedPropertyHelper(JSContext *cx, HandleObject obj, StringPredicate predicate)
{
PropertyIteratorObject *iterobj = cx->enumerators;
RootedPropertyIteratorObject iterobj(cx, cx->enumerators);
while (iterobj) {
again:
NativeIterator *ni = iterobj->getNativeIterator();
@@ -1561,7 +1563,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
gen->regs = cx->regs();
cx->enterGenerator(gen); /* OOM check above. */
PropertyIteratorObject *enumerators = cx->enumerators;
RootedPropertyIteratorObject enumerators(cx, cx->enumerators);
cx->enumerators = gen->enumerators;
RootedScript script(cx, fp->script());