mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 899973 - GC: Convert the rest of the JS property API to use MutableHandleValue for out params - js changes r=sfink
This commit is contained in:
parent
83e7e190e6
commit
31aad21f23
@ -27,7 +27,7 @@ BEGIN_TEST(testLookup_bug522590)
|
||||
|
||||
// This lookup must not return an internal function object.
|
||||
JS::RootedValue r(cx);
|
||||
CHECK(JS_LookupProperty(cx, xobj, "f", r.address()));
|
||||
CHECK(JS_LookupProperty(cx, xobj, "f", &r));
|
||||
CHECK(r.isObject());
|
||||
JSObject *funobj = &r.toObject();
|
||||
CHECK(funobj->is<JSFunction>());
|
||||
|
@ -3106,11 +3106,11 @@ LookupPropertyById(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
|
||||
static JSBool
|
||||
LookupResult(JSContext *cx, HandleObject obj, HandleObject obj2, HandleId id,
|
||||
HandleShape shape, Value *vp)
|
||||
HandleShape shape, MutableHandleValue vp)
|
||||
{
|
||||
if (!shape) {
|
||||
/* XXX bad API: no way to tell "not defined" from "void value" */
|
||||
vp->setUndefined();
|
||||
vp.setUndefined();
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@ -3120,28 +3120,28 @@ LookupResult(JSContext *cx, HandleObject obj, HandleObject obj2, HandleId id,
|
||||
if (!Proxy::getPropertyDescriptor(cx, obj2, id, &desc, 0))
|
||||
return false;
|
||||
if (!(desc.attrs & JSPROP_SHARED)) {
|
||||
*vp = desc.value;
|
||||
vp.set(desc.value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (IsImplicitDenseElement(shape)) {
|
||||
*vp = obj2->getDenseElement(JSID_TO_INT(id));
|
||||
vp.set(obj2->getDenseElement(JSID_TO_INT(id)));
|
||||
return true;
|
||||
} else {
|
||||
/* Peek at the native property's slot value, without doing a Get. */
|
||||
if (shape->hasSlot()) {
|
||||
*vp = obj2->nativeGetSlot(shape->slot());
|
||||
vp.set(obj2->nativeGetSlot(shape->slot()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX bad API: no way to return "defined but value unknown" */
|
||||
vp->setBoolean(true);
|
||||
vp.setBoolean(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_LookupPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, jsval *vp)
|
||||
JS_LookupPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, MutableHandleValue vp)
|
||||
{
|
||||
RootedId id(cx, idArg);
|
||||
RootedObject obj(cx, objArg);
|
||||
@ -3160,11 +3160,15 @@ JS_LookupElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval *vp)
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_LookupPropertyById(cx, obj, id, vp);
|
||||
RootedValue value(cx);
|
||||
if (!JS_LookupPropertyById(cx, obj, id, &value))
|
||||
return false;
|
||||
*vp = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_LookupProperty(JSContext *cx, JSObject *objArg, const char *name, jsval *vp)
|
||||
JS_LookupProperty(JSContext *cx, JSObject *objArg, const char *name, MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
JSAtom *atom = Atomize(cx, name, strlen(name));
|
||||
@ -3172,7 +3176,8 @@ JS_LookupProperty(JSContext *cx, JSObject *objArg, const char *name, jsval *vp)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_LookupUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen, jsval *vp)
|
||||
JS_LookupUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
JSAtom *atom = AtomizeChars<CanGC>(cx, name, AUTO_NAMELEN(name, namelen));
|
||||
@ -3181,7 +3186,7 @@ JS_LookupUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *objArg, jsid id_, unsigned flags,
|
||||
JSObject **objpArg, jsval *vp)
|
||||
JSObject **objpArg, MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedObject objp(cx, *objpArg);
|
||||
@ -3204,7 +3209,8 @@ JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *objArg, jsid id_, unsign
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_LookupPropertyWithFlags(JSContext *cx, JSObject *objArg, const char *name, unsigned flags, jsval *vp)
|
||||
JS_LookupPropertyWithFlags(JSContext *cx, JSObject *objArg, const char *name, unsigned flags,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
JSObject *obj2;
|
||||
@ -3718,18 +3724,14 @@ JS_GetUCPropertyAttrsGetterAndSetter(JSContext *cx, JSObject *objArg,
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *objArg, jsid idArg, jsval *vp)
|
||||
JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *objArg, jsid idArg, MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx, idArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!GetOwnPropertyDescriptor(cx, obj, id, &value))
|
||||
return false;
|
||||
*vp = value;
|
||||
return true;
|
||||
return GetOwnPropertyDescriptor(cx, obj, id, vp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
@ -3926,7 +3928,7 @@ JS_SetUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t nam
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_DeletePropertyById2(JSContext *cx, JSObject *objArg, jsid id, jsval *rval)
|
||||
JS_DeletePropertyById2(JSContext *cx, JSObject *objArg, jsid id, MutableHandleValue rval)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
@ -3946,7 +3948,7 @@ JS_DeletePropertyById2(JSContext *cx, JSObject *objArg, jsid id, jsval *rval)
|
||||
return false;
|
||||
}
|
||||
|
||||
*rval = BooleanValue(succeeded);
|
||||
rval.setBoolean(succeeded);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3968,7 +3970,7 @@ JS_DeleteElement2(JSContext *cx, JSObject *objArg, uint32_t index, jsval *rval)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteProperty2(JSContext *cx, JSObject *objArg, const char *name, jsval *rval)
|
||||
JS_DeleteProperty2(JSContext *cx, JSObject *objArg, const char *name, MutableHandleValue rval)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
CHECK_REQUEST(cx);
|
||||
@ -3983,12 +3985,13 @@ JS_DeleteProperty2(JSContext *cx, JSObject *objArg, const char *name, jsval *rva
|
||||
if (!JSObject::deleteByValue(cx, obj, StringValue(atom), &succeeded))
|
||||
return false;
|
||||
|
||||
*rval = BooleanValue(succeeded);
|
||||
rval.setBoolean(succeeded);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteUCProperty2(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen, jsval *rval)
|
||||
JS_DeleteUCProperty2(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen,
|
||||
MutableHandleValue rval)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
CHECK_REQUEST(cx);
|
||||
@ -4003,14 +4006,14 @@ JS_DeleteUCProperty2(JSContext *cx, JSObject *objArg, const jschar *name, size_t
|
||||
if (!JSObject::deleteByValue(cx, obj, StringValue(atom), &succeeded))
|
||||
return false;
|
||||
|
||||
*rval = BooleanValue(succeeded);
|
||||
rval.setBoolean(succeeded);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_DeletePropertyById(JSContext *cx, JSObject *objArg, jsid idArg)
|
||||
{
|
||||
jsval junk;
|
||||
RootedValue junk(cx);
|
||||
return JS_DeletePropertyById2(cx, objArg, idArg, &junk);
|
||||
}
|
||||
|
||||
@ -4024,7 +4027,7 @@ JS_DeleteElement(JSContext *cx, JSObject *objArg, uint32_t index)
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteProperty(JSContext *cx, JSObject *objArg, const char *name)
|
||||
{
|
||||
jsval junk;
|
||||
RootedValue junk(cx);
|
||||
return JS_DeleteProperty2(cx, objArg, name, &junk);
|
||||
}
|
||||
|
||||
|
@ -3389,18 +3389,18 @@ extern JS_PUBLIC_API(JSBool)
|
||||
JS_HasPropertyById(JSContext *cx, JSObject *obj, jsid id, JSBool *foundp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_LookupProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp);
|
||||
JS_LookupProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_LookupPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
|
||||
JS_LookupPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, const char *name,
|
||||
unsigned flags, jsval *vp);
|
||||
unsigned flags, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *obj, jsid id,
|
||||
unsigned flags, JSObject **objp, jsval *vp);
|
||||
unsigned flags, JSObject **objp, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
struct JSPropertyDescriptor {
|
||||
JSObject *obj;
|
||||
@ -3530,7 +3530,7 @@ JS_GetPropertyDescriptorById(JSContext *cx, JSObject *obj, jsid id, unsigned fla
|
||||
JSPropertyDescriptor *desc);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
|
||||
JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle<JS::Value> vp);
|
||||
@ -3561,13 +3561,13 @@ JS_DeleteProperty(JSContext *cx, JSObject *obj, const char *name);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteProperty2(JSContext *cx, JSObject *obj, const char *name,
|
||||
jsval *rval);
|
||||
JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DeletePropertyById(JSContext *cx, JSObject *obj, jsid id);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DeletePropertyById2(JSContext *cx, JSObject *obj, jsid id, jsval *rval);
|
||||
JS_DeletePropertyById2(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DefineUCProperty(JSContext *cx, JSObject *obj,
|
||||
@ -3629,7 +3629,7 @@ JS_HasUCProperty(JSContext *cx, JSObject *obj,
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_LookupUCProperty(JSContext *cx, JSObject *obj,
|
||||
const jschar *name, size_t namelen,
|
||||
jsval *vp);
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetUCProperty(JSContext *cx, JSObject *obj,
|
||||
@ -3644,7 +3644,7 @@ JS_SetUCProperty(JSContext *cx, JSObject *obj,
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteUCProperty2(JSContext *cx, JSObject *obj,
|
||||
const jschar *name, size_t namelen,
|
||||
jsval *rval);
|
||||
JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
JS_NewArrayObject(JSContext *cx, int length, jsval *vector);
|
||||
|
@ -531,7 +531,7 @@ js::ReportUsageError(JSContext *cx, HandleObject callee, const char *msg)
|
||||
JS_ASSERT(shape->hasDefaultGetter());
|
||||
|
||||
RootedValue usage(cx);
|
||||
if (!JS_LookupProperty(cx, callee, "usage", usage.address()))
|
||||
if (!JS_LookupProperty(cx, callee, "usage", &usage))
|
||||
return;
|
||||
|
||||
if (JSVAL_IS_VOID(usage)) {
|
||||
|
@ -424,7 +424,7 @@ DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool
|
||||
assertEnteredPolicy(cx, proxy, id);
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
RootedValue v(cx);
|
||||
if (!JS_DeletePropertyById2(cx, target, id, v.address()))
|
||||
if (!JS_DeletePropertyById2(cx, target, id, &v))
|
||||
return false;
|
||||
JSBool b;
|
||||
if (!JS_ValueToBoolean(cx, v, &b))
|
||||
|
@ -4024,10 +4024,10 @@ static bool
|
||||
PrintHelp(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
RootedValue usage(cx);
|
||||
if (!JS_LookupProperty(cx, obj, "usage", usage.address()))
|
||||
if (!JS_LookupProperty(cx, obj, "usage", &usage))
|
||||
return false;
|
||||
RootedValue help(cx);
|
||||
if (!JS_LookupProperty(cx, obj, "help", help.address()))
|
||||
if (!JS_LookupProperty(cx, obj, "help", &help))
|
||||
return false;
|
||||
|
||||
if (JSVAL_IS_VOID(usage) || JSVAL_IS_VOID(help))
|
||||
@ -4050,7 +4050,7 @@ Help(JSContext *cx, unsigned argc, jsval *vp)
|
||||
|
||||
for (size_t i = 0; i < ida.length(); i++) {
|
||||
RootedValue v(cx);
|
||||
if (!JS_LookupPropertyById(cx, global, ida[i], v.address()))
|
||||
if (!JS_LookupPropertyById(cx, global, ida[i], &v))
|
||||
return false;
|
||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
||||
JS_ReportError(cx, "primitive arg");
|
||||
|
Loading…
Reference in New Issue
Block a user