Bug 952650 (part 1) - Remove JSVAL_IS_NULL. r=terrence.
authorRodrigo Rodriguez Jr. <rrodrigue96@hotmail.com>
Sun, 27 Apr 2014 19:30:51 -0700
changeset 180884 24dedc2a7064523474d2d61153e3d9713fa2730c
parent 180883 68e78cfc9094234eb3733e715a52995713a2b67e
child 180885 24f49a2ca817513c6eea574b7e92b8ef883406a2
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)
reviewersterrence
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 1) - Remove JSVAL_IS_NULL. r=terrence.
content/canvas/src/CanvasUtils.h
dom/base/nsDOMClassInfo.cpp
dom/indexedDB/KeyPath.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/workers/XMLHttpRequest.cpp
js/jsd/jsd_val.cpp
js/jsd/jsd_xpc.cpp
js/public/Value.h
js/src/ctypes/CTypes.cpp
js/src/jsapi-tests/testResolveRecursion.cpp
js/src/tests/js1_5/Regress/regress-355829-01.js
js/src/vm/Probes.cpp
js/src/vm/StructuredClone.cpp
js/xpconnect/public/nsAutoJSValHolder.h
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/XPCVariant.cpp
security/manager/ssl/src/nsCrypto.cpp
toolkit/components/places/History.cpp
--- a/content/canvas/src/CanvasUtils.h
+++ b/content/canvas/src/CanvasUtils.h
@@ -136,17 +136,17 @@ JSValToDashArray(JSContext* cx, const JS
                 return NS_ERROR_OUT_OF_MEMORY;
             }
         }
 
         if (dashes.Length() > 0 && !haveNonzeroElement) {
             // An all-zero pattern makes no sense.
             return NS_ERROR_ILLEGAL_VALUE;
         }
-    } else if (!(JSVAL_IS_VOID(patternArray) || JSVAL_IS_NULL(patternArray))) {
+    } else if (!(JSVAL_IS_VOID(patternArray) || patternArray.isNull())) {
         // undefined and null mean "reset to no dash".  Any other
         // random garbage is a type error.
         return NS_ERROR_INVALID_ARG;
     }
 
     return NS_OK;
 }
 
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -3029,17 +3029,17 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
     JS::Rooted<JS::Value> prop_val(cx, JS::UndefinedValue()); // Property value.
 
     nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi(do_QueryInterface(native));
     if (gpi) {
       rv = gpi->Init(aWin, &prop_val);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
-    if (JSVAL_IS_PRIMITIVE(prop_val) && !JSVAL_IS_NULL(prop_val)) {
+    if (JSVAL_IS_PRIMITIVE(prop_val) && !prop_val.isNull()) {
       if (aWin->IsOuterWindow()) {
         nsGlobalWindow *inner = aWin->GetCurrentInnerWindowInternal();
         NS_ENSURE_TRUE(inner, NS_ERROR_UNEXPECTED);
       }
 
       rv = WrapNative(cx, native, true, &prop_val);
     }
 
--- a/dom/indexedDB/KeyPath.cpp
+++ b/dom/indexedDB/KeyPath.cpp
@@ -296,17 +296,17 @@ KeyPath::Parse(JSContext* aCx, const JS:
       }
 
       if (!keyPath.AppendStringWithValidation(aCx, str)) {
         return NS_ERROR_FAILURE;
       }
     }
   }
   // Otherwise convert it to a string.
-  else if (!JSVAL_IS_NULL(aValue) && !JSVAL_IS_VOID(aValue)) {
+  else if (!aValue.isNull() && !JSVAL_IS_VOID(aValue)) {
     JSString* jsstr;
     nsDependentJSString str;
     if (!(jsstr = JS::ToString(aCx, aValue)) ||
         !str.init(aCx, jsstr)) {
       return NS_ERROR_FAILURE;
     }
 
     keyPath.SetType(STRING);
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -379,17 +379,17 @@ NPVariantToJSVal(NPP npp, JSContext *cx,
 bool
 JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
 {
   NS_ASSERTION(npp, "Must have an NPP to wrap a jsval!");
 
   if (JSVAL_IS_PRIMITIVE(val)) {
     if (val == JSVAL_VOID) {
       VOID_TO_NPVARIANT(*variant);
-    } else if (JSVAL_IS_NULL(val)) {
+    } else if (val.isNull()) {
       NULL_TO_NPVARIANT(*variant);
     } else if (JSVAL_IS_BOOLEAN(val)) {
       BOOLEAN_TO_NPVARIANT(JSVAL_TO_BOOLEAN(val), *variant);
     } else if (JSVAL_IS_INT(val)) {
       INT32_TO_NPVARIANT(JSVAL_TO_INT(val), *variant);
     } else if (JSVAL_IS_DOUBLE(val)) {
       double d = JSVAL_TO_DOUBLE(val);
       int i;
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -1251,17 +1251,17 @@ EventRunnable::WorkerRun(JSContext* aCx,
 
   nsAutoPtr<XMLHttpRequest::StateData> state(new XMLHttpRequest::StateData());
   StateDataAutoRooter rooter(aCx, state);
 
   state->mResponseTextResult = mResponseTextResult;
   state->mResponseText = mResponseText;
 
   if (NS_SUCCEEDED(mResponseTextResult)) {
-    MOZ_ASSERT(JSVAL_IS_VOID(mResponse) || JSVAL_IS_NULL(mResponse));
+    MOZ_ASSERT(JSVAL_IS_VOID(mResponse) || mResponse.isNull());
     state->mResponseResult = mResponseTextResult;
     state->mResponse = mResponse;
   }
   else {
     state->mResponseResult = mResponseResult;
 
     if (NS_SUCCEEDED(mResponseResult)) {
       if (mResponseBuffer.data()) {
--- a/js/jsd/jsd_val.cpp
+++ b/js/jsd/jsd_val.cpp
@@ -55,17 +55,17 @@ void JSD_ASSERT_VALID_PROPERTY(JSDProper
         MOZ_ASSERT(jsdprop->alias->nref > 0);
 }
 #endif
 
 
 bool
 jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval)
 {
-    return !JSVAL_IS_PRIMITIVE(jsdval->val) || JSVAL_IS_NULL(jsdval->val);
+    return !JSVAL_IS_PRIMITIVE(jsdval->val) || jsdval->val.isNull();
 }
 
 bool
 jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval)
 {
     return JSVAL_IS_NUMBER(jsdval->val);
 }
 
@@ -91,17 +91,17 @@ bool
 jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval)
 {
     return JSVAL_IS_BOOLEAN(jsdval->val);
 }
 
 bool
 jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval)
 {
-    return JSVAL_IS_NULL(jsdval->val);
+    return jsdval->val.isNull();
 }
 
 bool
 jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval)
 {
     return JSVAL_IS_VOID(jsdval->val);
 }
 
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -2153,17 +2153,17 @@ jsdValue::GetIsPrimitive (bool *_rval)
 }
 
 NS_IMETHODIMP
 jsdValue::GetJsType (uint32_t *_rval)
 {
     ASSERT_VALID_EPHEMERAL;
     JS::RootedValue val(JSD_GetJSRuntime(mCx), JSD_GetValueWrappedJSVal (mCx, mValue));
 
-    if (JSVAL_IS_NULL(val))
+    if (val.isNull())
         *_rval = TYPE_NULL;
     else if (JSVAL_IS_BOOLEAN(val))
         *_rval = TYPE_BOOLEAN;
     else if (JSVAL_IS_DOUBLE(val))
         *_rval = TYPE_DOUBLE;
     else if (JSVAL_IS_INT(val))
         *_rval = TYPE_INT;
     else if (JSVAL_IS_STRING(val))
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1817,22 +1817,16 @@ 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_NULL(jsval v)
-{
-    return JSVAL_IS_NULL_IMPL(JSVAL_TO_IMPL(v));
-}
-
-static inline bool
 JSVAL_IS_VOID(jsval v)
 {
     return JSVAL_IS_UNDEFINED_IMPL(JSVAL_TO_IMPL(v));
 }
 
 static inline bool
 JSVAL_IS_INT(jsval v)
 {
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -2323,17 +2323,17 @@ ImplicitConvert(JSContext* cx,
     } else if (!jsvalToInteger(cx, val, &result)) {                            \
       return TypeError(cx, #name, val);                                        \
     }                                                                          \
     *static_cast<type*>(buffer) = result;                                      \
     break;                                                                     \
   }
 #include "ctypes/typedefs.h"
   case TYPE_pointer: {
-    if (JSVAL_IS_NULL(val)) {
+    if (val.isNull()) {
       // Convert to a null pointer.
       *static_cast<void**>(buffer) = nullptr;
       break;
     }
 
     JS::Rooted<JSObject*> baseType(cx, PointerType::GetBaseType(targetType));
     if (sourceData) {
       // First, determine if the targetType is ctypes.void_t.ptr.
@@ -4361,17 +4361,17 @@ ArrayType::ConstructData(JSContext* cx,
 
 JSObject*
 ArrayType::GetBaseType(JSObject* obj)
 {
   JS_ASSERT(CType::IsCType(obj));
   JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array);
 
   jsval type = JS_GetReservedSlot(obj, SLOT_ELEMENT_T);
-  JS_ASSERT(!JSVAL_IS_NULL(type));
+  JS_ASSERT(!type.isNull());
   return &type.toObject();
 }
 
 bool
 ArrayType::GetSafeLength(JSObject* obj, size_t* result)
 {
   JS_ASSERT(CType::IsCType(obj));
   JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array);
--- a/js/src/jsapi-tests/testResolveRecursion.cpp
+++ b/js/src/jsapi-tests/testResolveRecursion.cpp
@@ -118,17 +118,17 @@ doResolve(JS::HandleObject obj, JS::Hand
         }
         if (obj == obj1) {
             CHECK_EQUAL(resolveEntryCount, 3);
             EVAL("obj1.x", &v);
             CHECK(JSVAL_IS_VOID(v));
             EVAL("obj1.y", &v);
             CHECK(JSVAL_IS_VOID(v));
             EVAL("obj2.y", &v);
-            CHECK(JSVAL_IS_NULL(v));
+            CHECK(v.isNull());
             EVAL("obj2.x", &v);
             CHECK(JSVAL_IS_VOID(v));
             EVAL("obj1.y = 0", &v);
             CHECK_SAME(v, JSVAL_ZERO);
             objp.set(obj);
             return true;
         }
     }
--- a/js/src/tests/js1_5/Regress/regress-355829-01.js
+++ b/js/src/tests/js1_5/Regress/regress-355829-01.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 = 355829;
-var summary = 'Do not assert: !argc || JSVAL_IS_NULL(argv[0]) || JSVAL_IS_VOID(argv[0])';
+var summary = 'Do not assert: !argc || argv[0].isNull() || JSVAL_IS_VOID(argv[0])';
 var actual = '';
 var expect = '';
 
 
 //-----------------------------------------------------------------------------
 test();
 //-----------------------------------------------------------------------------
 
--- a/js/src/vm/Probes.cpp
+++ b/js/src/vm/Probes.cpp
@@ -7,17 +7,17 @@
 #include "vm/Probes-inl.h"
 
 #include "jscntxt.h"
 
 #ifdef INCLUDE_MOZILLA_DTRACE
 #include "jsscriptinlines.h"
 #endif
 
-#define TYPEOF(cx,v)    (JSVAL_IS_NULL(v) ? JSTYPE_NULL : JS_TypeOfValue(cx,v))
+#define TYPEOF(cx,v)    (v.isNull() ? JSTYPE_NULL : JS_TypeOfValue(cx,v))
 
 using namespace js;
 
 const char probes::nullName[] = "(null)";
 const char probes::anonymousName[] = "(anonymous)";
 
 bool probes::ProfilingActive = true;
 
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -714,17 +714,17 @@ JSStructuredCloneWriter::~JSStructuredCl
     ClearStructuredClone(data, size, callbacks, closure);
 }
 
 bool
 JSStructuredCloneWriter::parseTransferable()
 {
     MOZ_ASSERT(transferableObjects.empty(), "parseTransferable called with stale data");
 
-    if (JSVAL_IS_NULL(transferable) || JSVAL_IS_VOID(transferable))
+    if (transferable.isNull() || JSVAL_IS_VOID(transferable))
         return true;
 
     if (!transferable.isObject())
         return reportErrorTransferable();
 
     JSContext *cx = context();
     RootedObject array(cx, &transferable.toObject());
     if (!JS_IsArrayObject(cx, array))
--- a/js/xpconnect/public/nsAutoJSValHolder.h
+++ b/js/xpconnect/public/nsAutoJSValHolder.h
@@ -112,17 +112,17 @@ public:
   JS::Value get() const { return mVal; }
 
   nsAutoJSValHolder &operator=(JSObject* aOther) {
     return *this = OBJECT_TO_JSVAL(aOther);
   }
 
   nsAutoJSValHolder &operator=(JS::Value aOther) {
 #ifdef DEBUG
-    if (JSVAL_IS_GCTHING(aOther) && !JSVAL_IS_NULL(aOther)) {
+    if (JSVAL_IS_GCTHING(aOther) && !aOther.isNull()) {
       MOZ_ASSERT(IsHeld(), "Not rooted!");
     }
 #endif
     mVal = aOther;
     return *this;
   }
 
 private:
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -479,17 +479,17 @@ XPCConvert::JSData2Native(void* d, Handl
             else
                 (**((nsAString**)d)).SetIsVoid(true);
             return true;
         }
         // Fall through to T_DOMSTRING case.
     }
     case nsXPTType::T_DOMSTRING:
     {
-        if (JSVAL_IS_NULL(s)) {
+        if (s.isNull()) {
             if (useAllocator)
                 *((const nsAString**)d) = &NullString();
             else
                 (**((nsAString**)d)).SetIsVoid(true);
             return true;
         }
         size_t length = 0;
         const char16_t* chars = nullptr;
@@ -538,17 +538,17 @@ XPCConvert::JSData2Native(void* d, Handl
         } else {
             ws->Assign(chars, length);
         }
         return true;
     }
 
     case nsXPTType::T_CHAR_STR:
     {
-        if (JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) {
+        if (JSVAL_IS_VOID(s) || s.isNull()) {
             *((char**)d) = nullptr;
             return true;
         }
 
         JSString* str = ToString(cx, s);
         if (!str) {
             return false;
         }
@@ -579,17 +579,17 @@ XPCConvert::JSData2Native(void* d, Handl
         return true;
     }
 
     case nsXPTType::T_WCHAR_STR:
     {
         const jschar* chars=nullptr;
         JSString* str;
 
-        if (JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) {
+        if (JSVAL_IS_VOID(s) || s.isNull()) {
             *((jschar**)d) = nullptr;
             return true;
         }
 
         if (!(str = ToString(cx, s))) {
             return false;
         }
         if (!(chars = JS_GetStringCharsZ(cx, str))) {
@@ -609,17 +609,17 @@ XPCConvert::JSData2Native(void* d, Handl
     }
 
     case nsXPTType::T_UTF8STRING:
     {
         const jschar* chars;
         size_t length;
         JSString* str;
 
-        if (JSVAL_IS_NULL(s) || JSVAL_IS_VOID(s)) {
+        if (s.isNull() || JSVAL_IS_VOID(s)) {
             if (useAllocator) {
                 *((const nsACString**)d) = &NullCString();
             } else {
                 nsCString* rs = *((nsCString**)d);
                 rs->SetIsVoid(true);
             }
             return true;
         }
@@ -653,17 +653,17 @@ XPCConvert::JSData2Native(void* d, Handl
             rs = *((nsCString**)d);
         }
         CopyUTF16toUTF8(Substring(chars, length), *rs);
         return true;
     }
 
     case nsXPTType::T_CSTRING:
     {
-        if (JSVAL_IS_NULL(s) || JSVAL_IS_VOID(s)) {
+        if (s.isNull() || JSVAL_IS_VOID(s)) {
             if (useAllocator) {
                 nsACString *rs = new nsCString();
                 if (!rs)
                     return false;
 
                 rs->SetIsVoid(true);
                 *((nsACString**)d) = rs;
             } else {
@@ -1206,17 +1206,17 @@ XPCConvert::JSValToXPCException(MutableH
                 return NS_ERROR_FAILURE;
 
             return ConstructException(NS_ERROR_XPC_JS_THREW_JS_OBJECT,
                                       strBytes.ptr(), ifaceName, methodName,
                                       nullptr, exceptn, cx, s.address());
         }
     }
 
-    if (JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) {
+    if (JSVAL_IS_VOID(s) || s.isNull()) {
         return ConstructException(NS_ERROR_XPC_JS_THREW_NULL,
                                   nullptr, ifaceName, methodName, nullptr,
                                   exceptn, cx, s.address());
     }
 
     if (JSVAL_IS_NUMBER(s)) {
         // lets see if it looks like an nsresult
         nsresult rv;
@@ -1754,29 +1754,29 @@ XPCConvert::NativeStringWithSize2JS(Muta
 }
 
 // static
 bool
 XPCConvert::JSStringWithSize2Native(void* d, HandleValue s,
                                     uint32_t count, const nsXPTType& type,
                                     nsresult* pErr)
 {
-    NS_PRECONDITION(!JSVAL_IS_NULL(s), "bad param");
+    NS_PRECONDITION(!s.isNull(), "bad param");
     NS_PRECONDITION(d, "bad param");
 
     AutoJSContext cx;
     uint32_t len;
 
     if (pErr)
         *pErr = NS_ERROR_XPC_BAD_CONVERT_NATIVE;
 
     switch (type.TagPart()) {
         case nsXPTType::T_PSTRING_SIZE_IS:
         {
-            if (JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) {
+            if (JSVAL_IS_VOID(s) || s.isNull()) {
                 if (0 != count) {
                     if (pErr)
                         *pErr = NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING;
                     return false;
                 }
                 if (0 != count) {
                     len = (count + 1) * sizeof(char);
                     if (!(*((void**)d) = nsMemory::Alloc(len)))
@@ -1820,17 +1820,17 @@ XPCConvert::JSStringWithSize2Native(void
             return true;
         }
 
         case nsXPTType::T_PWSTRING_SIZE_IS:
         {
             const jschar* chars=nullptr;
             JSString* str;
 
-            if (JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) {
+            if (JSVAL_IS_VOID(s) || s.isNull()) {
                 if (0 != count) {
                     if (pErr)
                         *pErr = NS_ERROR_XPC_NOT_ENOUGH_CHARS_IN_STRING;
                     return false;
                 }
 
                 if (0 != count) {
                     len = (count + 1) * sizeof(jschar);
--- a/js/xpconnect/src/XPCQuickStubs.h
+++ b/js/xpconnect/src/XPCQuickStubs.h
@@ -219,30 +219,30 @@ protected:
     bool mValid;
 
     /*
      * If null is returned, then we either failed or fully initialized
      * |this|; in either case the caller should return immediately
      * without doing anything else. Otherwise, the JSString* created
      * from |v| will be returned.  It'll be rooted, as needed, in
      * *pval.  nullBehavior and undefinedBehavior control what happens
-     * when |v| is JSVAL_IS_NULL and JSVAL_IS_VOID respectively.
+     * when v.isNull() and JSVAL_IS_VOID are respectively true.
      */
     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)) {
             s = JSVAL_TO_STRING(v);
         } else {
             StringificationBehavior behavior = eStringify;
-            if (JSVAL_IS_NULL(v)) {
+            if (v.isNull()) {
                 behavior = nullBehavior;
             } else if (JSVAL_IS_VOID(v)) {
                 behavior = undefinedBehavior;
             }
 
             // If pval is null, that means the argument was optional and
             // not passed; turn those into void strings if they're
             // supposed to be stringified.
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -58,17 +58,17 @@ XPCTraceableVariant::~XPCTraceableVarian
 
     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))
         nsVariant::Cleanup(&mData);
 
-    if (!JSVAL_IS_NULL(val))
+    if (!val.isNull())
         RemoveFromRootSet();
 }
 
 void XPCTraceableVariant::TraceJS(JSTracer* trc)
 {
     MOZ_ASSERT(mJSVal.isMarkable());
     trc->setTracingDetails(GetTraceName, this, 0);
     JS_CallHeapValueTracer(trc, &mJSVal, "XPCTraceableVariant::mJSVal");
--- a/security/manager/ssl/src/nsCrypto.cpp
+++ b/security/manager/ssl/src/nsCrypto.cpp
@@ -941,26 +941,26 @@ cryptojs_ReadArgsAndGenerateKey(JSContex
   nsresult  rv;
 
   if (!JSVAL_IS_INT(argv[0])) {
     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 (!JSVAL_IS_NULL(argv[1])) {
+  if (!argv[1].isNull()) {
     JS::Rooted<JS::Value> v(cx, argv[1]);
     jsString = JS::ToString(cx, v);
     NS_ENSURE_TRUE(jsString, NS_ERROR_OUT_OF_MEMORY);
     argv[1] = STRING_TO_JSVAL(jsString);
     params.encodeLatin1(cx, jsString);
     NS_ENSURE_TRUE(!!params, NS_ERROR_OUT_OF_MEMORY);
   }
 
-  if (JSVAL_IS_NULL(argv[2])) {
+  if (argv[2].isNull()) {
     JS_ReportError(cx,"%s%s", JS_ERROR,
              "key generation type not specified");
     return NS_ERROR_FAILURE;
   }
   JS::Rooted<JS::Value> v(cx, argv[2]);
   jsString = JS::ToString(cx, v);
   NS_ENSURE_TRUE(jsString, NS_ERROR_OUT_OF_MEMORY);
   argv[2] = STRING_TO_JSVAL(jsString);
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -311,23 +311,23 @@ 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 (JSVAL_IS_VOID(aValue) ||
-      !(JSVAL_IS_NULL(aValue) || JSVAL_IS_STRING(aValue))) {
+      !(aValue.isNull() || JSVAL_IS_STRING(aValue))) {
     _string.SetIsVoid(true);
     return;
   }
 
   // |null| in JS maps to the empty string.
-  if (JSVAL_IS_NULL(aValue)) {
+  if (aValue.isNull()) {
     _string.Truncate();
     return;
   }
   size_t length;
   const jschar* chars =
     JS_GetStringCharsZAndLength(aCtx, JSVAL_TO_STRING(aValue), &length);
   if (!chars) {
     _string.SetIsVoid(true);