Bug 1776658: Update some setNumber callers. r=jandem, a=dsmith
authorKris Maglione <maglione.k@gmail.com>
Wed, 03 Aug 2022 19:55:31 +0000
changeset 696122 22075771cc8a6230c0c78e0d20f4d2d600f12e04
parent 696121 1dcb29795850db0c2baf36789c2df0760a5d0e9d
child 696123 d9db2c017db30e1d8b9ef3c7679376890d9b64ab
push id16931
push userdsmith@mozilla.com
push dateThu, 04 Aug 2022 18:37:42 +0000
treeherdermozilla-beta@f028f909c84f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, dsmith
bugs1776658
milestone104.0
Bug 1776658: Update some setNumber callers. r=jandem, a=dsmith Differential Revision: https://phabricator.services.mozilla.com/D152822
dom/bindings/ToJSValue.h
dom/indexedDB/KeyPath.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCVariant.cpp
--- a/dom/bindings/ToJSValue.h
+++ b/dom/bindings/ToJSValue.h
@@ -112,17 +112,17 @@ inline bool ToJSValue(JSContext* aCx, fl
   return true;
 }
 
 inline bool ToJSValue(JSContext* aCx, double aArgument,
                       JS::MutableHandle<JS::Value> aValue) {
   // Make sure we're called in a compartment
   MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx));
 
-  aValue.setNumber(aArgument);
+  aValue.set(JS_NumberValue(aArgument));
   return true;
 }
 
 // Accept CallbackObjects
 [[nodiscard]] inline bool ToJSValue(JSContext* aCx, CallbackObject& aArgument,
                                     JS::MutableHandle<JS::Value> aValue) {
   // Make sure we're called in a compartment
   MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx));
--- a/dom/indexedDB/KeyPath.cpp
+++ b/dom/indexedDB/KeyPath.cpp
@@ -82,17 +82,17 @@ nsresult GetJSValFromKeyPathString(
     const size_t keyPathLen = token.Length();
 
     if (!targetObject) {
       // We're still walking the chain of existing objects
       // http://w3c.github.io/IndexedDB/#evaluate-a-key-path-on-a-value
       // step 4 substep 1: check for .length on a String value.
       if (currentVal.isString() && !tokenizer.hasMoreTokens() &&
           token.EqualsLiteral("length")) {
-        aKeyJSVal->setNumber(double(JS_GetStringLength(currentVal.toString())));
+        aKeyJSVal->setNumber(JS_GetStringLength(currentVal.toString()));
         break;
       }
 
       if (!currentVal.isObject()) {
         return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
       }
       obj = &currentVal.toObject();
 
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -99,17 +99,17 @@ bool XPCConvert::NativeData2JS(JSContext
       return true;
     case nsXPTType::T_U64:
       d.setNumber(static_cast<double>(*static_cast<const uint64_t*>(s)));
       return true;
     case nsXPTType::T_FLOAT:
       d.setNumber(*static_cast<const float*>(s));
       return true;
     case nsXPTType::T_DOUBLE:
-      d.setNumber(*static_cast<const double*>(s));
+      d.set(JS_NumberValue(*static_cast<const double*>(s)));
       return true;
     case nsXPTType::T_BOOL:
       d.setBoolean(*static_cast<const bool*>(s));
       return true;
     case nsXPTType::T_CHAR: {
       char p = *static_cast<const char*>(s);
 
 #ifdef STRICT_CHECK_OF_UNICODE
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -434,17 +434,17 @@ bool XPCVariant::VariantDataToJS(JSConte
     case nsIDataType::VTYPE_UINT32:
     case nsIDataType::VTYPE_UINT64:
     case nsIDataType::VTYPE_FLOAT:
     case nsIDataType::VTYPE_DOUBLE: {
       double d;
       if (NS_FAILED(variant->GetAsDouble(&d))) {
         return false;
       }
-      pJSVal.setNumber(d);
+      pJSVal.set(JS_NumberValue(d));
       return true;
     }
     case nsIDataType::VTYPE_BOOL: {
       bool b;
       if (NS_FAILED(variant->GetAsBool(&b))) {
         return false;
       }
       pJSVal.setBoolean(b);