Issue #1240 - Part 7 - Handle BigInt values in XPCVariant code. https://bugzilla.mozilla.org/show_bug.cgi?id=1603055

This commit is contained in:
Brian Smith 2023-07-20 17:25:46 -05:00 committed by roytam1
commit 4a3f1b7570

View file

@ -179,7 +179,7 @@ XPCArrayHomogenizer::GetTypeForArray(JSContext* cx, HandleObject array,
type = tDbl;
} else if (val.isBoolean()) {
type = tBool;
} else if (val.isUndefined() || val.isSymbol()) {
} else if (val.isUndefined() || val.isSymbol() || val.isBigInt()) {
state = tVar;
break;
} else if (val.isNull()) {
@ -187,7 +187,7 @@ XPCArrayHomogenizer::GetTypeForArray(JSContext* cx, HandleObject array,
} else if (val.isString()) {
type = tStr;
} else {
MOZ_ASSERT(val.isObject(), "invalid type of jsval!");
MOZ_RELEASE_ASSERT(val.isObject(), "invalid type of jsval!");
jsobj = &val.toObject();
bool isArray;
@ -273,8 +273,8 @@ bool XPCVariant::InitializeData(JSContext* cx)
mData.SetFromBool(val.toBoolean());
return true;
}
// We can't represent symbol on C++ side, so pretend it is void.
if (val.isUndefined() || val.isSymbol()) {
// We can't represent symbol or BigInt on C++ side, so pretend it is void.
if (val.isUndefined() || val.isSymbol() || val.isBigInt()) {
mData.SetToVoid();
return true;
}
@ -302,7 +302,7 @@ bool XPCVariant::InitializeData(JSContext* cx)
}
// leaving only JSObject...
MOZ_ASSERT(val.isObject(), "invalid type of jsval!");
MOZ_RELEASE_ASSERT(val.isObject(), "invalid type of jsval!");
RootedObject jsobj(cx, &val.toObject());