This commit is contained in:
Brian Smith 2023-09-11 04:01:25 -05:00 • committed by roytam1
commit e9202b0b0f

View file

@ -277,10 +277,15 @@ PreprocessValue(JSContext* cx, HandleObject holder, KeyType key, MutableHandleVa
RootedString keyStr(cx);
/* Step 2. */
if (vp.isObject()) {
// Step 2. Modified by BigInt spec 6.1 to check for a toJSON method on the
// BigInt prototype when the value is a BigInt.
if (vp.isObject() || vp.isBigInt()) {
RootedValue toJSON(cx);
RootedObject obj(cx, &vp.toObject());
RootedObject obj(cx, JS::ToObject(cx, vp));
if (!obj) {
return false;
}
if (!GetProperty(cx, obj, obj, cx->names().toJSON, &toJSON))
return false;