mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 959787 - Handlify several JSAPI interfaces that can GC, Part 4; r=sfink,r=bz
--HG-- extra : rebase_source : 8e1ff566f47795cd82e3f4c0a6fa37b88e7847b4
This commit is contained in:
parent
142e9b7c5b
commit
10295353cd
@ -100,7 +100,7 @@ IDToString(JSContext *cx, jsid id_)
|
||||
return JS_GetInternedStringChars(JSID_TO_STRING(id));
|
||||
|
||||
JS::Rooted<JS::Value> idval(cx);
|
||||
if (!JS_IdToValue(cx, id, idval.address()))
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
return nullptr;
|
||||
JSString *str = JS::ToString(cx, idval);
|
||||
if(!str)
|
||||
|
@ -590,7 +590,7 @@ IdToString(JSContext *cx, jsid id)
|
||||
if (JSID_IS_STRING(id))
|
||||
return JSID_TO_STRING(id);
|
||||
JS::Rooted<JS::Value> idval(cx);
|
||||
if (!::JS_IdToValue(cx, id, idval.address()))
|
||||
if (!::JS_IdToValue(cx, id, &idval))
|
||||
return nullptr;
|
||||
return JS::ToString(cx, idval);
|
||||
}
|
||||
@ -1311,7 +1311,7 @@ nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, JS::Handle<jsid> id, bool *aI
|
||||
} else {
|
||||
JS::Rooted<JS::Value> idval(cx);
|
||||
double array_index;
|
||||
if (!::JS_IdToValue(cx, id, idval.address()) ||
|
||||
if (!::JS_IdToValue(cx, id, &idval) ||
|
||||
!JS::ToNumber(cx, idval, &array_index) ||
|
||||
!::JS_DoubleIsInt32(array_index, &i)) {
|
||||
return -1;
|
||||
@ -4358,7 +4358,9 @@ nsStorage2SH::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JS_NewUCStringCopyN(cx, key.get(), key.Length());
|
||||
NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
JS_ValueToId(cx, STRING_TO_JSVAL(str), idp);
|
||||
JS::Rooted<jsid> id(cx);
|
||||
JS_ValueToId(cx, JS::StringValue(str), &id);
|
||||
*idp = id;
|
||||
|
||||
keys->RemoveElementAt(0);
|
||||
|
||||
|
@ -1479,7 +1479,7 @@ AppendNamedPropertyIds(JSContext* cx, JS::Handle<JSObject*> proxy,
|
||||
}
|
||||
|
||||
JS::Rooted<jsid> id(cx);
|
||||
if (!JS_ValueToId(cx, v, id.address())) {
|
||||
if (!JS_ValueToId(cx, v, &id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5225,7 +5225,8 @@ if (!${obj}) {
|
||||
if self.idlNode.getExtendedAttribute("Frozen"):
|
||||
assert self.idlNode.type.isSequence()
|
||||
freezeValue = CGGeneric(
|
||||
"if (!JS_FreezeObject(cx, &args.rval().toObject())) {\n"
|
||||
"JS::Rooted<JSObject*> rvalObj(cx, &args.rval().toObject());\n"
|
||||
"if (!JS_FreezeObject(cx, rvalObj)) {\n"
|
||||
" return false;\n"
|
||||
"}")
|
||||
if self.idlNode.type.nullable():
|
||||
|
@ -285,7 +285,7 @@ IdToInt32(JSContext* cx, JS::Handle<jsid> id)
|
||||
JS::Rooted<JS::Value> idval(cx);
|
||||
double array_index;
|
||||
int32_t i;
|
||||
if (!::JS_IdToValue(cx, id, idval.address()) ||
|
||||
if (!::JS_IdToValue(cx, id, &idval) ||
|
||||
!JS::ToNumber(cx, idval, &array_index) ||
|
||||
!::JS_DoubleIsInt32(array_index, &i)) {
|
||||
return -1;
|
||||
|
@ -105,7 +105,7 @@ static nsresult CompareDictionaries(JSContext* aCx, JSObject *aA,
|
||||
if (bprop.isUndefined()) {
|
||||
// Unknown property found in A. Bail with name
|
||||
JS::Rooted<JS::Value> nameval(aCx);
|
||||
bool success = JS_IdToValue(aCx, props[i], nameval.address());
|
||||
bool success = JS_IdToValue(aCx, props[i], &nameval);
|
||||
NS_ENSURE_TRUE(success, NS_ERROR_UNEXPECTED);
|
||||
|
||||
JS::Rooted<JSString*> namestr(aCx, JS::ToString(aCx, nameval));
|
||||
|
@ -899,7 +899,7 @@ nsJSObjWrapper::NP_Enumerate(NPObject *npobj, NPIdentifier **idarray,
|
||||
|
||||
for (uint32_t i = 0; i < *count; i++) {
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!JS_IdToValue(cx, ida[i], v.address())) {
|
||||
if (!JS_IdToValue(cx, ida[i], &v)) {
|
||||
PR_Free(*idarray);
|
||||
return false;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ InstallXBLField(JSContext* cx,
|
||||
JSFlatString* fieldStr = JS_ASSERT_STRING_IS_FLAT(name.toString());
|
||||
fieldName.init(fieldStr);
|
||||
|
||||
MOZ_ALWAYS_TRUE(JS_ValueToId(cx, name, idp.address()));
|
||||
MOZ_ALWAYS_TRUE(JS_ValueToId(cx, name, idp));
|
||||
|
||||
// If a separate XBL scope is being used, the callee is not same-compartment
|
||||
// with the xbl prototype, and the object is a cross-compartment wrapper.
|
||||
|
@ -137,7 +137,7 @@ bool
|
||||
JavaScriptShared::convertIdToGeckoString(JSContext *cx, JS::HandleId id, nsString *to)
|
||||
{
|
||||
RootedValue idval(cx);
|
||||
if (!JS_IdToValue(cx, id, idval.address()))
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
return false;
|
||||
|
||||
RootedString str(cx, ToString(cx, idval));
|
||||
@ -159,7 +159,7 @@ JavaScriptShared::convertGeckoStringToId(JSContext *cx, const nsString &from, JS
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
return JS_ValueToId(cx, StringValue(str), to.address());
|
||||
return JS_ValueToId(cx, StringValue(str), to);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -502,7 +502,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
/* Not found in property list, look it up explicitly */
|
||||
|
||||
nameval = STRING_TO_JSVAL(name);
|
||||
if(!JS_ValueToId(cx, nameval, nameid.address()))
|
||||
if(!JS_ValueToId(cx, nameval, &nameid))
|
||||
return nullptr;
|
||||
|
||||
if(!(obj = JSVAL_TO_OBJECT(jsdval->val)))
|
||||
@ -544,7 +544,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
}
|
||||
}
|
||||
|
||||
if (!JS_IdToValue(cx, nameid, propId.address()))
|
||||
if (!JS_IdToValue(cx, nameid, &propId))
|
||||
return nullptr;
|
||||
|
||||
propAlias = JSVAL_NULL;
|
||||
|
@ -55,7 +55,7 @@ document_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned
|
||||
{
|
||||
// If id is "all", resolve document.all=true.
|
||||
JS::RootedValue v(cx);
|
||||
if (!JS_IdToValue(cx, id, v.address()))
|
||||
if (!JS_IdToValue(cx, id, &v))
|
||||
return false;
|
||||
if (JSVAL_IS_STRING(v)) {
|
||||
JSString *str = JSVAL_TO_STRING(v);
|
||||
|
@ -2225,28 +2225,22 @@ JS_DestroyIdArray(JSContext *cx, JSIdArray *ida)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_ValueToId(JSContext *cx, jsval valueArg, jsid *idp)
|
||||
JS_ValueToId(JSContext *cx, jsval valueArg, MutableHandleId idp)
|
||||
{
|
||||
RootedValue value(cx, valueArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, value);
|
||||
|
||||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, value, &id))
|
||||
return false;
|
||||
|
||||
*idp = id;
|
||||
return true;
|
||||
return ValueToId<CanGC>(cx, value, idp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_IdToValue(JSContext *cx, jsid id, jsval *vp)
|
||||
JS_IdToValue(JSContext *cx, jsid id, MutableHandleValue vp)
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
*vp = IdToJsval(id);
|
||||
assertSameCompartment(cx, *vp);
|
||||
vp.set(IdToJsval(id));
|
||||
assertSameCompartment(cx, vp);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2661,20 +2655,17 @@ JS_GetObjectRuntime(JSObject *obj)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_FreezeObject(JSContext *cx, JSObject *objArg)
|
||||
JS_FreezeObject(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
|
||||
return JSObject::freeze(cx, obj);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_DeepFreezeObject(JSContext *cx, JSObject *objArg)
|
||||
JS_DeepFreezeObject(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
@ -3685,10 +3676,8 @@ static const Class prop_iter_class = {
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_NewPropertyIterator(JSContext *cx, JSObject *objArg)
|
||||
JS_NewPropertyIterator(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
@ -3717,10 +3706,8 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *objArg)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_NextProperty(JSContext *cx, JSObject *iterobjArg, jsid *idp)
|
||||
JS_NextProperty(JSContext *cx, HandleObject iterobj, jsid *idp)
|
||||
{
|
||||
RootedObject iterobj(cx, iterobjArg);
|
||||
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, iterobj);
|
||||
@ -3789,9 +3776,8 @@ JS_IsArrayObject(JSContext *cx, JSObject *objArg)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_GetArrayLength(JSContext *cx, JSObject *objArg, uint32_t *lengthp)
|
||||
JS_GetArrayLength(JSContext *cx, HandleObject obj, uint32_t *lengthp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
@ -3799,9 +3785,8 @@ JS_GetArrayLength(JSContext *cx, JSObject *objArg, uint32_t *lengthp)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_SetArrayLength(JSContext *cx, JSObject *objArg, uint32_t length)
|
||||
JS_SetArrayLength(JSContext *cx, HandleObject obj, uint32_t length)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
@ -3809,19 +3794,13 @@ JS_SetArrayLength(JSContext *cx, JSObject *objArg, uint32_t length)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_CheckAccess(JSContext *cx, JSObject *objArg, jsid idArg, JSAccessMode mode,
|
||||
jsval *vp, unsigned *attrsp)
|
||||
JS_CheckAccess(JSContext *cx, HandleObject obj, HandleId id, JSAccessMode mode,
|
||||
MutableHandleValue vp, unsigned *attrsp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx, idArg);
|
||||
RootedValue value(cx, *vp);
|
||||
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, id);
|
||||
bool status = CheckAccess(cx, obj, id, mode, &value, attrsp);
|
||||
*vp = value;
|
||||
return status;
|
||||
return CheckAccess(cx, obj, id, mode, vp, attrsp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
|
@ -2309,10 +2309,10 @@ class AutoIdArray : private AutoGCRooter
|
||||
} /* namespace JS */
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_ValueToId(JSContext *cx, jsval v, jsid *idp);
|
||||
JS_ValueToId(JSContext *cx, jsval v, JS::MutableHandle<jsid> idp);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_IdToValue(JSContext *cx, jsid id, jsval *vp);
|
||||
JS_IdToValue(JSContext *cx, jsid id, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
/*
|
||||
* JSNewResolveOp flag bits.
|
||||
@ -2745,13 +2745,13 @@ JS_NewObjectWithGivenProto(JSContext *cx, const JSClass *clasp, JS::Handle<JSObj
|
||||
* deep-frozen.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_DeepFreezeObject(JSContext *cx, JSObject *obj);
|
||||
JS_DeepFreezeObject(JSContext *cx, JS::Handle<JSObject*> obj);
|
||||
|
||||
/*
|
||||
* Freezes an object; see ES5's Object.freeze(obj) method.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_FreezeObject(JSContext *cx, JSObject *obj);
|
||||
JS_FreezeObject(JSContext *cx, JS::Handle<JSObject*> obj);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_PreventExtensions(JSContext *cx, JS::HandleObject obj);
|
||||
@ -3060,10 +3060,10 @@ extern JS_PUBLIC_API(bool)
|
||||
JS_IsArrayObject(JSContext *cx, JSObject *obj);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_GetArrayLength(JSContext *cx, JSObject *obj, uint32_t *lengthp);
|
||||
JS_GetArrayLength(JSContext *cx, JS::Handle<JSObject*> obj, uint32_t *lengthp);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_SetArrayLength(JSContext *cx, JSObject *obj, uint32_t length);
|
||||
JS_SetArrayLength(JSContext *cx, JS::Handle<JSObject*> obj, uint32_t length);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_DefineElement(JSContext *cx, JSObject *obj, uint32_t index, jsval value,
|
||||
@ -3158,7 +3158,7 @@ JS_Enumerate(JSContext *cx, JSObject *obj);
|
||||
* order, which uses order of property definition in obj.
|
||||
*/
|
||||
extern JS_PUBLIC_API(JSObject *)
|
||||
JS_NewPropertyIterator(JSContext *cx, JSObject *obj);
|
||||
JS_NewPropertyIterator(JSContext *cx, JS::Handle<JSObject*> obj);
|
||||
|
||||
/*
|
||||
* Return true on success with *idp containing the id of the next enumerable
|
||||
@ -3166,11 +3166,11 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *obj);
|
||||
* left to visit. Return false on error.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp);
|
||||
JS_NextProperty(JSContext *cx, JS::Handle<JSObject*> iterobj, jsid *idp);
|
||||
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
|
||||
jsval *vp, unsigned *attrsp);
|
||||
JS_CheckAccess(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JSAccessMode mode,
|
||||
JS::MutableHandle<JS::Value> vp, unsigned *attrsp);
|
||||
|
||||
extern JS_PUBLIC_API(jsval)
|
||||
JS_GetReservedSlot(JSObject *obj, uint32_t index);
|
||||
|
@ -1295,7 +1295,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation,
|
||||
for (uint32_t i = 0; i < symbolCount; ++i) {
|
||||
if (!JS_GetElement(mContext, symbolsObj, i, &value) ||
|
||||
!value.isString() ||
|
||||
!JS_ValueToId(mContext, value, symbolId.address())) {
|
||||
!JS_ValueToId(mContext, value, &symbolId)) {
|
||||
return ReportOnCaller(cxhelper, ERROR_ARRAY_ELEMENT,
|
||||
PromiseFlatCString(aLocation).get(), i);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ SandboxImport(JSContext *cx, unsigned argc, Value *vp)
|
||||
}
|
||||
|
||||
RootedId id(cx);
|
||||
if (!JS_ValueToId(cx, StringValue(funname), id.address()))
|
||||
if (!JS_ValueToId(cx, StringValue(funname), &id))
|
||||
return false;
|
||||
|
||||
// We need to resolve the this object, because this function is used
|
||||
@ -294,7 +294,7 @@ ExportFunction(JSContext *cx, HandleValue vfunction, HandleValue vscope, HandleV
|
||||
|
||||
RootedValue vname(cx);
|
||||
vname.setString(funName);
|
||||
if (!JS_ValueToId(cx, vname, id.address()))
|
||||
if (!JS_ValueToId(cx, vname, &id))
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(JSID_IS_STRING(id));
|
||||
@ -1447,7 +1447,7 @@ OptionsBase::ParseId(const char *name, MutableHandleId prop)
|
||||
if (!found)
|
||||
return true;
|
||||
|
||||
return JS_ValueToId(mCx, value, prop.address());
|
||||
return JS_ValueToId(mCx, value, prop);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -263,9 +263,11 @@ nsXPCComponents_Interfaces::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
JSString* idstr;
|
||||
const char* name;
|
||||
|
||||
JS::Rooted<jsid> id(cx);
|
||||
if (NS_SUCCEEDED(interface->GetNameShared(&name)) && name &&
|
||||
nullptr != (idstr = JS_NewStringCopyZ(cx, name)) &&
|
||||
JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp)) {
|
||||
JS_ValueToId(cx, StringValue(idstr), &id)) {
|
||||
*idp = id;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -512,7 +514,9 @@ nsXPCComponents_InterfacesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
if (NS_SUCCEEDED(interface->GetIIDShared(&iid))) {
|
||||
iid->ToProvidedString(idstr);
|
||||
jsstr = JS_NewStringCopyZ(cx, idstr);
|
||||
if (jsstr && JS_ValueToId(cx, STRING_TO_JSVAL(jsstr), idp)) {
|
||||
JS::Rooted<jsid> id(cx);
|
||||
if (jsstr && JS_ValueToId(cx, StringValue(jsstr), &id)) {
|
||||
*idp = id;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -766,8 +770,10 @@ nsXPCComponents_Classes::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
nsAutoCString name;
|
||||
if (NS_SUCCEEDED(holder->GetData(name))) {
|
||||
JSString* idstr = JS_NewStringCopyN(cx, name.get(), name.Length());
|
||||
JS::Rooted<jsid> id(cx);
|
||||
if (idstr &&
|
||||
JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp)) {
|
||||
JS_ValueToId(cx, StringValue(idstr), &id)) {
|
||||
*idp = id;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -1006,8 +1012,10 @@ nsXPCComponents_ClassesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
if (NS_SUCCEEDED(holder->ToString(&name)) && name) {
|
||||
JSString* idstr = JS_NewStringCopyZ(cx, name);
|
||||
nsMemory::Free(name);
|
||||
JS::Rooted<jsid> id(cx);
|
||||
if (idstr &&
|
||||
JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp)) {
|
||||
JS_ValueToId(cx, StringValue(idstr), &id)) {
|
||||
*idp = id;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
@ -1258,8 +1266,11 @@ nsXPCComponents_Results::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
iter = (const void**) JSVAL_TO_PRIVATE(*statep);
|
||||
if (nsXPCException::IterateNSResults(nullptr, &name, nullptr, iter)) {
|
||||
JSString* idstr = JS_NewStringCopyZ(cx, name);
|
||||
if (idstr && JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp))
|
||||
JS::Rooted<jsid> id(cx);
|
||||
if (idstr && JS_ValueToId(cx, StringValue(idstr), &id)) {
|
||||
*idp = id;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
// else... FALL THROUGH
|
||||
}
|
||||
@ -2399,7 +2410,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
|
||||
|
||||
RootedString str(cx, ToString(cx, args[1]));
|
||||
RootedId id(cx);
|
||||
if (!str || !JS_ValueToId(cx, StringValue(str), id.address()))
|
||||
if (!str || !JS_ValueToId(cx, StringValue(str), &id))
|
||||
return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval);
|
||||
|
||||
RootedValue val(cx);
|
||||
@ -2447,7 +2458,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
|
||||
|
||||
RootedString str(cx, ToString(cx, args[0]));
|
||||
RootedId id(cx);
|
||||
if (!str || !JS_ValueToId(cx, StringValue(str), id.address()))
|
||||
if (!str || !JS_ValueToId(cx, StringValue(str), &id))
|
||||
return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval);
|
||||
|
||||
RootedValue val(cx);
|
||||
|
@ -610,7 +610,7 @@ PropertyOpForwarder(JSContext *cx, unsigned argc, jsval *vp)
|
||||
|
||||
JS::RootedValue argval(cx, (argc > 0) ? args.get(0) : JSVAL_VOID);
|
||||
JS::RootedId id(cx);
|
||||
if (!JS_ValueToId(cx, v, id.address()))
|
||||
if (!JS_ValueToId(cx, v, &id))
|
||||
return false;
|
||||
args.rval().set(argval);
|
||||
return ApplyPropertyOp<Op>(cx, *popp, obj, id, args.rval());
|
||||
|
@ -731,7 +731,7 @@ env_setProperty(JSContext *cx, HandleObject obj, HandleId id, bool strict, Mutab
|
||||
int rv;
|
||||
|
||||
RootedValue idval(cx);
|
||||
if (!JS_IdToValue(cx, id, idval.address()))
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
return false;
|
||||
|
||||
idstr = ToString(cx, idval);
|
||||
@ -814,7 +814,7 @@ env_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
JSString *idstr, *valstr;
|
||||
|
||||
RootedValue idval(cx);
|
||||
if (!JS_IdToValue(cx, id, idval.address()))
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
return false;
|
||||
|
||||
idstr = ToString(cx, idval);
|
||||
|
@ -335,7 +335,7 @@ nsXPCWrappedJSClass::GetNamedPropertyAsVariant(XPCCallContext& ccx,
|
||||
|
||||
RootedId id(cx);
|
||||
nsresult rv = NS_OK;
|
||||
if (!JS_ValueToId(cx, value, id.address()) ||
|
||||
if (!JS_ValueToId(cx, value, &id) ||
|
||||
!GetNamedPropertyAsVariantRaw(ccx, aJSObj, id, aResult, &rv)) {
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
@ -378,7 +378,7 @@ nsXPCWrappedJSClass::BuildPropertyEnumerator(XPCCallContext& ccx,
|
||||
}
|
||||
|
||||
RootedValue jsvalName(cx);
|
||||
if (!JS_IdToValue(cx, idName, jsvalName.address()))
|
||||
if (!JS_IdToValue(cx, idName, &jsvalName))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
JSString* name = ToString(cx, jsvalName);
|
||||
|
@ -128,10 +128,12 @@ StatementParams::NewEnumerate(nsIXPConnectWrappedNative *aWrapper,
|
||||
NS_ENSURE_TRUE(jsname, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Set our name.
|
||||
if (!::JS_ValueToId(aCtx, STRING_TO_JSVAL(jsname), _idp)) {
|
||||
JS::Rooted<jsid> id(aCtx);
|
||||
if (!::JS_ValueToId(aCtx, JS::StringValue(jsname), &id)) {
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
*_idp = id;
|
||||
|
||||
// And increment our index.
|
||||
*_statep = INT_TO_JSVAL(++index);
|
||||
|
@ -231,27 +231,27 @@ namespace {
|
||||
* _array's length.
|
||||
*/
|
||||
nsresult
|
||||
GetJSArrayFromJSValue(const JS::Value& aValue,
|
||||
GetJSArrayFromJSValue(JS::Handle<JS::Value> aValue,
|
||||
JSContext* aCtx,
|
||||
JSObject** _array,
|
||||
JS::MutableHandle<JSObject*> _array,
|
||||
uint32_t* _arrayLength) {
|
||||
if (aValue.isObjectOrNull()) {
|
||||
JS::Rooted<JSObject*> val(aCtx, aValue.toObjectOrNull());
|
||||
if (JS_IsArrayObject(aCtx, val)) {
|
||||
*_array = val;
|
||||
(void)JS_GetArrayLength(aCtx, *_array, _arrayLength);
|
||||
_array.set(val);
|
||||
(void)JS_GetArrayLength(aCtx, _array, _arrayLength);
|
||||
NS_ENSURE_ARG(*_arrayLength > 0);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Build a temporary array to store this one item so the code below can
|
||||
// just loop.
|
||||
*_arrayLength = 1;
|
||||
*_array = JS_NewArrayObject(aCtx, 0, nullptr);
|
||||
NS_ENSURE_TRUE(*_array, NS_ERROR_OUT_OF_MEMORY);
|
||||
_array.set(JS_NewArrayObject(aCtx, 0, nullptr));
|
||||
NS_ENSURE_TRUE(_array, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
bool rc = JS_DefineElement(aCtx, *_array, 0, aValue, nullptr, nullptr, 0);
|
||||
bool rc = JS_DefineElement(aCtx, _array, 0, aValue, nullptr, nullptr, 0);
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2686,7 +2686,7 @@ History::GetPlacesInfo(JS::Handle<JS::Value> aPlaceIdentifiers,
|
||||
uint32_t placesIndentifiersLength;
|
||||
JS::Rooted<JSObject*> placesIndentifiers(aCtx);
|
||||
nsresult rv = GetJSArrayFromJSValue(aPlaceIdentifiers, aCtx,
|
||||
placesIndentifiers.address(),
|
||||
&placesIndentifiers,
|
||||
&placesIndentifiersLength);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -2754,7 +2754,7 @@ History::UpdatePlaces(JS::Handle<JS::Value> aPlaceInfos,
|
||||
|
||||
uint32_t infosLength;
|
||||
JS::Rooted<JSObject*> infos(aCtx);
|
||||
nsresult rv = GetJSArrayFromJSValue(aPlaceInfos, aCtx, infos.address(), &infosLength);
|
||||
nsresult rv = GetJSArrayFromJSValue(aPlaceInfos, aCtx, &infos, &infosLength);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsTArray<VisitData> visitData;
|
||||
|
@ -81,7 +81,7 @@ JSObjectBuilder::ArrayPush(JS::HandleObject aArray, int value)
|
||||
return;
|
||||
|
||||
uint32_t length;
|
||||
mOk = JS_GetArrayLength(mCx, (JSObject*)aArray, &length);
|
||||
mOk = JS_GetArrayLength(mCx, aArray, &length);
|
||||
|
||||
if (!mOk)
|
||||
return;
|
||||
@ -103,7 +103,7 @@ JSObjectBuilder::ArrayPush(JS::HandleObject aArray, const char *value)
|
||||
}
|
||||
|
||||
uint32_t length;
|
||||
mOk = JS_GetArrayLength(mCx, (JSObject*)aArray, &length);
|
||||
mOk = JS_GetArrayLength(mCx, aArray, &length);
|
||||
|
||||
if (!mOk)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user