mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 996785 - Rename CPOW toValue (r=mrbkap)
This commit is contained in:
parent
dbfc9e7d7b
commit
8f0019b5b9
@ -413,7 +413,7 @@ JavaScriptChild::AnswerSet(const ObjectId &objId, const ObjectId &receiverId, co
|
||||
MOZ_ASSERT(obj == receiver);
|
||||
|
||||
RootedValue val(cx);
|
||||
if (!toValue(cx, value, &val))
|
||||
if (!fromVariant(cx, value, &val))
|
||||
return fail(cx, rs);
|
||||
|
||||
if (!JS_SetPropertyById(cx, obj, internedId, val))
|
||||
@ -465,7 +465,7 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray<JSParam> &argv
|
||||
MOZ_ASSERT(argv.Length() >= 2);
|
||||
|
||||
RootedValue objv(cx);
|
||||
if (!toValue(cx, argv[0], &objv))
|
||||
if (!fromVariant(cx, argv[0], &objv))
|
||||
return fail(cx, rs);
|
||||
|
||||
JSAutoCompartment comp(cx, &objv.toObject());
|
||||
@ -488,7 +488,7 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray<JSParam> &argv
|
||||
return fail(cx, rs);
|
||||
} else {
|
||||
RootedValue v(cx);
|
||||
if (!toValue(cx, argv[i].get_JSVariant(), &v))
|
||||
if (!fromVariant(cx, argv[i].get_JSVariant(), &v))
|
||||
return fail(cx, rs);
|
||||
if (!vals.append(v))
|
||||
return fail(cx, rs);
|
||||
|
@ -317,7 +317,7 @@ JavaScriptParent::get(JSContext *cx, HandleObject proxy, HandleObject receiver,
|
||||
if (!ok(cx, status))
|
||||
return false;
|
||||
|
||||
return toValue(cx, val, vp);
|
||||
return fromVariant(cx, val, vp);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -350,7 +350,7 @@ JavaScriptParent::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject re
|
||||
if (!ok(cx, status))
|
||||
return false;
|
||||
|
||||
return toValue(cx, result, vp);
|
||||
return fromVariant(cx, result, vp);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -443,7 +443,7 @@ JavaScriptParent::call(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
||||
|
||||
// Take the value the child process returned, and set it on the XPC
|
||||
// object.
|
||||
if (!toValue(cx, outparams[i], &v))
|
||||
if (!fromVariant(cx, outparams[i], &v))
|
||||
return false;
|
||||
|
||||
obj = &outobjects[i].toObject();
|
||||
@ -451,7 +451,7 @@ JavaScriptParent::call(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!toValue(cx, result, args.rval()))
|
||||
if (!fromVariant(cx, result, args.rval()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -620,7 +620,7 @@ JavaScriptParent::ok(JSContext *cx, const ReturnStatus &status)
|
||||
return JS_ThrowStopIteration(cx);
|
||||
|
||||
RootedValue exn(cx);
|
||||
if (!toValue(cx, status.get_ReturnException().exn(), &exn))
|
||||
if (!fromVariant(cx, status.get_ReturnException().exn(), &exn))
|
||||
return false;
|
||||
|
||||
JS_SetPendingException(cx, exn);
|
||||
|
@ -228,7 +228,7 @@ JavaScriptShared::toVariant(JSContext *cx, JS::HandleValue from, JSVariant *to)
|
||||
}
|
||||
|
||||
bool
|
||||
JavaScriptShared::toValue(JSContext *cx, const JSVariant &from, MutableHandleValue to)
|
||||
JavaScriptShared::fromVariant(JSContext *cx, const JSVariant &from, MutableHandleValue to)
|
||||
{
|
||||
switch (from.type()) {
|
||||
case JSVariant::Tvoid_t:
|
||||
@ -384,7 +384,7 @@ JavaScriptShared::toDescriptor(JSContext *cx, const PPropertyDescriptor &in,
|
||||
MutableHandle<JSPropertyDescriptor> out)
|
||||
{
|
||||
out.setAttributes(in.attrs());
|
||||
if (!toValue(cx, in.value(), out.value()))
|
||||
if (!fromVariant(cx, in.value(), out.value()))
|
||||
return false;
|
||||
Rooted<JSObject*> obj(cx);
|
||||
if (!unwrap(cx, in.objId(), &obj))
|
||||
@ -448,7 +448,7 @@ JavaScriptShared::Unwrap(JSContext *cx, const InfallibleTArray<CpowEntry> &aCpow
|
||||
for (size_t i = 0; i < aCpows.Length(); i++) {
|
||||
const nsString &name = aCpows[i].name();
|
||||
|
||||
if (!toValue(cx, aCpows[i].value(), &v))
|
||||
if (!fromVariant(cx, aCpows[i].value(), &v))
|
||||
return false;
|
||||
|
||||
if (!JS_DefineUCProperty(cx,
|
||||
|
@ -93,21 +93,16 @@ class JavaScriptShared
|
||||
|
||||
protected:
|
||||
bool toVariant(JSContext *cx, JS::HandleValue from, JSVariant *to);
|
||||
bool toValue(JSContext *cx, const JSVariant &from, JS::MutableHandleValue to);
|
||||
bool fromDescriptor(JSContext *cx, JS::Handle<JSPropertyDescriptor> desc, PPropertyDescriptor *out);
|
||||
bool fromVariant(JSContext *cx, const JSVariant &from, JS::MutableHandleValue to);
|
||||
|
||||
bool fromDescriptor(JSContext *cx, JS::Handle<JSPropertyDescriptor> desc,
|
||||
PPropertyDescriptor *out);
|
||||
bool toDescriptor(JSContext *cx, const PPropertyDescriptor &in,
|
||||
JS::MutableHandle<JSPropertyDescriptor> out);
|
||||
|
||||
bool convertIdToGeckoString(JSContext *cx, JS::HandleId id, nsString *to);
|
||||
bool convertGeckoStringToId(JSContext *cx, const nsString &from, JS::MutableHandleId id);
|
||||
|
||||
bool toValue(JSContext *cx, const JSVariant &from, jsval *to) {
|
||||
JS::RootedValue v(cx);
|
||||
if (!toValue(cx, from, &v))
|
||||
return false;
|
||||
*to = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp) = 0;
|
||||
virtual JSObject *unwrap(JSContext *cx, ObjectId id) = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user