Issue #1240 - Follow-up: Fix incorrect values in Number() constructor. https://bugzilla.mozilla.org/show_bug.cgi?id=1466893 Our code base was using the return value to create the Number object. However with the BigInt changes, it is no longer stored in rval, use args[0].

This commit is contained in:
Brian Smith 2023-07-28 19:55:53 -05:00 committed by roytam1
commit df03810723

View file

@ -545,7 +545,9 @@ Number(JSContext* cx, unsigned argc, Value* vp)
RootedObject proto(cx);
if (!GetPrototypeFromConstructor(cx, newTarget, &proto))
return false;
JSObject* obj = NumberObject::create(cx, args.rval().toNumber(), proto);
double d = args.length() > 0 ? args[0].toNumber() : 0;
JSObject* obj = NumberObject::create(cx, d, proto);
if (!obj)
return false;
args.rval().setObject(*obj);