mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 823283 - Remove all remaining uses of JSRESOLVE_QUALIFIED, and the few remaining tests (which were pretty much purely diagnostic). r=luke
--HG-- extra : rebase_source : 51e2ac7ccc76be84d12600baeb6d458c2927bea7
This commit is contained in:
parent
cd30487f2a
commit
c3a0e6572c
@ -5836,7 +5836,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod):
|
||||
|
||||
return setOrIndexedGet + """JSObject* expando;
|
||||
if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) {
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED;
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0);
|
||||
if (!JS_GetPropertyDescriptorById(cx, expando, id, flags, desc)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ DOMProxyHandler::getPropertyDescriptor(JSContext* cx, JSObject* proxy, jsid id,
|
||||
return true;
|
||||
}
|
||||
|
||||
return JS_GetPropertyDescriptorById(cx, proto, id, JSRESOLVE_QUALIFIED, desc);
|
||||
return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -4560,7 +4560,7 @@ IonBuilder::jsop_initprop(HandlePropertyName name)
|
||||
RootedShape shape(cx);
|
||||
RootedId id(cx, NameToId(name));
|
||||
bool res = LookupPropertyWithFlags(cx, templateObject, id,
|
||||
JSRESOLVE_QUALIFIED, &holder, &shape);
|
||||
0, &holder, &shape);
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
|
@ -3350,7 +3350,7 @@ JS_GetConstructor(JSContext *cx, JSObject *protoArg)
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, proto);
|
||||
{
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
if (!JSObject::getProperty(cx, proto, proto, cx->names().constructor, &cval))
|
||||
return NULL;
|
||||
@ -3597,7 +3597,7 @@ JS_LookupPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, jsval *vp)
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
|
||||
return LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &prop) &&
|
||||
return LookupPropertyById(cx, obj, id, 0, &obj2, &prop) &&
|
||||
LookupResult(cx, obj, obj2, id, prop, vp);
|
||||
}
|
||||
|
||||
@ -3668,7 +3668,7 @@ JS_HasPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, JSBool *foundp)
|
||||
RootedId id(cx, idArg);
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSBool ok = LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &prop);
|
||||
JSBool ok = LookupPropertyById(cx, obj, id, 0, &obj2, &prop);
|
||||
*foundp = (prop != NULL);
|
||||
return ok;
|
||||
}
|
||||
@ -3714,7 +3714,7 @@ JS_AlreadyHasOwnPropertyById(JSContext *cx, JSObject *objArg, jsid id_, JSBool *
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
|
||||
if (!LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &prop))
|
||||
if (!LookupPropertyById(cx, obj, id, 0, &obj2, &prop))
|
||||
return JS_FALSE;
|
||||
*foundp = (obj == obj2);
|
||||
return JS_TRUE;
|
||||
@ -3838,7 +3838,7 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
|
||||
? JS_FUNC_TO_DATA_PTR(JSObject *, setter)
|
||||
: NULL);
|
||||
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
if (flags != 0 && obj->isNative()) {
|
||||
return DefineNativeProperty(cx, obj, id, value, getter, setter,
|
||||
attrs, flags, tinyid);
|
||||
@ -4092,7 +4092,7 @@ JS_GetPropertyAttrsGetterAndSetterById(JSContext *cx, JSObject *objArg, jsid idA
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx, idArg);
|
||||
AutoPropertyDescriptorRooter desc(cx);
|
||||
if (!GetPropertyDescriptorById(cx, obj, id, JSRESOLVE_QUALIFIED, JS_FALSE, &desc))
|
||||
if (!GetPropertyDescriptorById(cx, obj, id, 0, JS_FALSE, &desc))
|
||||
return false;
|
||||
|
||||
*attrsp = desc.attrs;
|
||||
@ -4164,7 +4164,7 @@ SetPropertyAttributesById(JSContext *cx, HandleObject obj, HandleId id, unsigned
|
||||
RootedObject obj2(cx);
|
||||
RootedShape shape(cx);
|
||||
|
||||
if (!LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &shape))
|
||||
if (!LookupPropertyById(cx, obj, id, 0, &obj2, &shape))
|
||||
return false;
|
||||
if (!shape || obj != obj2) {
|
||||
*foundp = false;
|
||||
@ -4215,7 +4215,7 @@ JS_ForwardGetPropertyTo(JSContext *cx, JSObject *objArg, jsid idArg, JSObject *o
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, id);
|
||||
assertSameCompartment(cx, onBehalfOf);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!JSObject::getGeneric(cx, obj, onBehalfOf, id, &value))
|
||||
@ -4254,7 +4254,7 @@ JS_ForwardGetElementTo(JSContext *cx, JSObject *objArg, uint32_t index, JSObject
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!JSObject::getElement(cx, obj, onBehalfOf, index, &value))
|
||||
@ -4272,7 +4272,7 @@ JS_GetElementIfPresent(JSContext *cx, JSObject *objArg, uint32_t index, JSObject
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
RootedValue value(cx);
|
||||
bool isPresent;
|
||||
@ -4343,7 +4343,7 @@ JS_SetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, jsval *vp)
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, id);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_ASSIGNING);
|
||||
|
||||
RootedValue value(cx, *vp);
|
||||
if (!JSObject::setGeneric(cx, obj, obj, id, &value, false))
|
||||
@ -4360,7 +4360,7 @@ JS_SetElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval *vp)
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, *vp);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_ASSIGNING);
|
||||
|
||||
RootedValue value(cx, *vp);
|
||||
if (!JSObject::setElement(cx, obj, obj, index, &value, false))
|
||||
@ -4393,7 +4393,7 @@ JS_DeletePropertyById2(JSContext *cx, JSObject *objArg, jsid id, jsval *rval)
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, id);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
RootedValue value(cx);
|
||||
|
||||
@ -4417,7 +4417,7 @@ JS_DeleteElement2(JSContext *cx, JSObject *objArg, uint32_t index, jsval *rval)
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!JSObject::deleteElement(cx, obj, index, &value, false))
|
||||
@ -4433,7 +4433,7 @@ JS_DeleteProperty2(JSContext *cx, JSObject *objArg, const char *name, jsval *rva
|
||||
RootedObject obj(cx, objArg);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
JSAtom *atom = Atomize(cx, name, strlen(name));
|
||||
if (!atom)
|
||||
@ -4453,7 +4453,7 @@ JS_DeleteUCProperty2(JSContext *cx, JSObject *objArg, const jschar *name, size_t
|
||||
RootedObject obj(cx, objArg);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
JSAtom *atom = AtomizeChars(cx, name, AUTO_NAMELEN(name, namelen));
|
||||
if (!atom)
|
||||
|
@ -1836,7 +1836,6 @@ typedef JSBool
|
||||
/*
|
||||
* Like JSResolveOp, but flags provide contextual information as follows:
|
||||
*
|
||||
* JSRESOLVE_QUALIFIED a qualified property id: obj.id or obj[id], not id
|
||||
* JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment
|
||||
*
|
||||
* The *objp out parameter, on success, should be null to indicate that id
|
||||
@ -4230,8 +4229,7 @@ JS_IdToValue(JSContext *cx, jsid id, jsval *vp);
|
||||
/*
|
||||
* JSNewResolveOp flag bits.
|
||||
*/
|
||||
#define JSRESOLVE_QUALIFIED 0x01 /* resolve a qualified property id */
|
||||
#define JSRESOLVE_ASSIGNING 0x02 /* resolve on the left of assignment */
|
||||
#define JSRESOLVE_ASSIGNING 0x01 /* resolve on the left of assignment */
|
||||
|
||||
/*
|
||||
* Invoke the [[DefaultValue]] hook (see ES5 8.6.2) with the provided hint on
|
||||
|
@ -211,22 +211,22 @@ fun_enumerate(JSContext *cx, HandleObject obj)
|
||||
|
||||
if (!obj->isBoundFunction()) {
|
||||
id = NameToId(cx->names().classPrototype);
|
||||
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
||||
if (!JSObject::hasProperty(cx, obj, id, &found, 0))
|
||||
return false;
|
||||
}
|
||||
|
||||
id = NameToId(cx->names().length);
|
||||
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
||||
if (!JSObject::hasProperty(cx, obj, id, &found, 0))
|
||||
return false;
|
||||
|
||||
id = NameToId(cx->names().name);
|
||||
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
||||
if (!JSObject::hasProperty(cx, obj, id, &found, 0))
|
||||
return false;
|
||||
|
||||
for (unsigned i = 0; i < ArrayLength(poisonPillProps); i++) {
|
||||
const uint16_t offset = poisonPillProps[i];
|
||||
id = NameToId(OFFSET_TO_NAME(cx->runtime, offset));
|
||||
if (!JSObject::hasProperty(cx, obj, id, &found, JSRESOLVE_QUALIFIED))
|
||||
if (!JSObject::hasProperty(cx, obj, id, &found, 0))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ JSBool
|
||||
js_HasOwnProperty(JSContext *cx, LookupGenericOp lookup, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
if (lookup) {
|
||||
if (!lookup(cx, obj, id, objp, propp))
|
||||
return false;
|
||||
@ -328,7 +328,7 @@ js::GetFirstArgumentAsObject(JSContext *cx, unsigned argc, Value *vp, const char
|
||||
static bool
|
||||
HasProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp, bool *foundp)
|
||||
{
|
||||
if (!JSObject::hasProperty(cx, obj, id, foundp, JSRESOLVE_QUALIFIED))
|
||||
if (!JSObject::hasProperty(cx, obj, id, foundp, 0))
|
||||
return false;
|
||||
if (!*foundp) {
|
||||
vp.setUndefined();
|
||||
@ -1520,11 +1520,8 @@ js_InferFlags(JSContext *cx, unsigned defaultFlags)
|
||||
if (!script)
|
||||
return defaultFlags;
|
||||
|
||||
const JSCodeSpec *cs = &js_CodeSpec[*pc];
|
||||
uint32_t format = cs->format;
|
||||
uint32_t format = js_CodeSpec[*pc].format;
|
||||
unsigned flags = 0;
|
||||
if (JOF_MODE(format) != JOF_NAME)
|
||||
flags |= JSRESOLVE_QUALIFIED;
|
||||
if (format & JOF_SET)
|
||||
flags |= JSRESOLVE_ASSIGNING;
|
||||
return flags;
|
||||
@ -3444,7 +3441,7 @@ baseops::GetPropertyDefault(JSContext *cx, HandleObject obj, HandleId id, Handle
|
||||
{
|
||||
RootedShape prop(cx);
|
||||
RootedObject obj2(cx);
|
||||
if (!LookupPropertyWithFlags(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &prop))
|
||||
if (!LookupPropertyWithFlags(cx, obj, id, 0, &obj2, &prop))
|
||||
return false;
|
||||
|
||||
if (!prop) {
|
||||
@ -3458,7 +3455,7 @@ baseops::GetPropertyDefault(JSContext *cx, HandleObject obj, HandleId id, Handle
|
||||
JSBool
|
||||
js::GetMethod(JSContext *cx, HandleObject obj, HandleId id, unsigned getHow, MutableHandleValue vp)
|
||||
{
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
GenericIdOp op = obj->getOps()->getGeneric;
|
||||
if (!op) {
|
||||
|
@ -379,7 +379,7 @@ DirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
PropertyDescriptor *desc)
|
||||
{
|
||||
RootedObject target(cx, GetProxyTargetObject(proxy));
|
||||
return JS_GetPropertyDescriptorById(cx, target, id, JSRESOLVE_QUALIFIED, desc);
|
||||
return JS_GetPropertyDescriptorById(cx, target, id, 0, desc);
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -406,7 +406,7 @@ DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
PropertyDescriptor *desc)
|
||||
{
|
||||
RootedObject target(cx, GetProxyTargetObject(proxy));
|
||||
return GetOwnPropertyDescriptor(cx, target, id, JSRESOLVE_QUALIFIED, desc);
|
||||
return GetOwnPropertyDescriptor(cx, target, id, 0, desc);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -546,7 +546,7 @@ DirectProxyHandler::hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
|
||||
{
|
||||
RootedObject target(cx, GetProxyTargetObject(proxy));
|
||||
AutoPropertyDescriptorRooter desc(cx);
|
||||
if (!JS_GetPropertyDescriptorById(cx, target, id, JSRESOLVE_QUALIFIED, &desc))
|
||||
if (!JS_GetPropertyDescriptorById(cx, target, id, 0, &desc))
|
||||
return false;
|
||||
*bp = (desc.obj == target);
|
||||
return true;
|
||||
@ -1254,7 +1254,7 @@ static bool
|
||||
HasOwn(JSContext *cx, HandleObject obj, HandleId id, bool *bp)
|
||||
{
|
||||
AutoPropertyDescriptorRooter desc(cx);
|
||||
if (!JS_GetPropertyDescriptorById(cx, obj, id, JSRESOLVE_QUALIFIED, &desc))
|
||||
if (!JS_GetPropertyDescriptorById(cx, obj, id, 0, &desc))
|
||||
return false;
|
||||
*bp = (desc.obj == obj);
|
||||
return true;
|
||||
@ -1587,7 +1587,7 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy
|
||||
JS_ASSERT(!desc->obj);
|
||||
return true;
|
||||
}
|
||||
return JS_GetPropertyDescriptorById(cx, proto, id, JSRESOLVE_QUALIFIED, desc);
|
||||
return JS_GetPropertyDescriptorById(cx, proto, id, 0, desc);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -2211,8 +2211,7 @@ Proxy::getPropertyDescriptor(JSContext *cx, JSObject *proxy_, jsid id_, bool set
|
||||
if (desc->obj)
|
||||
return true;
|
||||
INVOKE_ON_PROTOTYPE(cx, handler, proxy,
|
||||
JS_GetPropertyDescriptorById(cx, proto, id,
|
||||
JSRESOLVE_QUALIFIED, desc));
|
||||
JS_GetPropertyDescriptorById(cx, proto, id, 0, desc));
|
||||
}
|
||||
|
||||
bool
|
||||
@ -2398,7 +2397,7 @@ Proxy::set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id
|
||||
AutoPropertyDescriptorRooter desc(cx);
|
||||
if (handler->hasOwn(cx, proxy, id, &hasOwn) && !hasOwn &&
|
||||
handler->getPrototypeOf(cx, proxy, proto.address()) && proto &&
|
||||
JS_GetPropertyDescriptorById(cx, proto, id, JSRESOLVE_QUALIFIED, &desc) &&
|
||||
JS_GetPropertyDescriptorById(cx, proto, id, 0, &desc) &&
|
||||
desc.obj && desc.setter)
|
||||
{
|
||||
return JSObject::setGeneric(cx, proto, receiver, id, vp, strict);
|
||||
|
@ -2492,7 +2492,7 @@ mjit::Compiler::jsop_initprop()
|
||||
#ifdef DEBUG
|
||||
bool res =
|
||||
#endif
|
||||
LookupPropertyWithFlags(cx, baseobj, id, JSRESOLVE_QUALIFIED, &holder, &shape);
|
||||
LookupPropertyWithFlags(cx, baseobj, id, 0, &holder, &shape);
|
||||
JS_ASSERT(res && shape && holder == baseobj);
|
||||
|
||||
RegisterID objReg = frame.copyDataIntoReg(obj);
|
||||
|
@ -2798,7 +2798,7 @@ resolver_enumerate(JSContext *cx, HandleObject obj)
|
||||
RootedObject ignore(cx);
|
||||
for (size_t i = 0; ok && i < ida.length(); i++) {
|
||||
Rooted<jsid> id(cx, ida[i]);
|
||||
ok = CopyProperty(cx, obj, referent, id, JSRESOLVE_QUALIFIED, &ignore);
|
||||
ok = CopyProperty(cx, obj, referent, id, 0, &ignore);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -4195,9 +4195,8 @@ its_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
{
|
||||
if (its_noisy) {
|
||||
IdStringifier idString(cx, id);
|
||||
fprintf(gOutFile, "resolving its property %s, flags {%s,%s}\n",
|
||||
fprintf(gOutFile, "resolving its property %s, flags {%s}\n",
|
||||
idString.getBytes(),
|
||||
(flags & JSRESOLVE_QUALIFIED) ? "qualified" : "",
|
||||
(flags & JSRESOLVE_ASSIGNING) ? "assigning" : "");
|
||||
}
|
||||
return true;
|
||||
@ -4446,54 +4445,52 @@ global_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
#endif
|
||||
|
||||
#if defined(SHELL_HACK) && defined(DEBUG) && defined(XP_UNIX)
|
||||
if (!(flags & JSRESOLVE_QUALIFIED)) {
|
||||
/*
|
||||
* Do this expensive hack only for unoptimized Unix builds, which are
|
||||
* not used for benchmarking.
|
||||
*/
|
||||
char *path, *comp, *full;
|
||||
const char *name;
|
||||
bool ok, found;
|
||||
JSFunction *fun;
|
||||
/*
|
||||
* Do this expensive hack only for unoptimized Unix builds, which are
|
||||
* not used for benchmarking.
|
||||
*/
|
||||
char *path, *comp, *full;
|
||||
const char *name;
|
||||
bool ok, found;
|
||||
JSFunction *fun;
|
||||
|
||||
if (!JSVAL_IS_STRING(id))
|
||||
return true;
|
||||
path = getenv("PATH");
|
||||
if (!path)
|
||||
return true;
|
||||
path = JS_strdup(cx, path);
|
||||
if (!path)
|
||||
return false;
|
||||
JSAutoByteString name(cx, JSVAL_TO_STRING(id));
|
||||
if (!name)
|
||||
return false;
|
||||
ok = true;
|
||||
for (comp = strtok(path, ":"); comp; comp = strtok(NULL, ":")) {
|
||||
if (*comp != '\0') {
|
||||
full = JS_smprintf("%s/%s", comp, name.ptr());
|
||||
if (!full) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
full = (char *)name;
|
||||
}
|
||||
found = (access(full, X_OK) == 0);
|
||||
if (*comp != '\0')
|
||||
free(full);
|
||||
if (found) {
|
||||
fun = JS_DefineFunction(cx, obj, name, Exec, 0,
|
||||
JSPROP_ENUMERATE);
|
||||
ok = (fun != NULL);
|
||||
if (ok)
|
||||
objp.set(obj);
|
||||
if (!JSVAL_IS_STRING(id))
|
||||
return true;
|
||||
path = getenv("PATH");
|
||||
if (!path)
|
||||
return true;
|
||||
path = JS_strdup(cx, path);
|
||||
if (!path)
|
||||
return false;
|
||||
JSAutoByteString name(cx, JSVAL_TO_STRING(id));
|
||||
if (!name)
|
||||
return false;
|
||||
ok = true;
|
||||
for (comp = strtok(path, ":"); comp; comp = strtok(NULL, ":")) {
|
||||
if (*comp != '\0') {
|
||||
full = JS_smprintf("%s/%s", comp, name.ptr());
|
||||
if (!full) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
full = (char *)name;
|
||||
}
|
||||
found = (access(full, X_OK) == 0);
|
||||
if (*comp != '\0')
|
||||
free(full);
|
||||
if (found) {
|
||||
fun = JS_DefineFunction(cx, obj, name, Exec, 0,
|
||||
JSPROP_ENUMERATE);
|
||||
ok = (fun != NULL);
|
||||
if (ok)
|
||||
objp.set(obj);
|
||||
break;
|
||||
}
|
||||
JS_free(cx, path);
|
||||
return ok;
|
||||
}
|
||||
JS_free(cx, path);
|
||||
return ok;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
|
@ -1350,7 +1350,7 @@ class DebugScopeProxy : public BaseProxyHandler
|
||||
return true;
|
||||
}
|
||||
|
||||
return JS_GetPropertyDescriptorById(cx, scope, id, JSRESOLVE_QUALIFIED, desc);
|
||||
return JS_GetPropertyDescriptorById(cx, scope, id, 0, desc);
|
||||
}
|
||||
|
||||
bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid idArg, Value *vp) MOZ_OVERRIDE
|
||||
|
@ -3150,11 +3150,8 @@ xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
||||
js::RootedId id(cx, id_);
|
||||
|
||||
MOZ_ASSERT(js::GetObjectCompartment(obj) == js::GetObjectCompartment(proxy));
|
||||
// XXXbz Not sure about the JSRESOLVE_QUALIFIED here, but we have
|
||||
// no way to tell for sure whether to use it.
|
||||
if (!JS_GetPropertyDescriptorById(cx, obj, id,
|
||||
(set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED,
|
||||
desc))
|
||||
(set ? JSRESOLVE_ASSIGNING : 0), desc))
|
||||
return false;
|
||||
|
||||
if (!desc->obj)
|
||||
|
@ -155,7 +155,7 @@ LookupGetterOrSetter(JSContext *cx, JSBool wantGetter, unsigned argc, jsval *vp)
|
||||
jsid id;
|
||||
JSPropertyDescriptor desc;
|
||||
if (!JS_ValueToId(cx, idval, &id) ||
|
||||
!JS_GetPropertyDescriptorById(cx, obj, id, JSRESOLVE_QUALIFIED, &desc))
|
||||
!JS_GetPropertyDescriptorById(cx, obj, id, 0, &desc))
|
||||
return false;
|
||||
|
||||
// No property at all means no getters or setters possible.
|
||||
@ -238,8 +238,7 @@ DefineGetterOrSetter(JSContext *cx, unsigned argc, JSBool wantGetter, jsval *vp)
|
||||
return forward(cx, argc, vp);
|
||||
|
||||
if (!JS_ValueToId(cx, idval, &id) ||
|
||||
!JS_LookupPropertyWithFlagsById(cx, obj, id,
|
||||
JSRESOLVE_QUALIFIED, &obj2, &v) ||
|
||||
!JS_LookupPropertyWithFlagsById(cx, obj, id, 0, &obj2, &v) ||
|
||||
(obj2 &&
|
||||
!JS_GetPropertyAttrsGetterAndSetterById(cx, obj2, id, &attrs,
|
||||
&found, &getter, &setter)))
|
||||
|
@ -392,7 +392,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper:
|
||||
Access access = NO_ACCESS;
|
||||
|
||||
JSPropertyDescriptor desc;
|
||||
if (!JS_GetPropertyDescriptorById(cx, hallpass, id, JSRESOLVE_QUALIFIED, &desc)) {
|
||||
if (!JS_GetPropertyDescriptorById(cx, hallpass, id, 0, &desc)) {
|
||||
return false; // Error
|
||||
}
|
||||
if (!desc.obj || !(desc.attrs & JSPROP_ENUMERATE))
|
||||
|
@ -638,7 +638,7 @@ XPCWrappedNativeXrayTraits::resolveDOMCollectionProperty(JSContext *cx, JSObject
|
||||
|
||||
bool retval = true;
|
||||
JSObject *pobj = NULL;
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED;
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0);
|
||||
nsresult rv = wn->GetScriptableInfo()->GetCallback()->NewResolve(wn, cx, wrapper, id,
|
||||
flags, &pobj, &retval);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -647,11 +647,8 @@ XPCWrappedNativeXrayTraits::resolveDOMCollectionProperty(JSContext *cx, JSObject
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pobj && !JS_GetPropertyDescriptorById(cx, holder, id,
|
||||
JSRESOLVE_QUALIFIED, desc))
|
||||
{
|
||||
if (pobj && !JS_GetPropertyDescriptorById(cx, holder, id, 0, desc))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -979,7 +976,7 @@ XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, js::Wrapper &jsWra
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED;
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0);
|
||||
JSBool hasProp;
|
||||
if (!JS_HasPropertyById(cx, holder, id, &hasProp)) {
|
||||
return false;
|
||||
@ -1327,7 +1324,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrappe
|
||||
{
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
if (!JS_GetPropertyDescriptorById(cx, obj, id,
|
||||
(set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED,
|
||||
(set ? JSRESOLVE_ASSIGNING : 0),
|
||||
desc)) {
|
||||
return false;
|
||||
}
|
||||
@ -1368,7 +1365,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrappe
|
||||
if (desc->obj)
|
||||
return true;
|
||||
|
||||
if (!JS_GetPropertyDescriptorById(cx, holder, id, JSRESOLVE_QUALIFIED, desc))
|
||||
if (!JS_GetPropertyDescriptorById(cx, holder, id, 0, desc))
|
||||
return false;
|
||||
if (desc->obj) {
|
||||
desc->obj = wrapper;
|
||||
@ -1396,7 +1393,7 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrappe
|
||||
|
||||
desc->obj = wrapper;
|
||||
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED;
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0);
|
||||
return JS_DefinePropertyById(cx, holder, id, desc->value, desc->getter, desc->setter,
|
||||
desc->attrs) &&
|
||||
JS_GetPropertyDescriptorById(cx, holder, id, flags, desc);
|
||||
@ -1429,7 +1426,7 @@ XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wra
|
||||
{
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
if (!JS_GetPropertyDescriptorById(cx, obj, id,
|
||||
(set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED,
|
||||
(set ? JSRESOLVE_ASSIGNING : 0),
|
||||
desc)) {
|
||||
return false;
|
||||
}
|
||||
@ -1445,7 +1442,7 @@ XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wra
|
||||
if (desc->obj)
|
||||
return true;
|
||||
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0) | JSRESOLVE_QUALIFIED;
|
||||
unsigned flags = (set ? JSRESOLVE_ASSIGNING : 0);
|
||||
if (!JS_GetPropertyDescriptorById(cx, holder, id, flags, desc))
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user