Bug 952650 (part 9) - Remove JSVAL_IS_INT. r=njn.
authorRodrigo Rodriguez Jr. <rrodrigue96@hotmail.com>
Sun, 27 Apr 2014 19:47:02 -0700
changeset 180892 762a93154b1e38110d2c063315be84ff9a396d9d
parent 180891 bdc9683e85bab7229e24e7345b8bfbd691828c0a
child 180893 31a8179c225bd9e5763ef83595091ba81f028606
push id42890
push usernnethercote@mozilla.com
push dateWed, 30 Apr 2014 02:10:00 +0000
treeherdermozilla-inbound@51eaa71a1dfb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs952650
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 952650 (part 9) - Remove JSVAL_IS_INT. r=njn.
content/canvas/src/CanvasUtils.cpp
dom/base/nsDOMClassInfo.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/system/gonk/AudioManager.cpp
dom/system/gonk/AutoMounterSetting.cpp
gfx/skia/trunk/src/xml/SkJSDisplayable.cpp
js/ipc/JavaScriptShared.cpp
js/jsd/jsd_val.cpp
js/jsd/jsd_xpc.cpp
js/public/Value.h
js/src/ctypes/CTypes.cpp
js/src/jsapi-tests/testBindCallable.cpp
js/src/jsapi-tests/testCustomIterator.cpp
js/src/jsarray.cpp
js/src/tests/js1_5/extensions/regress-469761.js
js/src/tests/js1_5/extensions/regress-472599.js
js/xpconnect/src/XPCConvert.cpp
security/manager/ssl/src/nsCrypto.cpp
--- a/content/canvas/src/CanvasUtils.cpp
+++ b/content/canvas/src/CanvasUtils.cpp
@@ -64,17 +64,17 @@ DoDrawImageSecurityCheck(dom::HTMLCanvas
     aCanvasElement->SetWriteOnly();
 }
 
 bool
 CoerceDouble(JS::Value v, double* d)
 {
     if (v.isDouble()) {
         *d = v.toDouble();
-    } else if (JSVAL_IS_INT(v)) {
+    } else if (v.isInt32()) {
         *d = double(JSVAL_TO_INT(v));
     } else if (v.isUndefined()) {
         *d = 0.0;
     } else {
         return false;
     }
     return true;
 }
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -3542,17 +3542,17 @@ nsGenericArraySH::GetLength(nsIXPConnect
 {
   *length = 0;
 
   JS::Rooted<JS::Value> lenval(cx);
   if (!JS_GetProperty(cx, obj, "length", &lenval)) {
     return NS_ERROR_UNEXPECTED;
   }
 
-  if (!JSVAL_IS_INT(lenval)) {
+  if (!lenval.isInt32()) {
     // This can apparently happen with some sparse array impls falling back
     // onto this code.
     return NS_OK;
   }
 
   int32_t slen = JSVAL_TO_INT(lenval);
   if (slen < 0) {
     return NS_OK;
@@ -3579,17 +3579,17 @@ nsGenericArraySH::Enumerate(nsIXPConnect
     return NS_OK;
   }
 
   sCurrentlyEnumerating = true;
 
   JS::Rooted<JS::Value> len_val(cx);
   bool ok = ::JS_GetProperty(cx, obj, "length", &len_val);
 
-  if (ok && JSVAL_IS_INT(len_val)) {
+  if (ok && len_val.isInt32()) {
     int32_t length = JSVAL_TO_INT(len_val);
 
     for (int32_t i = 0; ok && i < length; ++i) {
       ok = ::JS_DefineElement(cx, obj, i, JSVAL_VOID, nullptr, nullptr,
                               JSPROP_ENUMERATE | JSPROP_SHARED);
     }
   }
 
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -383,17 +383,17 @@ JSValToNPVariant(NPP npp, JSContext *cx,
 
   if (JSVAL_IS_PRIMITIVE(val)) {
     if (val == JSVAL_VOID) {
       VOID_TO_NPVARIANT(*variant);
     } else if (val.isNull()) {
       NULL_TO_NPVARIANT(*variant);
     } else if (val.isBoolean()) {
       BOOLEAN_TO_NPVARIANT(val.toBoolean(), *variant);
-    } else if (JSVAL_IS_INT(val)) {
+    } else if (val.isInt32()) {
       INT32_TO_NPVARIANT(JSVAL_TO_INT(val), *variant);
     } else if (val.isDouble()) {
       double d = val.toDouble();
       int i;
       if (JS_DoubleIsInt32(d, &i)) {
         INT32_TO_NPVARIANT(i, *variant);
       } else {
         DOUBLE_TO_NPVARIANT(d, *variant);
@@ -896,17 +896,17 @@ nsJSObjWrapper::NP_Enumerate(NPObject *n
       JS::Rooted<JSString*> str(cx, v.toString());
       str = JS_InternJSString(cx, str);
       if (!str) {
         PR_Free(*idarray);
         return false;
       }
       id = StringToNPIdentifier(cx, str);
     } else {
-      NS_ASSERTION(JSVAL_IS_INT(v),
+      NS_ASSERTION(v.isInt32(),
                    "The element in ida must be either string or int!\n");
       id = IntToNPIdentifier(JSVAL_TO_INT(v));
     }
 
     (*idarray)[i] = id;
   }
 
   return true;
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -120,17 +120,17 @@ public:
   NS_DECL_ISUPPORTS
 
   AudioChannelVolInitCallback() {}
 
   NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult)
   {
     nsCOMPtr<nsIAudioManager> audioManager =
       do_GetService(NS_AUDIOMANAGER_CONTRACTID);
-    NS_ENSURE_TRUE(JSVAL_IS_INT(aResult), NS_OK);
+    NS_ENSURE_TRUE(aResult.isInt32(), NS_OK);
 
     int32_t volIndex = JSVAL_TO_INT(aResult);
     if (aName.EqualsLiteral("audio.volume.content")) {
       audioManager->SetAudioChannelVolume((int32_t)AudioChannel::Content,
                                           volIndex);
     } else if (aName.EqualsLiteral("audio.volume.notification")) {
       audioManager->SetAudioChannelVolume((int32_t)AudioChannel::Notification,
                                           volIndex);
--- a/dom/system/gonk/AutoMounterSetting.cpp
+++ b/dom/system/gonk/AutoMounterSetting.cpp
@@ -38,17 +38,17 @@ class SettingsServiceCallback MOZ_FINAL 
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
   SettingsServiceCallback() {}
 
   NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult)
   {
-    if (JSVAL_IS_INT(aResult)) {
+    if (aResult.isInt32()) {
       int32_t mode = JSVAL_TO_INT(aResult);
       SetAutoMounterMode(mode);
     }
     return NS_OK;
   }
 
   NS_IMETHOD HandleError(const nsAString& aName)
   {
--- a/gfx/skia/trunk/src/xml/SkJSDisplayable.cpp
+++ b/gfx/skia/trunk/src/xml/SkJSDisplayable.cpp
@@ -213,17 +213,17 @@ static void GenerateTables() {
 
 void SkJSDisplayable::Destructor(JSContext *cx, JSObject *obj) {
     delete (SkJSDisplayable*) JS_GetPrivate(cx, obj);
 }
 
 JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id,
                                  jsval *vp)
 {
-    if (JSVAL_IS_INT(id) == 0)
+    if (id.isInt32() == 0)
         return JS_TRUE;
     SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj);
     SkDisplayable* displayable = p->fDisplayable;
     SkDisplayTypes displayableType = displayable->getType();
     int members;
     const SkMemberInfo* info = SkDisplayType::GetMembers(NULL /* fMaker */, displayableType, &members);
     int idIndex = JSVAL_TO_INT(id);
     SkASSERT(idIndex >= 0 && idIndex < members);
@@ -285,17 +285,17 @@ JSBool SkJSDisplayable::GetProperty(JSCo
             break;
         default:
             SkASSERT(0); // !!! unimplemented
     }
     return JS_TRUE;
 }
 
 JSBool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) {
-    if (JSVAL_IS_INT(id) == 0)
+    if (id.isInt32() == 0)
         return JS_TRUE;
     SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj);
     SkDisplayable* displayable = p->fDisplayable;
     SkDisplayTypes displayableType = displayable->getType();
     int members;
     const SkMemberInfo* info = SkDisplayType::GetMembers(NULL /* fMaker */, displayableType, &members);
     int idIndex = JSVAL_TO_INT(id);
     SkASSERT(idIndex >= 0 && idIndex < members);
@@ -310,17 +310,17 @@ JSBool SkJSDisplayable::SetProperty(JSCo
         case SkType_Boolean:
             s32 = value.toBoolean();
             break;
         case SkType_Color:
         case SkType_S32:
             s32 = JSVAL_TO_INT(value);
             break;
         case SkType_Scalar:
-            if (JSVAL_IS_INT(value))
+            if (value.isInt32())
                 scalar = SkIntToScalar(JSVAL_TO_INT(value));
             else {
                 SkASSERT(value.isDouble());
                 scalar = (float) *(double*) value.toDouble();
             }
             break;
         case SkType_String:
             str = JS_ValueToString(cx, value);
--- a/js/ipc/JavaScriptShared.cpp
+++ b/js/ipc/JavaScriptShared.cpp
@@ -205,17 +205,17 @@ JavaScriptShared::toVariant(JSContext *c
         nsDependentJSString dep;
         if (!dep.init(cx, from))
             return false;
         *to = dep;
         return true;
       }
 
       case JSTYPE_NUMBER:
-        if (JSVAL_IS_INT(from))
+        if (from.isInt32())
             *to = double(from.toInt32());
         else
             *to = from.toDouble();
         return true;
 
       case JSTYPE_BOOLEAN:
         *to = from.toBoolean();
         return true;
--- a/js/jsd/jsd_val.cpp
+++ b/js/jsd/jsd_val.cpp
@@ -67,17 +67,17 @@ bool
 jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval)
 {
     return JSVAL_IS_NUMBER(jsdval->val);
 }
 
 bool
 jsd_IsValueInt(JSDContext* jsdc, JSDValue* jsdval)
 {
-    return JSVAL_IS_INT(jsdval->val);
+    return jsdval->val.isInt32();
 }
 
 bool
 jsd_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval)
 {
     return jsdval->val.isDouble();
 }
 
@@ -149,17 +149,17 @@ jsd_GetValueBoolean(JSDContext* jsdc, JS
         return false;
     return val.toBoolean();
 }
 
 int32_t
 jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval)
 {
     jsval val = jsdval->val;
-    if(!JSVAL_IS_INT(val))
+    if(!val.isInt32())
         return 0;
     return JSVAL_TO_INT(val);
 }
 
 double
 jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval)
 {
     if(!jsdval->val.isDouble())
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -2159,17 +2159,17 @@ jsdValue::GetJsType (uint32_t *_rval)
     JS::RootedValue val(JSD_GetJSRuntime(mCx), JSD_GetValueWrappedJSVal (mCx, mValue));
 
     if (val.isNull())
         *_rval = TYPE_NULL;
     else if (val.isBoolean())
         *_rval = TYPE_BOOLEAN;
     else if (val.isDouble())
         *_rval = TYPE_DOUBLE;
-    else if (JSVAL_IS_INT(val))
+    else if (val.isInt32())
         *_rval = TYPE_INT;
     else if (val.isString())
         *_rval = TYPE_STRING;
     else if (val.isUndefined())
         *_rval = TYPE_VOID;
     else if (JSD_IsValueFunction (mCx, mValue))
         *_rval = TYPE_FUNCTION;
     else if (!JSVAL_IS_PRIMITIVE(val))
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1816,26 +1816,20 @@ static_assert(sizeof(LayoutAlignmentTest
  */
 typedef JS::Value jsval;
 
 static_assert(sizeof(jsval_layout) == sizeof(JS::Value),
               "jsval_layout and JS::Value must have identical layouts");
 
 /************************************************************************/
 
-static inline bool
-JSVAL_IS_INT(jsval v)
-{
-    return JSVAL_IS_INT32_IMPL(JSVAL_TO_IMPL(v));
-}
-
 static inline int32_t
 JSVAL_TO_INT(jsval v)
 {
-    MOZ_ASSERT(JSVAL_IS_INT(v));
+    MOZ_ASSERT(v.isInt32());
     return JSVAL_TO_INT32_IMPL(JSVAL_TO_IMPL(v));
 }
 
 static inline JS_VALUE_CONSTEXPR jsval
 INT_TO_JSVAL(int32_t i)
 {
     return IMPL_TO_JSVAL(INT32_TO_JSVAL_IMPL(i));
 }
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -1574,17 +1574,17 @@ static MOZ_ALWAYS_INLINE bool IsNegative
 // arguments numerically equal to 0 or 1.
 static bool
 jsvalToBool(JSContext* cx, jsval val, bool* result)
 {
   if (val.isBoolean()) {
     *result = val.toBoolean();
     return true;
   }
-  if (JSVAL_IS_INT(val)) {
+  if (val.isInt32()) {
     int32_t i = JSVAL_TO_INT(val);
     *result = i != 0;
     return i == 0 || i == 1;
   }
   if (val.isDouble()) {
     double d = val.toDouble();
     *result = d != 0;
     // Allow -0.
@@ -1598,17 +1598,17 @@ jsvalToBool(JSContext* cx, jsval val, bo
 // Int64, UInt64, and CData integer types 't' where all values of 't' are
 // representable by IntegerType.
 template<class IntegerType>
 static bool
 jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
 {
   JS_STATIC_ASSERT(NumericLimits<IntegerType>::is_exact);
 
-  if (JSVAL_IS_INT(val)) {
+  if (val.isInt32()) {
     // Make sure the integer fits in the alotted precision, and has the right
     // sign.
     int32_t i = JSVAL_TO_INT(val);
     return ConvertExact(i, result);
   }
   if (val.isDouble()) {
     // Don't silently lose bits here -- check that val really is an
     // integer value, and has the right sign.
@@ -1691,17 +1691,17 @@ static bool
 jsvalToFloat(JSContext *cx, jsval val, FloatType* result)
 {
   JS_STATIC_ASSERT(!NumericLimits<FloatType>::is_exact);
 
   // The following casts may silently throw away some bits, but there's
   // no good way around it. Sternly requiring that the 64-bit double
   // argument be exactly representable as a 32-bit float is
   // unrealistic: it would allow 1/2 to pass but not 1/3.
-  if (JSVAL_IS_INT(val)) {
+  if (val.isInt32()) {
     *result = FloatType(JSVAL_TO_INT(val));
     return true;
   }
   if (val.isDouble()) {
     *result = FloatType(val.toDouble());
     return true;
   }
   if (!JSVAL_IS_PRIMITIVE(val)) {
@@ -1803,17 +1803,17 @@ template<class IntegerType>
 static bool
 jsvalToBigInteger(JSContext* cx,
                   jsval val,
                   bool allowString,
                   IntegerType* result)
 {
   JS_STATIC_ASSERT(NumericLimits<IntegerType>::is_exact);
 
-  if (JSVAL_IS_INT(val)) {
+  if (val.isInt32()) {
     // Make sure the integer fits in the alotted precision, and has the right
     // sign.
     int32_t i = JSVAL_TO_INT(val);
     return ConvertExact(i, result);
   }
   if (val.isDouble()) {
     // Don't silently lose bits here -- check that val really is an
     // integer value, and has the right sign.
@@ -1966,17 +1966,17 @@ jsvalToIntegerExplicit(jsval val, Intege
   }
   return false;
 }
 
 // Forcefully convert val to a pointer value when explicitly requested.
 static bool
 jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
 {
-  if (JSVAL_IS_INT(val)) {
+  if (val.isInt32()) {
     // int32_t always fits in intptr_t. If the integer is negative, cast through
     // an intptr_t intermediate to sign-extend.
     int32_t i = JSVAL_TO_INT(val);
     *result = i < 0 ? uintptr_t(intptr_t(i)) : uintptr_t(i);
     return true;
   }
   if (val.isDouble()) {
     double d = val.toDouble();
@@ -3476,17 +3476,17 @@ bool
 CType::GetSafeSize(JSObject* obj, size_t* result)
 {
   JS_ASSERT(CType::IsCType(obj));
 
   jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
 
   // The "size" property can be an int, a double, or JSVAL_VOID
   // (for arrays of undefined length), and must always fit in a size_t.
-  if (JSVAL_IS_INT(size)) {
+  if (size.isInt32()) {
     *result = JSVAL_TO_INT(size);
     return true;
   }
   if (size.isDouble()) {
     *result = Convert<size_t>(size.toDouble());
     return true;
   }
 
@@ -3501,31 +3501,31 @@ CType::GetSize(JSObject* obj)
 
   jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
 
   JS_ASSERT(!size.isUndefined());
 
   // The "size" property can be an int, a double, or JSVAL_VOID
   // (for arrays of undefined length), and must always fit in a size_t.
   // For callers who know it can never be JSVAL_VOID, return a size_t directly.
-  if (JSVAL_IS_INT(size))
+  if (size.isInt32())
     return JSVAL_TO_INT(size);
   return Convert<size_t>(size.toDouble());
 }
 
 bool
 CType::IsSizeDefined(JSObject* obj)
 {
   JS_ASSERT(CType::IsCType(obj));
 
   jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
 
   // The "size" property can be an int, a double, or JSVAL_VOID
   // (for arrays of undefined length), and must always fit in a size_t.
-  JS_ASSERT(JSVAL_IS_INT(size) || size.isDouble() || size.isUndefined());
+  JS_ASSERT(size.isInt32() || size.isDouble() || size.isUndefined());
   return !size.isUndefined();
 }
 
 size_t
 CType::GetAlignment(JSObject* obj)
 {
   JS_ASSERT(CType::IsCType(obj));
 
--- a/js/src/jsapi-tests/testBindCallable.cpp
+++ b/js/src/jsapi-tests/testBindCallable.cpp
@@ -19,14 +19,14 @@ BEGIN_TEST(test_BindCallable)
   JSObject* newCallable = JS_BindCallable(cx, funcObj, vObj);
   CHECK(newCallable);
 
   JS::RootedValue retval(cx);
   JS::RootedValue fun(cx, JS::ObjectValue(*newCallable));
   bool called = JS_CallFunctionValue(cx, JS::NullPtr(), fun, JS::HandleValueArray::empty(), &retval);
   CHECK(called);
 
-  CHECK(JSVAL_IS_INT(retval));
+  CHECK(retval.isInt32());
 
   CHECK(JSVAL_TO_INT(retval) == 1717);
   return true;
 }
 END_TEST(test_BindCallable)
--- a/js/src/jsapi-tests/testCustomIterator.cpp
+++ b/js/src/jsapi-tests/testCustomIterator.cpp
@@ -69,15 +69,15 @@ BEGIN_TEST(testCustomIterator_bug612523)
                        IterClassConstructor, 0, nullptr, nullptr, nullptr, nullptr));
 
     JS::RootedValue result(cx);
     EVAL("var o = new HasCustomIter(); \n"
          "var j = 0; \n"
          "for (var i in o) { ++j; }; \n"
          "j;", &result);
 
-    CHECK(JSVAL_IS_INT(result));
+    CHECK(result.isInt32());
     CHECK_EQUAL(JSVAL_TO_INT(result), 100);
     CHECK_EQUAL(iterCount, 101);
 
     return true;
 }
 END_TEST(testCustomIterator_bug612523)
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -84,17 +84,17 @@ js::GetLengthProperty(JSContext *cx, Han
  *
  * "Array objects give special treatment to a certain class of property names.
  * A property name P (in the form of a string value) is an array index if and
  * only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal
  * to 2^32-1."
  *
  * This means the largest allowed index is actually 2^32-2 (4294967294).
  *
- * In our implementation, it would be sufficient to check for JSVAL_IS_INT(id)
+ * In our implementation, it would be sufficient to check for id.isInt32()
  * except that by using signed 31-bit integers we miss the top half of the
  * valid range. This function checks the string representation itself; note
  * that calling a standard conversion routine might allow strings such as
  * "08" or "4.0" as array indices, which they are not.
  *
  */
 JS_FRIEND_API(bool)
 js::StringIsArrayIndex(JSLinearString *str, uint32_t *indexp)
--- a/js/src/tests/js1_5/extensions/regress-469761.js
+++ b/js/src/tests/js1_5/extensions/regress-469761.js
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //-----------------------------------------------------------------------------
 var BUGNUMBER = 469761;
-var summary = 'TM: Do not assert: JSVAL_IS_INT(STOBJ_GET_SLOT(callee_obj, JSSLOT_PRIVATE))';
+var summary = 'TM: Do not assert: STOBJ_GET_SLOT(callee_obj, JSSLOT_PRIVATE).isInt32()';
 var actual = '';
 var expect = '';
 
 
 //-----------------------------------------------------------------------------
 test();
 //-----------------------------------------------------------------------------
 
--- a/js/src/tests/js1_5/extensions/regress-472599.js
+++ b/js/src/tests/js1_5/extensions/regress-472599.js
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //-----------------------------------------------------------------------------
 var BUGNUMBER = 472599;
-var summary = 'Do not assert: JSVAL_IS_INT(STOBJ_GET_SLOT(callee_obj, JSSLOT_PRIVATE))';
+var summary = 'Do not assert: STOBJ_GET_SLOT(callee_obj, JSSLOT_PRIVATE).isInt32()';
 var actual = '';
 var expect = '';
 
 
 //-----------------------------------------------------------------------------
 test();
 //-----------------------------------------------------------------------------
 
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -1217,17 +1217,17 @@ XPCConvert::JSValToXPCException(MutableH
     }
 
     if (JSVAL_IS_NUMBER(s)) {
         // lets see if it looks like an nsresult
         nsresult rv;
         double number;
         bool isResult = false;
 
-        if (JSVAL_IS_INT(s)) {
+        if (s.isInt32()) {
             rv = (nsresult) JSVAL_TO_INT(s);
             if (NS_FAILED(rv))
                 isResult = true;
             else
                 number = (double) JSVAL_TO_INT(s);
         } else {
             number = s.toDouble();
             if (number > 0.0 &&
--- a/security/manager/ssl/src/nsCrypto.cpp
+++ b/security/manager/ssl/src/nsCrypto.cpp
@@ -935,17 +935,17 @@ cryptojs_ReadArgsAndGenerateKey(JSContex
                                 nsIInterfaceRequestor *uiCxt,
                                 PK11SlotInfo **slot, bool willEscrow)
 {
   JSString  *jsString;
   JSAutoByteString params;
   int    keySize;
   nsresult  rv;
 
-  if (!JSVAL_IS_INT(argv[0])) {
+  if (!argv[0].isInt32()) {
     JS_ReportError(cx, "%s%s", JS_ERROR,
                    "passed in non-integer for key size");
     return NS_ERROR_FAILURE;
   }
   keySize = JSVAL_TO_INT(argv[0]);
   if (!argv[1].isNull()) {
     JS::Rooted<JS::Value> v(cx, argv[1]);
     jsString = JS::ToString(cx, v);