Bug 827929 - Remove SkipRoot in Object::toSource; r=billm

This commit is contained in:
Terrence Cole 2013-01-08 10:52:44 -08:00
parent 10a31f72a8
commit f4a0271b64

View File

@ -137,12 +137,11 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp)
if (!buf.append('{'))
return false;
Value val[2];
PodArrayZero(val);
AutoArrayRooter tvr2(cx, ArrayLength(val), val);
RootedValue v0(cx), v1(cx);
MutableHandleValue val[2] = {&v0, &v1};
JSString *gsop[2];
SkipRoot skipGsop(cx, &gsop, 2);
RootedString str0(cx), str1(cx);
MutableHandleString gsop[2] = {&str0, &str1};
AutoIdVector idv(cx);
if (!GetPropertyNames(cx, obj, JSITER_OWNONLY, &idv))
@ -164,22 +163,21 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp)
unsigned attrs = shape->attributes();
if (attrs & JSPROP_GETTER) {
doGet = false;
val[valcnt] = shape->getterValue();
gsop[valcnt] = cx->names().get;
val[valcnt].set(shape->getterValue());
gsop[valcnt].set(cx->names().get);
valcnt++;
}
if (attrs & JSPROP_SETTER) {
doGet = false;
val[valcnt] = shape->setterValue();
gsop[valcnt] = cx->names().set;
val[valcnt].set(shape->setterValue());
gsop[valcnt].set(cx->names().set);
valcnt++;
}
}
if (doGet) {
valcnt = 1;
gsop[0] = NULL;
MutableHandleValue vp = MutableHandleValue::fromMarkedLocation(&val[0]);
if (!JSObject::getGeneric(cx, obj, obj, id, vp))
gsop[0].set(NULL);
if (!JSObject::getGeneric(cx, obj, obj, id, val[0]))
return false;
}
}
@ -252,7 +250,7 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp)
vchars++;
vlength = end - vchars - parenChomp;
} else {
gsop[j] = NULL;
gsop[j].set(NULL);
vchars = start;
}
}