Bug 952650 (part 10) - Remove JSVAL_IS_NUMBER. r=njn.
authorRodrigo Rodriguez Jr. <rrodrigue96@hotmail.com>
Sun, 27 Apr 2014 19:48:45 -0700
changeset 181299 31a8179c225bd9e5763ef83595091ba81f028606
parent 181298 762a93154b1e38110d2c063315be84ff9a396d9d
child 181300 d5711e3806d056664938d62ef58f2c54eeff6cf0
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersnjn
bugs952650
milestone32.0a1
Bug 952650 (part 10) - Remove JSVAL_IS_NUMBER. r=njn.
js/jsd/jsd_val.cpp
js/public/Value.h
js/src/tests/js1_5/Regress/regress-407024.js
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCWrappedJSClass.cpp
toolkit/components/places/History.cpp
--- a/js/jsd/jsd_val.cpp
+++ b/js/jsd/jsd_val.cpp
@@ -61,17 +61,17 @@ bool
 jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval)
 {
     return !JSVAL_IS_PRIMITIVE(jsdval->val) || jsdval->val.isNull();
 }
 
 bool
 jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval)
 {
-    return JSVAL_IS_NUMBER(jsdval->val);
+    return jsdval->val.isNumber();
 }
 
 bool
 jsd_IsValueInt(JSDContext* jsdc, JSDValue* jsdval)
 {
     return jsdval->val.isInt32();
 }
 
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1860,22 +1860,16 @@ DOUBLE_TO_JSVAL(double d)
 static inline JS_VALUE_CONSTEXPR jsval
 UINT_TO_JSVAL(uint32_t i)
 {
     return (i <= JSVAL_INT_MAX
             ? INT_TO_JSVAL((int32_t)i)
             : DOUBLE_TO_JSVAL((double)i));
 }
 
-static inline bool
-JSVAL_IS_NUMBER(jsval v)
-{
-    return JSVAL_IS_NUMBER_IMPL(JSVAL_TO_IMPL(v));
-}
-
 static inline jsval
 STRING_TO_JSVAL(JSString *str)
 {
     return IMPL_TO_JSVAL(STRING_TO_JSVAL_IMPL(str));
 }
 
 static inline JSObject *
 JSVAL_TO_OBJECT(jsval v)
--- a/js/src/tests/js1_5/Regress/regress-407024.js
+++ b/js/src/tests/js1_5/Regress/regress-407024.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 = 407024;
-var summary = 'Do not assert JSVAL_IS_NUMBER(pn3->pn_val) || pn3->pn_val.isString() || pn3->pn_val.isBoolean()';
+var summary = 'Do not assert pn3->pn_val.isNumber() || pn3->pn_val.isString() || pn3->pn_val.isBoolean()';
 var actual = 'No Crash';
 var expect = 'No Crash';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 eval("function f(x) { switch (x) { case Array: return 1; }}");
 var result = f(Array);
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -1211,17 +1211,17 @@ XPCConvert::JSValToXPCException(MutableH
     }
 
     if (s.isUndefined() || s.isNull()) {
         return ConstructException(NS_ERROR_XPC_JS_THREW_NULL,
                                   nullptr, ifaceName, methodName, nullptr,
                                   exceptn, cx, s.address());
     }
 
-    if (JSVAL_IS_NUMBER(s)) {
+    if (s.isNumber()) {
         // lets see if it looks like an nsresult
         nsresult rv;
         double number;
         bool isResult = false;
 
         if (s.isInt32()) {
             rv = (nsresult) JSVAL_TO_INT(s);
             if (NS_FAILED(rv))
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -236,17 +236,17 @@ nsXPCWrappedJSClass::CallQueryInterfaceO
                     Exception *e = nullptr;
                     UNWRAP_OBJECT(Exception, &jsexception.toObject(), e);
 
                     if (e &&
                         NS_SUCCEEDED(e->GetResult(&rv)) &&
                         rv == NS_NOINTERFACE) {
                         JS_ClearPendingException(cx);
                     }
-                } else if (JSVAL_IS_NUMBER(jsexception)) {
+                } else if (jsexception.isNumber()) {
                     // JS often throws an nsresult.
                     if (jsexception.isDouble())
                         // Visual Studio 9 doesn't allow casting directly from
                         // a double to an enumeration type, contrary to
                         // 5.2.9(10) of C++11, so add an intermediate cast.
                         rv = (nsresult)(uint32_t)(jsexception.toDouble());
                     else
                         rv = (nsresult)(JSVAL_TO_INT(jsexception));
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -386,17 +386,17 @@ GetIntFromJSObject(JSContext* aCtx,
 {
   JS::Rooted<JS::Value> value(aCtx);
   bool rc = JS_GetProperty(aCtx, aObject, aProperty, &value);
   NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
   if (value.isUndefined()) {
     return NS_ERROR_INVALID_ARG;
   }
   NS_ENSURE_ARG(JSVAL_IS_PRIMITIVE(value));
-  NS_ENSURE_ARG(JSVAL_IS_NUMBER(value));
+  NS_ENSURE_ARG(value.isNumber());
 
   double num;
   rc = JS::ToNumber(aCtx, value, &num);
   NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
   NS_ENSURE_ARG(IntType(num) == num);
 
   *_int = IntType(num);
   return NS_OK;