mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1135031 - Call HasProperty instead NativeLookupProperty in args_enumerate. r=jorendorff
This commit is contained in:
parent
c244052c0b
commit
f33031f3a5
@ -391,25 +391,25 @@ static bool
|
||||
args_enumerate(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
Rooted<NormalArgumentsObject*> argsobj(cx, &obj->as<NormalArgumentsObject>());
|
||||
|
||||
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<CanGC>(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<StrictArgumentsObject*> argsobj(cx, &obj->as<StrictArgumentsObject>());
|
||||
|
||||
/*
|
||||
* 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<CanGC>(cx, argsobj, id, &pobj, &prop))
|
||||
if (!HasProperty(cx, argsobj, id, &found))
|
||||
return false;
|
||||
|
||||
// callee
|
||||
id = NameToId(cx->names().callee);
|
||||
if (!NativeLookupProperty<CanGC>(cx, argsobj, id, &pobj, &prop))
|
||||
if (!HasProperty(cx, argsobj, id, &found))
|
||||
return false;
|
||||
|
||||
// caller
|
||||
id = NameToId(cx->names().caller);
|
||||
if (!NativeLookupProperty<CanGC>(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<CanGC>(cx, argsobj, id, &pobj, &prop))
|
||||
if (!HasProperty(cx, argsobj, id, &found))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user