Bug 1164602 - Replace js::NullPtr and JS::NullPtr with nullptr_t; r=sfink
authorTerrence Cole <terrence@mozilla.com>
Wed, 13 May 2015 14:07:34 -0700
changeset 276997 0deb2843004ff5bfb51f19504be00f08dccaca85
parent 276996 6255170bf8b00c8131fae7469f0c39a9106bb0d5
child 276998 4870410b92fabb5e28da1e959f565f3a32c7a286
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1164602
milestone41.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 1164602 - Replace js::NullPtr and JS::NullPtr with nullptr_t; r=sfink
dom/base/MessagePort.cpp
dom/base/nsFrameMessageManager.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/base/nsNodeUtils.h
dom/bindings/BindingUtils.cpp
dom/bindings/BindingUtils.h
dom/bindings/Codegen.py
dom/bindings/DOMJSProxyHandler.cpp
dom/bindings/StructuredClone.cpp
dom/devicestorage/DeviceStorageRequestChild.cpp
dom/html/HTMLTrackElement.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/json/nsJSON.cpp
dom/notification/Notification.cpp
dom/promise/PromiseCallback.cpp
dom/workers/Navigator.cpp
dom/workers/ServiceWorkerManager.cpp
dom/workers/WorkerPrivate.cpp
dom/xbl/nsXBLBinding.cpp
dom/xbl/nsXBLProtoImpl.cpp
js/public/HeapAPI.h
js/public/RootingAPI.h
js/src/asmjs/AsmJSLink.cpp
js/src/asmjs/AsmJSModule.cpp
js/src/asmjs/AsmJSValidate.cpp
js/src/builtin/Eval.cpp
js/src/builtin/Intl.cpp
js/src/builtin/Object.cpp
js/src/builtin/Object.h
js/src/builtin/SymbolObject.cpp
js/src/builtin/TestingFunctions.cpp
js/src/builtin/TypedObject.cpp
js/src/builtin/WeakSetObject.cpp
js/src/ctypes/CTypes.cpp
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/NameFunctions.cpp
js/src/frontend/Parser.cpp
js/src/gc/Marking.cpp
js/src/gdb/tests/test-JSSymbol.cpp
js/src/jit/BaselineCompiler.cpp
js/src/jit/BaselineIC.cpp
js/src/jit/BaselineIC.h
js/src/jit/VMFunctions.cpp
js/src/jsapi-tests/testBindCallable.cpp
js/src/jsapi-tests/testChromeBuffer.cpp
js/src/jsapi-tests/testClassGetter.cpp
js/src/jsapi-tests/testGCCellPtr.cpp
js/src/jsapi-tests/testObjectEmulatingUndefined.cpp
js/src/jsapi-tests/testProfileStrings.cpp
js/src/jsapi-tests/testUncaughtError.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsarray.cpp
js/src/jsarray.h
js/src/jscompartment.h
js/src/jsexn.cpp
js/src/jsfriendapi.cpp
js/src/jsfun.cpp
js/src/jsfun.h
js/src/jsfuninlines.h
js/src/jsiter.cpp
js/src/jsobj.cpp
js/src/jsobjinlines.h
js/src/jsreflect.cpp
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jsweakmap.cpp
js/src/perf/jsperf.cpp
js/src/proxy/BaseProxyHandler.cpp
js/src/proxy/ScriptedDirectProxyHandler.cpp
js/src/proxy/ScriptedIndirectProxyHandler.cpp
js/src/shell/js.cpp
js/src/vm/ArrayBufferObject.cpp
js/src/vm/Debugger.cpp
js/src/vm/ForOfIterator.cpp
js/src/vm/GeneratorObject.cpp
js/src/vm/GlobalObject.cpp
js/src/vm/HelperThreads.cpp
js/src/vm/Interpreter-inl.h
js/src/vm/Interpreter.cpp
js/src/vm/NativeObject.cpp
js/src/vm/PIC.cpp
js/src/vm/RegExpObject.cpp
js/src/vm/RegExpStatics.cpp
js/src/vm/SelfHosting.cpp
js/src/vm/SharedArrayObject.cpp
js/src/vm/SharedTypedArrayObject.cpp
js/src/vm/Stack.cpp
js/src/vm/TypedArrayObject.cpp
js/src/vm/UnboxedObject.cpp
js/src/vm/Xdr.cpp
js/xpconnect/src/ExportHelpers.cpp
js/xpconnect/src/Sandbox.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/src/XPCShellImpl.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
js/xpconnect/wrappers/XrayWrapper.cpp
js/xpconnect/wrappers/XrayWrapper.h
widget/android/NativeJSContainer.cpp
xpcom/base/CycleCollectedJSRuntime.cpp
--- a/dom/base/MessagePort.cpp
+++ b/dom/base/MessagePort.cpp
@@ -219,17 +219,17 @@ PostMessageReadTransferStructuredClone(J
   StructuredCloneInfo* scInfo = static_cast<StructuredCloneInfo*>(aClosure);
   NS_ASSERTION(scInfo, "Must have scInfo!");
 
   if (tag == SCTAG_DOM_MAP_MESSAGEPORT) {
     MessagePort* port = static_cast<MessagePort*>(data);
     port->BindToOwner(scInfo->mPort->GetOwner());
     scInfo->mPorts.Put(port, nullptr);
 
-    JS::Rooted<JSObject*> obj(aCx, port->WrapObject(aCx, JS::NullPtr()));
+    JS::Rooted<JSObject*> obj(aCx, port->WrapObject(aCx, nullptr));
     if (!obj || !JS_WrapObject(aCx, &obj)) {
       return false;
     }
 
     MOZ_ASSERT(port->GetOwner() == scInfo->mPort->GetOwner());
     returnObject.set(obj);
     return true;
   }
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -670,17 +670,17 @@ GetParamsForMessage(JSContext* aCx,
     console->LogMessage(error);
   }
 
   // Not clonable, try JSON
   //XXX This is ugly but currently structured cloning doesn't handle
   //    properly cases when interface is implemented in JS and used
   //    as a dictionary.
   nsAutoString json;
-  NS_ENSURE_TRUE(JS_Stringify(aCx, &v, JS::NullPtr(), JS::NullHandleValue,
+  NS_ENSURE_TRUE(JS_Stringify(aCx, &v, nullptr, JS::NullHandleValue,
                               JSONCreator, &json), false);
   NS_ENSURE_TRUE(!json.IsEmpty(), false);
 
   JS::Rooted<JS::Value> val(aCx, JS::NullValue());
   NS_ENSURE_TRUE(JS_ParseJSON(aCx, static_cast<const char16_t*>(json.get()),
                               json.Length(), &val), false);
 
   return WriteStructuredClone(aCx, val, aBuffer, aClosure);
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -8145,17 +8145,17 @@ PostMessageReadTransferStructuredClone(J
   StructuredCloneInfo* scInfo = static_cast<StructuredCloneInfo*>(aClosure);
   NS_ASSERTION(scInfo, "Must have scInfo!");
 
   if (tag == SCTAG_DOM_MAP_MESSAGEPORT) {
     MessagePort* port = static_cast<MessagePort*>(aData);
     port->BindToOwner(scInfo->window);
     scInfo->ports.Put(port, nullptr);
 
-    JS::Rooted<JSObject*> obj(aCx, port->WrapObject(aCx, JS::NullPtr()));
+    JS::Rooted<JSObject*> obj(aCx, port->WrapObject(aCx, nullptr));
     if (JS_WrapObject(aCx, &obj)) {
       MOZ_ASSERT(port->GetOwner() == scInfo->window);
       returnObject.set(obj);
     }
 
     return true;
   }
 
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2478,17 +2478,17 @@ NS_DOMReadStructuredClone(JSContext* cx,
 
     // Prevent the return value from being trashed by a GC during ~nsRefPtr.
     JS::Rooted<JSObject*> result(cx);
     {
       nsRefPtr<CryptoKey> key = new CryptoKey(global);
       if (!key->ReadStructuredClone(reader)) {
         result = nullptr;
       } else {
-        result = key->WrapObject(cx, JS::NullPtr());
+        result = key->WrapObject(cx, nullptr);
       }
     }
     return result;
   } else if (tag == SCTAG_DOM_NULL_PRINCIPAL ||
              tag == SCTAG_DOM_SYSTEM_PRINCIPAL ||
              tag == SCTAG_DOM_CONTENT_PRINCIPAL) {
     mozilla::ipc::PrincipalInfo info;
     if (tag == SCTAG_DOM_SYSTEM_PRINCIPAL) {
@@ -2534,17 +2534,17 @@ NS_DOMReadStructuredClone(JSContext* cx,
       return nullptr;
     }
 
     // Prevent the return value from being trashed by a GC during ~nsRefPtr.
     JS::Rooted<JSObject*> result(cx);
     {
       nsRefPtr<MozNDEFRecord> ndefRecord = new MozNDEFRecord(global);
       result = ndefRecord->ReadStructuredClone(cx, reader) ?
-               ndefRecord->WrapObject(cx, JS::NullPtr()) : nullptr;
+               ndefRecord->WrapObject(cx, nullptr) : nullptr;
     }
     return result;
 #else
     return nullptr;
 #endif
   }
 
   // Don't know what this is. Bail.
--- a/dom/base/nsNodeUtils.h
+++ b/dom/base/nsNodeUtils.h
@@ -155,26 +155,26 @@ public:
    * @param aResult *aResult will contain the cloned node.
    */
   static nsresult Clone(nsINode *aNode, bool aDeep,
                         nsNodeInfoManager *aNewNodeInfoManager,
                         nsCOMArray<nsINode> &aNodesWithProperties,
                         nsINode **aResult)
   {
     return CloneAndAdopt(aNode, true, aDeep, aNewNodeInfoManager,
-                         JS::NullPtr(), aNodesWithProperties, nullptr, aResult);
+                         nullptr, aNodesWithProperties, nullptr, aResult);
   }
 
   /**
    * Clones aNode, its attributes and, if aDeep is true, its descendant nodes
    */
   static nsresult Clone(nsINode *aNode, bool aDeep, nsINode **aResult)
   {
     nsCOMArray<nsINode> dummyNodeWithProperties;
-    return CloneAndAdopt(aNode, true, aDeep, nullptr, JS::NullPtr(),
+    return CloneAndAdopt(aNode, true, aDeep, nullptr, nullptr,
                          dummyNodeWithProperties, aNode->GetParent(), aResult);
   }
 
   /**
    * Walks aNode, its attributes and descendant nodes. If aNewNodeInfoManager is
    * not null, it is used to create new nodeinfos for the nodes. Also reparents
    * the XPConnect wrappers for the nodes into aReparentScope if non-null.
    * aNodesWithProperties will be filled with all the nodes that have
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -849,17 +849,17 @@ NativeInterface2JSObjectAndThrowIfFailed
   nsresult rv;
   // Inline some logic from XPCConvert::NativeInterfaceToJSObject that we need
   // on all threads.
   nsWrapperCache *cache = aHelper.GetWrapperCache();
 
   if (cache && cache->IsDOMBinding()) {
       JS::Rooted<JSObject*> obj(aCx, cache->GetWrapper());
       if (!obj) {
-        obj = cache->WrapObject(aCx, JS::NullPtr());
+        obj = cache->WrapObject(aCx, nullptr);
       }
 
       if (obj && aAllowNativeWrapper && !JS_WrapObject(aCx, &obj)) {
         return false;
       }
 
       if (obj) {
         aRetval.setObject(*obj);
@@ -1815,17 +1815,17 @@ DictionaryBase::ParseJSON(JSContext* aCx
   return JS_ParseJSON(aCx, PromiseFlatString(aJSON).get(), aJSON.Length(), aVal);
 }
 
 bool
 DictionaryBase::StringifyToJSON(JSContext* aCx,
                                 JS::MutableHandle<JS::Value> aValue,
                                 nsAString& aJSON) const
 {
-  return JS_Stringify(aCx, aValue, JS::NullPtr(), JS::NullHandleValue,
+  return JS_Stringify(aCx, aValue, nullptr, JS::NullHandleValue,
                       AppendJSONToString, &aJSON);
 }
 
 /* static */
 bool
 DictionaryBase::AppendJSONToString(const char16_t* aJSONData,
                                    uint32_t aDataLength,
                                    void* aString)
@@ -1890,17 +1890,17 @@ ReparentWrapper(JSContext* aCx, JS::Hand
   JS::Rooted<JSObject*> newobj(aCx, JS_CloneObject(aCx, aObj, proto));
   if (!newobj) {
     return NS_ERROR_FAILURE;
   }
 
   JS::Rooted<JSObject*> propertyHolder(aCx);
   JS::Rooted<JSObject*> copyFrom(aCx, isProxy ? expandoObject : aObj);
   if (copyFrom) {
-    propertyHolder = JS_NewObjectWithGivenProto(aCx, nullptr, JS::NullPtr());
+    propertyHolder = JS_NewObjectWithGivenProto(aCx, nullptr, nullptr);
     if (!propertyHolder) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     if (!JS_CopyPropertiesFrom(aCx, propertyHolder, copyFrom)) {
       return NS_ERROR_FAILURE;
     }
   } else {
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -928,17 +928,17 @@ DoGetOrCreateDOMReflector(JSContext* cx,
   if (obj) {
     JS::ExposeObjectToActiveJS(obj);
   } else {
     // Inline this here while we have non-dom objects in wrapper caches.
     if (!couldBeDOMBinding) {
       return false;
     }
 
-    obj = value->WrapObject(cx, JS::NullPtr());
+    obj = value->WrapObject(cx, nullptr);
     if (!obj) {
       // At this point, obj is null, so just return false.
       // Callers seem to be testing JS_IsExceptionPending(cx) to
       // figure out whether WrapObject() threw.
       return false;
     }
   }
 
@@ -1036,17 +1036,17 @@ WrapNewBindingNonWrapperCachedObject(JSC
     if (js::IsWrapper(scope)) {
       scope = js::CheckedUnwrap(scope, /* stopAtOuter = */ false);
       if (!scope)
         return false;
       ac.emplace(cx, scope);
     }
 
     MOZ_ASSERT(js::IsObjectInContextCompartment(scope, cx));
-    if (!value->WrapObject(cx, JS::NullPtr(), &obj)) {
+    if (!value->WrapObject(cx, nullptr, &obj)) {
       return false;
     }
   }
 
   // We can end up here in all sorts of compartments, per above.  Make
   // sure to JS_WrapValue!
   rval.set(JS::ObjectValue(*obj));
   return MaybeWrapObjectValue(cx, rval);
@@ -1082,17 +1082,17 @@ WrapNewBindingNonWrapperCachedObject(JSC
     if (js::IsWrapper(scope)) {
       scope = js::CheckedUnwrap(scope, /* stopAtOuter = */ false);
       if (!scope)
         return false;
       ac.emplace(cx, scope);
     }
 
     MOZ_ASSERT(js::IsObjectInContextCompartment(scope, cx));
-    if (!value->WrapObject(cx, JS::NullPtr(), &obj)) {
+    if (!value->WrapObject(cx, nullptr, &obj)) {
       return false;
     }
 
     value.forget();
   }
 
   // We can end up here in all sorts of compartments, per above.  Make
   // sure to JS_WrapValue!
@@ -1518,17 +1518,17 @@ struct WrapNativeParentHelper
     if ((obj = cache->GetWrapper())) {
       return obj;
     }
 
     // Inline this here while we have non-dom objects in wrapper caches.
     if (!CouldBeDOMBinding(parent)) {
       obj = WrapNativeParentFallback<T>::Wrap(cx, parent, cache);
     } else {
-      obj = parent->WrapObject(cx, JS::NullPtr());
+      obj = parent->WrapObject(cx, nullptr);
     }
 
     return obj;
   }
 };
 
 // Wrapping of our native parent, for cases when it's not a WebIDL object.  In
 // this case it must be nsISupports.
@@ -3019,46 +3019,46 @@ CreateGlobal(JSContext* aCx, T* aNative,
              JS::MutableHandle<JSObject*> aGlobal)
 {
   aOptions.setTrace(CreateGlobalOptions<T>::TraceGlobal);
 
   aGlobal.set(JS_NewGlobalObject(aCx, aClass, aPrincipal,
                                  JS::DontFireOnNewGlobalHook, aOptions));
   if (!aGlobal) {
     NS_WARNING("Failed to create global");
-    return JS::NullPtr();
+    return nullptr;
   }
 
   JSAutoCompartment ac(aCx, aGlobal);
 
   {
     js::SetReservedSlot(aGlobal, DOM_OBJECT_SLOT, PRIVATE_TO_JSVAL(aNative));
     NS_ADDREF(aNative);
 
     aCache->SetWrapper(aGlobal);
 
     dom::AllocateProtoAndIfaceCache(aGlobal,
                                     CreateGlobalOptions<T>::ProtoAndIfaceCacheKind);
 
     if (!CreateGlobalOptions<T>::PostCreateGlobal(aCx, aGlobal)) {
-      return JS::NullPtr();
+      return nullptr;
     }
   }
 
   if (aInitStandardClasses &&
       !CreateGlobalOptions<T>::ForceInitStandardClassesToFalse &&
       !JS_InitStandardClasses(aCx, aGlobal)) {
     NS_WARNING("Failed to init standard classes");
-    return JS::NullPtr();
+    return nullptr;
   }
 
   JS::Handle<JSObject*> proto = GetProto(aCx, aGlobal);
   if (!proto || !JS_SplicePrototype(aCx, aGlobal, proto)) {
     NS_WARNING("Failed to set proto");
-    return JS::NullPtr();
+    return nullptr;
   }
 
   return proto;
 }
 
 /*
  * Holds a jsid that is initialized to an interned string, with conversion to
  * Handle<jsid>.
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -2861,17 +2861,17 @@ class CGGetPerInterfaceObject(CGAbstract
                                   'JS::Handle<JSObject*>', args)
         self.id = idPrefix + "id::" + self.descriptor.name
 
     def definition_body(self):
         return fill(
             """
             /* Make sure our global is sane.  Hopefully we can remove this sometime */
             if (!(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL)) {
-              return JS::NullPtr();
+              return nullptr;
             }
 
             /* Check to see whether the interface objects are already installed */
             ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(aGlobal);
             if (!protoAndIfaceCache.EntrySlotIfExists(${id})) {
               CreateInterfaceObjects(aCx, aGlobal, protoAndIfaceCache, aDefineOnGlobal);
             }
 
@@ -9924,17 +9924,17 @@ class CGEnumerateOwnPropertiesViaGetOwnP
             ErrorResult rv;
             self->GetOwnPropertyNames(cx, names, rv);
             rv.WouldReportJSException();
             if (rv.Failed()) {
               return ThrowMethodFailedWithDetails(cx, rv, "%s", "enumerate");
             }
             // OK to pass null as "proxy" because it's ignored if
             // shadowPrototypeProperties is true
-            return AppendNamedPropertyIds(cx, JS::NullPtr(), names, true, props);
+            return AppendNamedPropertyIds(cx, nullptr, names, true, props);
             """))
 
 
 class CGPrototypeTraitsClass(CGClass):
     def __init__(self, descriptor, indent=''):
         templateArgs = [Argument('prototypes::ID', 'PrototypeID')]
         templateSpecialization = ['prototypes::id::' + descriptor.name]
         enums = [ClassEnum('', ['Depth'],
--- a/dom/bindings/DOMJSProxyHandler.cpp
+++ b/dom/bindings/DOMJSProxyHandler.cpp
@@ -113,17 +113,17 @@ DOMProxyHandler::EnsureExpandoObject(JSC
     if (expandoAndGeneration->expando.isObject()) {
       return &expandoAndGeneration->expando.toObject();
     }
   } else {
     expandoAndGeneration = nullptr;
   }
 
   JS::Rooted<JSObject*> expando(cx,
-    JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr()));
+    JS_NewObjectWithGivenProto(cx, nullptr, nullptr));
   if (!expando) {
     return nullptr;
   }
 
   nsISupports* native = UnwrapDOMObject<nsISupports>(obj);
   nsWrapperCache* cache;
   CallQueryInterface(native, &cache);
   if (expandoAndGeneration) {
--- a/dom/bindings/StructuredClone.cpp
+++ b/dom/bindings/StructuredClone.cpp
@@ -27,17 +27,17 @@ ReadStructuredCloneImageData(JSContext* 
 
   // Protect the result from a moving GC in ~nsRefPtr.
   JS::Rooted<JSObject*> result(aCx);
   {
     // Construct the ImageData.
     nsRefPtr<ImageData> imageData = new ImageData(width, height,
                                                   dataArray.toObject());
     // Wrap it in a JS::Value.
-    if (!imageData->WrapObject(aCx, JS::NullPtr(), &result)) {
+    if (!imageData->WrapObject(aCx, nullptr, &result)) {
       return nullptr;
     }
   }
   return result;
 }
 
 bool
 WriteStructuredCloneImageData(JSContext* aCx, JSStructuredCloneWriter* aWriter,
--- a/dom/devicestorage/DeviceStorageRequestChild.cpp
+++ b/dom/devicestorage/DeviceStorageRequestChild.cpp
@@ -105,17 +105,17 @@ DeviceStorageRequestChild::
       BlobResponse r = aValue;
       BlobChild* actor = static_cast<BlobChild*>(r.blobChild());
       nsRefPtr<BlobImpl> bloblImpl = actor->GetBlobImpl();
       nsRefPtr<Blob> blob = Blob::Create(mRequest->GetParentObject(),
                                          bloblImpl);
 
       AutoJSContext cx;
 
-      JS::Rooted<JSObject*> obj(cx, blob->WrapObject(cx, JS::NullPtr()));
+      JS::Rooted<JSObject*> obj(cx, blob->WrapObject(cx, nullptr));
       MOZ_ASSERT(obj);
 
       JS::Rooted<JS::Value> result(cx, JS::ObjectValue(*obj));
       mRequest->FireSuccess(result);
       break;
     }
 
     case DeviceStorageResponseValue::TFreeSpaceStorageResponse:
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -116,17 +116,17 @@ HTMLTrackElement::WrapNode(JSContext* aC
 {
   return HTMLTrackElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
 bool
 HTMLTrackElement::IsWebVTTEnabled()
 {
   // Our callee does not use its arguments.
-  return HTMLTrackElementBinding::ConstructorEnabled(nullptr, JS::NullPtr());
+  return HTMLTrackElementBinding::ConstructorEnabled(nullptr, nullptr);
 }
 
 TextTrack*
 HTMLTrackElement::GetTrack()
 {
   if (!mTrack) {
     CreateTextTrack();
   }
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -583,17 +583,17 @@ public:
 
     nsRefPtr<IDBMutableFile> mutableFile =
       IDBMutableFile::Create(aDatabase,
                              aData.name,
                              aData.type,
                              aFile.mFileInfo.forget());
     MOZ_ASSERT(mutableFile);
 
-    JS::Rooted<JSObject*> result(aCx, mutableFile->WrapObject(aCx, JS::NullPtr()));
+    JS::Rooted<JSObject*> result(aCx, mutableFile->WrapObject(aCx, nullptr));
     if (NS_WARN_IF(!result)) {
       return false;
     }
 
     aResult.set(result);
     return true;
   }
 
--- a/dom/json/nsJSON.cpp
+++ b/dom/json/nsJSON.cpp
@@ -181,17 +181,17 @@ nsJSON::EncodeFromJSVal(JS::Value *value
   mozilla::Maybe<JSAutoCompartment> ac;
   if (value->isObject()) {
     JS::Rooted<JSObject*> obj(cx, &value->toObject());
     ac.emplace(cx, obj);
   }
 
   nsJSONWriter writer;
   JS::Rooted<JS::Value> vp(cx, *value);
-  if (!JS_Stringify(cx, &vp, JS::NullPtr(), JS::NullHandleValue, WriteCallback, &writer)) {
+  if (!JS_Stringify(cx, &vp, nullptr, JS::NullHandleValue, WriteCallback, &writer)) {
     return NS_ERROR_XPC_BAD_CONVERT_JS;
   }
   *value = vp;
 
   NS_ENSURE_TRUE(writer.DidWrite(), NS_ERROR_UNEXPECTED);
   writer.FlushBuffer();
   result.Assign(writer.mOutputString);
   return NS_OK;
@@ -240,17 +240,17 @@ nsJSON::EncodeInternal(JSContext* cx, co
 
   // Backward compatibility:
   // function shall not pass, just "plain" objects and arrays
   JSType type = JS_TypeOfValue(cx, val);
   if (type == JSTYPE_FUNCTION)
     return NS_ERROR_INVALID_ARG;
 
   // We're good now; try to stringify
-  if (!JS_Stringify(cx, &val, JS::NullPtr(), JS::NullHandleValue, WriteCallback, writer))
+  if (!JS_Stringify(cx, &val, nullptr, JS::NullHandleValue, WriteCallback, writer))
     return NS_ERROR_FAILURE;
 
   return NS_OK;
 }
 
 
 nsJSONWriter::nsJSONWriter() : mStream(nullptr),
                                mBuffer(nullptr),
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -86,17 +86,17 @@ public:
     notification->InitFromBase64(aCx, aData, rv);
     if (rv.Failed()) {
       return rv.StealNSResult();
     }
 
     notification->SetStoredState(true);
 
     JSAutoCompartment ac(aCx, mGlobal);
-    JS::Rooted<JSObject*> element(aCx, notification->WrapObject(aCx, JS::NullPtr()));
+    JS::Rooted<JSObject*> element(aCx, notification->WrapObject(aCx, nullptr));
     NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
 
     JS::Rooted<JSObject*> notifications(aCx, mNotifications);
     if (!JS_DefineElement(aCx, notifications, mCount++, element, 0)) {
       return NS_ERROR_FAILURE;
     }
     return NS_OK;
   }
--- a/dom/promise/PromiseCallback.cpp
+++ b/dom/promise/PromiseCallback.cpp
@@ -280,17 +280,17 @@ WrapperPromiseCallback::Call(JSContext* 
           "then() cannot return same Promise that it resolves."));
       if (!message) {
         // Out of memory. Promise will stay unresolved.
         JS_ClearPendingException(aCx);
         return NS_ERROR_OUT_OF_MEMORY;
       }
 
       JS::Rooted<JS::Value> typeError(aCx);
-      if (!JS::CreateError(aCx, JSEXN_TYPEERR, JS::NullPtr(), fn, lineNumber, 0,
+      if (!JS::CreateError(aCx, JSEXN_TYPEERR, nullptr, fn, lineNumber, 0,
                            nullptr, message, &typeError)) {
         // Out of memory. Promise will stay unresolved.
         JS_ClearPendingException(aCx);
         return NS_ERROR_OUT_OF_MEMORY;
       }
 
       mNextPromise->RejectInternal(aCx, typeError);
       return NS_OK;
--- a/dom/workers/Navigator.cpp
+++ b/dom/workers/Navigator.cpp
@@ -138,17 +138,17 @@ GetDataStoresStructuredCloneCallbacksRea
 
     // Point WorkerDataStore to DataStore.
     workerStore->SetBackingDataStore(backingStore);
 
     JS::Rooted<JSObject*> global(aCx, JS::CurrentGlobalOrNull(aCx));
     if (!global) {
       MOZ_ASSERT(false, "cannot get global!");
     } else {
-      workerStoreObj = workerStore->WrapObject(aCx, JS::NullPtr());
+      workerStoreObj = workerStore->WrapObject(aCx, nullptr);
       if (!JS_WrapObject(aCx, &workerStoreObj)) {
         MOZ_ASSERT(false, "cannot wrap object for workerStoreObj!");
         workerStoreObj = nullptr;
       }
     }
   }
 
   return workerStoreObj;
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -440,17 +440,17 @@ public:
     if (!ToJSValue(cx, aErrorDesc.mMessage, &msgval)) {
       JS_ClearPendingException(cx);
       mPromise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
       return;
     }
     JS::Rooted<JSString*> msg(cx, msgval.toString());
 
     JS::Rooted<JS::Value> error(cx);
-    if (!JS::CreateError(cx, JSEXN_ERR, JS::NullPtr(), fn, aErrorDesc.mLineno,
+    if (!JS::CreateError(cx, JSEXN_ERR, nullptr, fn, aErrorDesc.mLineno,
                          aErrorDesc.mColno, nullptr, msg, &error)) {
       JS_ClearPendingException(cx);
       mPromise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
       return;
     }
 
     mPromise->MaybeReject(cx, error);
   }
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -442,17 +442,17 @@ ReadBlobOrFileNoWrap(JSContext* aCx,
 
 void
 ReadBlobOrFile(JSContext* aCx,
                JSStructuredCloneReader* aReader,
                bool aIsMainThread,
                JS::MutableHandle<JSObject*> aBlobOrFile)
 {
   nsRefPtr<Blob> blob = ReadBlobOrFileNoWrap(aCx, aReader, aIsMainThread);
-  aBlobOrFile.set(blob->WrapObject(aCx, JS::NullPtr()));
+  aBlobOrFile.set(blob->WrapObject(aCx, nullptr));
 }
 
 // See WriteFormData for serialization format.
 void
 ReadFormData(JSContext* aCx,
              JSStructuredCloneReader* aReader,
              bool aIsMainThread,
              uint32_t aCount,
@@ -500,17 +500,17 @@ ReadFormData(JSContext* aCx,
       formData->Append(name, *blob, thirdArg);
     } else {
       nsAutoString value;
       MOZ_ALWAYS_TRUE(ReadString(aReader, value));
       formData->Append(name, value);
     }
   }
 
-  aFormData.set(formData->WrapObject(aCx, JS::NullPtr()));
+  aFormData.set(formData->WrapObject(aCx, nullptr));
 }
 
 bool
 WriteBlobOrFile(JSContext* aCx,
                 JSStructuredCloneWriter* aWriter,
                 BlobImpl* aBlobOrBlobImpl,
                 nsTArray<nsCOMPtr<nsISupports>>& aClonedObjects)
 {
--- a/dom/xbl/nsXBLBinding.cpp
+++ b/dom/xbl/nsXBLBinding.cpp
@@ -936,17 +936,17 @@ GetOrCreateMapEntryForPrototype(JSContex
     return nullptr;
   }
   if (val.isObject()) {
     return &val.toObject();
   }
 
   // We don't have an entry. Create one and stick it in the map.
   JS::Rooted<JSObject*> entry(cx);
-  entry = JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr());
+  entry = JS_NewObjectWithGivenProto(cx, nullptr, nullptr);
   if (!entry) {
     return nullptr;
   }
   JS::Rooted<JS::Value> entryVal(cx, JS::ObjectValue(*entry));
   if (!JS::SetWeakMapEntry(cx, map, wrappedProto, entryVal)) {
     NS_WARNING("SetWeakMapEntry failed, probably due to non-preservable WeakMap "
                "key. XBL binding will fail for this element.");
     return nullptr;
--- a/dom/xbl/nsXBLProtoImpl.cpp
+++ b/dom/xbl/nsXBLProtoImpl.cpp
@@ -109,17 +109,17 @@ nsXBLProtoImpl::InstallImplementation(ns
   }
   bool propertyHolderIsNew = !existingHolder.object() || !existingHolder.value().isObject();
 
   if (!propertyHolderIsNew) {
     propertyHolder = &existingHolder.value().toObject();
   } else if (scopeObject != globalObject) {
 
     // This is just a property holder, so it doesn't need any special JSClass.
-    propertyHolder = JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr());
+    propertyHolder = JS_NewObjectWithGivenProto(cx, nullptr, nullptr);
     NS_ENSURE_TRUE(propertyHolder, NS_ERROR_OUT_OF_MEMORY);
 
     // Define it as a property on the scopeObject, using the same name used on
     // the content side.
     bool ok = JS_DefineUCProperty(cx, scopeObject, className, -1, propertyHolder,
                                   JSPROP_PERMANENT | JSPROP_READONLY,
                                   JS_STUBGETTER, JS_STUBSETTER);
     NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
@@ -243,17 +243,17 @@ nsXBLProtoImpl::CompilePrototypeMembers(
   // bind the prototype to a real xbl instance, we'll clone the pre-compiled JS into the real instance's 
   // context.
   AutoJSAPI jsapi;
   if (NS_WARN_IF(!jsapi.Init(xpc::CompilationScope())))
     return NS_ERROR_FAILURE;
   jsapi.TakeOwnershipOfErrorReporting();
   JSContext* cx = jsapi.cx();
 
-  mPrecompiledMemberHolder = JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr());
+  mPrecompiledMemberHolder = JS_NewObjectWithGivenProto(cx, nullptr, nullptr);
   if (!mPrecompiledMemberHolder)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Now that we have a class object installed, we walk our member list and compile each of our
   // properties and methods in turn.
   JS::Rooted<JSObject*> rootedHolder(cx, mPrecompiledMemberHolder);
   for (nsXBLProtoImplMember* curr = mMembers;
        curr;
@@ -362,17 +362,17 @@ nsXBLProtoImpl::DestroyMembers()
 
 nsresult
 nsXBLProtoImpl::Read(nsIObjectInputStream* aStream,
                      nsXBLPrototypeBinding* aBinding)
 {
   AssertInCompilationScope();
   AutoJSContext cx;
   // Set up a class object first so that deserialization is possible
-  mPrecompiledMemberHolder = JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr());
+  mPrecompiledMemberHolder = JS_NewObjectWithGivenProto(cx, nullptr, nullptr);
   if (!mPrecompiledMemberHolder)
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsXBLProtoImplField* previousField = nullptr;
   nsXBLProtoImplMember* previousMember = nullptr;
 
   do {
     XBLBindingSerializeDetails type;
--- a/js/public/HeapAPI.h
+++ b/js/public/HeapAPI.h
@@ -152,27 +152,27 @@ struct Zone
 // is for use when that is not possible because a single pointer must point
 // to several kinds of GC thing.
 class JS_FRIEND_API(GCCellPtr)
 {
   public:
     // Construction from a void* and trace kind.
     GCCellPtr(void* gcthing, JSGCTraceKind traceKind) : ptr(checkedCast(gcthing, traceKind)) {}
 
+    // Automatically construct a null GCCellPtr from nullptr.
+    MOZ_IMPLICIT GCCellPtr(decltype(nullptr)) : ptr(checkedCast(nullptr, JSTRACE_NULL)) {}
+
     // Construction from an explicit type.
     explicit GCCellPtr(JSObject* obj) : ptr(checkedCast(obj, JSTRACE_OBJECT)) { }
     explicit GCCellPtr(JSFunction* fun) : ptr(checkedCast(fun, JSTRACE_OBJECT)) { }
     explicit GCCellPtr(JSString* str) : ptr(checkedCast(str, JSTRACE_STRING)) { }
     explicit GCCellPtr(JSFlatString* str) : ptr(checkedCast(str, JSTRACE_STRING)) { }
     explicit GCCellPtr(JSScript* script) : ptr(checkedCast(script, JSTRACE_SCRIPT)) { }
     explicit GCCellPtr(const Value& v);
 
-    // Not all compilers have nullptr_t yet, so use this instead of GCCellPtr(nullptr).
-    static GCCellPtr NullPtr() { return GCCellPtr(nullptr, JSTRACE_NULL); }
-
     JSGCTraceKind kind() const {
         JSGCTraceKind traceKind = JSGCTraceKind(ptr & JSTRACE_OUTOFLINE);
         if (traceKind != JSTRACE_OUTOFLINE)
             return traceKind;
         return outOfLineKind();
     }
 
     // Allow GCCellPtr to be used in a boolean context.
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -116,33 +116,17 @@ template <typename T>
 class MutableHandleBase {};
 
 template <typename T>
 class HeapBase {};
 
 template <typename T>
 class PersistentRootedBase {};
 
-/*
- * js::NullPtr acts like a nullptr pointer in contexts that require a Handle.
- *
- * Handle provides an implicit constructor for js::NullPtr so that, given:
- *   foo(Handle<JSObject*> h);
- * callers can simply write:
- *   foo(js::NullPtr());
- * which avoids creating a Rooted<JSObject*> just to pass nullptr.
- *
- * This is the SpiderMonkey internal variant. js::NullPtr should be used in
- * preference to JS::NullPtr to avoid the GOT access required for JS_PUBLIC_API
- * symbols.
- */
-struct NullPtr
-{
-    static void * const constNullValue;
-};
+static void* const ConstNullValue = nullptr;
 
 namespace gc {
 struct Cell;
 template<typename T>
 struct PersistentRootedMarker;
 } /* namespace gc */
 
 #define DECLARE_POINTER_COMPARISON_OPS(T)                                                \
@@ -185,30 +169,16 @@ struct PersistentRootedMarker;
 namespace JS {
 
 template <typename T> class Rooted;
 template <typename T> class PersistentRooted;
 
 /* This is exposing internal state of the GC for inlining purposes. */
 JS_FRIEND_API(bool) isGCEnabled();
 
-/*
- * JS::NullPtr acts like a nullptr pointer in contexts that require a Handle.
- *
- * Handle provides an implicit constructor for JS::NullPtr so that, given:
- *   foo(Handle<JSObject*> h);
- * callers can simply write:
- *   foo(JS::NullPtr());
- * which avoids creating a Rooted<JSObject*> just to pass nullptr.
- */
-struct JS_PUBLIC_API(NullPtr)
-{
-    static void * const constNullValue;
-};
-
 JS_FRIEND_API(void) HeapObjectPostBarrier(JSObject** objp);
 JS_FRIEND_API(void) HeapObjectRelocate(JSObject** objp);
 
 #ifdef JS_DEBUG
 /*
  * For generational GC, assert that an object is in the tenured generation as
  * opposed to being in the nursery.
  */
@@ -428,28 +398,20 @@ class MOZ_NONHEAP_CLASS Handle : public 
     Handle(Handle<S> handle,
            typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0)
     {
         static_assert(sizeof(Handle<T>) == sizeof(T*),
                       "Handle must be binary compatible with T*.");
         ptr = reinterpret_cast<const T*>(handle.address());
     }
 
-    /* Create a handle for a nullptr pointer. */
-    MOZ_IMPLICIT Handle(js::NullPtr) {
+    MOZ_IMPLICIT Handle(decltype(nullptr)) {
         static_assert(mozilla::IsPointer<T>::value,
-                      "js::NullPtr overload not valid for non-pointer types");
-        ptr = reinterpret_cast<const T*>(&js::NullPtr::constNullValue);
-    }
-
-    /* Create a handle for a nullptr pointer. */
-    MOZ_IMPLICIT Handle(JS::NullPtr) {
-        static_assert(mozilla::IsPointer<T>::value,
-                      "JS::NullPtr overload not valid for non-pointer types");
-        ptr = reinterpret_cast<const T*>(&JS::NullPtr::constNullValue);
+                      "nullptr_t overload not valid for non-pointer types");
+        ptr = reinterpret_cast<const T*>(&js::ConstNullValue);
     }
 
     MOZ_IMPLICIT Handle(MutableHandle<T> handle) {
         ptr = handle.address();
     }
 
     /*
      * Take care when calling this method!
@@ -609,17 +571,17 @@ class InternalHandle<T*>
      * gcthing, and so does not need to be rooted in the first place. Use these
      * InternalHandles to pass pointers into functions that also need to accept
      * regular InternalHandles to gcthing fields.
      *
      * Make this private to prevent accidental misuse; this is only for
      * fromMarkedLocation().
      */
     explicit InternalHandle(T* field)
-      : holder(reinterpret_cast<void * const*>(&js::NullPtr::constNullValue)),
+      : holder(&js::ConstNullValue),
         offset(uintptr_t(field))
     {}
 
     void operator=(InternalHandle<T*> other) = delete;
 };
 
 /*
  * By default, things should use the inheritance hierarchy to find their
--- a/js/src/asmjs/AsmJSLink.cpp
+++ b/js/src/asmjs/AsmJSLink.cpp
@@ -867,17 +867,17 @@ HandleDynamicLinkFailure(JSContext* cx, 
         return false;
 
     const char16_t* chars = stableChars.twoByteRange().start().get();
     SourceBufferHolder::Ownership ownership = stableChars.maybeGiveOwnershipToCaller()
                                               ? SourceBufferHolder::GiveOwnership
                                               : SourceBufferHolder::NoOwnership;
     SourceBufferHolder srcBuf(chars, end - begin, ownership);
     if (!frontend::CompileFunctionBody(cx, &fun, options, formals, srcBuf,
-                                       /* enclosingScope = */ NullPtr()))
+                                       /* enclosingScope = */ nullptr))
         return false;
 
     // Call the function we just recompiled.
     args.setCallee(ObjectValue(*fun));
     return Invoke(cx, args, args.isConstructing() ? CONSTRUCT : NO_CONSTRUCT);
 }
 
 #ifdef MOZ_VTUNE
--- a/js/src/asmjs/AsmJSModule.cpp
+++ b/js/src/asmjs/AsmJSModule.cpp
@@ -1014,17 +1014,17 @@ const Class AsmJSModuleObject::class_ = 
     nullptr, /* hasInstance */
     nullptr, /* construct */
     AsmJSModuleObject_trace
 };
 
 AsmJSModuleObject*
 AsmJSModuleObject::create(ExclusiveContext* cx, ScopedJSDeletePtr<AsmJSModule>* module)
 {
-    JSObject* obj = NewObjectWithGivenProto(cx, &AsmJSModuleObject::class_, NullPtr());
+    JSObject* obj = NewObjectWithGivenProto(cx, &AsmJSModuleObject::class_, nullptr);
     if (!obj)
         return nullptr;
     AsmJSModuleObject* nobj = &obj->as<AsmJSModuleObject>();
 
     nobj->setReservedSlot(MODULE_SLOT, PrivateValue(module->forget()));
     return nobj;
 }
 
--- a/js/src/asmjs/AsmJSValidate.cpp
+++ b/js/src/asmjs/AsmJSValidate.cpp
@@ -7764,17 +7764,17 @@ CheckFunctionsSequential(ModuleCompiler&
         // In the case of the change-heap function, no MIR is produced.
         if (!mir)
             continue;
 
         int64_t before = PRMJ_Now();
 
         JitContext jcx(m.cx(), &mir->alloc());
 
-        IonSpewNewFunction(&mir->graph(), NullPtr());
+        IonSpewNewFunction(&mir->graph(), nullptr);
 
         if (!OptimizeMIR(mir))
             return m.failOffset(func->srcBegin(), "internal compiler failure (probably out of memory)");
 
         LIRGraph* lir = GenerateLIR(mir);
         if (!lir)
             return m.failOffset(func->srcBegin(), "internal compiler failure (probably out of memory)");
 
--- a/js/src/builtin/Eval.cpp
+++ b/js/src/builtin/Eval.cpp
@@ -520,17 +520,17 @@ js::ExecuteInGlobalAndReturnScope(JSCont
 {
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, global);
     MOZ_ASSERT(global->is<GlobalObject>());
     MOZ_RELEASE_ASSERT(scriptArg->hasPollutedGlobalScope());
 
     RootedScript script(cx, scriptArg);
     if (script->compartment() != cx->compartment()) {
-        script = CloneScript(cx, NullPtr(), NullPtr(), script);
+        script = CloneScript(cx, nullptr, nullptr, script);
         if (!script)
             return false;
 
         Debugger::onNewScript(cx, script);
     }
 
     RootedObject scope(cx, JS_NewPlainObject(cx));
     if (!scope)
--- a/js/src/builtin/Intl.cpp
+++ b/js/src/builtin/Intl.cpp
@@ -415,17 +415,17 @@ IntlInitialize(JSContext* cx, HandleObje
     args[2].set(options);
 
     return Invoke(cx, args);
 }
 
 static bool
 CreateDefaultOptions(JSContext* cx, MutableHandleValue defaultOptions)
 {
-    RootedObject options(cx, NewObjectWithGivenProto<PlainObject>(cx, NullPtr()));
+    RootedObject options(cx, NewObjectWithGivenProto<PlainObject>(cx, nullptr));
     if (!options)
         return false;
     defaultOptions.setObject(*options);
     return true;
 }
 
 // CountAvailable and GetAvailable describe the signatures used for ICU API
 // to determine available locales for various functionality.
@@ -434,17 +434,17 @@ typedef int32_t
 
 typedef const char*
 (* GetAvailable)(int32_t localeIndex);
 
 static bool
 intl_availableLocales(JSContext* cx, CountAvailable countAvailable,
                       GetAvailable getAvailable, MutableHandleValue result)
 {
-    RootedObject locales(cx, NewObjectWithGivenProto<PlainObject>(cx, NullPtr()));
+    RootedObject locales(cx, NewObjectWithGivenProto<PlainObject>(cx, nullptr));
     if (!locales)
         return false;
 
 #if ENABLE_INTL_API
     uint32_t count = countAvailable();
     RootedValue t(cx, BooleanValue(true));
     for (uint32_t i = 0; i < count; i++) {
         const char* locale = getAvailable(i);
--- a/js/src/builtin/Object.cpp
+++ b/js/src/builtin/Object.cpp
@@ -666,17 +666,17 @@ js::obj_create(JSContext* cx, unsigned a
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "Object.create", "0", "s");
         return false;
     }
 
     if (!args[0].isObjectOrNull()) {
         RootedValue v(cx, args[0]);
         UniquePtr<char[], JS::FreePolicy> bytes =
-            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
+            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, nullptr);
         if (!bytes)
             return false;
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
                              bytes.get(), "not an object or null");
         return false;
     }
 
     // Step 2.
@@ -1104,17 +1104,17 @@ CreateObjectPrototype(JSContext* cx, JSP
 {
     MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
     MOZ_ASSERT(cx->global()->isNative());
 
     /*
      * Create |Object.prototype| first, mirroring CreateBlankProto but for the
      * prototype of the created object.
      */
-    RootedPlainObject objectProto(cx, NewObjectWithGivenProto<PlainObject>(cx, NullPtr(),
+    RootedPlainObject objectProto(cx, NewObjectWithGivenProto<PlainObject>(cx, nullptr,
                                                                            SingletonObject));
     if (!objectProto)
         return nullptr;
 
     /*
      * The default 'new' type of Object.prototype is required by type inference
      * to have unknown properties, to simplify handling of e.g. heterogenous
      * objects in JSON and script literals.
--- a/js/src/builtin/Object.h
+++ b/js/src/builtin/Object.h
@@ -25,17 +25,17 @@ obj_construct(JSContext* cx, unsigned ar
 bool
 obj_propertyIsEnumerable(JSContext* cx, unsigned argc, Value* vp);
 
 bool
 obj_valueOf(JSContext* cx, unsigned argc, JS::Value* vp);
 
 PlainObject*
 ObjectCreateImpl(JSContext* cx, HandleObject proto, NewObjectKind newKind = GenericObject,
-                 HandleObjectGroup group = js::NullPtr());
+                 HandleObjectGroup group = nullptr);
 
 PlainObject*
 ObjectCreateWithTemplate(JSContext* cx, HandlePlainObject templateObj);
 
 // Object methods exposed so they can be installed in the self-hosting global.
 bool
 obj_create(JSContext* cx, unsigned argc, JS::Value* vp);
 
--- a/js/src/builtin/SymbolObject.cpp
+++ b/js/src/builtin/SymbolObject.cpp
@@ -156,17 +156,17 @@ bool
 SymbolObject::keyFor(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // step 1
     HandleValue arg = args.get(0);
     if (!arg.isSymbol()) {
         ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK,
-                              arg, js::NullPtr(), "not a symbol", nullptr);
+                              arg, nullptr, "not a symbol", nullptr);
         return false;
     }
 
     // step 2
     if (arg.toSymbol()->code() == JS::SymbolCode::InSymbolRegistry) {
 #ifdef DEBUG
         RootedString desc(cx, arg.toSymbol()->description());
         MOZ_ASSERT(Symbol::for_(cx, desc) == arg.toSymbol());
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -1000,28 +1000,28 @@ SaveStack(JSContext* cx, unsigned argc, 
 
     unsigned maxFrameCount = 0;
     if (args.length() >= 1) {
         double d;
         if (!ToNumber(cx, args[0], &d))
             return false;
         if (d < 0) {
             ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                  JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
+                                  JSDVG_SEARCH_STACK, args[0], nullptr,
                                   "not a valid maximum frame count", NULL);
             return false;
         }
         maxFrameCount = d;
     }
 
     JSCompartment* targetCompartment = cx->compartment();
     if (args.length() >= 2) {
         if (!args[1].isObject()) {
             ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                  JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
+                                  JSDVG_SEARCH_STACK, args[0], nullptr,
                                   "not an object", NULL);
             return false;
         }
         RootedObject obj(cx, UncheckedUnwrap(&args[1].toObject()));
         if (!obj)
             return false;
         targetCompartment = obj->compartment();
     }
@@ -1108,17 +1108,17 @@ static const js::Class FakePromiseClass 
     "Promise", JSCLASS_IS_ANONYMOUS
 };
 
 static bool
 MakeFakePromise(JSContext* cx, unsigned argc, jsval* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
-    RootedObject obj(cx, NewObjectWithGivenProto(cx, &FakePromiseClass, NullPtr()));
+    RootedObject obj(cx, NewObjectWithGivenProto(cx, &FakePromiseClass, nullptr));
     if (!obj)
         return false;
 
     JS::dbg::onNewPromise(cx, obj);
     args.rval().setObject(*obj);
     return true;
 }
 
@@ -1159,17 +1159,17 @@ static const JSClass FinalizeCounterClas
     finalize_counter_finalize
 };
 
 static bool
 MakeFinalizeObserver(JSContext* cx, unsigned argc, jsval* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
-    JSObject* obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, JS::NullPtr());
+    JSObject* obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, nullptr);
     if (!obj)
         return false;
 
     args.rval().setObject(*obj);
     return true;
 }
 
 static bool
@@ -2241,24 +2241,24 @@ FindPath(JSContext* cx, unsigned argc, j
         return false;
     }
 
     // We don't ToString non-objects given as 'start' or 'target', because this
     // test is all about object identity, and ToString doesn't preserve that.
     // Non-GCThing endpoints don't make much sense.
     if (!args[0].isObject() && !args[0].isString() && !args[0].isSymbol()) {
         ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                              JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
+                              JSDVG_SEARCH_STACK, args[0], nullptr,
                               "not an object, string, or symbol", NULL);
         return false;
     }
 
     if (!args[1].isObject() && !args[1].isString() && !args[1].isSymbol()) {
         ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                              JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
+                              JSDVG_SEARCH_STACK, args[0], nullptr,
                               "not an object, string, or symbol", NULL);
         return false;
     }
 
     AutoValueVector nodes(cx);
     Vector<heaptools::EdgeName> edges(cx);
 
     {
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -135,17 +135,17 @@ ConvertAndCopyTo(JSContext* cx,
 
     return Invoke(cx, args);
 }
 
 static bool
 ConvertAndCopyTo(JSContext* cx, HandleTypedObject typedObj, HandleValue val)
 {
     Rooted<TypeDescr*> type(cx, &typedObj->typeDescr());
-    return ConvertAndCopyTo(cx, type, typedObj, 0, NullPtr(), val);
+    return ConvertAndCopyTo(cx, type, typedObj, 0, nullptr, val);
 }
 
 /*
  * Overwrites the contents of `typedObj` at offset `offset` with `val`
  * converted to the type `typeObj`
  */
 static bool
 Reify(JSContext* cx,
@@ -775,21 +775,21 @@ StructMetaTypeDescr::create(JSContext* c
     AutoValueVector fieldTypeObjs(cx); // Type descriptor of each field.
     AutoValueVector fieldOffsets(cx);  // Offset of each field field.
     RootedObject userFieldOffsets(cx); // User-exposed {f:offset} object
     RootedObject userFieldTypes(cx);   // User-exposed {f:descr} object.
     CheckedInt32 sizeSoFar(0);         // Size of struct thus far.
     int32_t alignment = 1;             // Alignment of struct.
     bool opaque = false;               // Opacity of struct.
 
-    userFieldOffsets = NewObjectWithProto<PlainObject>(cx, NullPtr(), TenuredObject);
+    userFieldOffsets = NewObjectWithProto<PlainObject>(cx, nullptr, TenuredObject);
     if (!userFieldOffsets)
         return nullptr;
 
-    userFieldTypes = NewObjectWithProto<PlainObject>(cx, NullPtr(), TenuredObject);
+    userFieldTypes = NewObjectWithProto<PlainObject>(cx, nullptr, TenuredObject);
     if (!userFieldTypes)
         return nullptr;
 
     if (!stringBuffer.append("new StructType({")) {
         ReportOutOfMemory(cx);
         return nullptr;
     }
 
@@ -924,41 +924,41 @@ StructMetaTypeDescr::create(JSContext* c
     descr->initReservedSlot(JS_DESCR_SLOT_ALIGNMENT, Int32Value(alignment));
     descr->initReservedSlot(JS_DESCR_SLOT_SIZE, Int32Value(totalSize.value()));
     descr->initReservedSlot(JS_DESCR_SLOT_OPAQUE, BooleanValue(opaque));
 
     // Construct for internal use an array with the name for each field.
     {
         RootedObject fieldNamesVec(cx);
         fieldNamesVec = NewDenseCopiedArray(cx, fieldNames.length(),
-                                            fieldNames.begin(), NullPtr(),
+                                            fieldNames.begin(), nullptr,
                                             TenuredObject);
         if (!fieldNamesVec)
             return nullptr;
         descr->initReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_NAMES,
                                      ObjectValue(*fieldNamesVec));
     }
 
     // Construct for internal use an array with the type object for each field.
     {
         RootedObject fieldTypeVec(cx);
         fieldTypeVec = NewDenseCopiedArray(cx, fieldTypeObjs.length(),
-                                           fieldTypeObjs.begin(), NullPtr(),
+                                           fieldTypeObjs.begin(), nullptr,
                                            TenuredObject);
         if (!fieldTypeVec)
             return nullptr;
         descr->initReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_TYPES,
                                      ObjectValue(*fieldTypeVec));
     }
 
     // Construct for internal use an array with the offset for each field.
     {
         RootedObject fieldOffsetsVec(cx);
         fieldOffsetsVec = NewDenseCopiedArray(cx, fieldOffsets.length(),
-                                              fieldOffsets.begin(), NullPtr(),
+                                              fieldOffsets.begin(), nullptr,
                                               TenuredObject);
         if (!fieldOffsetsVec)
             return nullptr;
         descr->initReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS,
                                      ObjectValue(*fieldOffsetsVec));
     }
 
     // Create data properties fieldOffsets and fieldTypes
@@ -1925,17 +1925,17 @@ TypedObject::obj_setProperty(JSContext* 
                 JS_ReportErrorNumber(cx, GetErrorMessage,
                                      nullptr, JSMSG_TYPEDOBJECT_BINARYARRAY_BAD_INDEX);
                 return false;
             }
 
             Rooted<TypeDescr*> elementType(cx);
             elementType = &typedObj->typeDescr().as<ArrayTypeDescr>().elementType();
             size_t offset = elementType->size() * index;
-            if (!ConvertAndCopyTo(cx, elementType, typedObj, offset, NullPtr(), v))
+            if (!ConvertAndCopyTo(cx, elementType, typedObj, offset, nullptr, v))
                 return false;
             return result.succeed();
         }
         break;
       }
 
       case type::Struct: {
         Rooted<StructTypeDescr*> descr(cx, &typedObj->typeDescr().as<StructTypeDescr>());
--- a/js/src/builtin/WeakSetObject.cpp
+++ b/js/src/builtin/WeakSetObject.cpp
@@ -119,17 +119,17 @@ WeakSetObject::construct(JSContext* cx, 
             if (!iter.next(&keyVal, &done))
                 return false;
             if (done)
                 break;
 
             if (isOriginalAdder) {
                 if (keyVal.isPrimitive()) {
                     UniquePtr<char[], JS::FreePolicy> bytes =
-                        DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, NullPtr());
+                        DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, nullptr);
                     if (!bytes)
                         return false;
                     JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
                     return false;
                 }
 
                 keyObject = &keyVal.toObject();
                 if (!SetWeakMapEntry(cx, map, keyObject, placeholder))
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -923,32 +923,32 @@ BuildCStyleTypeSource(JSContext* cx, JSO
     TypeCode type;
     RootedObject baseTypeObj(cx, typeObj);
     do {
       baseTypeObj = PointerType::GetBaseType(baseTypeObj);
       ptrCount++;
       type = CType::GetTypeCode(baseTypeObj);
     } while (type == TYPE_pointer || type == TYPE_array);
     if (type == TYPE_function) {
-      BuildCStyleFunctionTypeSource(cx, baseTypeObj, NullPtr(), ptrCount,
+      BuildCStyleFunctionTypeSource(cx, baseTypeObj, nullptr, ptrCount,
                                     source);
       break;
     }
     BuildCStyleTypeSource(cx, baseTypeObj, source);
     AppendChars(source, '*', ptrCount);
     break;
   }
   case TYPE_struct: {
     RootedString name(cx, CType::GetName(cx, typeObj));
     AppendString(source, "struct ");
     AppendString(source, name);
     break;
   }
   case TYPE_function:
-    BuildCStyleFunctionTypeSource(cx, typeObj, NullPtr(), 0, source);
+    BuildCStyleFunctionTypeSource(cx, typeObj, nullptr, 0, source);
     break;
   case TYPE_array:
     MOZ_CRASH("TYPE_array shouldn't appear in function type");
   }
 }
 
 static void
 BuildCStyleFunctionTypeSource(JSContext* cx, HandleObject typeObj,
@@ -1066,18 +1066,18 @@ GetFieldName(HandleObject structObj, uns
 
 static void
 BuildTypeSource(JSContext* cx, JSObject* typeObj_, bool makeShort,
                 AutoString& result);
 
 static bool
 ConvError(JSContext* cx, const char* expectedStr, HandleValue actual,
           ConversionType convType,
-          HandleObject funObj = NullPtr(), unsigned argIndex = 0,
-          HandleObject arrObj = NullPtr(), unsigned arrIndex = 0)
+          HandleObject funObj = nullptr, unsigned argIndex = 0,
+          HandleObject arrObj = nullptr, unsigned arrIndex = 0)
 {
   JSAutoByteString valBytes;
   const char* valStr = CTypesToSourceForError(cx, actual, valBytes);
   if (!valStr)
     return false;
 
   if (arrObj) {
     MOZ_ASSERT(CType::IsCType(arrObj));
@@ -1196,18 +1196,18 @@ ConvError(JSContext* cx, const char* exp
   }
 
   return false;
 }
 
 static bool
 ConvError(JSContext* cx, HandleObject expectedType, HandleValue actual,
           ConversionType convType,
-          HandleObject funObj = NullPtr(), unsigned argIndex = 0,
-          HandleObject arrObj = NullPtr(), unsigned arrIndex = 0)
+          HandleObject funObj = nullptr, unsigned argIndex = 0,
+          HandleObject arrObj = nullptr, unsigned arrIndex = 0)
 {
   MOZ_ASSERT(CType::IsCType(expectedType));
 
   AutoString expectedSource;
   JSAutoByteString expectedBytes;
   BuildTypeSource(cx, expectedType, true, expectedSource);
   const char* expectedStr = EncodeLatin1(cx, expectedSource, expectedBytes);
   if (!expectedStr)
@@ -1318,17 +1318,17 @@ ArgumentTypeMismatch(JSContext* cx, cons
 {
   JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                        CTYPESMSG_ARG_TYPE_MISMATCH, arg, func, type);
   return false;
 }
 
 static bool
 EmptyFinalizerError(JSContext* cx, ConversionType convType,
-                    HandleObject funObj = NullPtr(), unsigned argIndex = 0)
+                    HandleObject funObj = nullptr, unsigned argIndex = 0)
 {
   JSAutoByteString posBytes;
   const char* posStr;
   if (funObj) {
     AutoString posSource;
     BuildConversionPosition(cx, convType, funObj, argIndex, posSource);
     posStr = EncodeLatin1(cx, posSource, posBytes);
     if (!posStr)
@@ -1342,17 +1342,17 @@ EmptyFinalizerError(JSContext* cx, Conve
   return false;
 }
 
 static bool
 FieldCountMismatch(JSContext* cx,
                    unsigned expectedCount, HandleObject structObj,
                    unsigned actualCount, HandleValue actual,
                    ConversionType convType,
-                   HandleObject funObj = NullPtr(), unsigned argIndex = 0)
+                   HandleObject funObj = nullptr, unsigned argIndex = 0)
 {
   MOZ_ASSERT(structObj && CType::IsCType(structObj));
 
   JSAutoByteString valBytes;
   const char* valStr = CTypesToSourceForError(cx, actual, valBytes);
   if (!valStr)
     return false;
 
@@ -1424,17 +1424,17 @@ NonPrimitiveError(JSContext* cx, HandleO
   JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                        CTYPESMSG_NON_PRIMITIVE, typeStr);
   return false;
 }
 
 static bool
 PropNameNonStringError(JSContext* cx, HandleId id, HandleValue actual,
                        ConversionType convType,
-                       HandleObject funObj = NullPtr(), unsigned argIndex = 0)
+                       HandleObject funObj = nullptr, unsigned argIndex = 0)
 {
   JSAutoByteString valBytes;
   const char* valStr = CTypesToSourceForError(cx, actual, valBytes);
   if (!valStr)
     return false;
 
   JSAutoByteString idBytes;
   RootedValue idVal(cx, IdToValue(id));
@@ -1667,17 +1667,17 @@ static JSObject*
 InitInt64Class(JSContext* cx,
                HandleObject parent,
                const JSClass* clasp,
                JSNative construct,
                const JSFunctionSpec* fs,
                const JSFunctionSpec* static_fs)
 {
   // Init type class and constructor
-  RootedObject prototype(cx, JS_InitClass(cx, parent, js::NullPtr(), clasp, construct,
+  RootedObject prototype(cx, JS_InitClass(cx, parent, nullptr, clasp, construct,
                                           0, nullptr, fs, nullptr, static_fs));
   if (!prototype)
     return nullptr;
 
   RootedObject ctor(cx, JS_GetConstructor(cx, prototype));
   if (!ctor)
     return nullptr;
 
@@ -2858,18 +2858,18 @@ bool CanConvertTypedArrayItemTo(JSObject
 //    is handed off to the caller; 'freePointer' will be set to indicate this.
 static bool
 ImplicitConvert(JSContext* cx,
                 HandleValue val,
                 JSObject* targetType_,
                 void* buffer,
                 ConversionType convType,
                 bool* freePointer,
-                HandleObject funObj = NullPtr(), unsigned argIndex = 0,
-                HandleObject arrObj = NullPtr(), unsigned arrIndex = 0)
+                HandleObject funObj = nullptr, unsigned argIndex = 0,
+                HandleObject arrObj = nullptr, unsigned arrIndex = 0)
 {
   RootedObject targetType(cx, targetType_);
   MOZ_ASSERT(CType::IsSizeDefined(targetType));
 
   // First, check if val is either a CData object or a CDataFinalizer
   // of type targetType.
   JSObject* sourceData = nullptr;
   JSObject* sourceType = nullptr;
@@ -3860,17 +3860,17 @@ CType::ConstructBasic(JSContext* cx,
                       HandleObject obj,
                       const CallArgs& args)
 {
   if (args.length() > 1) {
     return ArgumentLengthError(cx, "CType constructor", "at most one", "");
   }
 
   // construct a CData object
-  RootedObject result(cx, CData::Create(cx, obj, NullPtr(), nullptr, true));
+  RootedObject result(cx, CData::Create(cx, obj, nullptr, nullptr, true));
   if (!result)
     return false;
 
   if (args.length() == 1) {
     if (!ExplicitConvert(cx, args[0], obj, CData::GetData(result),
                          ConversionType::Construct))
       return false;
   }
@@ -4634,17 +4634,17 @@ PointerType::ConstructData(JSContext* cx
     return false;
   }
 
   if (args.length() > 3) {
     return ArgumentLengthError(cx, "PointerType constructor", "0, 1, 2, or 3",
                                "s");
   }
 
-  RootedObject result(cx, CData::Create(cx, obj, NullPtr(), nullptr, true));
+  RootedObject result(cx, CData::Create(cx, obj, nullptr, nullptr, true));
   if (!result)
     return false;
 
   // Set return value early, must not observe *vp after
   args.rval().setObject(*result);
 
   // There are 3 things that we might be creating here:
   // 1 - A null pointer (no arguments)
@@ -4789,17 +4789,17 @@ PointerType::OffsetBy(JSContext* cx, con
     return false;
   }
 
   size_t elementSize = CType::GetSize(baseType);
   char* data = static_cast<char*>(*static_cast<void**>(CData::GetData(obj)));
   void* address = data + offset * elementSize;
 
   // Create a PointerType CData object containing the new address.
-  JSObject* result = CData::Create(cx, typeObj, NullPtr(), &address, true);
+  JSObject* result = CData::Create(cx, typeObj, nullptr, &address, true);
   if (!result)
     return false;
 
   args.rval().setObject(*result);
   return true;
 }
 
 bool
@@ -4828,17 +4828,17 @@ PointerType::ContentsGetter(JSContext* c
 
   void* data = *static_cast<void**>(CData::GetData(obj));
   if (data == nullptr) {
     JS_ReportError(cx, "cannot read contents of null pointer");
     return false;
   }
 
   RootedValue result(cx);
-  if (!ConvertToJS(cx, baseType, NullPtr(), data, false, false, &result))
+  if (!ConvertToJS(cx, baseType, nullptr, data, false, false, &result))
     return false;
 
   args.rval().set(result);
   return true;
 }
 
 bool
 PointerType::ContentsSetter(JSContext* cx, JS::CallArgs args)
@@ -5033,17 +5033,17 @@ ArrayType::ConstructData(JSContext* cx,
     }
 
     // Construct a new ArrayType of defined length, for the new CData object.
     obj = CreateInternal(cx, baseType, length, true);
     if (!obj)
       return false;
   }
 
-  JSObject* result = CData::Create(cx, obj, NullPtr(), nullptr, true);
+  JSObject* result = CData::Create(cx, obj, nullptr, nullptr, true);
   if (!result)
     return false;
 
   args.rval().setObject(*result);
 
   if (convertObject) {
     if (!ExplicitConvert(cx, args[0], obj, CData::GetData(result),
                          ConversionType::Construct))
@@ -5264,17 +5264,17 @@ ArrayType::Setter(JSContext* cx, HandleO
     JS_ReportError(cx, "invalid index");
     return false;
   }
 
   RootedObject baseType(cx, GetBaseType(typeObj));
   size_t elementSize = CType::GetSize(baseType);
   char* data = static_cast<char*>(CData::GetData(obj)) + elementSize * index;
   if (!ImplicitConvert(cx, vp, baseType, data, ConversionType::Setter,
-                       nullptr, NullPtr(), 0, typeObj, index))
+                       nullptr, nullptr, 0, typeObj, index))
     return false;
   return result.succeed();
 }
 
 bool
 ArrayType::AddressOfElement(JSContext* cx, unsigned argc, jsval* vp)
 {
   CallArgs args = CallArgsFromVp(argc, vp);
@@ -5298,17 +5298,17 @@ ArrayType::AddressOfElement(JSContext* c
   }
 
   RootedObject baseType(cx, GetBaseType(typeObj));
   RootedObject pointerType(cx, PointerType::CreateInternal(cx, baseType));
   if (!pointerType)
     return false;
 
   // Create a PointerType CData object containing null.
-  RootedObject result(cx, CData::Create(cx, pointerType, NullPtr(), nullptr, true));
+  RootedObject result(cx, CData::Create(cx, pointerType, nullptr, nullptr, true));
   if (!result)
     return false;
 
   args.rval().setObject(*result);
 
   // Convert the index to a size_t and bounds-check it.
   size_t index;
   size_t length = GetLength(typeObj);
@@ -5423,17 +5423,17 @@ StructType::Create(JSContext* cx, unsign
   }
 
   // Get ctypes.StructType.prototype from the ctypes.StructType constructor.
   RootedObject typeProto(cx, CType::GetProtoFromCtor(&args.callee(), SLOT_STRUCTPROTO));
 
   // Create a simple StructType with no defined fields. The result will be
   // non-instantiable as CData, will have no 'prototype' property, and will
   // have undefined size and alignment and no ffi_type.
-  RootedObject result(cx, CType::Create(cx, typeProto, NullPtr(), TYPE_struct,
+  RootedObject result(cx, CType::Create(cx, typeProto, nullptr, TYPE_struct,
                                         name.toString(), JSVAL_VOID, JSVAL_VOID, nullptr));
   if (!result)
     return false;
 
   if (args.length() == 2) {
     RootedObject arr(cx, args[1].isPrimitive() ? nullptr : &args[1].toObject());
     if (!arr || !JS_IsArrayObject(cx, arr)) {
       return ArgumentTypeMismatch(cx, "second ", "StructType", "an array");
@@ -5746,17 +5746,17 @@ StructType::ConstructData(JSContext* cx,
     return false;
   }
 
   if (!CType::IsSizeDefined(obj)) {
     JS_ReportError(cx, "cannot construct an opaque StructType");
     return false;
   }
 
-  JSObject* result = CData::Create(cx, obj, NullPtr(), nullptr, true);
+  JSObject* result = CData::Create(cx, obj, nullptr, nullptr, true);
   if (!result)
     return false;
 
   args.rval().setObject(*result);
 
   if (args.length() == 0)
     return true;
 
@@ -5794,17 +5794,17 @@ StructType::ConstructData(JSContext* cx,
   // We have a type constructor of the form 'ctypes.StructType(a, b, c, ...)'.
   // ImplicitConvert each field.
   if (args.length() == fields->count()) {
     for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) {
       const FieldInfo& field = r.front().value();
       MOZ_ASSERT(field.mIndex < fields->count());  /* Quantified invariant */
       if (!ImplicitConvert(cx, args[field.mIndex], field.mType,
                            buffer + field.mOffset, ConversionType::Construct,
-                           nullptr, NullPtr(), 0, obj, field.mIndex))
+                           nullptr, nullptr, 0, obj, field.mIndex))
         return false;
     }
 
     return true;
   }
 
   size_t count = fields->count();
   if (count >= 2) {
@@ -5982,17 +5982,17 @@ StructType::FieldSetter(JSContext* cx, u
   const FieldInfo* field = LookupField(cx, typeObj, name);
   if (!field)
     return false;
 
   args.rval().setUndefined();
 
   char* data = static_cast<char*>(CData::GetData(obj)) + field->mOffset;
   return ImplicitConvert(cx, args.get(0), field->mType, data, ConversionType::Setter, nullptr,
-                         NullPtr(), 0, typeObj, field->mIndex);
+                         nullptr, 0, typeObj, field->mIndex);
 }
 
 bool
 StructType::AddressOfField(JSContext* cx, unsigned argc, jsval* vp)
 {
   CallArgs args = CallArgsFromVp(argc, vp);
   RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
   if (!obj)
@@ -6027,17 +6027,17 @@ StructType::AddressOfField(JSContext* cx
     return false;
 
   RootedObject baseType(cx, field->mType);
   RootedObject pointerType(cx, PointerType::CreateInternal(cx, baseType));
   if (!pointerType)
     return false;
 
   // Create a PointerType CData object containing null.
-  JSObject* result = CData::Create(cx, pointerType, NullPtr(), nullptr, true);
+  JSObject* result = CData::Create(cx, pointerType, nullptr, nullptr, true);
   if (!result)
     return false;
 
   args.rval().setObject(*result);
 
   // Manually set the pointer inside the object, so we skip the conversion step.
   void** data = static_cast<void**>(CData::GetData(result));
   *data = static_cast<char*>(CData::GetData(obj)) + field->mOffset;
@@ -6660,17 +6660,17 @@ FunctionType::Call(JSContext* cx,
   CTYPES_FOR_EACH_CHAR16_TYPE(INTEGRAL_CASE)
 #undef INTEGRAL_CASE
   default:
     break;
   }
 
   // prepare a JS object from the result
   RootedObject returnType(cx, fninfo->mReturnType);
-  return ConvertToJS(cx, returnType, NullPtr(), returnValue.mData, false, true, args.rval());
+  return ConvertToJS(cx, returnType, nullptr, returnValue.mData, false, true, args.rval());
 }
 
 FunctionInfo*
 FunctionType::GetFunctionInfo(JSObject* obj)
 {
   MOZ_ASSERT(CType::IsCType(obj));
   MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_function);
 
@@ -6941,17 +6941,17 @@ CClosure::ClosureStub(ffi_cif* cif, void
     JS_ReportOutOfMemory(cx);
     return;
   }
 
   for (uint32_t i = 0; i < cif->nargs; ++i) {
     // Convert each argument, and have any CData objects created depend on
     // the existing buffers.
     RootedObject argType(cx, fninfo->mArgTypes[i]);
-    if (!ConvertToJS(cx, argType, NullPtr(), args[i], false, false, argv[i]))
+    if (!ConvertToJS(cx, argType, nullptr, args[i], false, false, argv[i]))
       return;
   }
 
   // Call the JS function. 'thisObj' may be nullptr, in which case the JS
   // engine will find an appropriate object to use.
   RootedValue rval(cx);
   bool success = JS_CallFunctionValue(cx, thisObj, jsfnVal, argv, &rval);
 
@@ -7176,17 +7176,17 @@ CData::IsCDataProto(JSObject* obj)
 
 bool
 CData::ValueGetter(JSContext* cx, JS::CallArgs args)
 {
   RootedObject obj(cx, &args.thisv().toObject());
 
   // Convert the value to a primitive; do not create a new CData object.
   RootedObject ctype(cx, GetCType(obj));
-  return ConvertToJS(cx, ctype, NullPtr(), GetData(obj), true, false, args.rval());
+  return ConvertToJS(cx, ctype, nullptr, GetData(obj), true, false, args.rval());
 }
 
 bool
 CData::ValueSetter(JSContext* cx, JS::CallArgs args)
 {
   RootedObject obj(cx, &args.thisv().toObject());
   args.rval().setUndefined();
   return ImplicitConvert(cx, args.get(0), GetCType(obj), GetData(obj),
@@ -7210,17 +7210,17 @@ CData::Address(JSContext* cx, unsigned a
   }
 
   RootedObject typeObj(cx, CData::GetCType(obj));
   RootedObject pointerType(cx, PointerType::CreateInternal(cx, typeObj));
   if (!pointerType)
     return false;
 
   // Create a PointerType CData object containing null.
-  JSObject* result = CData::Create(cx, pointerType, NullPtr(), nullptr, true);
+  JSObject* result = CData::Create(cx, pointerType, nullptr, nullptr, true);
   if (!result)
     return false;
 
   args.rval().setObject(*result);
 
   // Manually set the pointer inside the object, so we skip the conversion step.
   void** data = static_cast<void**>(GetData(result));
   *data = GetData(obj);
@@ -7281,17 +7281,17 @@ CData::GetRuntime(JSContext* cx, unsigne
   size_t targetSize;
   if (!CType::GetSafeSize(targetType, &targetSize) ||
       targetSize != sizeof(void*)) {
     JS_ReportError(cx, "target CType has non-pointer size");
     return false;
   }
 
   void* data = static_cast<void*>(cx->runtime());
-  JSObject* result = CData::Create(cx, targetType, NullPtr(), &data, true);
+  JSObject* result = CData::Create(cx, targetType, nullptr, &data, true);
   if (!result)
     return false;
 
   args.rval().setObject(*result);
   return true;
 }
 
 typedef JS::TwoByteCharsZ (*InflateUTF8Method)(JSContext*, const JS::UTF8Chars, size_t*);
@@ -7608,17 +7608,17 @@ CDataFinalizer::GetValue(JSContext* cx, 
     JS_GetPrivate(obj);
 
   if (!p) {
     JS_ReportError(cx, "Attempting to get the value of an empty CDataFinalizer");
     return false;  // We have called |dispose| or |forget| already.
   }
 
   RootedObject ctype(cx, GetCType(cx, obj));
-  return ConvertToJS(cx, ctype, /*parent*/NullPtr(), p->cargs, false, true, aResult);
+  return ConvertToJS(cx, ctype, /*parent*/nullptr, p->cargs, false, true, aResult);
 }
 
 /*
  * Attach a C function as a finalizer to a JS object.
  *
  * Pseudo-JS signature:
  * function(CData<T>, CData<T -> U>): CDataFinalizer<T>
  *          value,    finalizer
@@ -7879,17 +7879,17 @@ CDataFinalizer::Methods::Forget(JSContex
 
   if (!p) {
     JS_ReportError(cx, "forget called on an empty CDataFinalizer");
     return false;
   }
 
   RootedValue valJSData(cx);
   RootedObject ctype(cx, GetCType(cx, obj));
-  if (!ConvertToJS(cx, ctype, NullPtr(), p->cargs, false, true, &valJSData)) {
+  if (!ConvertToJS(cx, ctype, nullptr, p->cargs, false, true, &valJSData)) {
     JS_ReportError(cx, "CDataFinalizer value cannot be represented");
     return false;
   }
 
   CDataFinalizer::Cleanup(p, obj);
 
   args.rval().set(valJSData);
   return true;
@@ -7956,17 +7956,17 @@ CDataFinalizer::Methods::Dispose(JSConte
   CDataFinalizer::CallFinalizer(p, &errnoStatus, nullptr);
 #endif // defined(XP_WIN)
 
   JS_SetReservedSlot(objCTypes, SLOT_ERRNO, INT_TO_JSVAL(errnoStatus));
 #if defined(XP_WIN)
   JS_SetReservedSlot(objCTypes, SLOT_LASTERROR, INT_TO_JSVAL(lastErrorStatus));
 #endif // defined(XP_WIN)
 
-  if (ConvertToJS(cx, resultType, NullPtr(), p->rvalue, false, true, &result)) {
+  if (ConvertToJS(cx, resultType, nullptr, p->rvalue, false, true, &result)) {
     CDataFinalizer::Cleanup(p, obj);
     args.rval().set(result);
     return true;
   }
   CDataFinalizer::Cleanup(p, obj);
   return false;
 }
 
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -296,17 +296,17 @@ frontend::CompileScript(ExclusiveContext
     if (!script)
         return nullptr;
 
     bool insideNonGlobalEval =
         evalStaticScope && evalStaticScope->enclosingScopeForStaticScopeIter();
     BytecodeEmitter::EmitterMode emitterMode =
         options.selfHostingMode ? BytecodeEmitter::SelfHosting : BytecodeEmitter::Normal;
     BytecodeEmitter bce(/* parent = */ nullptr, &parser, &globalsc, script,
-                        /* lazyScript = */ js::NullPtr(), options.forEval,
+                        /* lazyScript = */ nullptr, options.forEval,
                         evalCaller, evalStaticScope, insideNonGlobalEval,
                         options.lineno, emitterMode);
     if (!bce.init())
         return nullptr;
 
     // Syntax parsing may cause us to restart processing of top level
     // statements in the script. Use Maybe<> so that the parse context can be
     // reset when this occurs.
@@ -519,18 +519,18 @@ frontend::CompileLazyFunction(JSContext*
     /*
      * We just pass false for insideNonGlobalEval and insideEval, because we
      * don't actually know whether we are or not.  The only consumer of those
      * booleans is TryConvertFreeName, and it has special machinery to avoid
      * doing bad things when a lazy function is inside eval.
      */
     MOZ_ASSERT(!options.forEval);
     BytecodeEmitter bce(/* parent = */ nullptr, &parser, pn->pn_funbox, script, lazy,
-                        /* insideEval = */ false, /* evalCaller = */ js::NullPtr(),
-                        /* evalStaticScope = */ js::NullPtr(),
+                        /* insideEval = */ false, /* evalCaller = */ nullptr,
+                        /* evalStaticScope = */ nullptr,
                         /* insideNonGlobalEval = */ false, options.lineno,
                         BytecodeEmitter::LazyFunction);
     if (!bce.init())
         return false;
 
     return bce.emitFunctionScript(pn->pn_body);
 }
 
@@ -646,19 +646,19 @@ CompileFunctionBody(JSContext* cx, Mutab
                                                       /* staticLevel = */ 0, sourceObject,
                                                       /* sourceStart = */ 0, srcBuf.length()));
         if (!script)
             return false;
 
         script->bindings = fn->pn_funbox->bindings;
 
         BytecodeEmitter funbce(/* parent = */ nullptr, &parser, fn->pn_funbox, script,
-                               /* lazyScript = */ js::NullPtr(), /* insideEval = */ false,
-                               /* evalCaller = */ js::NullPtr(),
-                               /* evalStaticScope = */ js::NullPtr(),
+                               /* lazyScript = */ nullptr, /* insideEval = */ false,
+                               /* evalCaller = */ nullptr,
+                               /* evalStaticScope = */ nullptr,
                                /* insideNonGlobalEval = */ false, options.lineno);
         if (!funbce.init())
             return false;
 
         if (!funbce.emitFunctionScript(fn->pn_body))
             return false;
     } else {
         fun.set(fn->pn_funbox->function());
@@ -681,10 +681,10 @@ frontend::CompileFunctionBody(JSContext*
                                enclosingStaticScope, NotGenerator);
 }
 
 bool
 frontend::CompileStarGeneratorBody(JSContext* cx, MutableHandleFunction fun,
                                    const ReadOnlyCompileOptions& options, const AutoNameVector& formals,
                                    JS::SourceBufferHolder& srcBuf)
 {
-    return CompileFunctionBody(cx, fun, options, formals, srcBuf, NullPtr(), StarGenerator);
+    return CompileFunctionBody(cx, fun, options, formals, srcBuf, nullptr, StarGenerator);
 }
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -4367,17 +4367,17 @@ ParseNode::getConstantValue(ExclusiveCon
             count = pn_count - 1;
             pn = pn_head->pn_next;
         } else {
             MOZ_ASSERT(isOp(JSOP_NEWINIT) && !(pn_xflags & PNX_NONCONST));
             count = pn_count;
             pn = pn_head;
         }
 
-        RootedArrayObject obj(cx, NewDenseFullyAllocatedArray(cx, count, NullPtr(), newKind));
+        RootedArrayObject obj(cx, NewDenseFullyAllocatedArray(cx, count, nullptr, newKind));
         if (!obj)
             return false;
 
         unsigned idx = 0;
         RootedId id(cx);
         for (; pn; idx++, pn = pn->pn_next) {
             if (!pn->getConstantValue(cx, allowObjects, &value))
                 return false;
@@ -5508,19 +5508,19 @@ BytecodeEmitter::emitFunction(ParseNode*
                                                           sourceObject,
                                                           funbox->bufStart, funbox->bufEnd));
             if (!script)
                 return false;
 
             script->bindings = funbox->bindings;
 
             uint32_t lineNum = parser->tokenStream.srcCoords.lineNum(pn->pn_pos.begin);
-            BytecodeEmitter bce2(this, parser, funbox, script, /* lazyScript = */ js::NullPtr(),
+            BytecodeEmitter bce2(this, parser, funbox, script, /* lazyScript = */ nullptr,
                                  insideEval, evalCaller,
-                                 /* evalStaticScope = */ js::NullPtr(),
+                                 /* evalStaticScope = */ nullptr,
                                  insideNonGlobalEval, lineNum, emitterMode);
             if (!bce2.init())
                 return false;
 
             /* We measured the max scope depth when we parsed the function. */
             if (!bce2.emitFunctionScript(pn->pn_body))
                 return false;
 
--- a/js/src/frontend/NameFunctions.cpp
+++ b/js/src/frontend/NameFunctions.cpp
@@ -273,17 +273,17 @@ class NameResolver
   public:
     explicit NameResolver(ExclusiveContext* cx) : cx(cx), nparents(0), buf(nullptr) {}
 
     /*
      * Resolve all names for anonymous functions recursively within the
      * ParseNode instance given. The prefix is for each subsequent name, and
      * should initially be nullptr.
      */
-    bool resolve(ParseNode* cur, HandleAtom prefixArg = js::NullPtr()) {
+    bool resolve(ParseNode* cur, HandleAtom prefixArg = nullptr) {
         RootedAtom prefix(cx, prefixArg);
         if (cur == nullptr)
             return true;
 
         if (cur->isKind(PNK_FUNCTION) && cur->isArity(PN_CODE)) {
             RootedAtom prefix2(cx);
             if (!resolveFun(cur, prefix, &prefix2))
                 return false;
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -1239,17 +1239,17 @@ Parser<ParseHandler>::newFunction(Handle
       case Setter:
         flags = JSFunction::INTERPRETED_SETTER;
         break;
       default:
         flags = JSFunction::INTERPRETED_NORMAL;
         break;
     }
 
-    fun = NewFunctionWithProto(context, nullptr, 0, flags, NullPtr(), atom, proto,
+    fun = NewFunctionWithProto(context, nullptr, 0, flags, nullptr, atom, proto,
                                allocKind, TenuredObject);
     if (!fun)
         return nullptr;
     if (options().selfHostingMode)
         fun->setIsSelfHostedBuiltin();
     return fun;
 }
 
@@ -6588,17 +6588,17 @@ Parser<ParseHandler>::assignExpr(InHandl
         tokenStream.seek(start);
         if (!abortIfSyntaxParser())
             return null();
 
         TokenKind ignored;
         if (!tokenStream.peekToken(&ignored))
             return null();
 
-        return functionDef(inHandling, yieldHandling, NullPtr(), Arrow, NotGenerator);
+        return functionDef(inHandling, yieldHandling, nullptr, Arrow, NotGenerator);
       }
 
       default:
         MOZ_ASSERT(!tokenStream.isCurrentTokenAssignment());
         tokenStream.ungetToken();
         return lhs;
     }
 
@@ -7366,17 +7366,17 @@ Parser<ParseHandler>::generatorComprehen
     RootedObject proto(context);
     if (comprehensionKind == StarGenerator) {
         JSContext* cx = context->maybeJSContext();
         proto = GlobalObject::getOrCreateStarGeneratorFunctionPrototype(cx, context->global());
         if (!proto)
             return null();
     }
 
-    RootedFunction fun(context, newFunction(/* atom = */ NullPtr(), Expression, proto));
+    RootedFunction fun(context, newFunction(/* atom = */ nullptr, Expression, proto));
     if (!fun)
         return null();
 
     // Create box for fun->object early to root it.
     Directives directives(/* strict = */ outerpc->sc->strict());
     FunctionBox* genFunbox = newFunctionBox(genfn, fun, outerpc, directives, comprehensionKind);
     if (!genFunbox)
         return null();
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -99,19 +99,16 @@ using mozilla::PodCopy;
 //      o<-----------------o<========================OO============Oo                           //
 //                                                                                              //
 //                                                                                              //
 //   Legend:                                                                                    //
 //     ------  Direct calls                                                                     //
 //     . . .   Static dispatch                                                                  //
 //     ======  Dispatch through a manual stack.                                                 //
 //                                                                                              //
-void * const js::NullPtr::constNullValue = nullptr;
-
-JS_PUBLIC_DATA(void * const) JS::NullPtr::constNullValue = nullptr;
 
 
 /*** Tracing Invariants **************************************************************************/
 
 #if defined(DEBUG)
 template<typename T>
 static inline bool
 IsThingPoisoned(T* thing)
--- a/js/src/gdb/tests/test-JSSymbol.cpp
+++ b/js/src/gdb/tests/test-JSSymbol.cpp
@@ -1,17 +1,17 @@
 #include "gdb-tests.h"
 #include "jsapi.h"
 
 FRAGMENT(JSSymbol, simple) {
   using namespace JS;
 
   RootedString hello(cx, JS_NewStringCopyZ(cx, "Hello!"));
 
-  Rooted<Symbol*> unique(cx, NewSymbol(cx, NullPtr()));
+  Rooted<Symbol*> unique(cx, NewSymbol(cx, nullptr));
   Rooted<Symbol*> unique_with_desc(cx, NewSymbol(cx, hello));
   Rooted<Symbol*> registry(cx, GetSymbolFor(cx, hello));
   Rooted<Symbol*> well_known(cx, GetWellKnownSymbol(cx, SymbolCode::iterator));
 
   breakpoint();
 
   (void) unique;
   (void) unique_with_desc;
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -3384,17 +3384,17 @@ BaselineCompiler::emit_JSOP_RUNONCE()
     return callVM(RunOnceScriptPrologueInfo);
 }
 
 bool
 BaselineCompiler::emit_JSOP_REST()
 {
     frame.syncStack(0);
 
-    ArrayObject* templateObject = NewDenseUnallocatedArray(cx, 0, NullPtr(), TenuredObject);
+    ArrayObject* templateObject = NewDenseUnallocatedArray(cx, 0, nullptr, TenuredObject);
     if (!templateObject)
         return false;
     ObjectGroup::fixRestArgumentsGroup(cx, templateObject);
 
     // Call IC.
     ICRest_Fallback::Compiler compiler(cx, templateObject);
     if (!emitOpIC(compiler.getStub(&stubSpace_)))
         return false;
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -6111,17 +6111,17 @@ DoInFallback(JSContext* cx, BaselineFram
              HandleValue key, HandleValue objValue, MutableHandleValue res)
 {
     // This fallback stub may trigger debug mode toggling.
     DebugModeOSRVolatileStub<ICIn_Fallback*> stub(frame, stub_);
 
     FallbackICSpew(cx, stub, "In");
 
     if (!objValue.isObject()) {
-        ReportValueError(cx, JSMSG_IN_NOT_OBJECT, -1, objValue, NullPtr());
+        ReportValueError(cx, JSMSG_IN_NOT_OBJECT, -1, objValue, nullptr);
         return false;
     }
 
     RootedObject obj(cx, &objValue.toObject());
 
     bool cond = false;
     if (!OperatorIn(cx, key, obj, &cond))
         return false;
@@ -9927,29 +9927,29 @@ GetTemplateObjectForNative(JSContext* cx
         // Note: the template array won't be used if its length is inaccurately
         // computed here.  (We allocate here because compilation may occur on a
         // separate thread where allocation is impossible.)
         size_t count = 0;
         if (args.length() != 1)
             count = args.length();
         else if (args.length() == 1 && args[0].isInt32() && args[0].toInt32() >= 0)
             count = args[0].toInt32();
-        res.set(NewDenseUnallocatedArray(cx, count, NullPtr(), TenuredObject));
+        res.set(NewDenseUnallocatedArray(cx, count, nullptr, TenuredObject));
         if (!res)
             return false;
 
         ObjectGroup* group = ObjectGroup::allocationSiteGroup(cx, script, pc, JSProto_Array);
         if (!group)
             return false;
         res->setGroup(group);
         return true;
     }
 
     if (native == intrinsic_NewDenseArray) {
-        res.set(NewDenseUnallocatedArray(cx, 0, NullPtr(), TenuredObject));
+        res.set(NewDenseUnallocatedArray(cx, 0, nullptr, TenuredObject));
         if (!res)
             return false;
 
         ObjectGroup* group = ObjectGroup::allocationSiteGroup(cx, script, pc, JSProto_Array);
         if (!group)
             return false;
         res->setGroup(group);
         return true;
@@ -9967,17 +9967,17 @@ GetTemplateObjectForNative(JSContext* cx
                 return false;
 
             res->setGroup(args.thisv().toObject().group());
             return true;
         }
     }
 
     if (native == js::str_split && args.length() == 1 && args[0].isString()) {
-        res.set(NewDenseUnallocatedArray(cx, 0, NullPtr(), TenuredObject));
+        res.set(NewDenseUnallocatedArray(cx, 0, nullptr, TenuredObject));
         if (!res)
             return false;
 
         ObjectGroup* group = ObjectGroup::allocationSiteGroup(cx, script, pc, JSProto_Array);
         if (!group)
             return false;
         res->setGroup(group);
         return true;
@@ -10299,17 +10299,17 @@ CopyArray(JSContext* cx, HandleArrayObje
     MOZ_ASSERT(obj->is<ArrayObject>());
     uint32_t length = obj->as<ArrayObject>().length();
     MOZ_ASSERT(obj->getDenseInitializedLength() == length);
 
     RootedObjectGroup group(cx, obj->getGroup(cx));
     if (!group)
         return false;
 
-    RootedArrayObject newObj(cx, NewDenseFullyAllocatedArray(cx, length, NullPtr(), TenuredObject));
+    RootedArrayObject newObj(cx, NewDenseFullyAllocatedArray(cx, length, nullptr, TenuredObject));
     if (!newObj)
         return false;
 
     newObj->setGroup(group);
     newObj->setDenseInitializedLength(length);
     newObj->initDenseElements(0, obj->getDenseElements(), length);
     result.setObject(*newObj);
     return true;
@@ -12116,17 +12116,17 @@ TryAttachInstanceOfStub(JSContext* cx, B
 
 static bool
 DoInstanceOfFallback(JSContext* cx, BaselineFrame* frame, ICInstanceOf_Fallback* stub,
                      HandleValue lhs, HandleValue rhs, MutableHandleValue res)
 {
     FallbackICSpew(cx, stub, "InstanceOf");
 
     if (!rhs.isObject()) {
-        ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS, -1, rhs, NullPtr());
+        ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS, -1, rhs, nullptr);
         return false;
     }
 
     RootedObject obj(cx, &rhs.toObject());
     bool cond = false;
     if (!HasInstance(cx, obj, lhs, &cond))
         return false;
 
@@ -13110,17 +13110,17 @@ ICGetProp_DOMProxyShadowed::Clone(JSCont
 static bool DoRestFallback(JSContext* cx, ICRest_Fallback* stub,
                            BaselineFrame* frame, MutableHandleValue res)
 {
     unsigned numFormals = frame->numFormalArgs() - 1;
     unsigned numActuals = frame->numActualArgs();
     unsigned numRest = numActuals > numFormals ? numActuals - numFormals : 0;
     Value* rest = frame->argv() + numFormals;
 
-    ArrayObject* obj = NewDenseCopiedArray(cx, numRest, rest, NullPtr());
+    ArrayObject* obj = NewDenseCopiedArray(cx, numRest, rest, nullptr);
     if (!obj)
         return false;
     ObjectGroup::fixRestArgumentsGroup(cx, obj);
     res.setObject(*obj);
     return true;
 }
 
 typedef bool (*DoRestFallbackFn)(JSContext*, ICRest_Fallback*, BaselineFrame*,
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -2920,17 +2920,17 @@ class ICGetElemNativeCompiler : public I
         isCallElem_(isCallElem),
         firstMonitorStub_(firstMonitorStub),
         obj_(obj),
         holder_(holder),
         name_(name),
         acctype_(acctype),
         needsAtomize_(needsAtomize),
         offset_(offset),
-        getter_(js::NullPtr()),
+        getter_(nullptr),
         pcOffset_(0)
     {}
 
     ICGetElemNativeCompiler(JSContext* cx, ICStub::Kind kind, ICStub* firstMonitorStub,
                             HandleObject obj, HandleObject holder, HandlePropertyName name,
                             ICGetElemNativeStub::AccessType acctype, bool needsAtomize,
                             HandleFunction getter, uint32_t pcOffset, bool isCallElem)
       : ICStubCompiler(cx, kind),
--- a/js/src/jit/VMFunctions.cpp
+++ b/js/src/jit/VMFunctions.cpp
@@ -887,17 +887,17 @@ InitRestParameter(JSContext* cx, uint32_
             arrRes->setLengthInt32(length);
         }
         return arrRes;
     }
 
     NewObjectKind newKind = templateObj->group()->shouldPreTenure()
                             ? TenuredObject
                             : GenericObject;
-    ArrayObject* arrRes = NewDenseCopiedArray(cx, length, rest, NullPtr(), newKind);
+    ArrayObject* arrRes = NewDenseCopiedArray(cx, length, rest, nullptr, newKind);
     if (arrRes)
         arrRes->setGroup(templateObj->group());
     return arrRes;
 }
 
 bool
 HandleDebugTrap(JSContext* cx, BaselineFrame* frame, uint8_t* retAddr, bool* mustReturn)
 {
--- a/js/src/jsapi-tests/testBindCallable.cpp
+++ b/js/src/jsapi-tests/testBindCallable.cpp
@@ -16,17 +16,17 @@ BEGIN_TEST(test_BindCallable)
 
   JS::RootedObject funcObj(cx, func.toObjectOrNull());
   JS::RootedObject vObj(cx, v.toObjectOrNull());
   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);
+  bool called = JS_CallFunctionValue(cx, nullptr, fun, JS::HandleValueArray::empty(), &retval);
   CHECK(called);
 
   CHECK(retval.isInt32());
 
   CHECK(retval.toInt32() == 1717);
   return true;
 }
 END_TEST(test_BindCallable)
--- a/js/src/jsapi-tests/testChromeBuffer.cpp
+++ b/js/src/jsapi-tests/testChromeBuffer.cpp
@@ -36,17 +36,17 @@ CallTrusted(JSContext* cx, unsigned argc
 
     if (!JS_SaveFrameChain(cx))
         return false;
 
     bool ok = false;
     {
         JSAutoCompartment ac(cx, trusted_glob);
         JS::RootedValue funVal(cx, JS::ObjectValue(*trusted_fun));
-        ok = JS_CallFunctionValue(cx, JS::NullPtr(), funVal, JS::HandleValueArray::empty(), args.rval());
+        ok = JS_CallFunctionValue(cx, nullptr, funVal, JS::HandleValueArray::empty(), args.rval());
     }
     JS_RestoreFrameChain(cx);
     return ok;
 }
 
 BEGIN_TEST(testChromeBuffer)
 {
     JS_SetTrustedPrincipals(rt, &system_principals);
@@ -95,17 +95,17 @@ BEGIN_TEST(testChromeBuffer)
         JS::CompileOptions options(cx);
         options.setFileAndLine("", 0);
         JS::AutoObjectVector emptyScopeChain(cx);
         CHECK(JS::CompileFunction(cx, emptyScopeChain, options, "untrusted", 1,
                                   &paramName, bytes, strlen(bytes), &fun));
         CHECK(JS_DefineProperty(cx, global, "untrusted", fun, JSPROP_ENUMERATE));
 
         JS::RootedValue rval(cx);
-        CHECK(JS_CallFunction(cx, JS::NullPtr(), fun, JS::HandleValueArray(v), &rval));
+        CHECK(JS_CallFunction(cx, nullptr, fun, JS::HandleValueArray(v), &rval));
         CHECK(rval.toInt32() == 100);
         JS::RuntimeOptionsRef(rt) = oldOptions;
     }
 
     /*
      * Check that content called from chrome in the reserved-buffer space
      * immediately ooms.
      */
@@ -144,17 +144,17 @@ BEGIN_TEST(testChromeBuffer)
         JS::CompileOptions options(cx);
         options.setFileAndLine("", 0);
         JS::AutoObjectVector emptyScopeChain(cx);
         CHECK(JS::CompileFunction(cx, emptyScopeChain, options, "untrusted", 1,
                                  &paramName, bytes, strlen(bytes), &fun));
         CHECK(JS_DefineProperty(cx, global, "untrusted", fun, JSPROP_ENUMERATE));
 
         JS::RootedValue rval(cx);
-        CHECK(JS_CallFunction(cx, JS::NullPtr(), fun, JS::HandleValueArray(v), &rval));
+        CHECK(JS_CallFunction(cx, nullptr, fun, JS::HandleValueArray(v), &rval));
         bool match;
         CHECK(JS_StringEqualsAscii(cx, rval.toString(), "From trusted: InternalError: too much recursion", &match));
         CHECK(match);
     }
 
     /*
      * Check that JS_SaveFrameChain called on the way from content to chrome
      * (say, as done by XPCJSContextSTack::Push) works.
@@ -185,15 +185,15 @@ BEGIN_TEST(testChromeBuffer)
         options.setFileAndLine("", 0);
         JS::AutoObjectVector emptyScopeChain(cx);
         CHECK(JS::CompileFunction(cx, emptyScopeChain, options, "untrusted", 1,
                                   &paramName, bytes, strlen(bytes), &fun));
         CHECK(JS_DefineProperty(cx, global, "untrusted", fun, JSPROP_ENUMERATE));
 
         JS::RootedValue arg(cx, JS::ObjectValue(*callTrusted));
         JS::RootedValue rval(cx);
-        CHECK(JS_CallFunction(cx, JS::NullPtr(), fun, JS::HandleValueArray(arg), &rval));
+        CHECK(JS_CallFunction(cx, nullptr, fun, JS::HandleValueArray(arg), &rval));
         CHECK(rval.toInt32() == 42);
     }
 
     return true;
 }
 END_TEST(testChromeBuffer)
--- a/js/src/jsapi-tests/testClassGetter.cpp
+++ b/js/src/jsapi-tests/testClassGetter.cpp
@@ -48,17 +48,17 @@ static bool test_fn(JSContext* cx, unsig
 
 static const JSFunctionSpec ptestFunctions[] = {
     JS_FS( "test_fn", test_fn, 0, 0 ),
     JS_FS_END
 };
 
 BEGIN_TEST(testClassGetter_isCalled)
 {
-    CHECK(JS_InitClass(cx, global, js::NullPtr(), &ptestClass, PTest, 0,
+    CHECK(JS_InitClass(cx, global, nullptr, &ptestClass, PTest, 0,
                        nullptr, ptestFunctions, nullptr, nullptr));
 
     EXEC("function check() { var o = new PTest(); o.test_fn(); o.test_value1; o.test_value2; o.test_value1; }");
 
     for (int i = 1; i < 9; i++) {
         JS::RootedValue rval(cx);
         CHECK(JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(),
                                   &rval));
--- a/js/src/jsapi-tests/testGCCellPtr.cpp
+++ b/js/src/jsapi-tests/testGCCellPtr.cpp
@@ -27,28 +27,28 @@ BEGIN_TEST(testGCCellPtr)
     CHECK(str);
 
     const char* code = "function foo() { return 'bar'; }";
     JS::CompileOptions opts(cx);
     JS::RootedScript script(cx);
     CHECK(JS_CompileScript(cx, code, strlen(code), opts, &script));
     CHECK(script);
 
-    CHECK(!JS::GCCellPtr::NullPtr());
+    CHECK(!JS::GCCellPtr(nullptr));
 
     CHECK(JS::GCCellPtr(obj.get()));
     CHECK(JS::GCCellPtr(obj.get()).kind() == JSTRACE_OBJECT);
     CHECK(JS::GCCellPtr(JS::ObjectValue(*obj)).kind() == JSTRACE_OBJECT);
 
     CHECK(JS::GCCellPtr(str.get()));
     CHECK(JS::GCCellPtr(str.get()).kind() == JSTRACE_STRING);
     CHECK(JS::GCCellPtr(JS::StringValue(str)).kind() == JSTRACE_STRING);
 
     CHECK(JS::GCCellPtr(script.get()));
-    CHECK(!JS::GCCellPtr::NullPtr());
+    CHECK(!JS::GCCellPtr(nullptr));
     CHECK(JS::GCCellPtr(script.get()).kind() == JSTRACE_SCRIPT);
 
     JS::GCCellPtr objcell(obj.get());
     JS::GCCellPtr scriptcell = JS::GCCellPtr(script.get());
     CHECK(GivesAndTakesCells(objcell));
     CHECK(GivesAndTakesCells(scriptcell));
 
     JS::GCCellPtr copy = objcell;
--- a/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp
+++ b/js/src/jsapi-tests/testObjectEmulatingUndefined.cpp
@@ -17,17 +17,17 @@ ObjectEmulatingUndefinedConstructor(JSCo
     if (!obj)
         return false;
     args.rval().setObject(*obj);
     return true;
 }
 
 BEGIN_TEST(testObjectEmulatingUndefined_truthy)
 {
-    CHECK(JS_InitClass(cx, global, js::NullPtr(), &ObjectEmulatingUndefinedClass,
+    CHECK(JS_InitClass(cx, global, nullptr, &ObjectEmulatingUndefinedClass,
                        ObjectEmulatingUndefinedConstructor, 0,
                        nullptr, nullptr, nullptr, nullptr));
 
     JS::RootedValue result(cx);
 
     EVAL("if (new ObjectEmulatingUndefined()) true; else false;", &result);
     CHECK_SAME(result, JSVAL_FALSE);
 
@@ -43,17 +43,17 @@ BEGIN_TEST(testObjectEmulatingUndefined_
     CHECK_SAME(result, JSVAL_TRUE);
 
     return true;
 }
 END_TEST(testObjectEmulatingUndefined_truthy)
 
 BEGIN_TEST(testObjectEmulatingUndefined_equal)
 {
-    CHECK(JS_InitClass(cx, global, js::NullPtr(), &ObjectEmulatingUndefinedClass,
+    CHECK(JS_InitClass(cx, global, nullptr, &ObjectEmulatingUndefinedClass,
                        ObjectEmulatingUndefinedConstructor, 0,
                        nullptr, nullptr, nullptr, nullptr));
 
     JS::RootedValue result(cx);
 
     EVAL("if (new ObjectEmulatingUndefined() == undefined) true; else false;", &result);
     CHECK_SAME(result, JSVAL_TRUE);
 
--- a/js/src/jsapi-tests/testProfileStrings.cpp
+++ b/js/src/jsapi-tests/testProfileStrings.cpp
@@ -77,17 +77,17 @@ static const JSFunctionSpec ptestFunctio
     JS_FS_END
 };
 
 static JSObject*
 initialize(JSContext* cx)
 {
     js::SetRuntimeProfilingStack(cx->runtime(), pstack, &psize, 10);
     JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
-    return JS_InitClass(cx, global, js::NullPtr(), &ptestClass, Prof, 0,
+    return JS_InitClass(cx, global, nullptr, &ptestClass, Prof, 0,
                         nullptr, ptestFunctions, nullptr, nullptr);
 }
 
 BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
 {
     CHECK(initialize(cx));
 
     EXEC("function g() { var p = new Prof(); p.test_fn(); }");
--- a/js/src/jsapi-tests/testUncaughtError.cpp
+++ b/js/src/jsapi-tests/testUncaughtError.cpp
@@ -17,17 +17,17 @@ BEGIN_TEST(testUncaughtError)
 
     CHECK(uncaughtCount == 0);
 
     Rooted<JSString*> empty(cx, JS_GetEmptyString(JS_GetRuntime(cx)));
     if (!empty)
         return false;
 
     Rooted<Value> err(cx);
-    if (!CreateError(cx, JSEXN_TYPEERR, JS::NullPtr(), empty, 0, 0, nullptr, empty, &err))
+    if (!CreateError(cx, JSEXN_TYPEERR, nullptr, empty, 0, 0, nullptr, empty, &err))
         return false;
 
     Rooted<JSObject*> errObj(cx, &err.toObject());
     if (!JS_SetProperty(cx, errObj, "fileName", err))
         return false;
     if (!JS_SetProperty(cx, errObj, "lineNumber", err))
         return false;
     if (!JS_SetProperty(cx, errObj, "columnNumber", err))
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -146,17 +146,17 @@ JS::ObjectOpResult::reportStrictErrorOrW
                   "unsigned value of OkCode must not be an error code");
     MOZ_ASSERT(code_ != Uninitialized);
     MOZ_ASSERT(!ok());
 
     unsigned flags = strict ? JSREPORT_ERROR : (JSREPORT_WARNING | JSREPORT_STRICT);
     if (code_ == JSMSG_OBJECT_NOT_EXTENSIBLE || code_ == JSMSG_SET_NON_OBJECT_RECEIVER) {
         RootedValue val(cx, ObjectValue(*obj));
         return ReportValueErrorFlags(cx, flags, code_, JSDVG_IGNORE_STACK, val,
-                                     NullPtr(), nullptr, nullptr);
+                                     nullptr, nullptr, nullptr);
     }
     if (ErrorTakesIdArgument(code_)) {
         RootedValue idv(cx, IdToValue(id));
         RootedString str(cx, ValueToSource(cx, idv));
         if (!str)
             return false;
 
         JSAutoByteString propName(cx, str);
@@ -1987,17 +1987,17 @@ JS_NewObject(JSContext* cx, const JSClas
 
     const Class* clasp = Valueify(jsclasp);
     if (!clasp)
         clasp = &PlainObject::class_;    /* default class is Object */
 
     MOZ_ASSERT(clasp != &JSFunction::class_);
     MOZ_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL));
 
-    return NewObjectWithClassProto(cx, clasp, NullPtr());
+    return NewObjectWithClassProto(cx, clasp, nullptr);
 }
 
 JS_PUBLIC_API(JSObject*)
 JS_NewObjectWithGivenProto(JSContext* cx, const JSClass* jsclasp, HandleObject proto)
 {
     MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
@@ -2652,17 +2652,17 @@ JS_DefineObject(JSContext* cx, HandleObj
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj);
 
     const Class* clasp = Valueify(jsclasp);
     if (!clasp)
         clasp = &PlainObject::class_;    /* default class is Object */
 
-    RootedObject nobj(cx, NewObjectWithClassProto(cx, clasp, NullPtr()));
+    RootedObject nobj(cx, NewObjectWithClassProto(cx, clasp, nullptr));
     if (!nobj)
         return nullptr;
 
     RootedValue nobjValue(cx, ObjectValue(*nobj));
     if (!DefineProperty(cx, obj, name, nobjValue, NativeOpWrapper(nullptr), NativeOpWrapper(nullptr),
                         attrs, 0)) {
         return nullptr;
     }
@@ -3832,17 +3832,17 @@ JS::Compile(JSContext* cx, const ReadOnl
             SourceBufferHolder& srcBuf, MutableHandleScript script)
 {
     MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     AutoLastFrameCheck lfc(cx);
 
     script.set(frontend::CompileScript(cx, &cx->tempLifoAlloc(), cx->global(),
-                                       NullPtr(), NullPtr(), options, srcBuf));
+                                       nullptr, nullptr, options, srcBuf));
     return !!script;
 }
 
 bool
 JS::Compile(JSContext* cx, const ReadOnlyCompileOptions& options,
             const char16_t* chars, size_t length, MutableHandleScript script)
 {
     SourceBufferHolder srcBuf(chars, length, SourceBufferHolder::NoOwnership);
@@ -4166,17 +4166,17 @@ ExecuteScript(JSContext* cx, HandleObjec
     RootedScript script(cx, scriptArg);
 
     MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj, scriptArg);
 
     if (!script->hasPollutedGlobalScope() && !obj->is<GlobalObject>()) {
-        script = CloneScript(cx, NullPtr(), NullPtr(), script, HasPollutedGlobalScope);
+        script = CloneScript(cx, nullptr, nullptr, script, HasPollutedGlobalScope);
         if (!script)
             return false;
         js::Debugger::onNewScript(cx, script);
     }
     AutoLastFrameCheck lfc(cx);
     return Execute(cx, script, *obj, rval);
 }
 
@@ -4216,17 +4216,17 @@ JS_ExecuteScript(JSContext* cx, AutoObje
 }
 
 JS_PUBLIC_API(bool)
 JS::CloneAndExecuteScript(JSContext* cx, HandleScript scriptArg)
 {
     CHECK_REQUEST(cx);
     RootedScript script(cx, scriptArg);
     if (script->compartment() != cx->compartment()) {
-        script = CloneScript(cx, NullPtr(), NullPtr(), script);
+        script = CloneScript(cx, nullptr, nullptr, script);
         if (!script)
             return false;
 
         js::Debugger::onNewScript(cx, script);
     }
     return ExecuteScript(cx, cx->global(), script, nullptr);
 }
 
@@ -4243,17 +4243,17 @@ Evaluate(JSContext* cx, HandleObject sco
     assertSameCompartment(cx, scope);
 
     AutoLastFrameCheck lfc(cx);
 
     options.setHasPollutedScope(!scope->is<GlobalObject>());
     options.setIsRunOnce(true);
     SourceCompressionTask sct(cx);
     RootedScript script(cx, frontend::CompileScript(cx, &cx->tempLifoAlloc(),
-                                                    scope, NullPtr(), NullPtr(), options,
+                                                    scope, nullptr, nullptr, options,
                                                     srcBuf, nullptr, 0, &sct));
     if (!script)
         return false;
 
     MOZ_ASSERT(script->getVersion() == options.version);
 
     bool result = Execute(cx, script, *scope,
                           options.noScriptRval ? nullptr : rval.address());
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -2420,18 +2420,18 @@ JS_IsExtensible(JSContext* cx, JS::Handl
 
 extern JS_PUBLIC_API(bool)
 JS_IsNative(JSObject* obj);
 
 extern JS_PUBLIC_API(JSRuntime*)
 JS_GetObjectRuntime(JSObject* obj);
 
 /*
- * Unlike JS_NewObject, JS_NewObjectWithGivenProto does not compute a default proto.
- * If proto is JS::NullPtr, the JS object will have `null` as [[Prototype]].
+ * Unlike JS_NewObject, JS_NewObjectWithGivenProto does not compute a default
+ * proto. If proto is nullptr, the JS object will have `null` as [[Prototype]].
  */
 extern JS_PUBLIC_API(JSObject*)
 JS_NewObjectWithGivenProto(JSContext* cx, const JSClass* clasp, JS::Handle<JSObject*> proto);
 
 // Creates a new plain object, like `new Object()`, with Object.prototype as [[Prototype]].
 extern JS_PUBLIC_API(JSObject*)
 JS_NewPlainObject(JSContext* cx);
 
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -2280,22 +2280,22 @@ NewFullyAllocatedArrayTryReuseGroup(JSCo
         group->maybePreliminaryObjects()->maybeAnalyze(cx, group);
 
     NewObjectKind newKind = GenericObject;
     if (group->shouldPreTenure() || group->maybePreliminaryObjects())
         newKind = TenuredObject;
 
     if (group->maybeUnboxedLayout()) {
         if (length > UnboxedArrayObject::MaximumCapacity)
-            return NewDenseFullyAllocatedArray(cx, length, NullPtr(), newKind);
+            return NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
 
         return UnboxedArrayObject::create(cx, group, length, newKind);
     }
 
-    ArrayObject* res = NewDenseFullyAllocatedArray(cx, length, NullPtr(), newKind);
+    ArrayObject* res = NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
     if (!res)
         return nullptr;
 
     res->setGroup(group);
 
     if (PreliminaryObjectArray* preliminaryObjects = group->maybePreliminaryObjects())
         preliminaryObjects->registerNewObject(res);
 
@@ -2321,19 +2321,19 @@ NewPartlyAllocatedArrayTryReuseGroup(JSC
     if (group->maybePreliminaryObjects())
         group->maybePreliminaryObjects()->maybeAnalyze(cx, group);
 
     NewObjectKind newKind = GenericObject;
     if (group->shouldPreTenure() || group->maybePreliminaryObjects())
         newKind = TenuredObject;
 
     if (group->maybeUnboxedLayout())
-        return NewDensePartlyAllocatedArray(cx, length, NullPtr(), newKind);
-
-    ArrayObject* res = NewDensePartlyAllocatedArray(cx, length, NullPtr(), newKind);
+        return NewDensePartlyAllocatedArray(cx, length, nullptr, newKind);
+
+    ArrayObject* res = NewDensePartlyAllocatedArray(cx, length, nullptr, newKind);
     if (!res)
         return nullptr;
 
     res->setGroup(group);
     return res;
 }
 
 /*
@@ -3425,62 +3425,62 @@ NewArray(ExclusiveContext* cxArg, uint32
     if (maxLength > 0 && !EnsureNewArrayElements(cxArg, arr, std::min(maxLength, length)))
         return nullptr;
 
     probes::CreateObject(cxArg, arr);
     return arr;
 }
 
 ArrayObject * JS_FASTCALL
-js::NewDenseEmptyArray(JSContext* cx, HandleObject proto /* = NullPtr() */,
+js::NewDenseEmptyArray(JSContext* cx, HandleObject proto /* = nullptr */,
                        NewObjectKind newKind /* = GenericObject */)
 {
     return NewArray<0>(cx, 0, proto, newKind);
 }
 
 ArrayObject * JS_FASTCALL
 js::NewDenseFullyAllocatedArray(ExclusiveContext* cx, uint32_t length,
-                                HandleObject proto /* = NullPtr() */,
+                                HandleObject proto /* = nullptr */,
                                 NewObjectKind newKind /* = GenericObject */)
 {
     return NewArray<NativeObject::NELEMENTS_LIMIT>(cx, length, proto, newKind);
 }
 
 ArrayObject * JS_FASTCALL
 js::NewDensePartlyAllocatedArray(ExclusiveContext* cx, uint32_t length,
-                                 HandleObject proto /* = NullPtr() */,
+                                 HandleObject proto /* = nullptr */,
                                  NewObjectKind newKind /* = GenericObject */)
 {
     return NewArray<ArrayObject::EagerAllocationMaxLength>(cx, length, proto, newKind);
 }
 
 ArrayObject * JS_FASTCALL
 js::NewDenseUnallocatedArray(ExclusiveContext* cx, uint32_t length,
-                             HandleObject proto /* = NullPtr() */,
+                             HandleObject proto /* = nullptr */,
                              NewObjectKind newKind /* = GenericObject */)
 {
     return NewArray<0>(cx, length, proto, newKind);
 }
 
 ArrayObject*
 js::NewDenseArray(ExclusiveContext* cx, uint32_t length, HandleObjectGroup group,
                   AllocatingBehaviour allocating, bool convertDoubleElements)
 {
     NewObjectKind newKind = !group ? SingletonObject : GenericObject;
     if (group && group->shouldPreTenure())
         newKind = TenuredObject;
 
     ArrayObject* arr;
     if (allocating == NewArray_Unallocating) {
-        arr = NewDenseUnallocatedArray(cx, length, NullPtr(), newKind);
+        arr = NewDenseUnallocatedArray(cx, length, nullptr, newKind);
     } else if (allocating == NewArray_PartlyAllocating) {
-        arr = NewDensePartlyAllocatedArray(cx, length, NullPtr(), newKind);
+        arr = NewDensePartlyAllocatedArray(cx, length, nullptr, newKind);
     } else {
         MOZ_ASSERT(allocating == NewArray_FullyAllocating);
-        arr = NewDenseFullyAllocatedArray(cx, length, NullPtr(), newKind);
+        arr = NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
     }
     if (!arr)
         return nullptr;
 
     if (group)
         arr->setGroup(group);
 
     if (convertDoubleElements)
@@ -3491,17 +3491,17 @@ js::NewDenseArray(ExclusiveContext* cx, 
     if (arr->length() > INT32_MAX)
         arr->setLength(cx, arr->length());
 
     return arr;
 }
 
 ArrayObject*
 js::NewDenseCopiedArray(JSContext* cx, uint32_t length, HandleArrayObject src,
-                        uint32_t elementOffset, HandleObject proto /* = NullPtr() */)
+                        uint32_t elementOffset, HandleObject proto /* = nullptr */)
 {
     MOZ_ASSERT(!src->isIndexed());
 
     ArrayObject* arr = NewArray<NativeObject::NELEMENTS_LIMIT>(cx, length, proto);
     if (!arr)
         return nullptr;
 
     MOZ_ASSERT(arr->getDenseCapacity() >= length);
@@ -3511,17 +3511,17 @@ js::NewDenseCopiedArray(JSContext* cx, u
     arr->initDenseElements(0, vp, length);
 
     return arr;
 }
 
 // values must point at already-rooted Value objects
 ArrayObject*
 js::NewDenseCopiedArray(JSContext* cx, uint32_t length, const Value* values,
-                        HandleObject proto /* = NullPtr() */,
+                        HandleObject proto /* = nullptr */,
                         NewObjectKind newKind /* = GenericObject */)
 {
     ArrayObject* arr = NewArray<NativeObject::NELEMENTS_LIMIT>(cx, length, proto);
     if (!arr)
         return nullptr;
 
     MOZ_ASSERT(arr->getDenseCapacity() >= length);
 
@@ -3576,17 +3576,17 @@ js::ArrayInfo(JSContext* cx, unsigned ar
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     JSObject* obj;
 
     for (unsigned i = 0; i < args.length(); i++) {
         RootedValue arg(cx, args[i]);
 
         UniquePtr<char[], JS::FreePolicy> bytes =
-            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, NullPtr());
+            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, nullptr);
         if (!bytes)
             return false;
         if (arg.isPrimitive() ||
             !(obj = arg.toObjectOrNull())->is<ArrayObject>()) {
             fprintf(stderr, "%s: not array\n", bytes.get());
             continue;
         }
         fprintf(stderr, "%s: (len %u", bytes.get(), obj->as<ArrayObject>().length());
--- a/js/src/jsarray.h
+++ b/js/src/jsarray.h
@@ -34,38 +34,38 @@ IdIsIndex(jsid id, uint32_t* indexp)
 
 extern JSObject*
 InitArrayClass(JSContext* cx, js::HandleObject obj);
 
 class ArrayObject;
 
 /* Create a dense array with no capacity allocated, length set to 0. */
 extern ArrayObject * JS_FASTCALL
-NewDenseEmptyArray(JSContext* cx, HandleObject proto = NullPtr(),
+NewDenseEmptyArray(JSContext* cx, HandleObject proto = nullptr,
                    NewObjectKind newKind = GenericObject);
 
 /*
  * Create a dense array with a set length, but without allocating space for the
  * contents. This is useful, e.g., when accepting length from the user.
  */
 extern ArrayObject * JS_FASTCALL
-NewDenseUnallocatedArray(ExclusiveContext* cx, uint32_t length, HandleObject proto = NullPtr(),
+NewDenseUnallocatedArray(ExclusiveContext* cx, uint32_t length, HandleObject proto = nullptr,
                          NewObjectKind newKind = GenericObject);
 
 /*
  * Create a dense array with length and capacity == |length|, initialized length set to 0,
  * but with only |EagerAllocationMaxLength| elements allocated.
  */
 extern ArrayObject * JS_FASTCALL
-NewDensePartlyAllocatedArray(ExclusiveContext* cx, uint32_t length, HandleObject proto = NullPtr(),
+NewDensePartlyAllocatedArray(ExclusiveContext* cx, uint32_t length, HandleObject proto = nullptr,
                              NewObjectKind newKind = GenericObject);
 
 /* Create a dense array with length and capacity == 'length', initialized length set to 0. */
 extern ArrayObject * JS_FASTCALL
-NewDenseFullyAllocatedArray(ExclusiveContext* cx, uint32_t length, HandleObject proto = NullPtr(),
+NewDenseFullyAllocatedArray(ExclusiveContext* cx, uint32_t length, HandleObject proto = nullptr,
                             NewObjectKind newKind = GenericObject);
 
 enum AllocatingBehaviour {
     NewArray_Unallocating,
     NewArray_PartlyAllocating,
     NewArray_FullyAllocating
 };
 
@@ -75,22 +75,22 @@ enum AllocatingBehaviour {
  */
 extern ArrayObject*
 NewDenseArray(ExclusiveContext* cx, uint32_t length, HandleObjectGroup group,
               AllocatingBehaviour allocating, bool convertDoubleElements = false);
 
 /* Create a dense array with a copy of the dense array elements in src. */
 extern ArrayObject*
 NewDenseCopiedArray(JSContext* cx, uint32_t length, HandleArrayObject src,
-                    uint32_t elementOffset, HandleObject proto = NullPtr());
+                    uint32_t elementOffset, HandleObject proto = nullptr);
 
 /* Create a dense array from the given array values, which must be rooted */
 extern ArrayObject*
 NewDenseCopiedArray(JSContext* cx, uint32_t length, const Value* values,
-                    HandleObject proto = NullPtr(), NewObjectKind newKind = GenericObject);
+                    HandleObject proto = nullptr, NewObjectKind newKind = GenericObject);
 
 /* Create a dense array based on templateObject with the given length. */
 extern ArrayObject*
 NewDenseFullyAllocatedArrayWithTemplate(JSContext* cx, uint32_t length, JSObject* templateObject);
 
 /* Create a dense array with the same copy-on-write elements as another object. */
 extern JSObject*
 NewDenseCopyOnWriteArray(JSContext* cx, HandleArrayObject templateObject, gc::InitialHeap heap);
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -378,21 +378,21 @@ struct JSCompartment
     ~JSCompartment();
 
     bool init(JSContext* maybecx);
 
     /* Mark cross-compartment wrappers. */
     void markCrossCompartmentWrappers(JSTracer* trc);
 
     inline bool wrap(JSContext* cx, JS::MutableHandleValue vp,
-                     JS::HandleObject existing = js::NullPtr());
+                     JS::HandleObject existing = nullptr);
 
     bool wrap(JSContext* cx, js::MutableHandleString strp);
     bool wrap(JSContext* cx, JS::MutableHandleObject obj,
-              JS::HandleObject existingArg = js::NullPtr());
+              JS::HandleObject existingArg = nullptr);
     bool wrap(JSContext* cx, JS::MutableHandle<js::PropertyDescriptor> desc);
 
     template<typename T> bool wrap(JSContext* cx, JS::AutoVectorRooter<T>& vec) {
         for (size_t i = 0; i < vec.length(); ++i) {
             if (!wrap(cx, vec[i]))
                 return false;
         }
         return true;
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -468,17 +468,17 @@ ErrorObject::createProto(JSContext* cx, 
 {
     RootedObject errorProto(cx, GenericCreatePrototype(cx, key));
     if (!errorProto)
         return nullptr;
 
     Rooted<ErrorObject*> err(cx, &errorProto->as<ErrorObject>());
     RootedString emptyStr(cx, cx->names().empty);
     JSExnType type = ExnTypeFromProtoKey(key);
-    if (!ErrorObject::init(cx, err, type, nullptr, emptyStr, NullPtr(), 0, 0, emptyStr))
+    if (!ErrorObject::init(cx, err, type, nullptr, emptyStr, nullptr, 0, 0, emptyStr))
         return nullptr;
 
     // The various prototypes also have .name in addition to the normal error
     // instance properties.
     RootedPropertyName name(cx, ClassName(key, cx));
     RootedValue nameValue(cx, StringValue(name));
     if (!DefineProperty(cx, err, cx->names().name, nameValue, nullptr, nullptr, 0))
         return nullptr;
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -131,17 +131,17 @@ JS_FRIEND_API(JSObject*)
 JS_NewObjectWithUniqueType(JSContext* cx, const JSClass* clasp, HandleObject proto)
 {
     /*
      * Create our object with a null proto and then splice in the correct proto
      * after we setSingleton, so that we don't pollute the default
      * ObjectGroup attached to our proto with information about our object, since
      * we're not going to be using that ObjectGroup anyway.
      */
-    RootedObject obj(cx, NewObjectWithGivenProto(cx, (const js::Class*)clasp, NullPtr(),
+    RootedObject obj(cx, NewObjectWithGivenProto(cx, (const js::Class*)clasp, nullptr,
                                                  SingletonObject));
     if (!obj)
         return nullptr;
     if (!JS_SplicePrototype(cx, obj, proto))
         return nullptr;
     return obj;
 }
 
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -590,17 +590,17 @@ js::XDRInterpretedFunction(XDRState<mode
             if (!proto)
                 return false;
         }
 
         gc::AllocKind allocKind = gc::AllocKind::FUNCTION;
         if (uint16_t(flagsword) & JSFunction::EXTENDED)
             allocKind = gc::AllocKind::FUNCTION_EXTENDED;
         fun = NewFunctionWithProto(cx, nullptr, 0, JSFunction::INTERPRETED,
-                                   /* enclosingDynamicScope = */ NullPtr(), NullPtr(), proto,
+                                   /* enclosingDynamicScope = */ nullptr, nullptr, proto,
                                    allocKind, TenuredObject);
         if (!fun)
             return false;
         script = nullptr;
     }
 
     if (firstword & IsLazy) {
         if (!XDRLazyScript(xdr, enclosingScope, enclosingScript, fun, &lazy))
@@ -646,17 +646,17 @@ js::CloneFunctionAndScript(JSContext* cx
     if (srcFun->isStarGenerator()) {
         cloneProto = GlobalObject::getOrCreateStarGeneratorFunctionPrototype(cx, cx->global());
         if (!cloneProto)
             return nullptr;
     }
 
     gc::AllocKind allocKind = srcFun->getAllocKind();
     RootedFunction clone(cx, NewFunctionWithProto(cx, nullptr, 0,
-                                                  JSFunction::INTERPRETED, NullPtr(), NullPtr(),
+                                                  JSFunction::INTERPRETED, nullptr, nullptr,
                                                   cloneProto, allocKind, TenuredObject));
     if (!clone)
         return nullptr;
 
     JSScript::AutoDelazify srcScript(cx, srcFun);
     if (!srcScript)
         return nullptr;
     RootedScript clonedScript(cx, CloneScript(cx, enclosingScope, clone, srcScript, polluted));
@@ -693,17 +693,17 @@ fun_hasInstance(JSContext* cx, HandleObj
         return false;
 
     if (pval.isPrimitive()) {
         /*
          * Throw a runtime error if instanceof is called on a function that
          * has a non-object as its .prototype value.
          */
         RootedValue val(cx, ObjectValue(*obj));
-        ReportValueError(cx, JSMSG_BAD_PROTOTYPE, -1, val, js::NullPtr());
+        ReportValueError(cx, JSMSG_BAD_PROTOTYPE, -1, val, nullptr);
         return false;
     }
 
     RootedObject pobj(cx, &pval.toObject());
     bool isDelegate;
     if (!IsDelegate(cx, pobj, v, &isDelegate))
         return false;
     *bp = isDelegate;
@@ -751,17 +751,17 @@ ThrowTypeError(JSContext* cx, unsigned a
 static JSObject*
 CreateFunctionConstructor(JSContext* cx, JSProtoKey key)
 {
     Rooted<GlobalObject*> global(cx, cx->global());
     RootedObject functionProto(cx, &global->getPrototype(JSProto_Function).toObject());
 
     RootedObject functionCtor(cx,
       NewFunctionWithProto(cx, Function, 1, JSFunction::NATIVE_CTOR,
-                           NullPtr(), HandlePropertyName(cx->names().Function),
+                           nullptr, HandlePropertyName(cx->names().Function),
                            functionProto, AllocKind::FUNCTION, SingletonObject));
     if (!functionCtor)
         return nullptr;
 
     return functionCtor;
 
 }
 
@@ -772,17 +772,17 @@ CreateFunctionPrototype(JSContext* cx, J
 
     RootedObject objectProto(cx, &self->getPrototype(JSProto_Object).toObject());
     /*
      * Bizarrely, |Function.prototype| must be an interpreted function, so
      * give it the guts to be one.
      */
     JSObject* functionProto_ =
         NewFunctionWithProto(cx, nullptr, 0, JSFunction::INTERPRETED,
-                             self, NullPtr(), objectProto, AllocKind::FUNCTION,
+                             self, nullptr, objectProto, AllocKind::FUNCTION,
                              SingletonObject);
     if (!functionProto_)
         return nullptr;
 
     RootedFunction functionProto(cx, &functionProto_->as<JSFunction>());
     functionProto->setIsFunctionPrototype();
 
     const char* rawSource = "() {\n}";
@@ -802,17 +802,17 @@ CreateFunctionPrototype(JSContext* cx, J
     CompileOptions options(cx);
     options.setNoScriptRval(true)
            .setVersion(JSVERSION_DEFAULT);
     RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
     if (!sourceObject || !ScriptSourceObject::initFromOptions(cx, sourceObject, options))
         return nullptr;
 
     RootedScript script(cx, JSScript::Create(cx,
-                                             /* enclosingScope = */ js::NullPtr(),
+                                             /* enclosingScope = */ nullptr,
                                              /* savedCallerFun = */ false,
                                              options,
                                              /* staticLevel = */ 0,
                                              sourceObject,
                                              0,
                                              ss->length()));
     if (!script || !JSScript::fullyInitTrivial(cx, script))
         return nullptr;
@@ -840,17 +840,17 @@ CreateFunctionPrototype(JSContext* cx, J
     // |Function.prototype| right now.)
     //
     // Note that we can't use NewFunction here, even though we want the normal
     // Function.prototype for our proto, because we're still in the middle of
     // creating that as far as the world is concerned, so things will get all
     // confused.
     RootedFunction throwTypeError(cx,
       NewFunctionWithProto(cx, ThrowTypeError, 0, JSFunction::NATIVE_FUN,
-                           NullPtr(), NullPtr(), functionProto, AllocKind::FUNCTION,
+                           nullptr, nullptr, functionProto, AllocKind::FUNCTION,
                            SingletonObject));
     if (!throwTypeError || !PreventExtensions(cx, throwTypeError))
         return nullptr;
 
     self->setThrowTypeError(throwTypeError);
 
     return functionProto;
 }
@@ -1951,17 +1951,17 @@ FunctionConstructor(JSContext* cx, unsig
                                               ? SourceBufferHolder::GiveOwnership
                                               : SourceBufferHolder::NoOwnership;
     bool ok;
     SourceBufferHolder srcBuf(chars.start().get(), chars.length(), ownership);
     if (isStarGenerator)
         ok = frontend::CompileStarGeneratorBody(cx, &fun, options, formals, srcBuf);
     else
         ok = frontend::CompileFunctionBody(cx, &fun, options, formals, srcBuf,
-                                           /* enclosingScope = */ js::NullPtr());
+                                           /* enclosingScope = */ nullptr);
     args.rval().setObject(*fun);
     return ok;
 }
 
 bool
 js::Function(JSContext* cx, unsigned argc, Value* vp)
 {
     return FunctionConstructor(cx, argc, vp, NotGenerator);
@@ -1980,40 +1980,40 @@ JSFunction::isBuiltinFunctionConstructor
 }
 
 JSFunction*
 js::NewNativeFunction(ExclusiveContext* cx, Native native, unsigned nargs, HandleAtom atom,
                       gc::AllocKind allocKind /* = AllocKind::FUNCTION */,
                       NewObjectKind newKind /* = GenericObject */)
 {
     return NewFunctionWithProto(cx, native, nargs, JSFunction::NATIVE_FUN,
-                                NullPtr(), atom, NullPtr(), allocKind, newKind);
+                                nullptr, atom, nullptr, allocKind, newKind);
 }
 
 JSFunction*
 js::NewNativeConstructor(ExclusiveContext* cx, Native native, unsigned nargs, HandleAtom atom,
                          gc::AllocKind allocKind /* = AllocKind::FUNCTION */,
                          NewObjectKind newKind /* = GenericObject */,
                          JSFunction::Flags flags /* = JSFunction::NATIVE_CTOR */)
 {
     MOZ_ASSERT(flags & JSFunction::NATIVE_CTOR);
-    return NewFunctionWithProto(cx, native, nargs, flags, NullPtr(), atom,
-                                NullPtr(), allocKind, newKind);
+    return NewFunctionWithProto(cx, native, nargs, flags, nullptr, atom,
+                                nullptr, allocKind, newKind);
 }
 
 JSFunction*
 js::NewScriptedFunction(ExclusiveContext* cx, unsigned nargs,
                         JSFunction::Flags flags, HandleAtom atom,
                         gc::AllocKind allocKind /* = AllocKind::FUNCTION */,
                         NewObjectKind newKind /* = GenericObject */,
-                        HandleObject enclosingDynamicScope /* = NullPtr() */)
+                        HandleObject enclosingDynamicScope /* = nullptr */)
 {
     return NewFunctionWithProto(cx, nullptr, nargs, flags,
                                 enclosingDynamicScope ? enclosingDynamicScope : cx->global(),
-                                atom, NullPtr(), allocKind, newKind);
+                                atom, nullptr, allocKind, newKind);
 }
 
 JSFunction*
 js::NewFunctionWithProto(ExclusiveContext* cx, Native native,
                          unsigned nargs, JSFunction::Flags flags, HandleObject enclosingDynamicScope,
                          HandleAtom atom, HandleObject proto,
                          gc::AllocKind allocKind /* = AllocKind::FUNCTION */,
                          NewObjectKind newKind /* = GenericObject */)
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -559,17 +559,17 @@ NewNativeConstructor(ExclusiveContext* c
 
 // Allocate a new scripted function.  If enclosingDynamicScope is null, the
 // global will be used.  In all cases the parent of the resulting object will be
 // the global.
 extern JSFunction*
 NewScriptedFunction(ExclusiveContext* cx, unsigned nargs, JSFunction::Flags flags,
                     HandleAtom atom, gc::AllocKind allocKind = gc::AllocKind::FUNCTION,
                     NewObjectKind newKind = GenericObject,
-                    HandleObject enclosingDynamicScope = NullPtr());
+                    HandleObject enclosingDynamicScope = nullptr);
 
 // If proto is nullptr, Function.prototype is used instead.  If
 // enclosingDynamicScope is null, the function will have a null environment()
 // (yes, null, not the global).  In all cases, the global will be used as the
 // parent.
 extern JSFunction*
 NewFunctionWithProto(ExclusiveContext* cx, JSNative native, unsigned nargs,
                      JSFunction::Flags flags, HandleObject enclosingDynamicScope, HandleAtom atom,
@@ -627,17 +627,17 @@ class FunctionExtended : public JSFuncti
 extern bool
 CloneFunctionObjectUseSameScript(JSCompartment* compartment, HandleFunction fun,
                                  HandleObject newParent);
 
 extern JSFunction*
 CloneFunctionObject(JSContext* cx, HandleFunction fun, HandleObject parent,
                     gc::AllocKind kind = gc::AllocKind::FUNCTION,
                     NewObjectKind newKindArg = GenericObject,
-                    HandleObject proto = NullPtr());
+                    HandleObject proto = nullptr);
 
 extern bool
 FindBody(JSContext* cx, HandleFunction fun, HandleLinearString src, size_t* bodyStart,
          size_t* bodyEnd);
 
 } // namespace js
 
 inline js::FunctionExtended*
--- a/js/src/jsfuninlines.h
+++ b/js/src/jsfuninlines.h
@@ -48,17 +48,17 @@ CanReuseFunctionForClone(JSContext* cx, 
             return false;
         script->setHasBeenCloned();
     }
     return true;
 }
 
 inline JSFunction*
 CloneFunctionObjectIfNotSingleton(JSContext* cx, HandleFunction fun, HandleObject parent,
-                                  HandleObject proto = NullPtr(),
+                                  HandleObject proto = nullptr,
                                   NewObjectKind newKind = GenericObject)
 {
     /*
      * For attempts to clone functions at a function definition opcode,
      * try to avoid the the clone if the function has singleton type. This
      * was called pessimistically, and we need to preserve the type's
      * property that if it is singleton there is only a single object
      * with its type in existence.
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -452,17 +452,17 @@ GetCustomIterator(JSContext* cx, HandleO
          * We are always coming from js::ValueToIterator, and we are no longer on
          * trace, so the object we are iterating over is on top of the stack (-1).
          */
         JSAutoByteString bytes;
         if (!AtomToPrintableString(cx, name, &bytes))
             return false;
         RootedValue val(cx, ObjectValue(*obj));
         ReportValueError2(cx, JSMSG_BAD_TRAP_RETURN_VALUE,
-                          -1, val, js::NullPtr(), bytes.ptr());
+                          -1, val, nullptr, bytes.ptr());
         return false;
     }
     objp.set(&rval.toObject());
     return true;
 }
 
 template <typename T>
 static inline bool
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -93,17 +93,17 @@ JS_ObjectToOuterObject(JSContext* cx, Ha
 }
 
 JSObject*
 js::NonNullObject(JSContext* cx, const Value& v)
 {
     if (v.isPrimitive()) {
         RootedValue value(cx, v);
         UniquePtr<char[], JS::FreePolicy> bytes =
-            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, NullPtr());
+            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, nullptr);
         if (!bytes)
             return nullptr;
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
         return nullptr;
     }
     return &v.toObject();
 }
 
@@ -211,17 +211,17 @@ js::GetFirstArgumentAsObject(JSContext* 
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              method, "0", "s");
         return false;
     }
 
     HandleValue v = args[0];
     if (!v.isObject()) {
         UniquePtr<char[], JS::FreePolicy> bytes =
-            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
+            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, nullptr);
         if (!bytes)
             return false;
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
                              bytes.get(), "not an object");
         return false;
     }
 
     objp.set(&v.toObject());
@@ -259,17 +259,17 @@ js::Throw(JSContext* cx, jsid id, unsign
 }
 
 bool
 js::Throw(JSContext* cx, JSObject* obj, unsigned errorNumber)
 {
     if (js_ErrorFormatString[errorNumber].argCount == 1) {
         RootedValue val(cx, ObjectValue(*obj));
         ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,
-                              JSDVG_IGNORE_STACK, val, NullPtr(),
+                              JSDVG_IGNORE_STACK, val, nullptr,
                               nullptr, nullptr);
     } else {
         MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount == 0);
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, errorNumber);
     }
     return false;
 }
 
@@ -1712,17 +1712,17 @@ js::DeepCloneObjectLiteral(JSContext* cx
         // Deep clone any elements.
         uint32_t initialized = aobj->getDenseInitializedLength();
         for (uint32_t i = 0; i < initialized; ++i) {
             if (!DeepCloneValue(cx, values[i].address(), newKind))
                 return nullptr;
         }
 
         RootedArrayObject clone(cx, NewDenseUnallocatedArray(cx, aobj->length(),
-                                                             NullPtr(), newKind));
+                                                             nullptr, newKind));
         if (!clone || !clone->ensureElements(cx, values.length()))
             return nullptr;
 
         clone->setDenseInitializedLength(values.length());
         clone->initDenseElements(0, values.begin(), values.length());
 
         if (aobj->denseElementsAreCopyOnWrite()) {
             if (!ObjectElements::MakeElementsCopyOnWrite(cx, clone))
@@ -1852,17 +1852,17 @@ js::XDRObjectLiteral(XDRState<mode>* xdr
             aobj = &obj->as<ArrayObject>();
             length = aobj->length();
         }
 
         if (!xdr->codeUint32(&length))
             return false;
 
         if (mode == XDR_DECODE) {
-            obj.set(NewDenseUnallocatedArray(cx, length, NullPtr(), TenuredObject));
+            obj.set(NewDenseUnallocatedArray(cx, length, nullptr, TenuredObject));
             if (!obj)
                 return false;
             aobj = &obj->as<ArrayObject>();
         }
 
         AutoValueVector values(cx);
         if (mode == XDR_ENCODE && !GetScriptArrayObjectElements(cx, aobj, values))
             return false;
@@ -1994,17 +1994,17 @@ js::CloneObjectLiteral(JSContext* cx, Ha
         return res;
     }
 
     RootedArrayObject srcArray(cx, &srcObj->as<ArrayObject>());
     MOZ_ASSERT(srcArray->denseElementsAreCopyOnWrite());
     MOZ_ASSERT(srcArray->getElementsHeader()->ownerObject() == srcObj);
 
     size_t length = srcArray->as<ArrayObject>().length();
-    RootedArrayObject res(cx, NewDenseFullyAllocatedArray(cx, length, NullPtr(), TenuredObject));
+    RootedArrayObject res(cx, NewDenseFullyAllocatedArray(cx, length, nullptr, TenuredObject));
     if (!res)
         return nullptr;
 
     RootedId id(cx);
     RootedValue value(cx);
     for (size_t i = 0; i < length; i++) {
         // The only markable values in copy on write arrays are atoms, which
         // can be freely copied between compartments.
@@ -2852,35 +2852,35 @@ js::GetPropertyPure(ExclusiveContext* cx
     return pobj->isNative() && NativeGetPureInline(&pobj->as<NativeObject>(), shape, vp);
 }
 
 bool
 JSObject::reportReadOnly(JSContext* cx, jsid id, unsigned report)
 {
     RootedValue val(cx, IdToValue(id));
     return ReportValueErrorFlags(cx, report, JSMSG_READ_ONLY,
-                                 JSDVG_IGNORE_STACK, val, js::NullPtr(),
+                                 JSDVG_IGNORE_STACK, val, nullptr,
                                  nullptr, nullptr);
 }
 
 bool
 JSObject::reportNotConfigurable(JSContext* cx, jsid id, unsigned report)
 {
     RootedValue val(cx, IdToValue(id));
     return ReportValueErrorFlags(cx, report, JSMSG_CANT_DELETE,
-                                 JSDVG_IGNORE_STACK, val, js::NullPtr(),
+                                 JSDVG_IGNORE_STACK, val, nullptr,
                                  nullptr, nullptr);
 }
 
 bool
 JSObject::reportNotExtensible(JSContext* cx, unsigned report)
 {
     RootedValue val(cx, ObjectValue(*this));
     return ReportValueErrorFlags(cx, report, JSMSG_OBJECT_NOT_EXTENSIBLE,
-                                 JSDVG_IGNORE_STACK, val, js::NullPtr(),
+                                 JSDVG_IGNORE_STACK, val, nullptr,
                                  nullptr, nullptr);
 }
 
 
 /*** ES6 standard internal methods ***************************************************************/
 
 bool
 js::SetPrototype(JSContext* cx, HandleObject obj, HandleObject proto, JS::ObjectOpResult& result)
@@ -3090,17 +3090,17 @@ js::DefineProperty(JSContext* cx, Handle
 bool
 js::DefineProperty(ExclusiveContext* cx, HandleObject obj, HandleId id, HandleValue value,
                    JSGetterOp getter, JSSetterOp setter, unsigned attrs,
                    ObjectOpResult& result)
 {
     MOZ_ASSERT(!(attrs & JSPROP_PROPOP_ACCESSORS));
 
     Rooted<PropertyDescriptor> desc(cx);
-    desc.initFields(NullPtr(), value, attrs, getter, setter);
+    desc.initFields(nullptr, value, attrs, getter, setter);
     if (DefinePropertyOp op = obj->getOps()->defineProperty) {
         if (!cx->shouldBeJSContext())
             return false;
         return op(cx->asJSContext(), obj, id, desc, result);
     }
     return NativeDefineProperty(cx, obj.as<NativeObject>(), id, desc, result);
 }
 
@@ -3497,17 +3497,17 @@ js::PrimitiveToObject(JSContext* cx, con
 JSObject*
 js::ToObjectSlow(JSContext* cx, JS::HandleValue val, bool reportScanStack)
 {
     MOZ_ASSERT(!val.isMagic());
     MOZ_ASSERT(!val.isObject());
 
     if (val.isNullOrUndefined()) {
         if (reportScanStack) {
-            ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val, NullPtr());
+            ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val, nullptr);
         } else {
             JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
                                  val.isNull() ? "null" : "undefined", "object");
         }
         return nullptr;
     }
 
     return PrimitiveToObject(cx, val);
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -675,17 +675,17 @@ NewObjectWithProto(ExclusiveContext* cx,
 /*
  * Create a native instance of the given class with parent and proto set
  * according to the context's active global.
  */
 inline JSObject*
 NewBuiltinClassInstance(ExclusiveContext* cx, const Class* clasp, gc::AllocKind allocKind,
                         NewObjectKind newKind = GenericObject)
 {
-    return NewObjectWithClassProto(cx, clasp, NullPtr(), allocKind, newKind);
+    return NewObjectWithClassProto(cx, clasp, nullptr, allocKind, newKind);
 }
 
 inline JSObject*
 NewBuiltinClassInstance(ExclusiveContext* cx, const Class* clasp, NewObjectKind newKind = GenericObject)
 {
     gc::AllocKind allocKind = gc::GetGCObjectKind(clasp);
     return NewBuiltinClassInstance(cx, clasp, allocKind, newKind);
 }
--- a/js/src/jsreflect.cpp
+++ b/js/src/jsreflect.cpp
@@ -160,17 +160,17 @@ class NodeBuilder
     RootedValue userv;                 /* user-specified builder object or null */
 
   public:
     NodeBuilder(JSContext* c, bool l, char const* s)
       : cx(c), tokenStream(nullptr), saveLoc(l), src(s), srcval(c), callbacks(cx),
           userv(c)
     {}
 
-    bool init(HandleObject userobj = js::NullPtr()) {
+    bool init(HandleObject userobj = nullptr) {
         if (src) {
             if (!atomValue(src, &srcval))
                 return false;
         } else {
             srcval.setNull();
         }
 
         if (!userobj) {
@@ -196,17 +196,17 @@ class NodeBuilder
 
             if (funv.isNullOrUndefined()) {
                 callbacks[i].setNull();
                 continue;
             }
 
             if (!funv.isObject() || !funv.toObject().is<JSFunction>()) {
                 ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_NOT_FUNCTION,
-                                      JSDVG_SEARCH_STACK, funv, js::NullPtr(), nullptr, nullptr);
+                                      JSDVG_SEARCH_STACK, funv, nullptr, nullptr, nullptr);
                 return false;
             }
 
             callbacks[i].set(funv);
         }
 
         return true;
     }
@@ -3620,17 +3620,17 @@ reflect_parse(JSContext* cx, uint32_t ar
 
     RootedObject builder(cx);
 
     RootedValue arg(cx, args.get(1));
 
     if (!arg.isNullOrUndefined()) {
         if (!arg.isObject()) {
             ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                  JSDVG_SEARCH_STACK, arg, js::NullPtr(),
+                                  JSDVG_SEARCH_STACK, arg, nullptr,
                                   "not an object", nullptr);
             return false;
         }
 
         RootedObject config(cx, &arg.toObject());
 
         RootedValue prop(cx);
 
@@ -3672,17 +3672,17 @@ reflect_parse(JSContext* cx, uint32_t ar
         RootedId builderId(cx, NameToId(cx->names().builder));
         RootedValue nullVal(cx, NullValue());
         if (!GetPropertyDefault(cx, config, builderId, nullVal, &prop))
             return false;
 
         if (!prop.isNullOrUndefined()) {
             if (!prop.isObject()) {
                 ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                      JSDVG_SEARCH_STACK, prop, js::NullPtr(),
+                                      JSDVG_SEARCH_STACK, prop, nullptr,
                                       "not an object", nullptr);
                 return false;
             }
             builder = &prop.toObject();
         }
     }
 
     /* Extract the builder methods first to report errors before parsing. */
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -1169,17 +1169,17 @@ js::XDRLazyScript(XDRState<mode>* xdr, H
         if (!xdr->codeUint32(&begin) || !xdr->codeUint32(&end) ||
             !xdr->codeUint32(&lineno) || !xdr->codeUint32(&column) ||
             !xdr->codeUint64(&packedFields))
         {
             return false;
         }
 
         if (mode == XDR_DECODE)
-            lazy.set(LazyScript::Create(cx, fun, NullPtr(), enclosingScope, enclosingScript,
+            lazy.set(LazyScript::Create(cx, fun, nullptr, enclosingScope, enclosingScript,
                                         packedFields, begin, end, lineno, column));
     }
 
     // Code free variables.
     if (!XDRLazyFreeVariables(xdr, lazy))
         return false;
 
     // Code inner functions.
@@ -1383,17 +1383,17 @@ const Class ScriptSourceObject::class_ =
     nullptr, /* hasInstance */
     nullptr, /* construct */
     trace
 };
 
 ScriptSourceObject*
 ScriptSourceObject::create(ExclusiveContext* cx, ScriptSource* source)
 {
-    RootedObject object(cx, NewObjectWithGivenProto(cx, &class_, NullPtr()));
+    RootedObject object(cx, NewObjectWithGivenProto(cx, &class_, nullptr));
     if (!object)
         return nullptr;
     RootedScriptSource sourceObject(cx, &object->as<ScriptSourceObject>());
 
     source->incref();    // The matching decref is in ScriptSourceObject::finalize.
     sourceObject->initReservedSlot(SOURCE_SLOT, PrivateValue(source));
 
     // The remaining slots should eventually be populated by a call to
@@ -3239,17 +3239,17 @@ js::CloneFunctionScript(JSContext* cx, H
 
     // The only scripts with enclosing static scopes that may be cloned across
     // compartments are non-strict, indirect eval scripts, as their dynamic
     // scope chains terminate in the global scope immediately.
     RootedObject scope(cx, script->enclosingStaticScope());
     if (script->compartment() != cx->compartment() && scope) {
         MOZ_ASSERT(!scope->as<StaticEvalObject>().isDirect() &&
                    !scope->as<StaticEvalObject>().isStrict());
-        scope = StaticEvalObject::create(cx, NullPtr());
+        scope = StaticEvalObject::create(cx, nullptr);
         if (!scope)
             return false;
     }
 
     clone->initScript(nullptr);
 
     JSScript* cscript = CloneScript(cx, scope, clone, script, polluted, newKind);
     if (!cscript)
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -1728,17 +1728,17 @@ class JSScript : public js::gc::TenuredC
     friend class AutoDelazify;
 
     class AutoDelazify
     {
         JS::RootedScript script_;
         JSContext* cx_;
         bool oldDoNotRelazify_;
       public:
-        explicit AutoDelazify(JSContext* cx, JS::HandleFunction fun = JS::NullPtr())
+        explicit AutoDelazify(JSContext* cx, JS::HandleFunction fun = nullptr)
             : script_(cx)
             , cx_(cx)
         {
             holdScript(fun);
         }
 
         ~AutoDelazify()
         {
--- a/js/src/jsweakmap.cpp
+++ b/js/src/jsweakmap.cpp
@@ -387,17 +387,17 @@ SetWeakMapEntryInternal(JSContext* cx, H
 
 MOZ_ALWAYS_INLINE bool
 WeakMap_set_impl(JSContext* cx, CallArgs args)
 {
     MOZ_ASSERT(IsWeakMap(args.thisv()));
 
     if (!args.get(0).isObject()) {
         UniquePtr<char[], JS::FreePolicy> bytes =
-            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, args.get(0), NullPtr());
+            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, args.get(0), nullptr);
         if (!bytes)
             return false;
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
         return false;
     }
 
     RootedObject key(cx, &args[0].toObject());
     Rooted<JSObject*> thisObj(cx, &args.thisv().toObject());
@@ -572,17 +572,17 @@ WeakMap_construct(JSContext* cx, unsigne
             // Steps 12i-j.
             if (!GetElement(cx, pairObject, pairObject, 1, &val))
                 return false;
 
             // Steps 12k-l.
             if (isOriginalAdder) {
                 if (keyVal.isPrimitive()) {
                     UniquePtr<char[], JS::FreePolicy> bytes =
-                        DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, NullPtr());
+                        DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, nullptr);
                     if (!bytes)
                         return false;
                     JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
                     return false;
                 }
 
                 keyObject = &keyVal.toObject();
                 if (!SetWeakMapEntry(cx, obj, keyObject, val))
--- a/js/src/perf/jsperf.cpp
+++ b/js/src/perf/jsperf.cpp
@@ -208,17 +208,17 @@ pm_finalize(JSFreeOp* fop, JSObject* obj
 
 // Helpers (declared above)
 
 static PerfMeasurement*
 GetPM(JSContext* cx, JS::HandleValue value, const char* fname)
 {
     if (!value.isObject()) {
         UniquePtr<char[], JS::FreePolicy> bytes =
-            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, NullPtr());
+            DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, nullptr);
         if (!bytes)
             return nullptr;
         JS_ReportErrorNumber(cx, GetErrorMessage, 0, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
         return nullptr;
     }
     RootedObject obj(cx, &value.toObject());
     PerfMeasurement* p = (PerfMeasurement*)
         JS_GetInstancePrivate(cx, obj, &pm_class, nullptr);
@@ -236,17 +236,17 @@ namespace JS {
 
 JSObject*
 RegisterPerfMeasurement(JSContext* cx, HandleObject globalArg)
 {
     static const uint8_t PM_CATTRS = JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT;
 
     RootedObject global(cx, globalArg);
     RootedObject prototype(cx);
-    prototype = JS_InitClass(cx, global, js::NullPtr() /* parent */,
+    prototype = JS_InitClass(cx, global, nullptr /* parent */,
                              &pm_class, pm_construct, 1,
                              pm_props, pm_fns, 0, 0);
     if (!prototype)
         return 0;
 
     RootedObject ctor(cx);
     ctor = JS_GetConstructor(cx, prototype);
     if (!ctor)
--- a/js/src/proxy/BaseProxyHandler.cpp
+++ b/js/src/proxy/BaseProxyHandler.cpp
@@ -296,17 +296,17 @@ BaseProxyHandler::nativeCall(JSContext* 
 
 bool
 BaseProxyHandler::hasInstance(JSContext* cx, HandleObject proxy, MutableHandleValue v,
                               bool* bp) const
 {
     assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
     RootedValue val(cx, ObjectValue(*proxy.get()));
     ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS,
-                     JSDVG_SEARCH_STACK, val, js::NullPtr());
+                     JSDVG_SEARCH_STACK, val, nullptr);
     return false;
 }
 
 bool
 BaseProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext* cx) const
 {
     return false;
 }
--- a/js/src/proxy/ScriptedDirectProxyHandler.cpp
+++ b/js/src/proxy/ScriptedDirectProxyHandler.cpp
@@ -152,17 +152,17 @@ GetDirectProxyHandlerObject(JSObject* pr
 static inline void
 ReportInvalidTrapResult(JSContext* cx, JSObject* proxy, JSAtom* atom)
 {
     RootedValue v(cx, ObjectOrNullValue(proxy));
     JSAutoByteString bytes;
     if (!AtomToPrintableString(cx, atom, &bytes))
         return;
     ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_IGNORE_STACK, v,
-                      js::NullPtr(), bytes.ptr());
+                      nullptr, bytes.ptr());
 }
 
 // This function is shared between ownPropertyKeys, enumerate, and
 // getOwnEnumerablePropertyKeys.
 static bool
 ArrayToIdVector(JSContext* cx, HandleObject proxy, HandleObject target, HandleValue v,
                 AutoIdVector& props, unsigned flags, JSAtom* trapName_)
 {
@@ -703,17 +703,17 @@ ScriptedDirectProxyHandler::delete_(JSCo
     // steps 12-13
     Rooted<PropertyDescriptor> desc(cx);
     if (!GetOwnPropertyDescriptor(cx, target, id, &desc))
         return false;
 
     // step 14-15
     if (desc.object() && !desc.configurable()) {
         RootedValue v(cx, IdToValue(id));
-        ReportValueError(cx, JSMSG_CANT_DELETE, JSDVG_IGNORE_STACK, v, js::NullPtr());
+        ReportValueError(cx, JSMSG_CANT_DELETE, JSDVG_IGNORE_STACK, v, nullptr);
         return false;
     }
 
     // step 16
     return result.succeed();
 }
 
 // ES6 (14 October, 2014) 9.5.11 Proxy.[[Enumerate]]
--- a/js/src/proxy/ScriptedIndirectProxyHandler.cpp
+++ b/js/src/proxy/ScriptedIndirectProxyHandler.cpp
@@ -151,17 +151,17 @@ ScriptedIndirectProxyHandler::isExtensib
 static bool
 ReturnedValueMustNotBePrimitive(JSContext* cx, HandleObject proxy, JSAtom* atom, const Value& v)
 {
     if (v.isPrimitive()) {
         JSAutoByteString bytes;
         if (AtomToPrintableString(cx, atom, &bytes)) {
             RootedValue val(cx, ObjectOrNullValue(proxy));
             ReportValueError2(cx, JSMSG_BAD_TRAP_RETURN_VALUE,
-                              JSDVG_SEARCH_STACK, val, js::NullPtr(), bytes.ptr());
+                              JSDVG_SEARCH_STACK, val, nullptr, bytes.ptr());
         }
         return false;
     }
     return true;
 }
 
 static JSObject*
 GetIndirectProxyHandlerObject(JSObject* proxy)
@@ -527,17 +527,17 @@ js::proxy_createFunction(JSContext* cx, 
             return false;
     } else {
         construct = call;
     }
 
     // Stash the call and construct traps on a holder object that we can stick
     // in a slot on the proxy.
     RootedObject ccHolder(cx, JS_NewObjectWithGivenProto(cx, Jsvalify(&CallConstructHolder),
-                                                         js::NullPtr()));
+                                                         nullptr));
     if (!ccHolder)
         return false;
     ccHolder->as<NativeObject>().setReservedSlot(0, ObjectValue(*call));
     ccHolder->as<NativeObject>().setReservedSlot(1, ObjectValue(*construct));
 
     RootedValue priv(cx, ObjectValue(*handler));
     JSObject* proxy =
         NewProxyObject(cx, &CallableScriptedIndirectProxyHandler::singleton,
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -354,17 +354,17 @@ ShellInterruptCallback(JSContext* cx)
     gServiceInterrupt = false;
 
     bool result;
     RootedValue interruptFunc(cx, gInterruptFunc);
     if (!interruptFunc.isNull()) {
         JS::AutoSaveExceptionState savedExc(cx);
         JSAutoCompartment ac(cx, &interruptFunc.toObject());
         RootedValue rval(cx);
-        if (!JS_CallFunctionValue(cx, JS::NullPtr(), interruptFunc,
+        if (!JS_CallFunctionValue(cx, nullptr, interruptFunc,
                                   JS::HandleValueArray::empty(), &rval))
         {
             return false;
         }
         if (rval.isBoolean())
             result = rval.toBoolean();
         else
             result = false;
@@ -2266,17 +2266,17 @@ DisassFile(JSContext* cx, unsigned argc,
 
         if (!JS::Compile(cx, options, filename.ptr(), &script))
             return false;
     }
 
     Sprinter sprinter(cx);
     if (!sprinter.init())
         return false;
-    bool ok = DisassembleScript(cx, script, JS::NullPtr(), p.lines, p.recursive, &sprinter);
+    bool ok = DisassembleScript(cx, script, nullptr, p.lines, p.recursive, &sprinter);
     if (ok)
         fprintf(stdout, "%s\n", sprinter.string());
     if (!ok)
         return false;
 
     args.rval().setUndefined();
     return true;
 }
@@ -5649,17 +5649,17 @@ NewGlobalObject(JSContext* cx, JS::Compa
             return nullptr;
 
         /* Initialize FakeDOMObject. */
         static const js::DOMCallbacks DOMcallbacks = {
             InstanceClassHasProtoAtDepth
         };
         SetDOMCallbacks(cx->runtime(), &DOMcallbacks);
 
-        RootedObject domProto(cx, JS_InitClass(cx, glob, js::NullPtr(), &dom_class, dom_constructor,
+        RootedObject domProto(cx, JS_InitClass(cx, glob, nullptr, &dom_class, dom_constructor,
                                                0, dom_props, dom_methods, nullptr, nullptr));
         if (!domProto)
             return nullptr;
 
         /* Initialize FakeDOMObject.prototype */
         InitDOMObject(domProto);
     }
 
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -1544,17 +1544,17 @@ js::InitArrayBufferClass(JSContext* cx, 
     }
 
     if (!LinkConstructorAndPrototype(cx, ctor, arrayBufferProto))
         return nullptr;
 
     RootedId byteLengthId(cx, NameToId(cx->names().byteLength));
     unsigned attrs = JSPROP_SHARED | JSPROP_GETTER;
     JSObject* getter =
-        NewNativeFunction(cx, ArrayBufferObject::byteLengthGetter, 0, js::NullPtr());
+        NewNativeFunction(cx, ArrayBufferObject::byteLengthGetter, 0, nullptr);
     if (!getter)
         return nullptr;
 
     if (!NativeDefineProperty(cx, arrayBufferProto, byteLengthId, UndefinedHandleValue,
                               JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr, attrs))
         return nullptr;
 
     if (!JS_DefineFunctions(cx, ctor, ArrayBufferObject::jsstaticfuncs))
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -133,17 +133,17 @@ js::ReportObjectRequired(JSContext* cx)
 static bool
 ValueToIdentifier(JSContext* cx, HandleValue v, MutableHandleId id)
 {
     if (!ValueToId<CanGC>(cx, v, id))
         return false;
     if (!JSID_IS_ATOM(id) || !IsIdentifier(JSID_TO_ATOM(id))) {
         RootedValue val(cx, v);
         ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                              JSDVG_SEARCH_STACK, val, js::NullPtr(), "not an identifier",
+                              JSDVG_SEARCH_STACK, val, nullptr, "not an identifier",
                               nullptr);
         return false;
     }
     return true;
 }
 
 /*
  * A range of all the Debugger.Frame objects for a particular AbstractFramePtr.
@@ -700,17 +700,17 @@ Debugger::slowPathOnLeaveFrame(JSContext
         MOZ_CRASH("bad final trap status");
     }
 }
 
 /* static */ JSTrapStatus
 Debugger::slowPathOnDebuggerStatement(JSContext* cx, AbstractFramePtr frame)
 {
     RootedValue rval(cx);
-    JSTrapStatus status = dispatchHook(cx, &rval, OnDebuggerStatement, NullPtr());
+    JSTrapStatus status = dispatchHook(cx, &rval, OnDebuggerStatement, nullptr);
 
     switch (status) {
       case JSTRAP_CONTINUE:
       case JSTRAP_ERROR:
         break;
 
       case JSTRAP_RETURN:
         frame.setReturnValue(rval);
@@ -731,17 +731,17 @@ Debugger::slowPathOnDebuggerStatement(JS
 Debugger::slowPathOnExceptionUnwind(JSContext* cx, AbstractFramePtr frame)
 {
     // Invoking more JS on an over-recursed stack or after OOM is only going
     // to result in more of the same error.
     if (cx->isThrowingOverRecursed() || cx->isThrowingOutOfMemory())
         return JSTRAP_CONTINUE;
 
     RootedValue rval(cx);
-    JSTrapStatus status = dispatchHook(cx, &rval, OnExceptionUnwind, NullPtr());
+    JSTrapStatus status = dispatchHook(cx, &rval, OnExceptionUnwind, nullptr);
 
     switch (status) {
       case JSTRAP_CONTINUE:
         break;
 
       case JSTRAP_THROW:
         cx->setPendingException(rval);
         break;
@@ -3060,17 +3060,17 @@ Debugger::getNewestFrame(JSContext* cx, 
 }
 
 /* static */ bool
 Debugger::clearAllBreakpoints(JSContext* cx, unsigned argc, Value* vp)
 {
     THIS_DEBUGGER(cx, argc, vp, "clearAllBreakpoints", args, dbg);
     for (WeakGlobalObjectSet::Range r = dbg->debuggees.all(); !r.empty(); r.popFront())
         r.front()->compartment()->clearBreakpointsIn(cx->runtime()->defaultFreeOp(),
-                                                     dbg, NullPtr());
+                                                     dbg, nullptr);
     return true;
 }
 
 /* static */ bool
 Debugger::construct(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
@@ -4092,17 +4092,17 @@ Debugger::drainTraceLogger(JSContext* cx
     JSAtom* dataAtom = Atomize(cx, "data", strlen("data"));
     if (!dataAtom)
         return false;
     RootedId dataId(cx, AtomToId(dataAtom));
 
     /* Add all events to the array. */
     uint32_t index = 0;
     for (EventEntry* eventItem = events; eventItem < events + num; eventItem++, index++) {
-        RootedObject item(cx, NewObjectWithGivenProto(cx, &PlainObject::class_, NullPtr()));
+        RootedObject item(cx, NewObjectWithGivenProto(cx, &PlainObject::class_, nullptr));
         if (!item)
             return false;
 
         const char* eventText = logger->eventText(eventItem->textId);
         if (!DefineProperty(cx, item, dataId, eventText, strlen(eventText)))
             return false;
 
         RootedValue obj(cx, ObjectValue(*item));
@@ -4191,17 +4191,17 @@ Debugger::drainTraceLoggerScriptCalls(JS
     JSAtom* logTypeAtom = Atomize(cx, "logType", strlen("logType"));
     if (!logTypeAtom)
         return false;
     RootedId logTypeId(cx, AtomToId(logTypeAtom));
 
     /* Add all events to the array. */
     uint32_t index = 0;
     for (EventEntry* eventItem = events; eventItem < events + num; eventItem++) {
-        RootedObject item(cx, NewObjectWithGivenProto(cx, &PlainObject::class_, NullPtr()));
+        RootedObject item(cx, NewObjectWithGivenProto(cx, &PlainObject::class_, nullptr));
         if (!item)
             return false;
 
         uint32_t textId = eventItem->textId;
         if (textId != TraceLogger_Stop && !logger->textIdIsScriptEvent(textId))
             continue;
 
         const char* type = (textId == TraceLogger_Stop) ? "Stop" : "Script";
@@ -5996,17 +5996,17 @@ DebuggerFrame_getArguments(JSContext* cx
                                   JSPROP_PERMANENT | JSPROP_READONLY))
         {
             return false;
         }
 
         Rooted<jsid> id(cx);
         for (unsigned i = 0; i < fargc; i++) {
             RootedFunction getobj(cx);
-            getobj = NewNativeFunction(cx, DebuggerArguments_getArg, 0, js::NullPtr(),
+            getobj = NewNativeFunction(cx, DebuggerArguments_getArg, 0, nullptr,
                                        gc::AllocKind::FUNCTION_EXTENDED);
             if (!getobj)
                 return false;
             id = INT_TO_JSID(i);
             if (!getobj ||
                 !NativeDefineProperty(cx, argsobj, id, UndefinedHandleValue,
                                       JS_DATA_TO_FUNC_PTR(GetterOp, getobj.get()), nullptr,
                                       JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_GETTER))
@@ -6179,17 +6179,17 @@ EvaluateInEnv(JSContext* cx, Handle<Env*
      * calls and properly compute a static level. In practice, any non-zero
      * static level will suffice.
      *
      * Pass in a StaticEvalObject *not* linked to env for evalStaticScope, as
      * ScopeIter should stop at any non-ScopeObject or non-syntactic With
      * boundaries, and we are putting a DebugScopeProxy or non-syntactic With on
      * the scope chain.
      */
-    Rooted<StaticEvalObject*> staticScope(cx, StaticEvalObject::create(cx, js::NullPtr()));
+    Rooted<StaticEvalObject*> staticScope(cx, StaticEvalObject::create(cx, nullptr));
     if (!staticScope)
         return false;
     CompileOptions options(cx);
     options.setHasPollutedScope(true)
            .setIsRunOnce(true)
            .setForEval(true)
            .setNoScriptRval(false)
            .setFileAndLine(filename, lineno)
@@ -6316,17 +6316,17 @@ DebuggerGenericEval(JSContext* cx, const
         if (!thisObj)
             return false;
         thisv = ObjectValue(*thisObj);
         env = scope;
     }
 
     /* If evalWithBindings, create the inner environment. */
     if (evalWithBindings) {
-        RootedPlainObject nenv(cx, NewObjectWithGivenProto<PlainObject>(cx, NullPtr()));
+        RootedPlainObject nenv(cx, NewObjectWithGivenProto<PlainObject>(cx, nullptr));
         if (!nenv)
             return false;
         RootedId id(cx);
         for (size_t i = 0; i < keys.length(); i++) {
             id = keys[i];
             MutableHandleValue val = values[i];
             if (!cx->compartment()->wrap(cx, val) ||
                 !NativeDefineProperty(cx, nenv, id, val, nullptr, nullptr, 0))
@@ -6371,30 +6371,30 @@ DebuggerFrame_eval(JSContext* cx, unsign
 {
     THIS_FRAME_ITER(cx, argc, vp, "eval", args, thisobj, _, iter);
     if (!args.requireAtLeast(cx, "Debugger.Frame.prototype.eval", 1))
         return false;
     Debugger* dbg = Debugger::fromChildJSObject(thisobj);
     UpdateFrameIterPc(iter);
     return DebuggerGenericEval(cx, "Debugger.Frame.prototype.eval",
                                args[0], EvalWithDefaultBindings, JS::UndefinedHandleValue,
-                               args.get(1), args.rval(), dbg, js::NullPtr(), &iter);
+                               args.get(1), args.rval(), dbg, nullptr, &iter);
 }
 
 static bool
 DebuggerFrame_evalWithBindings(JSContext* cx, unsigned argc, Value* vp)
 {
     THIS_FRAME_ITER(cx, argc, vp, "evalWithBindings", args, thisobj, _, iter);
     if (!args.requireAtLeast(cx, "Debugger.Frame.prototype.evalWithBindings", 2))
         return false;
     Debugger* dbg = Debugger::fromChildJSObject(thisobj);
     UpdateFrameIterPc(iter);
     return DebuggerGenericEval(cx, "Debugger.Frame.prototype.evalWithBindings",
                                args[0], EvalHasExtraBindings, args[1], args.get(2),
-                               args.rval(), dbg, js::NullPtr(), &iter);
+                               args.rval(), dbg, nullptr, &iter);
 }
 
 static bool
 DebuggerFrame_construct(JSContext* cx, unsigned argc, Value* vp)
 {
     JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
                          "Debugger.Frame");
     return false;
@@ -7221,21 +7221,21 @@ RequireGlobalObject(JSContext* cx, Handl
         /* ... and WindowProxies around Windows. */
         if (IsOuterObject(obj)) {
             obj = JS_ObjectToInnerObject(cx, obj);
             isWindowProxy = "a WindowProxy referring to ";
         }
 
         if (obj->is<GlobalObject>()) {
             ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_WRAPPER_IN_WAY,
-                                  JSDVG_SEARCH_STACK, dbgobj, js::NullPtr(),
+                                  JSDVG_SEARCH_STACK, dbgobj, nullptr,
                                   isWrapper, isWindowProxy);
         } else {
             ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_BAD_REFERENT,
-                                  JSDVG_SEARCH_STACK, dbgobj, js::NullPtr(),
+                                  JSDVG_SEARCH_STACK, dbgobj, nullptr,
                                   "a global object", nullptr);
         }
         return false;
     }
 
     return true;
 }
 
--- a/js/src/vm/ForOfIterator.cpp
+++ b/js/src/vm/ForOfIterator.cpp
@@ -67,17 +67,17 @@ ForOfIterator::init(HandleValue iterable
         return true;
 
     // Throw if obj[@@iterator] isn't callable.
     // js::Invoke is about to check for this kind of error anyway, but it would
     // throw an inscrutable error message about |method| rather than this nice
     // one about |obj|.
     if (!callee.isObject() || !callee.toObject().isCallable()) {
         UniquePtr<char[], JS::FreePolicy> bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK,
-                                                                          iterable, NullPtr());
+                                                                          iterable, nullptr);
         if (!bytes)
             return false;
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_ITERABLE, bytes.get());
         return false;
     }
 
     args.setCallee(callee);
     if (!Invoke(cx, args))
--- a/js/src/vm/GeneratorObject.cpp
+++ b/js/src/vm/GeneratorObject.cpp
@@ -63,17 +63,17 @@ GeneratorObject::suspend(JSContext* cx, 
 {
     MOZ_ASSERT(*pc == JSOP_INITIALYIELD || *pc == JSOP_YIELD);
 
     Rooted<GeneratorObject*> genObj(cx, &obj->as<GeneratorObject>());
     MOZ_ASSERT(!genObj->hasExpressionStack());
 
     if (*pc == JSOP_YIELD && genObj->isClosing() && genObj->is<LegacyGeneratorObject>()) {
         RootedValue val(cx, ObjectValue(*frame.callee()));
-        ReportValueError(cx, JSMSG_BAD_GENERATOR_YIELD, JSDVG_IGNORE_STACK, val, NullPtr());
+        ReportValueError(cx, JSMSG_BAD_GENERATOR_YIELD, JSDVG_IGNORE_STACK, val, nullptr);
         return false;
     }
 
     uint32_t yieldIndex = GET_UINT24(pc);
     genObj->setYieldIndex(yieldIndex);
     genObj->setScopeChain(*frame.scopeChain());
 
     if (nvalues) {
@@ -307,17 +307,17 @@ GlobalObject::initGeneratorClasses(JSCon
             return false;
 
         RootedValue function(cx, global->getConstructor(JSProto_Function));
         if (!function.toObjectOrNull())
             return false;
         RootedObject proto(cx, &function.toObject());
         RootedAtom name(cx, cx->names().GeneratorFunction);
         RootedObject genFunction(cx, NewFunctionWithProto(cx, Generator, 1,
-                                                          JSFunction::NATIVE_CTOR, NullPtr(), name,
+                                                          JSFunction::NATIVE_CTOR, nullptr, name,
                                                           proto));
         if (!genFunction)
             return false;
         if (!LinkConstructorAndPrototype(cx, genFunction, genFunctionProto))
             return false;
 
         global->setSlot(STAR_GENERATOR_OBJECT_PROTO, ObjectValue(*genObjectProto));
         global->setConstructor(JSProto_GeneratorFunction, ObjectValue(*genFunction));
--- a/js/src/vm/GlobalObject.cpp
+++ b/js/src/vm/GlobalObject.cpp
@@ -237,17 +237,17 @@ GlobalObject::initBuiltinConstructor(JSC
 }
 
 GlobalObject*
 GlobalObject::createInternal(JSContext* cx, const Class* clasp)
 {
     MOZ_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL);
     MOZ_ASSERT(clasp->trace == JS_GlobalObjectTraceHook);
 
-    JSObject* obj = NewObjectWithGivenProto(cx, clasp, NullPtr(), SingletonObject);
+    JSObject* obj = NewObjectWithGivenProto(cx, clasp, nullptr, SingletonObject);
     if (!obj)
         return nullptr;
 
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
     // Initialize the private slot to null if present, as GC can call class
     // hooks before the caller gets to set this to a non-garbage value.
     if (clasp->flags & JSCLASS_HAS_PRIVATE)
@@ -537,17 +537,17 @@ GlobalObject::getDebuggers() const
 /* static */ GlobalObject::DebuggerVector*
 GlobalObject::getOrCreateDebuggers(JSContext* cx, Handle<GlobalObject*> global)
 {
     assertSameCompartment(cx, global);
     DebuggerVector* debuggers = global->getDebuggers();
     if (debuggers)
         return debuggers;
 
-    NativeObject* obj = NewNativeObjectWithGivenProto(cx, &GlobalDebuggees_class, NullPtr());
+    NativeObject* obj = NewNativeObjectWithGivenProto(cx, &GlobalDebuggees_class, nullptr);
     if (!obj)
         return nullptr;
     debuggers = cx->new_<DebuggerVector>();
     if (!debuggers)
         return nullptr;
     obj->setPrivate(debuggers);
     global->setReservedSlot(DEBUGGERS, ObjectValue(*obj));
     return debuggers;
--- a/js/src/vm/HelperThreads.cpp
+++ b/js/src/vm/HelperThreads.cpp
@@ -1227,17 +1227,17 @@ HelperThread::handleParseWorkload()
 
     {
         AutoUnlockHelperThreadState unlock;
         PerThreadData::AutoEnterRuntime enter(threadData.ptr(),
                                               parseTask->exclusiveContextGlobal->runtimeFromAnyThread());
         SourceBufferHolder srcBuf(parseTask->chars, parseTask->length,
                                   SourceBufferHolder::NoOwnership);
         parseTask->script = frontend::CompileScript(parseTask->cx, &parseTask->alloc,
-                                                    NullPtr(), NullPtr(), NullPtr(),
+                                                    nullptr, nullptr, nullptr,
                                                     parseTask->options,
                                                     srcBuf);
     }
 
     // The callback is invoked while we are still off the main thread.
     parseTask->callback(parseTask, parseTask->callbackData);
 
     // FinishOffThreadScript will need to be called on the script to
--- a/js/src/vm/Interpreter-inl.h
+++ b/js/src/vm/Interpreter-inl.h
@@ -181,17 +181,17 @@ ValuePropertyBearer(JSContext* cx, Inter
     if (v.isString())
         return GlobalObject::getOrCreateStringPrototype(cx, global);
     if (v.isNumber())
         return GlobalObject::getOrCreateNumberPrototype(cx, global);
     if (v.isBoolean())
         return GlobalObject::getOrCreateBooleanPrototype(cx, global);
 
     MOZ_ASSERT(v.isNull() || v.isUndefined());
-    ReportIsNullOrUndefined(cx, spindex, v, NullPtr());
+    ReportIsNullOrUndefined(cx, spindex, v, nullptr);
     return nullptr;
 }
 
 inline bool
 GetLengthProperty(const Value& lval, MutableHandleValue vp)
 {
     /* Optimize length accesses on strings, arrays, and arguments. */
     if (lval.isString()) {
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -171,17 +171,17 @@ js::OnUnknownMethod(JSContext* cx, Handl
 {
     RootedValue idval(cx, idval_);
 
     RootedValue value(cx);
     if (!GetProperty(cx, obj, obj, cx->names().noSuchMethod, &value))
         return false;
 
     if (value.isObject()) {
-        NativeObject* obj = NewNativeObjectWithClassProto(cx, &js_NoSuchMethodClass, NullPtr());
+        NativeObject* obj = NewNativeObjectWithClassProto(cx, &js_NoSuchMethodClass, nullptr);
         if (!obj)
             return false;
 
         obj->setSlot(JSSLOT_FOUND_FUNCTION, value);
         obj->setSlot(JSSLOT_SAVED_ID, idval);
         vp.setObject(*obj);
     }
     return true;
@@ -341,17 +341,17 @@ SetPropertyOperation(JSContext* cx, JSOp
 }
 
 bool
 js::ReportIsNotFunction(JSContext* cx, HandleValue v, int numToSkip, MaybeConstruct construct)
 {
     unsigned error = construct ? JSMSG_NOT_CONSTRUCTOR : JSMSG_NOT_FUNCTION;
     int spIndex = numToSkip >= 0 ? -(numToSkip + 1) : JSDVG_SEARCH_STACK;
 
-    ReportValueError3(cx, error, spIndex, v, NullPtr(), nullptr, nullptr);
+    ReportValueError3(cx, error, spIndex, v, nullptr, nullptr, nullptr);
     return false;
 }
 
 JSObject*
 js::ValueToCallable(JSContext* cx, HandleValue v, int numToSkip, MaybeConstruct construct)
 {
     if (v.isObject() && v.toObject().isCallable()) {
         return &v.toObject();
@@ -948,17 +948,17 @@ js::HasInstance(JSContext* cx, HandleObj
 {
     const Class* clasp = obj->getClass();
     RootedValue local(cx, v);
     if (clasp->hasInstance)
         return clasp->hasInstance(cx, obj, &local, bp);
 
     RootedValue val(cx, ObjectValue(*obj));
     ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS,
-                        JSDVG_SEARCH_STACK, val, NullPtr());
+                        JSDVG_SEARCH_STACK, val, nullptr);
     return false;
 }
 
 static inline bool
 EqualGivenSameType(JSContext* cx, HandleValue lval, HandleValue rval, bool* equal)
 {
     MOZ_ASSERT(SameType(lval, rval));
 
@@ -2163,17 +2163,17 @@ END_CASE(JSOP_AND)
             ADVANCE_AND_DISPATCH(1 + JSOP_IFEQ_LENGTH);                       \
         }                                                                     \
     JS_END_MACRO
 
 CASE(JSOP_IN)
 {
     HandleValue rref = REGS.stackHandleAt(-1);
     if (!rref.isObject()) {
-        ReportValueError(cx, JSMSG_IN_NOT_OBJECT, -1, rref, js::NullPtr());
+        ReportValueError(cx, JSMSG_IN_NOT_OBJECT, -1, rref, nullptr);
         goto error;
     }
     RootedObject& obj = rootObject0;
     obj = &rref.toObject();
     RootedId& id = rootId0;
     FETCH_ELEMENT_ID(-2, id);
     bool found;
     if (!HasProperty(cx, obj, id, &found))
@@ -3710,17 +3710,17 @@ CASE(JSOP_THROW)
     goto error;
 }
 
 CASE(JSOP_INSTANCEOF)
 {
     RootedValue& rref = rootValue0;
     rref = REGS.sp[-1];
     if (rref.isPrimitive()) {
-        ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS, -1, rref, js::NullPtr());
+        ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS, -1, rref, nullptr);
         goto error;
     }
     RootedObject& obj = rootObject0;
     obj = &rref.toObject();
     bool cond = false;
     if (!HasInstance(cx, obj, REGS.stackHandleAt(-2), &cond))
         goto error;
     REGS.sp--;
@@ -3910,17 +3910,17 @@ CASE(JSOP_CLASSHERITAGE)
         }
 
         funcProto = &val.toObject();
 
         if (!GetProperty(cx, funcProto, funcProto, cx->names().prototype, &objProto))
             goto error;
 
         if (!objProto.isObjectOrNull()) {
-            ReportValueError(cx, JSMSG_PROTO_NOT_OBJORNULL, -1, objProto, NullPtr());
+            ReportValueError(cx, JSMSG_PROTO_NOT_OBJORNULL, -1, objProto, nullptr);
             goto error;
         }
     }
 
     REGS.sp[-1].setObject(*funcProto);
     PUSH_COPY(objProto);
 }
 END_CASE(JSOP_CLASSHERITAGE)
@@ -4179,17 +4179,17 @@ js::Lambda(JSContext* cx, HandleFunction
     return clone;
 }
 
 JSObject*
 js::LambdaArrow(JSContext* cx, HandleFunction fun, HandleObject parent, HandleValue thisv)
 {
     MOZ_ASSERT(fun->isArrow());
 
-    RootedObject clone(cx, CloneFunctionObjectIfNotSingleton(cx, fun, parent, NullPtr(),
+    RootedObject clone(cx, CloneFunctionObjectIfNotSingleton(cx, fun, parent, nullptr,
                                                              TenuredObject));
     if (!clone)
         return nullptr;
 
     MOZ_ASSERT(clone->as<JSFunction>().isArrow());
     clone->as<JSFunction>().setExtendedSlot(0, thisv);
 
     MOZ_ASSERT(fun->global() == clone->global());
@@ -4206,17 +4206,17 @@ js::DefFunOperation(JSContext* cx, Handl
      * functions among multiple equivalent scopes, amortizing the cost of
      * compilation over a number of executions.  Examples include XUL scripts
      * and event handlers shared among Firefox or other Mozilla app chrome
      * windows, and user-defined JS functions precompiled and then shared among
      * requests in server-side JS.
      */
     RootedFunction fun(cx, funArg);
     if (fun->isNative() || fun->environment() != scopeChain) {
-        fun = CloneFunctionObjectIfNotSingleton(cx, fun, scopeChain, NullPtr(), TenuredObject);
+        fun = CloneFunctionObjectIfNotSingleton(cx, fun, scopeChain, nullptr, TenuredObject);
         if (!fun)
             return false;
     } else {
         MOZ_ASSERT(script->treatAsRunOnce());
         MOZ_ASSERT(!script->functionNonDelazifying());
     }
 
     /*
@@ -4714,17 +4714,17 @@ js::NewArrayOperation(JSContext* cx, Han
 
         if (group->shouldPreTenure() || group->maybePreliminaryObjects())
             newKind = TenuredObject;
 
         if (group->maybeUnboxedLayout())
             return UnboxedArrayObject::create(cx, group, length, newKind);
     }
 
-    ArrayObject* obj = NewDenseFullyAllocatedArray(cx, length, NullPtr(), newKind);
+    ArrayObject* obj = NewDenseFullyAllocatedArray(cx, length, nullptr, newKind);
     if (!obj)
         return nullptr;
 
     if (newKind == SingletonObject) {
         MOZ_ASSERT(obj->isSingleton());
     } else {
         obj->setGroup(group);
 
@@ -4744,17 +4744,17 @@ js::NewArrayOperationWithTemplate(JSCont
 
     if (templateObject->is<UnboxedArrayObject>()) {
         uint32_t length = templateObject->as<UnboxedArrayObject>().length();
         RootedObjectGroup group(cx, templateObject->group());
         return UnboxedArrayObject::create(cx, group, length, newKind);
     }
 
     ArrayObject* obj = NewDenseFullyAllocatedArray(cx, templateObject->as<ArrayObject>().length(),
-                                                   NullPtr(), newKind);
+                                                   nullptr, newKind);
     if (!obj)
         return nullptr;
 
     MOZ_ASSERT(obj->lastProperty() == templateObject->as<ArrayObject>().lastProperty());
     obj->setGroup(templateObject->group());
     return obj;
 }
 
--- a/js/src/vm/NativeObject.cpp
+++ b/js/src/vm/NativeObject.cpp
@@ -1435,17 +1435,17 @@ js::NativeDefineProperty(ExclusiveContex
 }
 
 bool
 js::NativeDefineProperty(ExclusiveContext* cx, HandleNativeObject obj, HandleId id,
                          HandleValue value, GetterOp getter, SetterOp setter, unsigned attrs,
                          ObjectOpResult& result)
 {
     Rooted<PropertyDescriptor> desc(cx);
-    desc.initFields(NullPtr(), value, attrs, getter, setter);
+    desc.initFields(nullptr, value, attrs, getter, setter);
     return NativeDefineProperty(cx, obj, id, desc, result);
 }
 
 bool
 js::NativeDefineProperty(ExclusiveContext* cx, HandleNativeObject obj, PropertyName* name,
                          HandleValue value, GetterOp getter, SetterOp setter, unsigned attrs,
                          ObjectOpResult& result)
 {
@@ -1753,17 +1753,17 @@ GetNonexistentProperty(JSContext* cx, Ha
         return true;
 
     unsigned flags = JSREPORT_WARNING | JSREPORT_STRICT;
     script->setWarnedAboutUndefinedProp();
 
     // Ok, bad undefined property reference: whine about it.
     RootedValue val(cx, IdToValue(id));
     return ReportValueErrorFlags(cx, flags, JSMSG_UNDEFINED_PROP, JSDVG_IGNORE_STACK, val,
-                                    js::NullPtr(), nullptr, nullptr);
+                                    nullptr, nullptr, nullptr);
 }
 
 /* The NoGC version of GetNonexistentProperty, present only to make types line up. */
 bool
 GetNonexistentProperty(JSContext* cx, NativeObject* obj, jsid id, JSObject* receiver,
                        IsNameLookup nameLookup, FakeMutableHandle<Value> vp)
 {
     return false;
--- a/js/src/vm/PIC.cpp
+++ b/js/src/vm/PIC.cpp
@@ -303,17 +303,17 @@ const Class ForOfPIC::jsclass = {
     nullptr,              /* construct   */
     ForOfPIC_traceObject
 };
 
 /* static */ NativeObject*
 js::ForOfPIC::createForOfPICObject(JSContext* cx, Handle<GlobalObject*> global)
 {
     assertSameCompartment(cx, global);
-    NativeObject* obj = NewNativeObjectWithGivenProto(cx, &ForOfPIC::jsclass, NullPtr());
+    NativeObject* obj = NewNativeObjectWithGivenProto(cx, &ForOfPIC::jsclass, nullptr);
     if (!obj)
         return nullptr;
     ForOfPIC::Chain* chain = cx->new_<ForOfPIC::Chain>();
     if (!chain)
         return nullptr;
     obj->setPrivate(chain);
     return obj;
 }
--- a/js/src/vm/RegExpObject.cpp
+++ b/js/src/vm/RegExpObject.cpp
@@ -836,17 +836,17 @@ RegExpCompartment::~RegExpCompartment()
 }
 
 ArrayObject*
 RegExpCompartment::createMatchResultTemplateObject(JSContext* cx)
 {
     MOZ_ASSERT(!matchResultTemplateObject_);
 
     /* Create template array object */
-    RootedArrayObject templateObject(cx, NewDenseUnallocatedArray(cx, 0, NullPtr(), TenuredObject));
+    RootedArrayObject templateObject(cx, NewDenseUnallocatedArray(cx, 0, nullptr, TenuredObject));
     if (!templateObject)
         return matchResultTemplateObject_; // = nullptr
 
     // Create a new group for the template.
     Rooted<TaggedProto> proto(cx, templateObject->getTaggedProto());
     ObjectGroup* group = ObjectGroupCompartment::makeGroup(cx, templateObject->getClass(), proto);
     if (!group)
         return matchResultTemplateObject_; // = nullptr
--- a/js/src/vm/RegExpStatics.cpp
+++ b/js/src/vm/RegExpStatics.cpp
@@ -51,17 +51,17 @@ const Class RegExpStaticsObject::class_ 
     nullptr, /* hasInstance */
     nullptr, /* construct */
     resc_trace
 };
 
 RegExpStaticsObject*
 RegExpStatics::create(ExclusiveContext* cx, Handle<GlobalObject*> parent)
 {
-    RegExpStaticsObject* obj = NewObjectWithGivenProto<RegExpStaticsObject>(cx, NullPtr());
+    RegExpStaticsObject* obj = NewObjectWithGivenProto<RegExpStaticsObject>(cx, nullptr);
     if (!obj)
         return nullptr;
     RegExpStatics* res = cx->new_<RegExpStatics>();
     if (!res)
         return nullptr;
     obj->setPrivate(static_cast<void*>(res));
     return obj;
 }
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -172,17 +172,17 @@ ThrowErrorWithType(JSContext* cx, JSExnT
             JSString* str = ToString<CanGC>(cx, val);
             if (!str)
                 return;
             errorArgs[i - 1].encodeLatin1(cx, str);
         } else if (val.isString()) {
             errorArgs[i - 1].encodeLatin1(cx, val.toString());
         } else {
             UniquePtr<char[], JS::FreePolicy> bytes =
-                DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, val, NullPtr());
+                DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, val, nullptr);
             if (!bytes)
                 return;
             errorArgs[i - 1].initBytes(bytes.release());
         }
         if (!errorArgs[i - 1])
             return;
     }
 
@@ -1668,24 +1668,24 @@ GetUnclonedValue(JSContext* cx, HandleNa
     // Since all atoms used by self hosting are marked as permanent, any
     // attempt to look up a non-permanent atom will fail. We should only
     // see such atoms when code is looking for properties on the self
     // hosted global which aren't present.
     if (JSID_IS_STRING(id) && !JSID_TO_STRING(id)->isPermanentAtom()) {
         MOZ_ASSERT(selfHostedObject->is<GlobalObject>());
         RootedValue value(cx, IdToValue(id));
         return ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_NO_SUCH_SELF_HOSTED_PROP,
-                                     JSDVG_IGNORE_STACK, value, NullPtr(), nullptr, nullptr);
+                                     JSDVG_IGNORE_STACK, value, nullptr, nullptr, nullptr);
     }
 
     RootedShape shape(cx, selfHostedObject->lookupPure(id));
     if (!shape) {
         RootedValue value(cx, IdToValue(id));
         return ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_NO_SUCH_SELF_HOSTED_PROP,
-                                     JSDVG_IGNORE_STACK, value, NullPtr(), nullptr, nullptr);
+                                     JSDVG_IGNORE_STACK, value, nullptr, nullptr, nullptr);
     }
 
     MOZ_ASSERT(shape->hasSlot() && shape->hasDefaultGetter());
     vp.set(selfHostedObject->getSlot(shape->slot()));
     return true;
 }
 
 static bool
@@ -1804,20 +1804,20 @@ CloneObject(JSContext* cx, HandleNativeO
         JSString* selfHostedString = selfHostedObject->as<StringObject>().unbox();
         if (!selfHostedString->isFlat())
             MOZ_CRASH();
         RootedString str(cx, CloneString(cx, &selfHostedString->asFlat()));
         if (!str)
             return nullptr;
         clone = StringObject::create(cx, str);
     } else if (selfHostedObject->is<ArrayObject>()) {
-        clone = NewDenseEmptyArray(cx, NullPtr(), TenuredObject);
+        clone = NewDenseEmptyArray(cx, nullptr, TenuredObject);
     } else {
         MOZ_ASSERT(selfHostedObject->isNative());
-        clone = NewObjectWithGivenProto(cx, selfHostedObject->getClass(), NullPtr(),
+        clone = NewObjectWithGivenProto(cx, selfHostedObject->getClass(), nullptr,
                                         selfHostedObject->asTenured().getAllocKind(),
                                         SingletonObject);
     }
     if (!clone)
         return nullptr;
     if (!CloneProperties(cx, selfHostedObject, clone))
         return nullptr;
     return clone;
@@ -1867,17 +1867,17 @@ JSRuntime::cloneSelfHostedFunctionScript
     RootedFunction sourceFun(cx, &funVal.toObject().as<JSFunction>());
     // JSFunction::generatorKind can't handle lazy self-hosted functions, so we make sure there
     // aren't any.
     MOZ_ASSERT(!sourceFun->isGenerator());
     RootedScript sourceScript(cx, sourceFun->getOrCreateScript(cx));
     if (!sourceScript)
         return false;
     MOZ_ASSERT(!sourceScript->enclosingStaticScope());
-    JSScript* cscript = CloneScript(cx, NullPtr(), targetFun, sourceScript);
+    JSScript* cscript = CloneScript(cx, nullptr, targetFun, sourceScript);
     if (!cscript)
         return false;
     cscript->setFunction(targetFun);
 
     MOZ_ASSERT(sourceFun->nargs() == targetFun->nargs());
     // The target function might have been relazified after it's flags changed.
     targetFun->setFlags((targetFun->flags() & ~JSFunction::INTERPRETED_LAZY) |
                         sourceFun->flags() | JSFunction::EXTENDED);
--- a/js/src/vm/SharedArrayObject.cpp
+++ b/js/src/vm/SharedArrayObject.cpp
@@ -341,17 +341,17 @@ js::InitSharedArrayBufferClass(JSContext
         return nullptr;
 
     if (!LinkConstructorAndPrototype(cx, ctor, proto))
         return nullptr;
 
     RootedId byteLengthId(cx, NameToId(cx->names().byteLength));
     unsigned attrs = JSPROP_SHARED | JSPROP_GETTER | JSPROP_PERMANENT;
     JSObject* getter =
-        NewNativeFunction(cx, SharedArrayBufferObject::byteLengthGetter, 0, NullPtr());
+        NewNativeFunction(cx, SharedArrayBufferObject::byteLengthGetter, 0, nullptr);
     if (!getter)
         return nullptr;
 
     if (!NativeDefineProperty(cx, proto, byteLengthId, UndefinedHandleValue,
                               JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr, attrs))
         return nullptr;
 
     if (!JS_DefineFunctions(cx, ctor, SharedArrayBufferObject::jsstaticfuncs))
--- a/js/src/vm/SharedTypedArrayObject.cpp
+++ b/js/src/vm/SharedTypedArrayObject.cpp
@@ -345,17 +345,17 @@ class SharedTypedArrayObjectTemplate : p
     // Define an accessor for a read-only property that invokes a native getter
     static bool
     DefineGetter(JSContext* cx, HandleNativeObject proto, PropertyName* name, Native native)
     {
         RootedId id(cx, NameToId(name));
         unsigned attrs = JSPROP_SHARED | JSPROP_GETTER;
 
         Rooted<GlobalObject*> global(cx, cx->compartment()->maybeGlobal());
-        JSObject* getter = NewNativeFunction(cx, native, 0, NullPtr());
+        JSObject* getter = NewNativeFunction(cx, native, 0, nullptr);
         if (!getter)
             return false;
 
         return NativeDefineProperty(cx, proto, id, UndefinedHandleValue,
                                     JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr,
                                     attrs);
     }
 
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -128,17 +128,17 @@ InterpreterFrame::copyRawFrameSlots(Auto
 
 JSObject*
 InterpreterFrame::createRestParameter(JSContext* cx)
 {
     MOZ_ASSERT(fun()->hasRest());
     unsigned nformal = fun()->nargs() - 1, nactual = numActualArgs();
     unsigned nrest = (nactual > nformal) ? nactual - nformal : 0;
     Value* restvp = argv() + nformal;
-    ArrayObject* obj = NewDenseCopiedArray(cx, nrest, restvp, NullPtr());
+    ArrayObject* obj = NewDenseCopiedArray(cx, nrest, restvp, nullptr);
     if (!obj)
         return nullptr;
     ObjectGroup::fixRestArgumentsGroup(cx, obj);
     return obj;
 }
 
 static inline void
 AssertDynamicScopeMatchesStaticScope(JSContext* cx, JSScript* script, JSObject* scope)
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -228,17 +228,17 @@ class TypedArrayObjectTemplate : public 
     createConstructor(JSContext* cx, JSProtoKey key)
     {
         Handle<GlobalObject*> global = cx->global();
         RootedFunction ctorProto(cx, GlobalObject::getOrCreateTypedArrayConstructor(cx, global));
         if (!ctorProto)
             return nullptr;
 
         return NewFunctionWithProto(cx, class_constructor, 3,
-                                    JSFunction::NATIVE_CTOR, NullPtr(),
+                                    JSFunction::NATIVE_CTOR, nullptr,
                                     ClassName(key, cx),
                                     ctorProto, gc::AllocKind::FUNCTION,
                                     SingletonObject);
     }
 
     static bool
     finishClassInit(JSContext* cx, HandleObject ctor, HandleObject proto)
     {
@@ -248,17 +248,17 @@ class TypedArrayObjectTemplate : public 
             !DefineProperty(cx, proto, cx->names().BYTES_PER_ELEMENT, bytesValue,
                             nullptr, nullptr, JSPROP_PERMANENT | JSPROP_READONLY))
         {
             return false;
         }
 
         RootedFunction fun(cx);
         fun = NewNativeFunction(cx, ArrayBufferObject::createTypedArrayFromBuffer<NativeType>,
-                                0, NullPtr());
+                                0, nullptr);
         if (!fun)
             return false;
 
         cx->global()->setCreateArrayFromBuffer<NativeType>(fun);
         return true;
     }
 
     static inline const Class* instanceClass()
@@ -1115,17 +1115,17 @@ DataViewObject::class_constructor(JSCont
         PodCopy(args2.array(), args.array(), args.length());
         args2[args.length()].setObject(*proto);
         if (!Invoke(cx, args2))
             return false;
         args.rval().set(args2.rval());
         return true;
     }
 
-    return construct(cx, bufobj, args, NullPtr());
+    return construct(cx, bufobj, args, nullptr);
 }
 
 template <typename NativeType>
 /* static */ uint8_t*
 DataViewObject::getDataPointer(JSContext* cx, Handle<DataViewObject*> obj, uint32_t offset)
 {
     const size_t TypeSize = sizeof(NativeType);
     if (offset > UINT32_MAX - TypeSize || offset + TypeSize > obj->byteLength()) {
@@ -1956,17 +1956,17 @@ template<Value ValueGetter(DataViewObjec
 bool
 DataViewObject::defineGetter(JSContext* cx, PropertyName* name, HandleNativeObject proto)
 {
     RootedId id(cx, NameToId(name));
     unsigned attrs = JSPROP_SHARED | JSPROP_GETTER;
 
     Rooted<GlobalObject*> global(cx, cx->compartment()->maybeGlobal());
     JSObject* getter =
-        NewNativeFunction(cx, DataViewObject::getter<ValueGetter>, 0, NullPtr());
+        NewNativeFunction(cx, DataViewObject::getter<ValueGetter>, 0, nullptr);
     if (!getter)
         return false;
 
     return NativeDefineProperty(cx, proto, id, UndefinedHandleValue,
                                 JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr, attrs);
 }
 
 /* static */ bool
@@ -2001,17 +2001,17 @@ DataViewObject::initClass(JSContext* cx)
         return false;
 
     /*
      * Create a helper function to implement the craziness of
      * |new DataView(new otherWindow.ArrayBuffer())|, and install it in the
      * global for use by the DataViewObject constructor.
      */
     RootedFunction fun(cx, NewNativeFunction(cx, ArrayBufferObject::createDataViewForThis,
-                                             0, NullPtr()));
+                                             0, nullptr));
     if (!fun)
         return false;
 
     if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_DataView, ctor, proto))
         return false;
 
     global->setCreateDataViewForThis(fun);
 
--- a/js/src/vm/UnboxedObject.cpp
+++ b/js/src/vm/UnboxedObject.cpp
@@ -328,17 +328,17 @@ UnboxedPlainObject::trace(JSTracer* trc,
 }
 
 /* static */ UnboxedExpandoObject*
 UnboxedPlainObject::ensureExpando(JSContext* cx, Handle<UnboxedPlainObject*> obj)
 {
     if (obj->expando_)
         return obj->expando_;
 
-    UnboxedExpandoObject* expando = NewObjectWithGivenProto<UnboxedExpandoObject>(cx, NullPtr());
+    UnboxedExpandoObject* expando = NewObjectWithGivenProto<UnboxedExpandoObject>(cx, nullptr);
     if (!expando)
         return nullptr;
 
     // If the expando is tenured then the original object must also be tenured.
     // Otherwise barriers triggered on the original object for writes to the
     // expando (as can happen in the JIT) won't see the tenured->nursery edge.
     // See WholeCellEdges::mark.
     MOZ_ASSERT_IF(!IsInsideNursery(expando), !IsInsideNursery(obj));
--- a/js/src/vm/Xdr.cpp
+++ b/js/src/vm/Xdr.cpp
@@ -109,30 +109,30 @@ bool
 XDRState<mode>::codeFunction(MutableHandleFunction objp)
 {
     if (mode == XDR_DECODE)
         objp.set(nullptr);
 
     if (!VersionCheck(this))
         return false;
 
-    return XDRInterpretedFunction(this, NullPtr(), NullPtr(), objp);
+    return XDRInterpretedFunction(this, nullptr, nullptr, objp);
 }
 
 template<XDRMode mode>
 bool
 XDRState<mode>::codeScript(MutableHandleScript scriptp)
 {
     if (mode == XDR_DECODE)
         scriptp.set(nullptr);
 
     if (!VersionCheck(this))
         return false;
 
-    if (!XDRScript(this, NullPtr(), NullPtr(), NullPtr(), scriptp))
+    if (!XDRScript(this, nullptr, nullptr, nullptr, scriptp))
         return false;
 
     return true;
 }
 
 template<XDRMode mode>
 bool
 XDRState<mode>::codeConstValue(MutableHandleValue vp)
--- a/js/xpconnect/src/ExportHelpers.cpp
+++ b/js/xpconnect/src/ExportHelpers.cpp
@@ -132,17 +132,17 @@ StackScopedCloneRead(JSContext* cx, JSSt
         return nullptr;
       }
 
       // Prevent the return value from being trashed by a GC during ~nsRefPtr.
       JS::Rooted<JSObject*> result(cx);
       {
         nsRefPtr<MozNDEFRecord> ndefRecord = new MozNDEFRecord(global);
         result = ndefRecord->ReadStructuredClone(cx, reader) ?
-                 ndefRecord->WrapObject(cx, JS::NullPtr()) : nullptr;
+                 ndefRecord->WrapObject(cx, nullptr) : nullptr;
       }
       return result;
 #else
       return nullptr;
 #endif
     }
 
     MOZ_ASSERT_UNREACHABLE("Encountered garbage in the clone stream!");
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -213,31 +213,31 @@ SandboxCreateCrypto(JSContext* cx, JS::H
 {
     MOZ_ASSERT(JS_IsGlobalObject(obj));
 
     nsIGlobalObject* native = xpc::NativeGlobal(obj);
     MOZ_ASSERT(native);
 
     dom::Crypto* crypto = new dom::Crypto();
     crypto->Init(native);
-    JS::RootedObject wrapped(cx, crypto->WrapObject(cx, JS::NullPtr()));
+    JS::RootedObject wrapped(cx, crypto->WrapObject(cx, nullptr));
     return JS_DefineProperty(cx, obj, "crypto", wrapped, JSPROP_ENUMERATE);
 }
 
 static bool
 SandboxCreateRTCIdentityProvider(JSContext* cx, JS::HandleObject obj)
 {
     MOZ_ASSERT(JS_IsGlobalObject(obj));
 
     nsCOMPtr<nsIGlobalObject> nativeGlobal = xpc::NativeGlobal(obj);
     MOZ_ASSERT(nativeGlobal);
 
     dom::RTCIdentityProviderRegistrar* registrar =
             new dom::RTCIdentityProviderRegistrar(nativeGlobal);
-    JS::RootedObject wrapped(cx, registrar->WrapObject(cx, JS::NullPtr()));
+    JS::RootedObject wrapped(cx, registrar->WrapObject(cx, nullptr));
     return JS_DefineProperty(cx, obj, "rtcIdentityProvider", wrapped, JSPROP_ENUMERATE);
 }
 
 static bool
 SandboxIsProxy(JSContext* cx, unsigned argc, jsval* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() < 1) {
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -2849,17 +2849,17 @@ nsXPCComponents_Utils::CallFunctionWithA
     JS::Rooted<JSObject*> asyncStackObj(cx, &asyncStack.toObject());
     JS::Rooted<JSString*> asyncCauseString(cx, JS_NewUCStringCopyN(cx, asyncCause.BeginReading(),
                                                                        asyncCause.Length()));
     if (!asyncCauseString)
         return NS_ERROR_OUT_OF_MEMORY;
 
     JS::AutoSetAsyncStackForNewCalls sas(cx, asyncStackObj, asyncCauseString);
 
-    if (!JS_CallFunctionValue(cx, JS::NullPtr(), function,
+    if (!JS_CallFunctionValue(cx, nullptr, function,
                               JS::HandleValueArray::empty(), retval))
     {
         return NS_ERROR_XPC_JAVASCRIPT_ERROR;
     }
 
     return NS_OK;
 }
 
@@ -3294,17 +3294,17 @@ nsXPCComponents_Utils::GetIncumbentGloba
         globalVal = ObjectValue(*global->GetGlobalJSObject());
         if (!JS_WrapValue(aCx, &globalVal))
             return NS_ERROR_FAILURE;
     }
 
     // Invoke the callback, if passed.
     if (aCallback.isObject()) {
         RootedValue ignored(aCx);
-        if (!JS_CallFunctionValue(aCx, JS::NullPtr(), aCallback, JS::HandleValueArray(globalVal), &ignored))
+        if (!JS_CallFunctionValue(aCx, nullptr, aCallback, JS::HandleValueArray(globalVal), &ignored))
             return NS_ERROR_FAILURE;
     }
 
     aOut.set(globalVal);
     return NS_OK;
 }
 
 /*
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -777,17 +777,17 @@ XPCConvert::NativeInterface2JSObject(Mut
     // to use is found as cache->GetWrapper(). If that is null, then the
     // object will create (and fill the cache) from its WrapObject call.
     nsWrapperCache* cache = aHelper.GetWrapperCache();
 
     RootedObject flat(cx, cache ? cache->GetWrapper() : nullptr);
     if (!flat && cache && cache->IsDOMBinding()) {
         RootedObject global(cx, xpcscope->GetGlobalJSObject());
         js::AssertSameCompartment(cx, global);
-        flat = cache->WrapObject(cx, JS::NullPtr());
+        flat = cache->WrapObject(cx, nullptr);
         if (!flat)
             return false;
     }
     if (flat) {
         if (allowNativeWrapper && !JS_WrapObject(cx, &flat))
             return false;
         return CreateHolderIfNeeded(flat, d, dest);
     }
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -707,17 +707,17 @@ nsJSCID::Construct(nsIXPConnectWrappedNa
 {
     RootedObject obj(cx, objArg);
     XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
     if (!rt)
         return NS_ERROR_FAILURE;
 
     // 'push' a call context and call on it
     RootedId name(cx, rt->GetStringID(XPCJSRuntime::IDX_CREATE_INSTANCE));
-    XPCCallContext ccx(JS_CALLER, cx, obj, JS::NullPtr(), name, args.length(), args.array(),
+    XPCCallContext ccx(JS_CALLER, cx, obj, nullptr, name, args.length(), args.array(),
                        args.rval().address());
 
     *_retval = XPCWrappedNative::CallMethod(ccx);
     return NS_OK;
 }
 
 /* bool hasInstance (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval val, out bool bp); */
 NS_IMETHODIMP
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -575,17 +575,17 @@ XPCShellInterruptCallback(JSContext* cx)
     RootedValue callback(cx, sScriptedInterruptCallback);
 
     // If no interrupt callback was set by script, no-op.
     if (callback.isUndefined())
         return true;
 
     JSAutoCompartment ac(cx, &callback.toObject());
     RootedValue rv(cx);
-    if (!JS_CallFunctionValue(cx, JS::NullPtr(), callback, JS::HandleValueArray::empty(), &rv) ||
+    if (!JS_CallFunctionValue(cx, nullptr, callback, JS::HandleValueArray::empty(), &rv) ||
         !rv.isBoolean())
     {
         NS_WARNING("Scripted interrupt callback failed! Terminating script.");
         JS_ClearPendingException(cx);
         return false;
     }
 
     return rv.toBoolean();
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -410,17 +410,17 @@ DefinePropertyIfFound(XPCCallContext& cc
 }
 
 /***************************************************************************/
 /***************************************************************************/
 
 static bool
 XPC_WN_OnlyIWrite_AddPropertyStub(JSContext* cx, HandleObject obj, HandleId id, HandleValue v)
 {
-    XPCCallContext ccx(JS_CALLER, cx, obj, NullPtr(), id);
+    XPCCallContext ccx(JS_CALLER, cx, obj, nullptr, id);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
     THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
 
     // Allow only XPConnect to add/set the property
     if (ccx.GetResolveName() == id)
         return true;
 
     return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);
@@ -608,17 +608,17 @@ MarkWrappedNative(JSTracer* trc, JSObjec
 XPCWrappedNative::Trace(JSTracer* trc, JSObject* obj)
 {
     MarkWrappedNative(trc, obj);
 }
 
 static bool
 XPC_WN_NoHelper_Resolve(JSContext* cx, HandleObject obj, HandleId id, bool* resolvedp)
 {
-    XPCCallContext ccx(JS_CALLER, cx, obj, NullPtr(), id);
+    XPCCallContext ccx(JS_CALLER, cx, obj, nullptr, id);
     XPCWrappedNative* wrapper = ccx.GetWrapper();
     THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
 
     XPCNativeSet* set = ccx.GetSet();
     if (!set)
         return true;
 
     // Don't resolve properties that are on our prototype.
@@ -776,17 +776,17 @@ XPC_WN_Helper_SetProperty(JSContext* cx,
 
 static bool
 XPC_WN_Helper_Call(JSContext* cx, unsigned argc, jsval* vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     // N.B. we want obj to be the callee, not JS_THIS(cx, vp)
     RootedObject obj(cx, &args.callee());
 
-    XPCCallContext ccx(JS_CALLER, cx, obj, NullPtr(), JSID_VOIDHANDLE, args.length(),
+    XPCCallContext ccx(JS_CALLER, cx, obj, nullptr, JSID_VOIDHANDLE, args.length(),
                        args.array(), args.rval().address());
     if (!ccx.IsValid())
         return false;
 
     PRE_HELPER_STUB
     Call(wrapper, cx, obj, args, &retval);
     POST_HELPER_STUB
 }
@@ -794,17 +794,17 @@ XPC_WN_Helper_Call(JSContext* cx, unsign
 static bool
 XPC_WN_Helper_Construct(JSContext* cx, unsigned argc, jsval* vp)
 {
     JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     RootedObject obj(cx, &args.callee());
     if (!obj)
         return false;
 
-    XPCCallContext ccx(JS_CALLER, cx, obj, NullPtr(), JSID_VOIDHANDLE, args.length(),
+    XPCCallContext ccx(JS_CALLER, cx, obj, nullptr, JSID_VOIDHANDLE, args.length(),
                        args.array(), args.rval().address());
     if (!ccx.IsValid())
         return false;
 
     PRE_HELPER_STUB
     Construct(wrapper, cx, obj, args, &retval);
     POST_HELPER_STUB
 }
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -1255,17 +1255,17 @@ ReadScriptOrFunction(nsIObjectInputStrea
 
     free(data);
     return rv;
 }
 
 NS_IMETHODIMP
 nsXPConnect::WriteScript(nsIObjectOutputStream* stream, JSContext* cx, JSScript* script)
 {
-    return WriteScriptOrFunction(stream, cx, script, NullPtr());
+    return WriteScriptOrFunction(stream, cx, script, nullptr);
 }
 
 NS_IMETHODIMP
 nsXPConnect::ReadScript(nsIObjectInputStream* stream, JSContext* cx, JSScript** scriptp)
 {
     return ReadScriptOrFunction(stream, cx, scriptp, nullptr);
 }
 
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -815,18 +815,18 @@ public:
     NS_IMETHOD GetLanguage(uint16_t* aResult);
 
     enum {NO_ARGS = (unsigned) -1};
 
     static JSContext* GetDefaultJSContext();
 
     XPCCallContext(XPCContext::LangType callerLanguage,
                    JSContext* cx,
-                   JS::HandleObject obj    = JS::NullPtr(),
-                   JS::HandleObject funobj = JS::NullPtr(),
+                   JS::HandleObject obj    = nullptr,
+                   JS::HandleObject funobj = nullptr,
                    JS::HandleId id         = JSID_VOIDHANDLE,
                    unsigned argc           = NO_ARGS,
                    jsval* argv             = nullptr,
                    jsval* rval             = nullptr);
 
     virtual ~XPCCallContext();
 
     inline bool                         IsValid() const ;
@@ -1280,17 +1280,17 @@ public:
     jsid   GetName() const {return mName;}
 
     uint16_t GetIndex() const {return mIndex;}
 
     bool GetConstantValue(XPCCallContext& ccx, XPCNativeInterface* iface,
                           jsval* pval)
         {MOZ_ASSERT(IsConstant(),
                     "Only call this if you're sure this is a constant!");
-         return Resolve(ccx, iface, JS::NullPtr(), pval);}
+         return Resolve(ccx, iface, nullptr, pval);}
 
     bool NewFunctionObject(XPCCallContext& ccx, XPCNativeInterface* iface,
                            JS::HandleObject parent, jsval* pval);
 
     bool IsMethod() const
         {return 0 != (mFlags & METHOD);}
 
     bool IsConstant() const
@@ -3506,17 +3506,17 @@ class MOZ_STACK_CLASS FunctionForwarderO
 public:
     explicit FunctionForwarderOptions(JSContext* cx = xpc_GetSafeJSContext(),
                                       JSObject* options = nullptr)
         : OptionsBase(cx, options)
         , allowCrossOriginArguments(false)
     { }
 
     JSObject* ToJSObject(JSContext* cx) {
-        JS::RootedObject obj(cx, JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr()));
+        JS::RootedObject obj(cx, JS_NewObjectWithGivenProto(cx, nullptr, nullptr));
         if (!obj)
             return nullptr;
 
         JS::RootedValue val(cx);
         unsigned attrs = JSPROP_READONLY | JSPROP_PERMANENT;
         val = JS::BooleanValue(allowCrossOriginArguments);
         if (!JS_DefineProperty(cx, obj, "allowCrossOriginArguments", val, attrs))
             return nullptr;
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -783,17 +783,17 @@ JSXrayTraits::enumerateNames(JSContext* 
     return true;
 }
 
 JSObject*
 JSXrayTraits::createHolder(JSContext* cx, JSObject* wrapper)
 {
     RootedObject target(cx, getTargetObject(wrapper));
     RootedObject holder(cx, JS_NewObjectWithGivenProto(cx, &HolderClass,
-                                                       JS::NullPtr()));
+                                                       nullptr));
     if (!holder)
         return nullptr;
 
     // Compute information about the target.
     bool isPrototype = false;
     JSProtoKey key = IdentifyStandardInstance(target);
     if (key == JSProto_Null) {
         isPrototype = true;
@@ -981,17 +981,17 @@ XrayTraits::attachExpandoObject(JSContex
             MOZ_ASSERT(!existingExpandoObject);
         else
             JS_ClearPendingException(cx);
     }
 #endif
 
     // Create the expando object.
     RootedObject expandoObject(cx,
-      JS_NewObjectWithGivenProto(cx, &ExpandoObjectClass, JS::NullPtr()));
+      JS_NewObjectWithGivenProto(cx, &ExpandoObjectClass, nullptr));
     if (!expandoObject)
         return nullptr;
 
     // AddRef and store the principal.
     NS_ADDREF(origin);
     JS_SetReservedSlot(expandoObject, JSSLOT_EXPANDO_ORIGIN, PRIVATE_TO_JSVAL(origin));
 
     // Note the exclusive global, if any.
@@ -1027,17 +1027,17 @@ XrayTraits::ensureExpandoObject(JSContex
         //
         // NB: We first need to check the class, _then_ wrap for the target's
         // compartment.
         RootedObject consumerGlobal(cx, js::GetGlobalForObjectCrossCompartment(wrapper));
         bool isSandbox = !strcmp(js::GetObjectJSClass(consumerGlobal)->name, "Sandbox");
         if (!JS_WrapObject(cx, &consumerGlobal))
             return nullptr;
         expandoObject = attachExpandoObject(cx, target, ObjectPrincipal(wrapper),
-                                            isSandbox ? (HandleObject)consumerGlobal : NullPtr());
+                                            isSandbox ? (HandleObject)consumerGlobal : nullptr);
     }
     return expandoObject;
 }
 
 bool
 XrayTraits::cloneExpandoChain(JSContext* cx, HandleObject dst, HandleObject src)
 {
     MOZ_ASSERT(js::IsObjectInContextCompartment(dst, cx));
@@ -1163,17 +1163,17 @@ XPCWrappedNativeXrayTraits::resolveNativ
                                                   MutableHandle<JSPropertyDescriptor> desc)
 {
     MOZ_ASSERT(js::GetObjectJSClass(holder) == &HolderClass);
 
     desc.object().set(nullptr);
 
     // This will do verification and the method lookup for us.
     RootedObject target(cx, getTargetObject(wrapper));
-    XPCCallContext ccx(JS_CALLER, cx, target, NullPtr(), id);
+    XPCCallContext ccx(JS_CALLER, cx, target, nullptr, id);
 
     // There are no native numeric (or symbol-keyed) properties, so we can
     // shortcut here. We will not find the property.
     if (!JSID_IS_STRING(id))
         return true;
 
     // The |controllers| property is accessible as a [ChromeOnly] property on
     // Window.WebIDL, and [noscript] in XPIDL. Chrome needs to see this over
@@ -1479,28 +1479,28 @@ XPCWrappedNativeXrayTraits::enumerateNam
         JS_ClearPendingException(cx);
     }
     return true;
 }
 
 JSObject*
 XPCWrappedNativeXrayTraits::createHolder(JSContext* cx, JSObject* wrapper)
 {
-    return JS_NewObjectWithGivenProto(cx, &HolderClass, JS::NullPtr());
+    return JS_NewObjectWithGivenProto(cx, &HolderClass, nullptr);
 }
 
 bool
 XPCWrappedNativeXrayTraits::call(JSContext* cx, HandleObject wrapper,
                                  const JS::CallArgs& args,
                                  const js::Wrapper& baseInstance)
 {
     // Run the call hook of the wrapped native.
     XPCWrappedNative* wn = getWN(wrapper);
     if (NATIVE_HAS_FLAG(wn, WantCall)) {
-        XPCCallContext ccx(JS_CALLER, cx, wrapper, NullPtr(), JSID_VOIDHANDLE, args.length(),
+        XPCCallContext ccx(JS_CALLER, cx, wrapper, nullptr, JSID_VOIDHANDLE, args.length(),
                            args.array(), args.rval().address());
         if (!ccx.IsValid())
             return false;
         bool ok = true;
         nsresult rv = wn->GetScriptableInfo()->GetCallback()->Call(
             wn, cx, wrapper, args, &ok);
         if (NS_FAILED(rv)) {
             if (ok)
@@ -1516,17 +1516,17 @@ XPCWrappedNativeXrayTraits::call(JSConte
 bool
 XPCWrappedNativeXrayTraits::construct(JSContext* cx, HandleObject wrapper,
                                       const JS::CallArgs& args,
                                       const js::Wrapper& baseInstance)
 {
     // Run the construct hook of the wrapped native.
     XPCWrappedNative* wn = getWN(wrapper);
     if (NATIVE_HAS_FLAG(wn, WantConstruct)) {
-        XPCCallContext ccx(JS_CALLER, cx, wrapper, NullPtr(), JSID_VOIDHANDLE, args.length(),
+        XPCCallContext ccx(JS_CALLER, cx, wrapper, nullptr, JSID_VOIDHANDLE, args.length(),
                            args.array(), args.rval().address());
         if (!ccx.IsValid())
             return false;
         bool ok = true;
         nsresult rv = wn->GetScriptableInfo()->GetCallback()->Construct(
             wn, cx, wrapper, args, &ok);
         if (NS_FAILED(rv)) {
             if (ok)
@@ -1694,17 +1694,17 @@ DOMXrayTraits::preserveWrapper(JSObject*
     CallQueryInterface(identity, &cache);
     if (cache)
         cache->PreserveWrapper(identity);
 }
 
 JSObject*
 DOMXrayTraits::createHolder(JSContext* cx, JSObject* wrapper)
 {
-    return JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr());
+    return JS_NewObjectWithGivenProto(cx, nullptr, nullptr);
 }
 
 namespace XrayUtils {
 
 JSObject*
 GetNativePropertiesObject(JSContext* cx, JSObject* wrapper)
 {
     MOZ_ASSERT(js::IsWrapper(wrapper) && WrapperFactory::IsXrayWrapper(wrapper),
--- a/js/xpconnect/wrappers/XrayWrapper.h
+++ b/js/xpconnect/wrappers/XrayWrapper.h
@@ -394,17 +394,17 @@ public:
     static const char* className(JSContext* cx, JS::HandleObject wrapper, const js::Wrapper& baseInstance) {
         return "Opaque";
     }
 
     virtual void preserveWrapper(JSObject* target) override { }
 
     virtual JSObject* createHolder(JSContext* cx, JSObject* wrapper) override
     {
-        return JS_NewObjectWithGivenProto(cx, nullptr, JS::NullPtr());
+        return JS_NewObjectWithGivenProto(cx, nullptr, nullptr);
     }
 
     static OpaqueXrayTraits singleton;
 };
 
 XrayType GetXrayType(JSObject* obj);
 XrayTraits* GetXrayTraits(JSObject* obj);
 
--- a/widget/android/NativeJSContainer.cpp
+++ b/widget/android/NativeJSContainer.cpp
@@ -995,17 +995,17 @@ Java_org_mozilla_gecko_util_NativeJSObje
     }
 
     const JS::RootedObject object(cx, NativeJSContainer::GetObjectFromObject(env, instance));
     JS::RootedValue value(cx, JS::ObjectValue(*object));
     nsAutoString json;
 
     if (!object ||
         !CheckJSCall(env,
-            JS_Stringify(cx, &value, JS::NullPtr(), JS::NullHandleValue, AppendJSON, &json))) {
+            JS_Stringify(cx, &value, nullptr, JS::NullHandleValue, AppendJSON, &json))) {
         return nullptr;
     }
     jstring ret = env->NewString(reinterpret_cast<const jchar*>(json.get()), json.Length());
     MOZ_ASSERT(ret);
     return ret;
 }
 
 } // extern "C"
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -123,17 +123,17 @@ static void
 TraceWeakMappingChild(JS::CallbackTracer* aTrc, void** aThingp,
                       JSGCTraceKind aKind);
 
 struct NoteWeakMapChildrenTracer : public JS::CallbackTracer
 {
   NoteWeakMapChildrenTracer(JSRuntime* aRt,
                             nsCycleCollectionNoteRootCallback& aCb)
     : JS::CallbackTracer(aRt, TraceWeakMappingChild), mCb(aCb),
-      mTracedAny(false), mMap(nullptr), mKey(JS::GCCellPtr::NullPtr()),
+      mTracedAny(false), mMap(nullptr), mKey(nullptr),
       mKeyDelegate(nullptr)
   {
   }
   nsCycleCollectionNoteRootCallback& mCb;
   bool mTracedAny;
   JSObject* mMap;
   JS::GCCellPtr mKey;
   JSObject* mKeyDelegate;
@@ -197,17 +197,17 @@ TraceWeakMapping(js::WeakMapTracer* aTrc
   // uses of weak maps use either objects or scripts as keys, which are okay.
   MOZ_ASSERT(AddToCCKind(aKey.kind()));
 
   // As an emergency fallback for non-debug builds, if the key is not
   // representable in the cycle collector graph, we treat it as marked.  This
   // can cause leaks, but is preferable to ignoring the binding, which could
   // cause the cycle collector to free live objects.
   if (!AddToCCKind(aKey.kind())) {
-    aKey = JS::GCCellPtr::NullPtr();
+    aKey = nullptr;
   }
 
   JSObject* kdelegate = nullptr;
   if (aKey.isObject()) {
     kdelegate = js::GetWeakmapKeyDelegate(aKey.toObject());
   }
 
   if (AddToCCKind(aValue.kind())) {
@@ -221,18 +221,17 @@ TraceWeakMapping(js::WeakMapTracer* aTrc
     if (aValue.isString()) {
       JS_TraceChildren(&tracer->mChildTracer, aValue.asCell(), aValue.kind());
     }
 
     // The delegate could hold alive the key, so report something to the CC
     // if we haven't already.
     if (!tracer->mChildTracer.mTracedAny &&
         aKey && JS::GCThingIsMarkedGray(aKey) && kdelegate) {
-      tracer->mCb.NoteWeakMapping(aMap, aKey, kdelegate,
-                                  JS::GCCellPtr::NullPtr());
+      tracer->mCb.NoteWeakMapping(aMap, aKey, kdelegate, nullptr);
     }
   }
 }
 
 // This is based on the logic in TraceWeakMapping.
 struct FixWeakMappingGrayBitsTracer : public js::WeakMapTracer
 {
   explicit FixWeakMappingGrayBitsTracer(JSRuntime* aRt)
@@ -262,17 +261,17 @@ private:
     bool delegateMightNeedMarking = aKey && JS::GCThingIsMarkedGray(aKey);
     bool valueMightNeedMarking = aValue && JS::GCThingIsMarkedGray(aValue) &&
                                  aValue.kind() != JSTRACE_STRING;
     if (!delegateMightNeedMarking && !valueMightNeedMarking) {
       return;
     }
 
     if (!AddToCCKind(aKey.kind())) {
-      aKey = JS::GCCellPtr::NullPtr();
+      aKey = nullptr;
     }
 
     if (delegateMightNeedMarking && aKey.isObject()) {
       JSObject* kdelegate = js::GetWeakmapKeyDelegate(aKey.toObject());
       if (kdelegate && !JS::ObjectIsMarkedGray(kdelegate)) {
         if (JS::UnmarkGrayGCThingRecursively(aKey)) {
           tracer->mAnyMarked = true;
         }