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