Bug 952650 (part 6) - Remove JSVAL_IS_STRING. r=njn.
authorRodrigo Rodriguez Jr. <rrodrigue96@hotmail.com>
Sun, 27 Apr 2014 19:41:01 -0700
changeset 181295 47e4ad6fbe3cc59e395a032c8cab0b1da4cccd8e
parent 181294 77173a0f4085f708941164ba3666aac9ecd3f54a
child 181296 061b0af0e45b3a7e74def211dcbc7f517b170209
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersnjn
bugs952650
milestone32.0a1
Bug 952650 (part 6) - Remove JSVAL_IS_STRING. r=njn.
dom/network/src/TCPSocketParent.cpp
dom/plugins/base/nsJSNPRuntime.cpp
gfx/skia/trunk/src/xml/SkJS.cpp
ipc/nfc/Nfc.cpp
ipc/ril/Ril.cpp
js/jsd/jsd_val.cpp
js/jsd/jsd_xpc.cpp
js/public/Value.h
js/src/ctypes/CTypes.cpp
js/src/ctypes/Library.cpp
js/src/jsapi-tests/testConservativeGC.cpp
js/src/jsapi-tests/testLookup.cpp
js/src/jsapi-tests/testTrap.cpp
js/src/jsapi-tests/testValueABI.cpp
js/src/jsopcode.cpp
js/src/tests/js1_5/Regress/regress-407024.js
js/src/tests/js1_8_5/regress/regress-477053.js
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/XPCVariant.cpp
toolkit/components/places/History.cpp
--- a/dom/network/src/TCPSocketParent.cpp
+++ b/dom/network/src/TCPSocketParent.cpp
@@ -235,17 +235,17 @@ TCPSocketParent::SendEvent(const nsAStri
       data = SendableData(arr);
 
     } else {
       nsDependentJSString name;
 
       JS::Rooted<JS::Value> val(aCx);
       if (!JS_GetProperty(aCx, obj, "name", &val)) {
         NS_ERROR("No name property on supposed error object");
-      } else if (JSVAL_IS_STRING(val)) {
+      } else if (val.isString()) {
         if (!name.init(aCx, JSVAL_TO_STRING(val))) {
           NS_WARNING("couldn't initialize string");
         }
       }
 
       data = TCPError(name);
     }
   } else {
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -393,17 +393,17 @@ JSValToNPVariant(NPP npp, JSContext *cx,
     } 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);
       }
-    } else if (JSVAL_IS_STRING(val)) {
+    } else if (val.isString()) {
       JSString *jsstr = JSVAL_TO_STRING(val);
       size_t length;
       const jschar *chars = ::JS_GetStringCharsZAndLength(cx, jsstr, &length);
       if (!chars) {
           return false;
       }
 
       nsDependentString str(chars, length);
--- a/gfx/skia/trunk/src/xml/SkJS.cpp
+++ b/gfx/skia/trunk/src/xml/SkJS.cpp
@@ -105,17 +105,17 @@ global_resolve(JSContext *cx, JSObject *
          * Do this expensive hack only for unoptimized Unix builds, which are
          * not used for benchmarking.
          */
         char *path, *comp, *full;
         const char *name;
         JSBool ok, found;
         JSFunction *fun;
 
-        if (!JSVAL_IS_STRING(id))
+        if (!id.isString())
             return JS_TRUE;
         path = getenv("PATH");
         if (!path)
             return JS_TRUE;
         path = JS_strdup(cx, path);
         if (!path)
             return JS_FALSE;
         name = JS_GetStringBytes(JSVAL_TO_STRING(id));
--- a/ipc/nfc/Nfc.cpp
+++ b/ipc/nfc/Nfc.cpp
@@ -85,17 +85,17 @@ PostToNFC(JSContext* aCx,
         return false;
     }
 
     JS::Value v = args[0];
 
     JSAutoByteString abs;
     void* data;
     size_t size;
-    if (JSVAL_IS_STRING(v)) {
+    if (v.isString()) {
         JS::Rooted<JSString*> str(aCx, v.toString());
         if (!abs.encodeUtf8(aCx, str)) {
             return false;
         }
 
         data = abs.ptr();
         size = abs.length();
     } else if (!JSVAL_IS_PRIMITIVE(v)) {
--- a/ipc/ril/Ril.cpp
+++ b/ipc/ril/Ril.cpp
@@ -90,17 +90,17 @@ PostToRIL(JSContext *aCx,
     }
 
     int clientId = args[0].toInt32();
     JS::Value v = args[1];
 
     JSAutoByteString abs;
     void *data;
     size_t size;
-    if (JSVAL_IS_STRING(v)) {
+    if (v.isString()) {
         JS::Rooted<JSString*> str(aCx, v.toString());
         if (!abs.encodeUtf8(aCx, str)) {
             return false;
         }
 
         data = abs.ptr();
         size = abs.length();
     } else if (!JSVAL_IS_PRIMITIVE(v)) {
--- a/js/jsd/jsd_val.cpp
+++ b/js/jsd/jsd_val.cpp
@@ -79,17 +79,17 @@ bool
 jsd_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval)
 {
     return jsdval->val.isDouble();
 }
 
 bool
 jsd_IsValueString(JSDContext* jsdc, JSDValue* jsdval)
 {
-    return JSVAL_IS_STRING(jsdval->val);
+    return jsdval->val.isString();
 }
 
 bool
 jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval)
 {
     return JSVAL_IS_BOOLEAN(jsdval->val);
 }
 
@@ -174,17 +174,17 @@ jsd_GetValueString(JSDContext* jsdc, JSD
     JS::RootedValue stringval(cx);
     JS::RootedString string(cx);
     JS::RootedObject scopeObj(cx);
 
     if(jsdval->string)
         return jsdval->string;
 
     /* Reuse the string without copying or re-rooting it */
-    if(JSVAL_IS_STRING(jsdval->val)) {
+    if(jsdval->val.isString()) {
         jsdval->string = JSVAL_TO_STRING(jsdval->val);
         return jsdval->string;
     }
 
     /* Objects call JS_ValueToString in their own compartment. */
     scopeObj = !JSVAL_IS_PRIMITIVE(jsdval->val) ? JSVAL_TO_OBJECT(jsdval->val) : jsdc->glob;
     {
         JSAutoCompartment ac(cx, scopeObj);
@@ -248,17 +248,17 @@ jsd_NewValue(JSDContext* jsdc, jsval val
         return nullptr;
 
     if(JSVAL_IS_GCTHING(val))
     {
         bool ok;
         JSAutoCompartment ac(cx, jsdc->glob);
 
         ok = JS::AddNamedValueRoot(cx, &jsdval->val, "JSDValue");
-        if(ok && JSVAL_IS_STRING(val)) {
+        if(ok && val.isString()) {
             if(!JS_WrapValue(cx, &val)) {
                 ok = false;
             }
         }
 
         if(!ok)
         {
             free(jsdval);
@@ -404,17 +404,17 @@ static bool _buildProps(JSDContext* jsdc
 
 void
 jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval)
 {
     AutoSafeJSContext cx;
     if(jsdval->string)
     {
         /* if the jsval is a string, then we didn't need to root the string */
-        if(!JSVAL_IS_STRING(jsdval->val))
+        if(!jsdval->val.isString())
         {
             JSAutoCompartment ac(cx, jsdc->glob);
             JS::RemoveStringRoot(cx, &jsdval->string);
         }
         jsdval->string = nullptr;
     }
 
     jsdval->funName = nullptr;
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -2161,17 +2161,17 @@ jsdValue::GetJsType (uint32_t *_rval)
     if (val.isNull())
         *_rval = TYPE_NULL;
     else if (JSVAL_IS_BOOLEAN(val))
         *_rval = TYPE_BOOLEAN;
     else if (val.isDouble())
         *_rval = TYPE_DOUBLE;
     else if (JSVAL_IS_INT(val))
         *_rval = TYPE_INT;
-    else if (JSVAL_IS_STRING(val))
+    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))
         *_rval = TYPE_OBJECT;
     else
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1872,26 +1872,20 @@ UINT_TO_JSVAL(uint32_t i)
 }
 
 static inline bool
 JSVAL_IS_NUMBER(jsval v)
 {
     return JSVAL_IS_NUMBER_IMPL(JSVAL_TO_IMPL(v));
 }
 
-static inline bool
-JSVAL_IS_STRING(jsval v)
-{
-    return JSVAL_IS_STRING_IMPL(JSVAL_TO_IMPL(v));
-}
-
 static inline JSString *
 JSVAL_TO_STRING(jsval v)
 {
-    MOZ_ASSERT(JSVAL_IS_STRING(v));
+    MOZ_ASSERT(v.isString());
     return JSVAL_TO_STRING_IMPL(JSVAL_TO_IMPL(v));
 }
 
 static inline jsval
 STRING_TO_JSVAL(JSString *str)
 {
     return IMPL_TO_JSVAL(STRING_TO_JSVAL_IMPL(str));
 }
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -1815,17 +1815,17 @@ jsvalToBigInteger(JSContext* cx,
     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.
     double d = val.toDouble();
     return ConvertExact(d, result);
   }
-  if (allowString && JSVAL_IS_STRING(val)) {
+  if (allowString && val.isString()) {
     // Allow conversion from base-10 or base-16 strings, provided the result
     // fits in IntegerType. (This allows an Int64 or UInt64 object to be passed
     // to the JS array element operator, which will automatically call
     // toString() on the object for us.)
     return StringToInteger(cx, JSVAL_TO_STRING(val), result);
   }
   if (!JSVAL_IS_PRIMITIVE(val)) {
     // Allow conversion from an Int64 or UInt64 object directly.
@@ -2307,17 +2307,17 @@ ImplicitConvert(JSContext* cx,
     break;                                                                     \
   }
 #define DEFINE_CHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z)
 #define DEFINE_JSCHAR_TYPE(name, type, ffiType)                                \
   case TYPE_##name: {                                                          \
     /* Convert from a 1-character string, regardless of encoding, */           \
     /* or from an integer, provided the result fits in 'type'. */              \
     type result;                                                               \
-    if (JSVAL_IS_STRING(val)) {                                                \
+    if (val.isString()) {                                                \
       JSString* str = JSVAL_TO_STRING(val);                                    \
       if (str->length() != 1)                                                  \
         return TypeError(cx, #name, val);                                      \
       const jschar *chars = str->getChars(cx);                                 \
       if (!chars)                                                              \
         return false;                                                          \
       result = chars[0];                                                       \
     } else if (!jsvalToInteger(cx, val, &result)) {                            \
@@ -2351,17 +2351,17 @@ ImplicitConvert(JSContext* cx,
         // sourceType.elementType.ptr, just like C.
         JSObject* elementType = ArrayType::GetBaseType(sourceType);
         if (voidptrTarget || CType::TypesEqual(baseType, elementType)) {
           *static_cast<void**>(buffer) = sourceBuffer;
           break;
         }
       }
 
-    } else if (isArgument && JSVAL_IS_STRING(val)) {
+    } else if (isArgument && val.isString()) {
       // Convert the string for the ffi call. This requires allocating space
       // which the caller assumes ownership of.
       // TODO: Extend this so we can safely convert strings at other times also.
       JSString* sourceString = JSVAL_TO_STRING(val);
       size_t sourceLength = sourceString->length();
       const jschar* sourceChars = sourceString->getChars(cx);
       if (!sourceChars)
         return false;
@@ -2430,17 +2430,17 @@ ImplicitConvert(JSContext* cx,
       break;
     }
     return TypeError(cx, "pointer", val);
   }
   case TYPE_array: {
     RootedObject baseType(cx, ArrayType::GetBaseType(targetType));
     size_t targetLength = ArrayType::GetLength(targetType);
 
-    if (JSVAL_IS_STRING(val)) {
+    if (val.isString()) {
       JSString* sourceString = JSVAL_TO_STRING(val);
       size_t sourceLength = sourceString->length();
       const jschar* sourceChars = sourceString->getChars(cx);
       if (!sourceChars)
         return false;
 
       switch (CType::GetTypeCode(baseType)) {
       case TYPE_char:
@@ -2646,17 +2646,17 @@ ExplicitConvert(JSContext* cx, HandleVal
     break;
   }
 #define DEFINE_INT_TYPE(name, type, ffiType)                                   \
   case TYPE_##name: {                                                          \
     /* Convert numeric values with a C-style cast, and */                      \
     /* allow conversion from a base-10 or base-16 string. */                   \
     type result;                                                               \
     if (!jsvalToIntegerExplicit(val, &result) &&                               \
-        (!JSVAL_IS_STRING(val) ||                                              \
+        (!val.isString() ||                                              \
          !StringToInteger(cx, JSVAL_TO_STRING(val), &result)))                 \
       return TypeError(cx, #name, val);                                        \
     *static_cast<type*>(buffer) = result;                                      \
     break;                                                                     \
   }
 #define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z)
 #define DEFINE_CHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z)
 #define DEFINE_JSCHAR_TYPE(x, y, z) DEFINE_CHAR_TYPE(x, y, z)
@@ -5405,17 +5405,17 @@ PrepareReturnType(JSContext* cx, jsval t
 
   return result;
 }
 
 static MOZ_ALWAYS_INLINE bool
 IsEllipsis(JSContext* cx, jsval v, bool* isEllipsis)
 {
   *isEllipsis = false;
-  if (!JSVAL_IS_STRING(v))
+  if (!v.isString())
     return true;
   JSString* str = JSVAL_TO_STRING(v);
   if (str->length() != 3)
     return true;
   const jschar* chars = str->getChars(cx);
   if (!chars)
     return false;
   jschar dot = '.';
--- a/js/src/ctypes/Library.cpp
+++ b/js/src/ctypes/Library.cpp
@@ -53,17 +53,17 @@ Library::Name(JSContext* cx, unsigned ar
   CallArgs args = CallArgsFromVp(argc, vp);
   if (args.length() != 1) {
     JS_ReportError(cx, "libraryName takes one argument");
     return false;
   }
 
   Value arg = args[0];
   JSString* str = nullptr;
-  if (JSVAL_IS_STRING(arg)) {
+  if (arg.isString()) {
     str = JSVAL_TO_STRING(arg);
   }
   else {
     JS_ReportError(cx, "name argument must be a string");
     return false;
   }
 
   AutoString resultString;
@@ -91,17 +91,17 @@ Library::Create(JSContext* cx, jsval pat
 
   // initialize the library
   JS_SetReservedSlot(libraryObj, SLOT_LIBRARY, PRIVATE_TO_JSVAL(nullptr));
 
   // attach API functions
   if (!JS_DefineFunctions(cx, libraryObj, sLibraryFunctions))
     return nullptr;
 
-  if (!JSVAL_IS_STRING(path)) {
+  if (!path.isString()) {
     JS_ReportError(cx, "open takes a string argument");
     return nullptr;
   }
 
   PRLibSpec libSpec;
   RootedFlatString pathStr(cx, JS_FlattenString(cx, JSVAL_TO_STRING(path)));
   if (!pathStr)
     return nullptr;
--- a/js/src/jsapi-tests/testConservativeGC.cpp
+++ b/js/src/jsapi-tests/testConservativeGC.cpp
@@ -14,29 +14,29 @@ BEGIN_TEST(testConservativeGC)
     JS::RootedValue v2(cx);
     EVAL("({foo: 'bar'});", &v2);
     CHECK(v2.isObject());
     char objCopy[sizeof(JSObject)];
     js_memcpy(&objCopy, JSVAL_TO_OBJECT(v2), sizeof(JSObject));
 
     JS::RootedValue v3(cx);
     EVAL("String(Math.PI);", &v3);
-    CHECK(JSVAL_IS_STRING(v3));
+    CHECK(v3.isString());
     char strCopy[sizeof(JSString)];
     js_memcpy(&strCopy, JSVAL_TO_STRING(v3), sizeof(JSString));
 
     JS::RootedValue tmp(cx);
     EVAL("({foo2: 'bar2'});", &tmp);
     CHECK(tmp.isObject());
     JS::RootedObject obj2(cx, JSVAL_TO_OBJECT(tmp));
     char obj2Copy[sizeof(JSObject)];
     js_memcpy(&obj2Copy, obj2, sizeof(JSObject));
 
     EVAL("String(Math.sqrt(3));", &tmp);
-    CHECK(JSVAL_IS_STRING(tmp));
+    CHECK(tmp.isString());
     JS::RootedString str2(cx, JSVAL_TO_STRING(tmp));
     char str2Copy[sizeof(JSString)];
     js_memcpy(&str2Copy, str2, sizeof(JSString));
 
     tmp = JSVAL_NULL;
 
     JS_GC(rt);
 
--- a/js/src/jsapi-tests/testLookup.cpp
+++ b/js/src/jsapi-tests/testLookup.cpp
@@ -52,17 +52,17 @@ static const JSClass DocumentAllClass = 
 bool
 document_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
                  JS::MutableHandleObject objp)
 {
     // If id is "all", resolve document.all=true.
     JS::RootedValue v(cx);
     if (!JS_IdToValue(cx, id, &v))
         return false;
-    if (JSVAL_IS_STRING(v)) {
+    if (v.isString()) {
         JSString *str = JSVAL_TO_STRING(v);
         JSFlatString *flatStr = JS_FlattenString(cx, str);
         if (!flatStr)
             return false;
         if (JS_FlatStringEqualsAscii(flatStr, "all")) {
             JS::Rooted<JSObject*> docAll(cx,
                                          JS_NewObject(cx, &DocumentAllClass, JS::NullPtr(), JS::NullPtr()));
             if (!docAll)
--- a/js/src/jsapi-tests/testTrap.cpp
+++ b/js/src/jsapi-tests/testTrap.cpp
@@ -11,17 +11,17 @@
 static int emptyTrapCallCount = 0;
 
 static JSTrapStatus
 EmptyTrapHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
                  jsval closureArg)
 {
     JS::RootedValue closure(cx, closureArg);
     JS_GC(JS_GetRuntime(cx));
-    if (JSVAL_IS_STRING(closure))
+    if (closure.isString())
         ++emptyTrapCallCount;
     return JSTRAP_CONTINUE;
 }
 
 BEGIN_TEST(testTrap_gc)
 {
     static const char source[] =
 "var i = 0;\n"
--- a/js/src/jsapi-tests/testValueABI.cpp
+++ b/js/src/jsapi-tests/testValueABI.cpp
@@ -33,17 +33,17 @@ BEGIN_TEST(testValueABI_retparam)
     jsval v = OBJECT_TO_JSVAL(obj);
     obj = nullptr;
     CHECK(C_ValueToObject(cx, v, obj.address()));
     bool equal;
     CHECK(JS_StrictlyEqual(cx, v, OBJECT_TO_JSVAL(obj), &equal));
     CHECK(equal);
 
     v = C_GetEmptyStringValue(cx);
-    CHECK(JSVAL_IS_STRING(v));
+    CHECK(v.isString());
 
     return true;
 }
 END_TEST(testValueABI_retparam)
 
 BEGIN_TEST(testValueABI_alignment)
 {
     typedef struct { char c; jsval v; } AlignTest;
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -795,17 +795,17 @@ js_DumpScriptDepth(JSContext *cx, JSScri
 }
 
 static char *
 QuoteString(Sprinter *sp, JSString *str, uint32_t quote);
 
 static bool
 ToDisassemblySource(JSContext *cx, HandleValue v, JSAutoByteString *bytes)
 {
-    if (JSVAL_IS_STRING(v)) {
+    if (v.isString()) {
         Sprinter sprinter(cx);
         if (!sprinter.init())
             return false;
         char *nbytes = QuoteString(&sprinter, JSVAL_TO_STRING(v), '"');
         if (!nbytes)
             return false;
         nbytes = JS_sprintf_append(nullptr, "%s", nbytes);
         if (!nbytes)
--- 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) || JSVAL_IS_STRING(pn3->pn_val) || JSVAL_IS_BOOLEAN(pn3->pn_val)';
+var summary = 'Do not assert JSVAL_IS_NUMBER(pn3->pn_val) || pn3->pn_val.isString() || JSVAL_IS_BOOLEAN(pn3->pn_val)';
 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/src/tests/js1_8_5/regress/regress-477053.js
+++ b/js/src/tests/js1_8_5/regress/regress-477053.js
@@ -1,16 +1,16 @@
 /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 
 /* 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 summary = 'Do not assert: JSVAL_IS_STRING(v)';
+var summary = 'Do not assert: v.isString()';
 var BUGNUMBER = 477053;
 var actual = '';
 var expect = '';
 
 printBugNumber(BUGNUMBER);
 
 try
 {
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -721,18 +721,17 @@ XPCConvert::JSData2Native(void* d, Handl
 
         if (iid->Equals(NS_GET_IID(nsIVariant))) {
             nsCOMPtr<nsIVariant> variant = XPCVariant::newVariant(cx, s);
             if (!variant)
                 return false;
 
             variant.forget(static_cast<nsISupports**>(d));
             return true;
-        } else if (iid->Equals(NS_GET_IID(nsIAtom)) &&
-                   JSVAL_IS_STRING(s)) {
+        } else if (iid->Equals(NS_GET_IID(nsIAtom)) && s.isString()) {
             // We're trying to pass a string as an nsIAtom.  Let's atomize!
             JSString* str = JSVAL_TO_STRING(s);
             const char16_t* chars = JS_GetStringCharsZ(cx, str);
             if (!chars) {
                 if (pErr)
                     *pErr = NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF;
                 return false;
             }
--- a/js/xpconnect/src/XPCQuickStubs.h
+++ b/js/xpconnect/src/XPCQuickStubs.h
@@ -228,17 +228,17 @@ protected:
      */
     template<class traits>
     JSString* InitOrStringify(JSContext* cx, JS::HandleValue v,
                               JS::MutableHandleValue pval,
                               bool notpassed,
                               StringificationBehavior nullBehavior,
                               StringificationBehavior undefinedBehavior) {
         JSString *s;
-        if (JSVAL_IS_STRING(v)) {
+        if (v.isString()) {
             s = JSVAL_TO_STRING(v);
         } else {
             StringificationBehavior behavior = eStringify;
             if (v.isNull()) {
                 behavior = nullBehavior;
             } else if (v.isUndefined()) {
                 behavior = undefinedBehavior;
             }
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -55,17 +55,17 @@ XPCVariant::XPCVariant(JSContext* cx, js
 XPCTraceableVariant::~XPCTraceableVariant()
 {
     jsval val = GetJSValPreserveColor();
 
     MOZ_ASSERT(JSVAL_IS_GCTHING(val), "Must be traceable or unlinked");
 
     // If val is JSVAL_STRING, we don't need to clean anything up; simply
     // removing the string from the root set is good.
-    if (!JSVAL_IS_STRING(val))
+    if (!val.isString())
         nsVariant::Cleanup(&mData);
 
     if (!val.isNull())
         RemoveFromRootSet();
 }
 
 void XPCTraceableVariant::TraceJS(JSTracer* trc)
 {
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -311,17 +311,17 @@ GetURIFromJSObject(JSContext* aCtx,
  * @param _string
  *        The string to populate with the value, or set it to void.
  */
 void
 GetJSValueAsString(JSContext* aCtx,
                    const JS::Value& aValue,
                    nsString& _string) {
   if (aValue.isUndefined() ||
-      !(aValue.isNull() || JSVAL_IS_STRING(aValue))) {
+      !(aValue.isNull() || aValue.isString())) {
     _string.SetIsVoid(true);
     return;
   }
 
   // |null| in JS maps to the empty string.
   if (aValue.isNull()) {
     _string.Truncate();
     return;