diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp index 39007f79b9d3..5d2e3f70d210 100644 --- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -391,25 +391,25 @@ static bool args_enumerate(JSContext *cx, HandleObject obj) { Rooted argsobj(cx, &obj->as()); + RootedId id(cx); + bool found; - /* - * Trigger reflection in args_resolve using a series of js_LookupProperty - * calls. - */ - int argc = int(argsobj->initialLength()); - for (int i = -2; i != argc; i++) { - id = (i == -2) - ? NameToId(cx->names().length) - : (i == -1) - ? NameToId(cx->names().callee) - : INT_TO_JSID(i); + // Trigger reflection. + id = NameToId(cx->names().length); + if (!HasProperty(cx, argsobj, id, &found)) + return false; - RootedObject pobj(cx); - RootedShape prop(cx); - if (!NativeLookupProperty(cx, argsobj, id, &pobj, &prop)) + id = NameToId(cx->names().callee); + if (!HasProperty(cx, argsobj, id, &found)) + return false; + + for (unsigned i = 0; i < argsobj->initialLength(); i++) { + id = INT_TO_JSID(i); + if (!HasProperty(cx, argsobj, id, &found)) return false; } + return true; } @@ -511,32 +511,25 @@ strictargs_enumerate(JSContext *cx, HandleObject obj) { Rooted argsobj(cx, &obj->as()); - /* - * Trigger reflection in strictargs_resolve using a series of - * js_LookupProperty calls. - */ - RootedObject pobj(cx); - RootedShape prop(cx); RootedId id(cx); + bool found; - // length + // Trigger reflection. id = NameToId(cx->names().length); - if (!NativeLookupProperty(cx, argsobj, id, &pobj, &prop)) + if (!HasProperty(cx, argsobj, id, &found)) return false; - // callee id = NameToId(cx->names().callee); - if (!NativeLookupProperty(cx, argsobj, id, &pobj, &prop)) + if (!HasProperty(cx, argsobj, id, &found)) return false; - // caller id = NameToId(cx->names().caller); - if (!NativeLookupProperty(cx, argsobj, id, &pobj, &prop)) + if (!HasProperty(cx, argsobj, id, &found)) return false; - for (uint32_t i = 0, argc = argsobj->initialLength(); i < argc; i++) { + for (unsigned i = 0; i < argsobj->initialLength(); i++) { id = INT_TO_JSID(i); - if (!NativeLookupProperty(cx, argsobj, id, &pobj, &prop)) + if (!HasProperty(cx, argsobj, id, &found)) return false; }