summaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorBrian Smith <brian@dbsoft.org>2023-07-28 19:55:53 -0500
committerBrian Smith <brian@dbsoft.org>2023-07-28 19:55:53 -0500
commit1851f19271ef2d46736f61433e567b583c474d08 (patch)
treefd2d5dd276363842a40db7c35bd8db0060c4f88d /js/src
parent3dc659b86d3f1082387440f579468f1d86b048e8 (diff)
downloaduxp-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].
Diffstat (limited to 'js/src')
-rw-r--r--js/src/jsnum.cpp4
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);