Bug 1090749. Reverse the isSelfHosted test in XrayWrapper and jsapi.cpp. r=waldo

This commit is contained in:
Boris Zbarsky 2014-10-29 17:00:48 -04:00
parent 3cc3a6789e
commit 98fc026551
2 changed files with 13 additions and 13 deletions

View File

@ -3317,13 +3317,7 @@ JS_DefineProperties(JSContext *cx, HandleObject obj, const JSPropertySpec *ps)
if (!PropertySpecNameToId(cx, ps->name, &id))
return false;
if (!ps->isSelfHosted()) {
if (!DefinePropertyById(cx, obj, id, JS::UndefinedHandleValue,
ps->getter.native, ps->setter.native, ps->flags, 0))
{
return false;
}
} else {
if (ps->isSelfHosted()) {
if (!DefineSelfHostedProperty(cx, obj, id,
ps->getter.selfHosted.funname,
ps->setter.selfHosted.funname,
@ -3331,6 +3325,12 @@ JS_DefineProperties(JSContext *cx, HandleObject obj, const JSPropertySpec *ps)
{
return false;
}
} else {
if (!DefinePropertyById(cx, obj, id, JS::UndefinedHandleValue,
ps->getter.native, ps->setter.native, ps->flags, 0))
{
return false;
}
}
}
return true;

View File

@ -504,12 +504,7 @@ JSXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper,
RootedFunction getterObj(cx);
RootedFunction setterObj(cx);
unsigned flags = psMatch->flags;
if (!psMatch->isSelfHosted()) {
desc.setGetter(JS_CAST_NATIVE_TO(psMatch->getter.native.op,
JSPropertyOp));
desc.setSetter(JS_CAST_NATIVE_TO(psMatch->setter.native.op,
JSStrictPropertyOp));
} else {
if (psMatch->isSelfHosted()) {
getterObj = JS::GetSelfHostedFunction(cx, psMatch->getter.selfHosted.funname, id, 0);
if (!getterObj)
return false;
@ -521,6 +516,11 @@ JSXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper,
return false;
desc.setSetterObject(JS_GetFunctionObject(setterObj));
}
} else {
desc.setGetter(JS_CAST_NATIVE_TO(psMatch->getter.native.op,
JSPropertyOp));
desc.setSetter(JS_CAST_NATIVE_TO(psMatch->setter.native.op,
JSStrictPropertyOp));
}
desc.setAttributes(flags);