зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1122209 - Change some uses of LookupProperty to HasProperty. r=evilpie.
--HG-- extra : rebase_source : f56fe7da945b0c08b9cbb9fcf9bb65a277cc1dc2
This commit is contained in:
Родитель
7b38f74598
Коммит
a775a5666a
|
@ -561,16 +561,8 @@ bool
|
|||
OperatorIn(JSContext *cx, HandleValue key, HandleObject obj, bool *out)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, key, &id))
|
||||
return false;
|
||||
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
if (!LookupProperty(cx, obj, id, &obj2, &prop))
|
||||
return false;
|
||||
|
||||
*out = !!prop;
|
||||
return true;
|
||||
return ValueToId<CanGC>(cx, key, &id) &&
|
||||
HasProperty(cx, obj, id, out);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -179,19 +179,17 @@ DoGetElement(JSContext *cx, HandleObject obj, HandleObject receiver,
|
|||
if (!ToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
if (!LookupProperty(cx, obj, id, &obj2, &prop))
|
||||
bool found;
|
||||
if (!HasProperty(cx, obj, id, &found))
|
||||
return false;
|
||||
|
||||
if (!prop) {
|
||||
vp.setUndefined();
|
||||
*hole = true;
|
||||
} else {
|
||||
if (found) {
|
||||
if (!GetProperty(cx, obj, receiver, id, vp))
|
||||
return false;
|
||||
*hole = false;
|
||||
} else {
|
||||
vp.setUndefined();
|
||||
}
|
||||
*hole = !found;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7371,12 +7371,11 @@ DebuggerEnv_find(JSContext *cx, unsigned argc, Value *vp)
|
|||
|
||||
/* This can trigger resolve hooks. */
|
||||
ErrorCopier ec(ac);
|
||||
RootedShape prop(cx);
|
||||
RootedObject pobj(cx);
|
||||
for (; env && !prop; env = env->enclosingScope()) {
|
||||
if (!LookupProperty(cx, env, id, &pobj, &prop))
|
||||
bool found;
|
||||
for (; env; env = env->enclosingScope()) {
|
||||
if (!HasProperty(cx, env, id, &found))
|
||||
return false;
|
||||
if (prop)
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1881,15 +1881,12 @@ CASE(JSOP_IN)
|
|||
obj = &rref.toObject();
|
||||
RootedId &id = rootId0;
|
||||
FETCH_ELEMENT_ID(-2, id);
|
||||
RootedObject &obj2 = rootObject1;
|
||||
RootedShape &prop = rootShape0;
|
||||
if (!LookupProperty(cx, obj, id, &obj2, &prop))
|
||||
bool found;
|
||||
if (!HasProperty(cx, obj, id, &found))
|
||||
goto error;
|
||||
bool cond = prop != nullptr;
|
||||
prop = nullptr;
|
||||
TRY_BRANCH_AFTER_COND(cond, 2);
|
||||
TRY_BRANCH_AFTER_COND(found, 2);
|
||||
REGS.sp--;
|
||||
REGS.sp[-1].setBoolean(cond);
|
||||
REGS.sp[-1].setBoolean(found);
|
||||
}
|
||||
END_CASE(JSOP_IN)
|
||||
|
||||
|
|
|
@ -2149,10 +2149,10 @@ js::NativeSetProperty(JSContext *cx, HandleNativeObject obj, HandleObject receiv
|
|||
// at all, but they do go through this function. So check for
|
||||
// unqualified assignment to a nonexistent global (a strict error).
|
||||
if (!qualified) {
|
||||
RootedObject pobj(cx);
|
||||
if (!LookupProperty(cx, proto, id, &pobj, &shape))
|
||||
bool found;
|
||||
if (!HasProperty(cx, proto, id, &found))
|
||||
return false;
|
||||
if (!shape)
|
||||
if (!found)
|
||||
return SetNonexistentProperty(cx, obj, receiver, id, qualified, vp, strict);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче