diff options
author | Brian Smith <brian@dbsoft.org> | 2023-07-28 19:55:53 -0500 |
---|---|---|
committer | Brian Smith <brian@dbsoft.org> | 2023-07-28 19:55:53 -0500 |
commit | 1851f19271ef2d46736f61433e567b583c474d08 (patch) | |
tree | fd2d5dd276363842a40db7c35bd8db0060c4f88d | |
parent | 3dc659b86d3f1082387440f579468f1d86b048e8 (diff) | |
download | uxp-1851f19271ef2d46736f61433e567b583c474d08.tar.gz |
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].
-rw-r--r-- | js/src/jsnum.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 4e8a5288e5..fd23e6ccd5 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -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); |