Bug 1648010 - Remove NS_NAMED_LITERAL_CSTRING and NS_NAMED_LITERAL_STRING macros. r=froydnj
authorSimon Giesecke <sgiesecke@mozilla.com>
Wed, 01 Jul 2020 08:42:31 +0000
changeset 538160 e52e5ee6f9d6217f3be04a71ff089148116f8fb0
parent 538159 3d7ffaefcd5a6c10988a1ecc3b75c3d55e1cd9e2
child 538161 b2142123046300857dc78bb694d5c7ce2a443604
push id37559
push userrmaries@mozilla.com
push dateWed, 01 Jul 2020 21:32:12 +0000
treeherdermozilla-central@597ca7dea687 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1648010
milestone80.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 1648010 - Remove NS_NAMED_LITERAL_CSTRING and NS_NAMED_LITERAL_STRING macros. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D80631
accessible/base/nsCoreUtils.cpp
accessible/windows/msaa/Compatibility.cpp
accessible/windows/msaa/CompatibilityUIA.cpp
accessible/windows/msaa/Platform.cpp
caps/BasePrincipal.cpp
caps/tests/gtest/TestOriginAttributes.cpp
chrome/nsChromeRegistry.cpp
docshell/base/nsPingListener.cpp
dom/base/BodyUtil.cpp
dom/base/Document.cpp
dom/base/Navigator.cpp
dom/base/Selection.cpp
dom/base/nsJSEnvironment.cpp
dom/base/nsObjectLoadingContent.cpp
dom/base/nsXMLContentSerializer.cpp
dom/base/test/gtest/TestParser.cpp
dom/cache/QuotaClient.cpp
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/CanvasRenderingContextHelper.cpp
dom/file/uri/BlobURLProtocolHandler.cpp
dom/filesystem/FileSystemUtils.cpp
dom/html/HTMLMediaElement.cpp
dom/html/PluginDocument.cpp
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/ProfilerHelpers.h
dom/ipc/ContentParent.cpp
dom/jsurl/nsJSProtocolHandler.cpp
dom/localstorage/ActorsParent.cpp
dom/media/VideoUtils.cpp
dom/media/eme/MediaKeySystemAccess.cpp
dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp
dom/media/gmp/ChromiumCDMParent.cpp
dom/media/gmp/ChromiumCDMProxy.cpp
dom/media/gtest/TestCDMStorage.cpp
dom/media/platforms/android/AndroidDecoderModule.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginsDirUnix.cpp
dom/plugins/ipc/FunctionHook.cpp
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleParent.cpp
dom/quota/ActorsParent.cpp
dom/quota/PersistenceType.cpp
dom/quota/QuotaCommon.cpp
dom/quota/test/gtest/TestQuotaManager.cpp
dom/script/ScriptLoader.cpp
dom/security/nsContentSecurityUtils.cpp
dom/security/test/gtest/TestFilenameEvalParser.cpp
dom/serviceworkers/ServiceWorkerContainer.cpp
dom/simpledb/ActorsParent.cpp
dom/u2f/U2F.cpp
dom/u2f/U2FAuthenticator.h
dom/webauthn/AndroidWebAuthnTokenManager.h
dom/webauthn/U2FSoftTokenManager.cpp
dom/webauthn/WebAuthnManagerBase.cpp
dom/webauthn/WebAuthnUtil.cpp
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
dom/workers/RuntimeService.cpp
dom/xml/nsXMLContentSink.cpp
dom/xslt/xslt/txMozillaXSLTProcessor.cpp
dom/xul/nsXULContentSink.cpp
editor/libeditor/CSSEditUtils.cpp
editor/libeditor/HTMLEditSubActionHandler.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditorObjectResizer.cpp
editor/libeditor/TextEditor.cpp
extensions/auth/nsAuthGSSAPI.cpp
extensions/pref/autoconfig/src/nsReadConfig.cpp
image/ImageMemoryReporter.cpp
intl/strres/nsStringBundle.cpp
ipc/glue/GeckoChildProcessHost.cpp
js/xpconnect/loader/ScriptPreloader.cpp
js/xpconnect/src/XPCJSRuntime.cpp
layout/base/AccessibleCaret.cpp
layout/base/PresShell.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsPageFrame.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/printing/nsPrintJob.cpp
layout/style/test/gtest/StyloParsingBench.cpp
layout/xul/nsMenuBarFrame.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
layout/xul/tree/nsTreeSelection.cpp
media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
modules/libpref/Preferences.cpp
mozglue/tests/gtest/TestDLLBlocklist.cpp
netwerk/base/CaptivePortalService.cpp
netwerk/base/nsIncrementalDownload.cpp
netwerk/base/nsURLHelperOSX.cpp
netwerk/base/nsURLHelperUnix.cpp
netwerk/base/nsURLHelperWin.cpp
netwerk/cookie/CookiePersistentStorage.cpp
netwerk/cookie/CookieService.cpp
netwerk/dns/TRRService.cpp
netwerk/protocol/about/nsAboutCacheEntry.cpp
netwerk/protocol/data/nsDataHandler.cpp
netwerk/protocol/http/AlternateServices.cpp
netwerk/protocol/http/HttpTrafficAnalyzer.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/viewsource/nsViewSourceChannel.cpp
netwerk/test/gtest/TestIsValidIp.cpp
security/manager/ssl/ContentSignatureVerifier.cpp
security/manager/ssl/LocalCertService.cpp
security/manager/ssl/nsNSSCallbacks.cpp
security/manager/ssl/nsNSSComponent.cpp
security/manager/ssl/nsSiteSecurityService.cpp
security/manager/ssl/tests/gtest/DataStorageTest.cpp
security/manager/ssl/tests/gtest/TLSIntoleranceTest.cpp
startupcache/test/TestStartupCache.cpp
storage/mozStorageService.cpp
toolkit/components/antitracking/ContentBlockingLog.cpp
toolkit/components/extensions/MatchPattern.cpp
toolkit/components/telemetry/core/Telemetry.cpp
toolkit/components/telemetry/core/TelemetryHistogram.cpp
toolkit/components/telemetry/core/TelemetryOrigin.cpp
toolkit/components/telemetry/geckoview/gtest/TestGeckoViewStreaming.cpp
toolkit/components/telemetry/other/UntrustedModules.cpp
toolkit/components/telemetry/tests/gtest/TestOrigins.cpp
toolkit/mozapps/extensions/AddonManagerStartup.cpp
toolkit/profile/nsProfileLock.cpp
toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsGDKErrorHandler.cpp
toolkit/xre/nsNativeAppSupportUnix.cpp
toolkit/xre/nsXREDirProvider.cpp
tools/profiler/core/shared-libraries-win32.cc
uriloader/base/nsURILoader.cpp
uriloader/exthandler/win/nsMIMEInfoWin.cpp
widget/gtk/nsLookAndFeel.cpp
widget/nsPrintSettingsService.cpp
widget/windows/GfxInfo.cpp
widget/windows/WinUtils.cpp
widget/windows/nsDataObj.cpp
widget/windows/tests/TestWinDND.cpp
xpcom/build/Omnijar.cpp
xpcom/components/ManifestParser.cpp
xpcom/io/FileUtilsWin.h
xpcom/io/nsLocalFileCommon.cpp
xpcom/io/nsLocalFileWin.cpp
xpcom/string/nsLiteralString.h
xpcom/tests/gtest/TestArenaAllocator.cpp
xpcom/tests/gtest/TestBase64.cpp
xpcom/tests/gtest/TestStrings.cpp
xpcom/tests/gtest/TestTokenizer.cpp
--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -372,18 +372,18 @@ bool nsCoreUtils::IsErrorPage(Document* 
   nsIURI* uri = aDocument->GetDocumentURI();
   if (!uri->SchemeIs("about")) {
     return false;
   }
 
   nsAutoCString path;
   uri->GetPathQueryRef(path);
 
-  NS_NAMED_LITERAL_CSTRING(neterror, "neterror");
-  NS_NAMED_LITERAL_CSTRING(certerror, "certerror");
+  constexpr auto neterror = "neterror"_ns;
+  constexpr auto certerror = "certerror"_ns;
 
   return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
 }
 
 bool nsCoreUtils::GetID(nsIContent* aContent, nsAString& aID) {
   return aContent->IsElement() &&
          aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aID);
 }
--- a/accessible/windows/msaa/Compatibility.cpp
+++ b/accessible/windows/msaa/Compatibility.cpp
@@ -290,38 +290,37 @@ static bool IsSystemOleAcc(nsCOMPtr<nsIF
   bool isEqual;
   rv = oleAcc->Equals(aFile, &isEqual);
   return NS_SUCCEEDED(rv) && isEqual;
 }
 
 static bool IsTypelibPreferred() {
   // If IAccessible's Proxy/Stub CLSID is kUniversalMarshalerClsid, then any
   // external a11y clients are expecting to use a typelib.
-  NS_NAMED_LITERAL_STRING(kUniversalMarshalerClsid,
-                          "{00020424-0000-0000-C000-000000000046}");
+  constexpr auto kUniversalMarshalerClsid =
+      u"{00020424-0000-0000-C000-000000000046}"_ns;
 
-  NS_NAMED_LITERAL_STRING(
-      kIAccessiblePSClsidPath,
-      "Interface\\{618736E0-3C3D-11CF-810C-00AA00389B71}\\ProxyStubClsid32");
+  constexpr auto kIAccessiblePSClsidPath =
+      "Interface\\{618736E0-3C3D-11CF-810C-00AA00389B71}"
+      u"\\ProxyStubClsid32"_ns;
 
   nsAutoString psClsid;
   if (!ReadCOMRegDefaultString(kIAccessiblePSClsidPath, psClsid)) {
     return false;
   }
 
   return psClsid.Equals(kUniversalMarshalerClsid,
                         nsCaseInsensitiveStringComparator);
 }
 
 static bool IsIAccessibleTypelibRegistered() {
   // The system default IAccessible typelib is always registered with version
   // 1.1, under the neutral locale (LCID 0).
-  NS_NAMED_LITERAL_STRING(
-      kIAccessibleTypelibRegPath,
-      "TypeLib\\{1EA4DBF0-3C3B-11CF-810C-00AA00389B71}\\1.1\\0\\win32");
+  constexpr auto kIAccessibleTypelibRegPath =
+      u"TypeLib\\{1EA4DBF0-3C3B-11CF-810C-00AA00389B71}\\1.1\\0\\win32"_ns;
 
   nsAutoString typelibPath;
   if (!ReadCOMRegDefaultString(kIAccessibleTypelibRegPath, typelibPath)) {
     return false;
   }
 
   nsCOMPtr<nsIFile> libTestFile;
   nsresult rv =
@@ -329,19 +328,18 @@ static bool IsIAccessibleTypelibRegister
   if (NS_FAILED(rv)) {
     return false;
   }
 
   return IsSystemOleAcc(libTestFile);
 }
 
 static bool IsIAccessiblePSRegistered() {
-  NS_NAMED_LITERAL_STRING(
-      kIAccessiblePSRegPath,
-      "CLSID\\{03022430-ABC4-11D0-BDE2-00AA001A1953}\\InProcServer32");
+  constexpr auto kIAccessiblePSRegPath =
+      u"CLSID\\{03022430-ABC4-11D0-BDE2-00AA001A1953}\\InProcServer32"_ns;
 
   nsAutoString proxyStubPath;
   if (!ReadCOMRegDefaultString(kIAccessiblePSRegPath, proxyStubPath)) {
     return false;
   }
 
   nsCOMPtr<nsIFile> libTestFile;
   nsresult rv =
--- a/accessible/windows/msaa/CompatibilityUIA.cpp
+++ b/accessible/windows/msaa/CompatibilityUIA.cpp
@@ -156,17 +156,17 @@ namespace a11y {
 Maybe<DWORD> Compatibility::sUiaRemotePid;
 
 Maybe<bool> Compatibility::OnUIAMessage(WPARAM aWParam, LPARAM aLParam) {
   auto clearUiaRemotePid = MakeScopeExit([]() { sUiaRemotePid = Nothing(); });
 
   Telemetry::AutoTimer<Telemetry::A11Y_UIA_DETECTION_TIMING_MS> timer;
 
   // UIA creates a section containing the substring "HOOK_SHMEM_"
-  NS_NAMED_LITERAL_STRING(kStrHookShmem, "HOOK_SHMEM_");
+  constexpr auto kStrHookShmem = u"HOOK_SHMEM_"_ns;
 
   // The section name always ends with this suffix, which is derived from the
   // current thread id and the UIA message's WPARAM and LPARAM.
   nsAutoString partialSectionSuffix;
   partialSectionSuffix.AppendPrintf("_%08x_%08x_%08x", ::GetCurrentThreadId(),
                                     static_cast<DWORD>(aLParam), aWParam);
 
   // Find any named Section that matches the naming convention of the UIA shared
--- a/accessible/windows/msaa/Platform.cpp
+++ b/accessible/windows/msaa/Platform.cpp
@@ -279,17 +279,17 @@ static void AppendVersionInfo(nsIFile* a
     return;
   }
 
   uint16_t major, minor, patch, build;
   Tie(major, minor, patch, build) = version.unwrap().AsTuple();
 
   aStrToAppend.AppendLiteral(u"|");
 
-  NS_NAMED_LITERAL_STRING(dot, ".");
+  constexpr auto dot = u"."_ns;
 
   aStrToAppend.AppendInt(major);
   aStrToAppend.Append(dot);
   aStrToAppend.AppendInt(minor);
   aStrToAppend.Append(dot);
   aStrToAppend.AppendInt(patch);
   aStrToAppend.Append(dot);
   aStrToAppend.AppendInt(build);
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -662,17 +662,17 @@ BasePrincipal::AllowsRelaxStrictFileOrig
   *aRes = NS_RelaxStrictFileOriginPolicy(aURI, prinURI);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BasePrincipal::GetPrefLightCacheKey(nsIURI* aURI, bool aWithCredentials,
                                     nsACString& _retval) {
   _retval.Truncate();
-  NS_NAMED_LITERAL_CSTRING(space, " ");
+  constexpr auto space = " "_ns;
 
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetURI(getter_AddRefs(uri));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString scheme, host, port;
   if (uri) {
     uri->GetScheme(scheme);
--- a/caps/tests/gtest/TestOriginAttributes.cpp
+++ b/caps/tests/gtest/TestOriginAttributes.cpp
@@ -105,20 +105,19 @@ TEST(OriginAttributes, FirstPartyDomain_
 
 TEST(OriginAttributes, NullPrincipal)
 {
   bool oldFpiPref = Preferences::GetBool(FPI_PREF);
   Preferences::SetBool(FPI_PREF, true);
   bool oldSitePref = Preferences::GetBool(SITE_PREF);
   Preferences::SetBool(SITE_PREF, true);
 
-  NS_NAMED_LITERAL_STRING(
-      spec, "moz-nullprincipal:{9bebdabb-828a-4284-8b00-432a968c6e42}");
-  NS_NAMED_LITERAL_STRING(expected,
-                          "9bebdabb-828a-4284-8b00-432a968c6e42.mozilla");
+  constexpr auto spec =
+      u"moz-nullprincipal:{9bebdabb-828a-4284-8b00-432a968c6e42}"_ns;
+  constexpr auto expected = u"9bebdabb-828a-4284-8b00-432a968c6e42.mozilla"_ns;
 
   nsCOMPtr<nsIURI> uri;
   NS_NewURI(getter_AddRefs(uri), spec);
 
   RefPtr<NullPrincipal> prin = new NullPrincipal();
   prin->Init(OriginAttributes(), true, uri);
   EXPECT_TRUE(prin->OriginAttributesRef().mFirstPartyDomain.Equals(expected));
 
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -165,17 +165,17 @@ nsresult nsChromeRegistry::GetProviderAn
     --slash;
   }
 
   aProvider.Assign(path.get() + 1, slash);
   return NS_OK;
 }
 
 nsresult nsChromeRegistry::Canonify(nsCOMPtr<nsIURI>& aChromeURL) {
-  NS_NAMED_LITERAL_CSTRING(kSlash, "/");
+  constexpr auto kSlash = "/"_ns;
 
   nsresult rv;
 
   nsAutoCString provider, path;
   rv = GetProviderAndPath(aChromeURL, provider, path);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (path.IsEmpty()) {
--- a/docshell/base/nsPingListener.cpp
+++ b/docshell/base/nsPingListener.cpp
@@ -188,17 +188,17 @@ static void SendPing(void* aClosure, nsI
     }
   }
 
   nsCOMPtr<nsIUploadChannel2> uploadChan = do_QueryInterface(httpChan);
   if (!uploadChan) {
     return;
   }
 
-  NS_NAMED_LITERAL_CSTRING(uploadData, "PING");
+  constexpr auto uploadData = "PING"_ns;
 
   nsCOMPtr<nsIInputStream> uploadStream;
   rv = NS_NewCStringInputStream(getter_AddRefs(uploadStream), uploadData);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 
   uploadChan->ExplicitSetUploadStream(uploadStream, "text/ping"_ns,
--- a/dom/base/BodyUtil.cpp
+++ b/dom/base/BodyUtil.cpp
@@ -415,17 +415,17 @@ already_AddRefed<Blob> BodyUtil::Consume
   return blob.forget();
 }
 
 // static
 already_AddRefed<FormData> BodyUtil::ConsumeFormData(nsIGlobalObject* aParent,
                                                      const nsCString& aMimeType,
                                                      const nsCString& aStr,
                                                      ErrorResult& aRv) {
-  NS_NAMED_LITERAL_CSTRING(formDataMimeType, "multipart/form-data");
+  constexpr auto formDataMimeType = "multipart/form-data"_ns;
 
   // Allow semicolon separated boundary/encoding suffix like
   // multipart/form-data; boundary= but disallow multipart/form-datafoobar.
   bool isValidFormDataMimeType = StringBeginsWith(aMimeType, formDataMimeType);
 
   if (isValidFormDataMimeType &&
       aMimeType.Length() > formDataMimeType.Length()) {
     isValidFormDataMimeType = aMimeType[formDataMimeType.Length()] == ';';
@@ -438,18 +438,17 @@ already_AddRefed<FormData> BodyUtil::Con
       return nullptr;
     }
 
     RefPtr<FormData> fd = parser.GetFormData();
     MOZ_ASSERT(fd);
     return fd.forget();
   }
 
-  NS_NAMED_LITERAL_CSTRING(urlDataMimeType,
-                           "application/x-www-form-urlencoded");
+  constexpr auto urlDataMimeType = "application/x-www-form-urlencoded"_ns;
   bool isValidUrlEncodedMimeType = StringBeginsWith(aMimeType, urlDataMimeType);
 
   if (isValidUrlEncodedMimeType &&
       aMimeType.Length() > urlDataMimeType.Length()) {
     isValidUrlEncodedMimeType = aMimeType[urlDataMimeType.Length()] == ';';
   }
 
   if (isValidUrlEncodedMimeType) {
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -9078,17 +9078,17 @@ void Document::WriteCommon(const nsAStri
     // If Open() fails, or if it didn't create a parser (as it won't
     // if the user chose to not discard the current document through
     // onbeforeunload), don't write anything.
     if (aRv.Failed() || !mParser) {
       return;
     }
   }
 
-  static NS_NAMED_LITERAL_STRING(new_line, "\n");
+  static constexpr auto new_line = u"\n"_ns;
 
   ++mWriteLevel;
 
   // This could be done with less code, but for performance reasons it
   // makes sense to have the code for two separate Parse() calls here
   // since the concatenation of strings costs more than we like. And
   // why pay that price when we don't need to?
   if (aNewlineTerminate) {
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -645,17 +645,17 @@ void Navigator::RefreshMIMEArray() {
 namespace {
 
 class VibrateWindowListener : public nsIDOMEventListener {
  public:
   VibrateWindowListener(nsPIDOMWindowInner* aWindow, Document* aDocument) {
     mWindow = do_GetWeakReference(aWindow);
     mDocument = do_GetWeakReference(aDocument);
 
-    NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
+    constexpr auto visibilitychange = u"visibilitychange"_ns;
     aDocument->AddSystemEventListener(visibilitychange, this, /* listener */
                                       true,                   /* use capture */
                                       false /* wants untrusted */);
   }
 
   void RemoveListener();
 
   NS_DECL_ISUPPORTS
@@ -696,17 +696,17 @@ VibrateWindowListener::HandleEvent(Event
   return NS_OK;
 }
 
 void VibrateWindowListener::RemoveListener() {
   nsCOMPtr<EventTarget> target = do_QueryReferent(mDocument);
   if (!target) {
     return;
   }
-  NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
+  constexpr auto visibilitychange = u"visibilitychange"_ns;
   target->RemoveSystemEventListener(visibilitychange, this,
                                     true /* use capture */);
 }
 
 }  // namespace
 
 void Navigator::SetVibrationPermission(bool aPermitted, bool aPersistent) {
   MOZ_ASSERT(NS_IsMainThread());
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -3509,18 +3509,18 @@ void Selection::SetColors(const nsAStrin
                           ErrorResult& aRv) {
   if (mSelectionType != SelectionType::eFind) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   mCustomColors.reset(new SelectionCustomColors);
 
-  NS_NAMED_LITERAL_STRING(currentColorStr, "currentColor");
-  NS_NAMED_LITERAL_STRING(transparentStr, "transparent");
+  constexpr auto currentColorStr = u"currentColor"_ns;
+  constexpr auto transparentStr = u"transparent"_ns;
 
   if (!aForegroundColor.Equals(currentColorStr)) {
     nscolor foregroundColor;
     nsAttrValue aForegroundColorValue;
     aForegroundColorValue.ParseColor(aForegroundColor);
     if (!aForegroundColorValue.GetColorValue(foregroundColor)) {
       aRv.Throw(NS_ERROR_INVALID_ARG);
       return;
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -505,17 +505,17 @@ class ScriptErrorEvent : public Runnable
 
       RefPtr<nsPresContext> presContext = win->GetDocShell()->GetPresContext();
 
       RootedDictionary<ErrorEventInit> init(rootingCx);
       init.mCancelable = true;
       init.mFilename = mReport->mFileName;
       init.mBubbles = true;
 
-      NS_NAMED_LITERAL_STRING(xoriginMsg, "Script error.");
+      constexpr auto xoriginMsg = u"Script error."_ns;
       if (!mReport->mIsMuted) {
         init.mMessage = mReport->mErrorMsg;
         init.mLineno = mReport->mLineNumber;
         init.mColno = mReport->mColumn;
         init.mError = mError;
       } else {
         NS_WARNING("Not same origin error!");
         init.mMessage = xoriginMsg;
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -805,17 +805,17 @@ void nsObjectLoadingContent::GetPluginPa
 }
 
 void nsObjectLoadingContent::GetNestedParams(
     nsTArray<MozPluginParameter>& aParams) {
   nsCOMPtr<Element> ourElement =
       do_QueryInterface(static_cast<nsIObjectLoadingContent*>(this));
 
   nsCOMPtr<nsIHTMLCollection> allParams;
-  NS_NAMED_LITERAL_STRING(xhtml_ns, "http://www.w3.org/1999/xhtml");
+  constexpr auto xhtml_ns = u"http://www.w3.org/1999/xhtml"_ns;
   ErrorResult rv;
   allParams = ourElement->GetElementsByTagNameNS(xhtml_ns, u"param"_ns, rv);
   if (rv.Failed()) {
     return;
   }
   MOZ_ASSERT(allParams);
 
   uint32_t numAllParams = allParams->Length();
--- a/dom/base/nsXMLContentSerializer.cpp
+++ b/dom/base/nsXMLContentSerializer.cpp
@@ -215,17 +215,17 @@ NS_IMETHODIMP
 nsXMLContentSerializer::AppendCDATASection(nsIContent* aCDATASection,
                                            int32_t aStartOffset,
                                            int32_t aEndOffset) {
   NS_ENSURE_ARG(aCDATASection);
   NS_ENSURE_STATE(mOutput);
 
   nsresult rv;
 
-  NS_NAMED_LITERAL_STRING(cdata, "<![CDATA[");
+  constexpr auto cdata = u"<![CDATA["_ns;
 
   if (mDoRaw || PreLevel() > 0) {
     NS_ENSURE_TRUE(AppendToString(cdata, *mOutput), NS_ERROR_OUT_OF_MEMORY);
   } else if (mDoFormat) {
     NS_ENSURE_TRUE(AppendToStringFormatedWrapped(cdata, *mOutput),
                    NS_ERROR_OUT_OF_MEMORY);
   } else if (mDoWrap) {
     NS_ENSURE_TRUE(AppendToStringWrapped(cdata, *mOutput),
@@ -311,17 +311,17 @@ nsXMLContentSerializer::AppendComment(Co
     if (length > 0) {
       data.Mid(frag, aStartOffset, length);
     }
     data.Assign(frag);
   }
 
   NS_ENSURE_TRUE(MaybeAddNewlineForRootNode(*mOutput), NS_ERROR_OUT_OF_MEMORY);
 
-  NS_NAMED_LITERAL_STRING(startComment, "<!--");
+  constexpr auto startComment = u"<!--"_ns;
 
   if (mDoRaw || PreLevel() > 0) {
     NS_ENSURE_TRUE(AppendToString(startComment, *mOutput),
                    NS_ERROR_OUT_OF_MEMORY);
   } else if (mDoFormat) {
     if (mAddSpace) {
       NS_ENSURE_TRUE(AppendNewLineToString(*mOutput), NS_ERROR_OUT_OF_MEMORY);
     }
@@ -1085,17 +1085,17 @@ nsXMLContentSerializer::AppendDocumentSt
   NS_ENSURE_STATE(mOutput);
 
   nsAutoString version, encoding, standalone;
   aDocument->GetXMLDeclaration(version, encoding, standalone);
 
   if (version.IsEmpty())
     return NS_OK;  // A declaration must have version, or there is no decl
 
-  NS_NAMED_LITERAL_STRING(endQuote, "\"");
+  constexpr auto endQuote = u"\""_ns;
 
   *mOutput += u"<?xml version=\""_ns + version + endQuote;
 
   if (!mCharset.IsEmpty()) {
     *mOutput +=
         u" encoding=\""_ns + NS_ConvertASCIItoUTF16(mCharset) + endQuote;
   }
   // Otherwise just don't output an encoding attr.  Not that we expect
--- a/dom/base/test/gtest/TestParser.cpp
+++ b/dom/base/test/gtest/TestParser.cpp
@@ -13,21 +13,20 @@
 
 // This is a test for mozilla::dom::DOMParser::CreateWithoutGlobal() which was
 // implemented for use in Thunderbird's MailNews module.
 
 // int main(int argc, char** argv)
 TEST(TestParser, TestParserMain)
 {
   bool allTestsPassed = false;
-  NS_NAMED_LITERAL_STRING(
-      htmlInput,
-      "<html><head>"
+  constexpr auto htmlInput =
+      u"<html><head>"
       "<meta http-equiv=\"content-type\" content=\"text/html; charset=\">"
-      "</head><body>Hello <b>Thunderbird!</b></body></html>");
+      "</head><body>Hello <b>Thunderbird!</b></body></html>"_ns;
 
   do {
     // Parse the HTML source.
     mozilla::IgnoredErrorResult rv2;
     RefPtr<mozilla::dom::DOMParser> parser =
         mozilla::dom::DOMParser::CreateWithoutGlobal(rv2);
     if (rv2.Failed()) break;
     nsCOMPtr<mozilla::dom::Document> document = parser->ParseFromString(
--- a/dom/cache/QuotaClient.cpp
+++ b/dom/cache/QuotaClient.cpp
@@ -183,17 +183,17 @@ static nsresult LockedGetPaddingSizeFrom
 }
 
 }  // namespace
 
 namespace mozilla {
 namespace dom {
 namespace cache {
 
-NS_NAMED_LITERAL_STRING(kCachesSQLiteFilename, "caches.sqlite");
+const nsLiteralString kCachesSQLiteFilename = u"caches.sqlite"_ns;
 
 CacheQuotaClient::CacheQuotaClient()
     : mDirPaddingFileMutex("DOMCacheQuotaClient.mDirPaddingFileMutex") {
   AssertIsOnBackgroundThread();
   MOZ_DIAGNOSTIC_ASSERT(!sInstance);
   sInstance = this;
 }
 
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -3992,17 +3992,17 @@ TextMetrics* CanvasRenderingContext2D::D
   aError = NS_OK;
   return nullptr;
 }
 
 gfxFontGroup* CanvasRenderingContext2D::GetCurrentFontStyle() {
   // use lazy initilization for the font group since it's rather expensive
   if (!CurrentState().fontGroup) {
     ErrorResult err;
-    NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
+    constexpr auto kDefaultFontStyle = u"10px sans-serif"_ns;
     static float kDefaultFontSize = 10.0;
     RefPtr<PresShell> presShell = GetPresShell();
     bool fontUpdated = SetFontInternal(kDefaultFontStyle, err);
     if (err.Failed() || !fontUpdated) {
       err.SuppressException();
       gfxFontStyle style;
       style.size = kDefaultFontSize;
       gfxTextPerfMetrics* tp = nullptr;
--- a/dom/canvas/CanvasRenderingContextHelper.cpp
+++ b/dom/canvas/CanvasRenderingContextHelper.cpp
@@ -260,17 +260,17 @@ nsresult CanvasRenderingContextHelper::P
     }
   }
 
   // If we haven't parsed the aParams check for proprietary options.
   // The proprietary option -moz-parse-options will take a image lib encoder
   // parse options string as is and pass it to the encoder.
   *outUsingCustomParseOptions = false;
   if (outParams.Length() == 0 && aEncoderOptions.isString()) {
-    NS_NAMED_LITERAL_STRING(mozParseOptions, "-moz-parse-options:");
+    constexpr auto mozParseOptions = u"-moz-parse-options:"_ns;
     nsAutoJSString paramString;
     if (!paramString.init(aCx, aEncoderOptions.toString())) {
       return NS_ERROR_FAILURE;
     }
     if (StringBeginsWith(paramString, mozParseOptions)) {
       nsDependentSubstring parseOptions =
           Substring(paramString, mozParseOptions.Length(),
                     paramString.Length() - mozParseOptions.Length());
--- a/dom/file/uri/BlobURLProtocolHandler.cpp
+++ b/dom/file/uri/BlobURLProtocolHandler.cpp
@@ -189,21 +189,20 @@ class BlobURLsReporter final : public ns
     for (auto iter = gDataTable->Iter(); !iter.Done(); iter.Next()) {
       nsCStringHashKey::KeyType key = iter.Key();
       DataInfo* info = iter.UserData();
 
       if (iter.UserData()->mObjectType == DataInfo::eBlobImpl) {
         BlobImpl* blobImpl = iter.UserData()->mBlobImpl;
         MOZ_ASSERT(blobImpl);
 
-        NS_NAMED_LITERAL_CSTRING(
-            desc,
+        constexpr auto desc =
             "A blob URL allocated with URL.createObjectURL; the referenced "
             "blob cannot be freed until all URLs for it have been explicitly "
-            "invalidated with URL.revokeObjectURL.");
+            "invalidated with URL.revokeObjectURL."_ns;
         nsAutoCString path, url, owner, specialDesc;
         uint64_t size = 0;
         uint32_t refCount = 1;
         DebugOnly<bool> blobImplWasCounted;
 
         blobImplWasCounted = refCounts.Get(blobImpl, &refCount);
         MOZ_ASSERT(blobImplWasCounted);
         MOZ_ASSERT(refCount > 0);
@@ -259,21 +258,20 @@ class BlobURLsReporter final : public ns
         continue;
       }
 
       // Just report the path for the MediaSource.
       nsAutoCString path;
       path = "media-source-urls/";
       BuildPath(path, key, info, aAnonymize);
 
-      NS_NAMED_LITERAL_CSTRING(
-          desc,
+      constexpr auto desc =
           "An object URL allocated with URL.createObjectURL; the referenced "
           "data cannot be freed until all URLs for it have been explicitly "
-          "invalidated with URL.revokeObjectURL.");
+          "invalidated with URL.revokeObjectURL."_ns;
 
       aCallback->Callback(EmptyCString(), path, KIND_OTHER, UNITS_COUNT, 1,
                           desc, aData);
     }
 
     return NS_OK;
   }
 
--- a/dom/filesystem/FileSystemUtils.cpp
+++ b/dom/filesystem/FileSystemUtils.cpp
@@ -36,18 +36,18 @@ bool FileSystemUtils::IsValidRelativeDOM
   }
 
   // Leading and trailing "/" are not allowed.
   if (aPath.First() == FILESYSTEM_DOM_PATH_SEPARATOR_CHAR ||
       aPath.Last() == FILESYSTEM_DOM_PATH_SEPARATOR_CHAR) {
     return false;
   }
 
-  NS_NAMED_LITERAL_STRING(kCurrentDir, ".");
-  NS_NAMED_LITERAL_STRING(kParentDir, "..");
+  constexpr auto kCurrentDir = u"."_ns;
+  constexpr auto kParentDir = u".."_ns;
 
   // Split path and check each path component.
   nsCharSeparatedTokenizerTemplate<TokenizerIgnoreNothing> tokenizer(
       aPath, FILESYSTEM_DOM_PATH_SEPARATOR_CHAR);
 
   while (tokenizer.hasMoreTokens()) {
     nsDependentSubstring pathComponent = tokenizer.nextToken();
     // The path containing empty components, such as "foo//bar", is invalid.
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1797,17 +1797,17 @@ class HTMLMediaElement::ChannelLoader fi
     NS_ASSERTION(aChannel == mChannel, "Channels should match!");
     mChannel = aNewChannel;
 
     // Handle forwarding of Range header so that the intial detection
     // of seeking support (via result code 206) works across redirects.
     nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(aChannel);
     NS_ENSURE_STATE(http);
 
-    NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");
+    constexpr auto rangeHdr = "Range"_ns;
 
     nsAutoCString rangeVal;
     if (NS_SUCCEEDED(http->GetRequestHeader(rangeHdr, rangeVal))) {
       NS_ENSURE_STATE(!rangeVal.IsEmpty());
 
       http = do_QueryInterface(aNewChannel);
       NS_ENSURE_STATE(http);
 
--- a/dom/html/PluginDocument.cpp
+++ b/dom/html/PluginDocument.cpp
@@ -190,34 +190,34 @@ nsresult PluginDocument::CreateSynthetic
 
   RefPtr<Element> body = GetBodyElement();
   if (!body) {
     NS_WARNING("no body on plugin document!");
     return NS_ERROR_FAILURE;
   }
 
   // remove margins from body
-  NS_NAMED_LITERAL_STRING(zero, "0");
+  constexpr auto zero = u"0"_ns;
   body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginwidth, zero, false);
   body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginheight, zero, false);
 
   // make plugin content
   RefPtr<mozilla::dom::NodeInfo> nodeInfo;
   nodeInfo = mNodeInfoManager->GetNodeInfo(
       nsGkAtoms::embed, nullptr, kNameSpaceID_XHTML, nsINode::ELEMENT_NODE);
   rv = NS_NewHTMLElement(getter_AddRefs(mPluginContent), nodeInfo.forget(),
                          NOT_FROM_PARSER);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // make it a named element
   mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::name, u"plugin"_ns,
                           false);
 
   // fill viewport and auto-resize
-  NS_NAMED_LITERAL_STRING(percent100, "100%");
+  constexpr auto percent100 = u"100%"_ns;
   mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::width, percent100,
                           false);
   mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::height, percent100,
                           false);
 
   // set URL
   nsAutoCString src;
   mDocumentURI->GetSpec(src);
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -251,81 +251,76 @@ const uint32_t kConnectionIdleCloseMS = 
 
 // The length of time that idle threads will stay alive before being shut down.
 const uint32_t kConnectionThreadIdleMS = 30 * 1000;  // 30 seconds
 
 #define SAVEPOINT_CLAUSE "SAVEPOINT sp;"
 
 const uint32_t kFileCopyBufferSize = 32768;
 
-constexpr auto kJournalDirectoryName = NS_LITERAL_STRING("journals");
-
-constexpr auto kFileManagerDirectoryNameSuffix = NS_LITERAL_STRING(".files");
-constexpr auto kSQLiteSuffix = NS_LITERAL_STRING(".sqlite");
-constexpr auto kSQLiteJournalSuffix = NS_LITERAL_STRING(".sqlite-journal");
-constexpr auto kSQLiteSHMSuffix = NS_LITERAL_STRING(".sqlite-shm");
-constexpr auto kSQLiteWALSuffix = NS_LITERAL_STRING(".sqlite-wal");
+constexpr auto kJournalDirectoryName = u"journals"_ns;
+
+constexpr auto kFileManagerDirectoryNameSuffix = u".files"_ns;
+constexpr auto kSQLiteSuffix = u".sqlite"_ns;
+constexpr auto kSQLiteJournalSuffix = u".sqlite-journal"_ns;
+constexpr auto kSQLiteSHMSuffix = u".sqlite-shm"_ns;
+constexpr auto kSQLiteWALSuffix = u".sqlite-wal"_ns;
 
 const char kPrefFileHandleEnabled[] = "dom.fileHandle.enabled";
 
-constexpr auto kPermissionStringBase = NS_LITERAL_CSTRING("indexedDB-chrome-");
-constexpr auto kPermissionReadSuffix = NS_LITERAL_CSTRING("-read");
-constexpr auto kPermissionWriteSuffix = NS_LITERAL_CSTRING("-write");
+constexpr auto kPermissionStringBase = "indexedDB-chrome-"_ns;
+constexpr auto kPermissionReadSuffix = "-read"_ns;
+constexpr auto kPermissionWriteSuffix = "-write"_ns;
 
 // The following constants define all names of binding parameters in statements,
 // where they are bound by name. This should include all parameter names which
 // are bound by name. Binding may be done by index when the statement definition
 // and binding are done in the same local scope, and no other reasons prevent
 // using the indexes (e.g. multiple statement variants with differing number or
 // order of parameters). Neither the styles of specifying parameter names
 // (literally vs. via these constants) nor the binding styles (by index vs. by
 // name) should not be mixed for the same statement. The decision must be made
 // for each statement based on the proximity of statement and binding calls.
-constexpr auto kStmtParamNameCurrentKey = NS_LITERAL_CSTRING("current_key");
-constexpr auto kStmtParamNameRangeBound = NS_LITERAL_CSTRING("range_bound");
-constexpr auto kStmtParamNameObjectStorePosition =
-    NS_LITERAL_CSTRING("object_store_position");
-constexpr auto kStmtParamNameLowerKey = NS_LITERAL_CSTRING("lower_key");
-constexpr auto kStmtParamNameUpperKey = NS_LITERAL_CSTRING("upper_key");
-constexpr auto kStmtParamNameKey = NS_LITERAL_CSTRING("key");
-constexpr auto kStmtParamNameObjectStoreId =
-    NS_LITERAL_CSTRING("object_store_id");
-constexpr auto kStmtParamNameIndexId = NS_LITERAL_CSTRING("index_id");
+constexpr auto kStmtParamNameCurrentKey = "current_key"_ns;
+constexpr auto kStmtParamNameRangeBound = "range_bound"_ns;
+constexpr auto kStmtParamNameObjectStorePosition = "object_store_position"_ns;
+constexpr auto kStmtParamNameLowerKey = "lower_key"_ns;
+constexpr auto kStmtParamNameUpperKey = "upper_key"_ns;
+constexpr auto kStmtParamNameKey = "key"_ns;
+constexpr auto kStmtParamNameObjectStoreId = "object_store_id"_ns;
+constexpr auto kStmtParamNameIndexId = "index_id"_ns;
 // TODO: Maybe the uses of kStmtParamNameId should be replaced by more
 // specific constants such as kStmtParamNameObjectStoreId.
-constexpr auto kStmtParamNameId = NS_LITERAL_CSTRING("id");
-constexpr auto kStmtParamNameValue = NS_LITERAL_CSTRING("value");
-constexpr auto kStmtParamNameObjectDataKey =
-    NS_LITERAL_CSTRING("object_data_key");
-constexpr auto kStmtParamNameIndexDataValues =
-    NS_LITERAL_CSTRING("index_data_values");
-constexpr auto kStmtParamNameData = NS_LITERAL_CSTRING("data");
-constexpr auto kStmtParamNameFileIds = NS_LITERAL_CSTRING("file_ids");
-constexpr auto kStmtParamNameValueLocale = NS_LITERAL_CSTRING("value_locale");
-constexpr auto kStmtParamNameLimit = NS_LITERAL_CSTRING("limit");
+constexpr auto kStmtParamNameId = "id"_ns;
+constexpr auto kStmtParamNameValue = "value"_ns;
+constexpr auto kStmtParamNameObjectDataKey = "object_data_key"_ns;
+constexpr auto kStmtParamNameIndexDataValues = "index_data_values"_ns;
+constexpr auto kStmtParamNameData = "data"_ns;
+constexpr auto kStmtParamNameFileIds = "file_ids"_ns;
+constexpr auto kStmtParamNameValueLocale = "value_locale"_ns;
+constexpr auto kStmtParamNameLimit = "limit"_ns;
 
 // The following constants define some names of columns in tables, which are
 // referred to in remote locations, e.g. in calls to
 // GetBindingClauseForKeyRange.
-constexpr auto kColumnNameKey = NS_LITERAL_CSTRING("key");
-constexpr auto kColumnNameValue = NS_LITERAL_CSTRING("value");
-constexpr auto kColumnNameAliasSortKey = NS_LITERAL_CSTRING("sort_column");
+constexpr auto kColumnNameKey = "key"_ns;
+constexpr auto kColumnNameValue = "value"_ns;
+constexpr auto kColumnNameAliasSortKey = "sort_column"_ns;
 
 // SQL fragments used at multiple locations.
-constexpr auto kOpenLimit = NS_LITERAL_CSTRING(" LIMIT ");
+constexpr auto kOpenLimit = " LIMIT "_ns;
 
 // The deletion marker file is created before RemoveDatabaseFilesAndDirectory
 // begins deleting a database. It is removed as the last step of deletion. If a
 // deletion marker file is found when initializing the origin, the deletion
 // routine is run again to ensure that the database and all of its related files
 // are removed. The primary goal of this mechanism is to avoid situations where
 // a database has been partially deleted, leading to inconsistent state for the
 // origin.
-constexpr auto kIdbDeletionMarkerFilePrefix =
-    NS_LITERAL_STRING("idb-deleting-");
+constexpr auto kIdbDeletionMarkerFilePrefix = u"idb-deleting-"_ns;
 
 const uint32_t kDeleteTimeoutMs = 1000;
 
 /**
  * Automatically crash the browser if IndexedDB shutdown takes this long.  We've
  * chosen a value that is longer than the value for QuotaManager shutdown timer
  * which is currently set to 30 seconds.  We've also chosen a value that is long
  * long enough that it is unlikely for the problem to be falsely triggered by
@@ -1820,17 +1815,17 @@ nsresult UpgradeSchemaFrom8To9_0(mozISto
   nsresult rv =
       aConnection.ExecuteSimpleSQL("UPDATE database SET dataVersion = 0;"_ns);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   nsCOMPtr<mozIStorageFunction> compressor = new CompressDataBlobsFunction();
 
-  NS_NAMED_LITERAL_CSTRING(compressorName, "compress");
+  constexpr auto compressorName = "compress"_ns;
 
   rv = aConnection.CreateFunction(compressorName, 1, compressor);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Turn off foreign key constraints before we do anything here.
   rv = aConnection.ExecuteSimpleSQL(
@@ -2099,17 +2094,17 @@ class EncodeKeysFunction final : public 
   }
 };
 
 nsresult UpgradeSchemaFrom11_0To12_0(mozIStorageConnection& aConnection) {
   AssertIsOnIOThread();
 
   AUTO_PROFILER_LABEL("UpgradeSchemaFrom11_0To12_0", DOM);
 
-  NS_NAMED_LITERAL_CSTRING(encoderName, "encode");
+  constexpr auto encoderName = "encode"_ns;
 
   nsCOMPtr<mozIStorageFunction> encoder = new EncodeKeysFunction();
 
   nsresult rv = aConnection.CreateFunction(encoderName, 1, encoder);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
@@ -2743,29 +2738,29 @@ UpgradeSchemaFrom17_0To18_0Helper::Upgra
 // static
 nsresult UpgradeSchemaFrom17_0To18_0Helper::DoUpgrade(
     mozIStorageConnection& aConnection, const nsACString& aOrigin) {
   MOZ_ASSERT(!aOrigin.IsEmpty());
 
   // Register the |upgrade_key| function.
   RefPtr<UpgradeKeyFunction> updateFunction = new UpgradeKeyFunction();
 
-  NS_NAMED_LITERAL_CSTRING(upgradeKeyFunctionName, "upgrade_key");
+  constexpr auto upgradeKeyFunctionName = "upgrade_key"_ns;
 
   nsresult rv =
       aConnection.CreateFunction(upgradeKeyFunctionName, 1, updateFunction);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Register the |insert_idv| function.
   RefPtr<InsertIndexDataValuesFunction> insertIDVFunction =
       new InsertIndexDataValuesFunction();
 
-  NS_NAMED_LITERAL_CSTRING(insertIDVFunctionName, "insert_idv");
+  constexpr auto insertIDVFunctionName = "insert_idv"_ns;
 
   rv = aConnection.CreateFunction(insertIDVFunctionName, 4, insertIDVFunction);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     MOZ_ALWAYS_SUCCEEDS(aConnection.RemoveFunction(upgradeKeyFunctionName));
     return rv;
   }
 
   rv = DoUpgradeInternal(aConnection, aOrigin);
@@ -3379,17 +3374,17 @@ nsresult UpgradeSchemaFrom19_0To20_0(nsI
 
   RefPtr<UpgradeFileIdsFunction> function = new UpgradeFileIdsFunction();
 
   rv = function->Init(aFMDirectory, aConnection);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  NS_NAMED_LITERAL_CSTRING(functionName, "upgrade");
+  constexpr auto functionName = "upgrade"_ns;
 
   rv = aConnection.CreateFunction(functionName, 2, function);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Disable update trigger.
   rv = aConnection.ExecuteSimpleSQL(
@@ -3582,17 +3577,17 @@ nsresult UpgradeSchemaFrom20_0To21_0(moz
 
   AssertIsOnIOThread();
 
   AUTO_PROFILER_LABEL("UpgradeSchemaFrom20_0To21_0", DOM);
 
   RefPtr<UpgradeIndexDataValuesFunction> function =
       new UpgradeIndexDataValuesFunction();
 
-  NS_NAMED_LITERAL_CSTRING(functionName, "upgrade_idv");
+  constexpr auto functionName = "upgrade_idv"_ns;
 
   nsresult rv = aConnection.CreateFunction(functionName, 1, function);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   rv = aConnection.ExecuteSimpleSQL(
       nsLiteralCString("UPDATE object_data "
@@ -3741,17 +3736,17 @@ class StripObsoleteOriginAttributesFunct
   }
 };
 
 nsresult UpgradeSchemaFrom25_0To26_0(mozIStorageConnection& aConnection) {
   AssertIsOnIOThread();
 
   AUTO_PROFILER_LABEL("UpgradeSchemaFrom25_0To26_0", DOM);
 
-  NS_NAMED_LITERAL_CSTRING(functionName, "strip_obsolete_attributes");
+  constexpr auto functionName = "strip_obsolete_attributes"_ns;
 
   nsCOMPtr<mozIStorageFunction> stripObsoleteAttributes =
       new StripObsoleteOriginAttributesFunction();
 
   nsresult rv = aConnection.CreateFunction(functionName,
                                            /* aNumArguments */ 1,
                                            stripObsoleteAttributes);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -3831,17 +3826,17 @@ Result<nsCOMPtr<nsIFileURL>, nsresult> G
   }
 
   return result;
 }
 
 nsresult SetDefaultPragmas(mozIStorageConnection& aConnection) {
   MOZ_ASSERT(!NS_IsMainThread());
 
-  static constexpr auto kBuiltInPragmas = NS_LITERAL_CSTRING(
+  static constexpr auto kBuiltInPragmas =
       // We use foreign keys in DEBUG builds only because there is a performance
       // cost to using them.
       "PRAGMA foreign_keys = "
 #ifdef DEBUG
       "ON"
 #else
       "OFF"
 #endif
@@ -3851,17 +3846,17 @@ nsresult SetDefaultPragmas(mozIStorageCo
       // instead it fires only the insert trigger. This confuses the update
       // refcount function. This behavior changes with enabled recursive
       // triggers, so the statement fires the delete trigger first and then the
       // insert trigger.
       "PRAGMA recursive_triggers = ON;"
 
       // We aggressively truncate the database file when idle so don't bother
       // overwriting the WAL with 0 during active periods.
-      "PRAGMA secure_delete = OFF;");
+      "PRAGMA secure_delete = OFF;"_ns;
 
   nsresult rv = aConnection.ExecuteSimpleSQL(kBuiltInPragmas);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   nsAutoCString pragmaStmt;
   pragmaStmt.AssignLiteral("PRAGMA synchronous = ");
@@ -3892,18 +3887,18 @@ nsresult SetDefaultPragmas(mozIStorageCo
   return NS_OK;
 }
 
 nsresult SetJournalMode(mozIStorageConnection& aConnection) {
   MOZ_ASSERT(!NS_IsMainThread());
 
   // Try enabling WAL mode. This can fail in various circumstances so we have to
   // check the results here.
-  NS_NAMED_LITERAL_CSTRING(journalModeQueryStart, "PRAGMA journal_mode = ");
-  NS_NAMED_LITERAL_CSTRING(journalModeWAL, "wal");
+  constexpr auto journalModeQueryStart = "PRAGMA journal_mode = "_ns;
+  constexpr auto journalModeWAL = "wal"_ns;
 
   nsCOMPtr<mozIStorageStatement> stmt;
   nsresult rv = aConnection.CreateStatement(
       journalModeQueryStart + journalModeWAL, getter_AddRefs(stmt));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
@@ -9738,17 +9733,17 @@ uint32_t TelemetryIdForFile(nsIFile* aFi
   // Get the <persistence> directory.
   nsCOMPtr<nsIFile> persistenceDirectory;
   MOZ_ALWAYS_SUCCEEDS(
       originDirectory->GetParent(getter_AddRefs(persistenceDirectory)));
 
   nsString persistence;
   MOZ_ALWAYS_SUCCEEDS(persistenceDirectory->GetLeafName(persistence));
 
-  NS_NAMED_LITERAL_STRING(separator, "*");
+  constexpr auto separator = u"*"_ns;
 
   uint32_t hashValue =
       HashString(persistence + separator + origin + separator + filename);
 
   MutexAutoLock lock(*gTelemetryIdMutex);
 
   if (!gTelemetryIdHashtable) {
     gTelemetryIdHashtable = new TelemetryIdHashtable();
@@ -19090,18 +19085,18 @@ nsAutoCString DatabaseOperationBase::May
 }
 
 // static
 nsAutoCString DatabaseOperationBase::GetBindingClauseForKeyRange(
     const SerializedKeyRange& aKeyRange, const nsACString& aKeyColumnName) {
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(!aKeyColumnName.IsEmpty());
 
-  NS_NAMED_LITERAL_CSTRING(andStr, " AND ");
-  NS_NAMED_LITERAL_CSTRING(spacecolon, " :");
+  constexpr auto andStr = " AND "_ns;
+  constexpr auto spacecolon = " :"_ns;
 
   nsAutoCString result;
   if (aKeyRange.isOnly()) {
     // Both keys equal.
     result =
         andStr + aKeyColumnName + " ="_ns + spacecolon + kStmtParamNameLowerKey;
   } else {
     if (!aKeyRange.lower().IsUnset()) {
@@ -23751,17 +23746,17 @@ nsresult CreateIndexOp::InsertDataFromOb
 
   AUTO_PROFILER_LABEL("CreateIndexOp::InsertDataFromObjectStore", DOM);
 
   auto& storageConnection = aConnection->MutableStorageConnection();
 
   RefPtr<UpdateIndexDataValuesFunction> updateFunction =
       new UpdateIndexDataValuesFunction(this, aConnection);
 
-  NS_NAMED_LITERAL_CSTRING(updateFunctionName, "update_index_data_values");
+  constexpr auto updateFunctionName = "update_index_data_values"_ns;
 
   nsresult rv =
       storageConnection.CreateFunction(updateFunctionName, 4, updateFunction);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   rv = InsertDataFromObjectStoreInternal(aConnection);
--- a/dom/indexedDB/ProfilerHelpers.h
+++ b/dom/indexedDB/ProfilerHelpers.h
@@ -85,17 +85,17 @@ class MOZ_STACK_CLASS LoggingString fina
     MOZ_ASSERT(aDatabase);
 
     AppendUTF16toUTF8(aDatabase->Name(), *this);
     Append(kQuote);
   }
 
   explicit LoggingString(const IDBTransaction& aTransaction)
       : nsAutoCString(kOpenBracket) {
-    NS_NAMED_LITERAL_CSTRING(kCommaSpace, ", ");
+    constexpr auto kCommaSpace = ", "_ns;
 
     const nsTArray<nsString>& stores = aTransaction.ObjectStoreNamesInternal();
 
     for (uint32_t count = stores.Length(), index = 0; index < count; index++) {
       Append(kQuote);
       AppendUTF16toUTF8(stores[index], *this);
       Append(kQuote);
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -468,22 +468,21 @@ ContentParentsMemoryReporter::CollectRep
     }
 
     nsPrintfCString path(
         "queued-ipc-messages/content-parent"
         "(%s, pid=%d, %s, 0x%p, refcnt=%" PRIuPTR ")",
         NS_ConvertUTF16toUTF8(friendlyName).get(), cp->Pid(), channelStr,
         static_cast<nsIObserver*>(cp), refcnt);
 
-    NS_NAMED_LITERAL_CSTRING(
-        desc,
+    constexpr auto desc =
         "The number of unset IPC messages held in this ContentParent's "
         "channel.  A large value here might indicate that we're leaking "
         "messages.  Similarly, a ContentParent object for a process that's no "
-        "longer running could indicate that we're leaking ContentParents.");
+        "longer running could indicate that we're leaking ContentParents."_ns;
 
     aHandleReport->Callback(/* process */ EmptyCString(), path, KIND_OTHER,
                             UNITS_COUNT, numQueuedMessages, desc, aData);
   }
 
   return NS_OK;
 }
 
--- a/dom/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/jsurl/nsJSProtocolHandler.cpp
@@ -312,18 +312,18 @@ nsresult nsJSThunk::EvaluateScript(
                "How did we get a non-undefined return value?");
     nsAutoJSString result;
     if (!result.init(cx, v)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     char* bytes;
     uint32_t bytesLen;
-    NS_NAMED_LITERAL_CSTRING(isoCharset, "windows-1252");
-    NS_NAMED_LITERAL_CSTRING(utf8Charset, "UTF-8");
+    constexpr auto isoCharset = "windows-1252"_ns;
+    constexpr auto utf8Charset = "UTF-8"_ns;
     const nsLiteralCString* charset;
     if (IsISO88591(result)) {
       // For compatibility, if the result is ISO-8859-1, we use
       // windows-1252, so that people can compatibly create images
       // using javascript: URLs.
       bytes = ToNewCString(result, mozilla::fallible);
       bytesLen = result.Length();
       charset = &isoCharset;
--- a/dom/localstorage/ActorsParent.cpp
+++ b/dom/localstorage/ActorsParent.cpp
@@ -839,18 +839,18 @@ nsresult GetShadowFile(const nsAString& 
 }
 
 nsresult SetShadowJournalMode(mozIStorageConnection* aConnection) {
   MOZ_ASSERT(IsOnIOThread() || IsOnConnectionThread());
   MOZ_ASSERT(aConnection);
 
   // Try enabling WAL mode. This can fail in various circumstances so we have to
   // check the results here.
-  NS_NAMED_LITERAL_CSTRING(journalModeQueryStart, "PRAGMA journal_mode = ");
-  NS_NAMED_LITERAL_CSTRING(journalModeWAL, "wal");
+  constexpr auto journalModeQueryStart = "PRAGMA journal_mode = "_ns;
+  constexpr auto journalModeWAL = "wal"_ns;
 
   nsCOMPtr<mozIStorageStatement> stmt;
   nsresult rv = aConnection->CreateStatement(
       journalModeQueryStart + journalModeWAL, getter_AddRefs(stmt));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
--- a/dom/media/VideoUtils.cpp
+++ b/dom/media/VideoUtils.cpp
@@ -173,17 +173,17 @@ uint32_t DecideAudioPlaybackChannels(con
   return info.mChannels;
 }
 
 bool IsDefaultPlaybackDeviceMono() {
   return CubebUtils::MaxNumberOfChannels() == 1;
 }
 
 bool IsVideoContentType(const nsCString& aContentType) {
-  NS_NAMED_LITERAL_CSTRING(video, "video");
+  constexpr auto video = "video"_ns;
   if (FindInReadable(video, aContentType)) {
     return true;
   }
   return false;
 }
 
 bool IsValidVideoRegion(const gfx::IntSize& aFrame,
                         const gfx::IntRect& aPicture,
--- a/dom/media/eme/MediaKeySystemAccess.cpp
+++ b/dom/media/eme/MediaKeySystemAccess.cpp
@@ -140,23 +140,23 @@ MediaKeySystemStatus MediaKeySystemAcces
     }
   }
 
   return MediaKeySystemStatus::Cdm_not_supported;
 }
 
 typedef nsCString EMECodecString;
 
-static NS_NAMED_LITERAL_CSTRING(EME_CODEC_AAC, "aac");
-static NS_NAMED_LITERAL_CSTRING(EME_CODEC_OPUS, "opus");
-static NS_NAMED_LITERAL_CSTRING(EME_CODEC_VORBIS, "vorbis");
-static NS_NAMED_LITERAL_CSTRING(EME_CODEC_FLAC, "flac");
-static NS_NAMED_LITERAL_CSTRING(EME_CODEC_H264, "h264");
-static NS_NAMED_LITERAL_CSTRING(EME_CODEC_VP8, "vp8");
-static NS_NAMED_LITERAL_CSTRING(EME_CODEC_VP9, "vp9");
+static constexpr auto EME_CODEC_AAC = "aac"_ns;
+static constexpr auto EME_CODEC_OPUS = "opus"_ns;
+static constexpr auto EME_CODEC_VORBIS = "vorbis"_ns;
+static constexpr auto EME_CODEC_FLAC = "flac"_ns;
+static constexpr auto EME_CODEC_H264 = "h264"_ns;
+static constexpr auto EME_CODEC_VP8 = "vp8"_ns;
+static constexpr auto EME_CODEC_VP9 = "vp9"_ns;
 
 EMECodecString ToEMEAPICodecString(const nsString& aCodec) {
   if (IsAACCodecString(aCodec)) {
     return EME_CODEC_AAC;
   }
   if (aCodec.EqualsLiteral("opus")) {
     return EME_CODEC_OPUS;
   }
--- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp
+++ b/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp
@@ -324,18 +324,19 @@ void MediaDrmCDMProxy::OnKeyStatusesChan
   if (session) {
     session->DispatchKeyStatusesChange();
   }
 }
 
 void MediaDrmCDMProxy::GetStatusForPolicy(PromiseId aPromiseId,
                                           const nsAString& aMinHdcpVersion) {
   // TODO: Implement GetStatusForPolicy.
-  NS_NAMED_LITERAL_CSTRING(
-      err, "Currently Fennec does not support GetStatusForPolicy");
+  constexpr auto err =
+      "Currently Fennec does not support GetStatusForPolicy"_ns;
+
   ErrorResult rv;
   rv.ThrowNotSupportedError(err);
   RejectPromise(aPromiseId, std::move(rv), err);
 }
 
 #ifdef DEBUG
 bool MediaDrmCDMProxy::IsOnOwnerThread() {
   return NS_GetCurrentThread() == mOwnerThread;
@@ -354,17 +355,17 @@ void MediaDrmCDMProxy::OnCDMCreated(uint
   }
 
   if (mCDM) {
     mKeys->OnCDMCreated(aPromiseId, 0);
     return;
   }
 
   // No CDM? Just reject the promise.
-  NS_NAMED_LITERAL_CSTRING(err, "Null CDM in OnCDMCreated()");
+  constexpr auto err = "Null CDM in OnCDMCreated()"_ns;
   ErrorResult rv;
   rv.ThrowInvalidStateError(err);
   mKeys->RejectPromise(aPromiseId, std::move(rv), err);
 }
 
 void MediaDrmCDMProxy::md_Init(uint32_t aPromiseId) {
   MOZ_ASSERT(IsOnOwnerThread());
   MOZ_ASSERT(mCDM);
--- a/dom/media/gmp/ChromiumCDMParent.cpp
+++ b/dom/media/gmp/ChromiumCDMParent.cpp
@@ -251,18 +251,18 @@ void ChromiumCDMParent::GetStatusForPoli
   }
   auto hdcpVersionResult = ToCDMHdcpVersion(aMinHdcpVersion);
   if (hdcpVersionResult.isErr()) {
     ErrorResult rv;
     // XXXbz there's no spec for this yet, and
     // <https://github.com/WICG/hdcp-detection/blob/master/explainer.md>
     // does not define what exceptions get thrown.  Let's assume
     // TypeError for invalid args, as usual.
-    NS_NAMED_LITERAL_CSTRING(
-        err, "getStatusForPolicy failed due to bad hdcp version argument");
+    constexpr auto err =
+        "getStatusForPolicy failed due to bad hdcp version argument"_ns;
     rv.ThrowTypeError(err);
     RejectPromise(aPromiseId, std::move(rv), err);
     return;
   }
 
   if (!SendGetStatusForPolicy(aPromiseId, hdcpVersionResult.unwrap())) {
     RejectPromiseWithStateError(
         aPromiseId, "Failed to send getStatusForPolicy to CDM process"_ns);
--- a/dom/media/gmp/ChromiumCDMProxy.cpp
+++ b/dom/media/gmp/ChromiumCDMProxy.cpp
@@ -150,17 +150,17 @@ void ChromiumCDMProxy::OnCDMCreated(uint
   }
   RefPtr<gmp::ChromiumCDMParent> cdm = GetCDMParent();
   // This should only be called once the CDM has been created.
   MOZ_ASSERT(cdm);
   if (cdm) {
     mKeys->OnCDMCreated(aPromiseId, cdm->PluginId());
   } else {
     // No CDM? Shouldn't be possible, but reject the promise anyway...
-    NS_NAMED_LITERAL_CSTRING(err, "Null CDM in OnCDMCreated()");
+    constexpr auto err = "Null CDM in OnCDMCreated()"_ns;
     ErrorResult rv;
     rv.ThrowInvalidStateError(err);
     mKeys->RejectPromise(aPromiseId, std::move(rv), err);
   }
 }
 
 void ChromiumCDMProxy::ShutdownCDMIfExists() {
   EME_LOG(
--- a/dom/media/gtest/TestCDMStorage.cpp
+++ b/dom/media/gtest/TestCDMStorage.cpp
@@ -827,51 +827,51 @@ class CDMStorageTest {
                              &CDMStorageTest::SetFinished));
 
     CreateDecryptor(u"http://example15.com"_ns, u"http://example16.com"_ns,
                     false, "test-op-apis"_ns);
   }
 #endif
 
   void TestLongRecordNames() {
-    NS_NAMED_LITERAL_CSTRING(longRecordName,
-                             "A_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_very_very_very_"
-                             "very_very_very_very_very_very_"
-                             "long_record_name");
+    constexpr auto longRecordName =
+        "A_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "very_very_very_very_very_very_very_very_very_"
+        "very_very_very_very_very_very_"
+        "long_record_name"_ns;
 
-    NS_NAMED_LITERAL_CSTRING(data, "Just_some_arbitrary_data.");
+    constexpr auto data = "Just_some_arbitrary_data."_ns;
 
     MOZ_ASSERT(longRecordName.Length() < GMP_MAX_RECORD_NAME_SIZE);
     MOZ_ASSERT(longRecordName.Length() > 260);  // Windows MAX_PATH
 
     nsCString response("stored ");
     response.Append(longRecordName);
     response.AppendLiteral(" ");
     response.Append(data);
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -29,20 +29,20 @@ using namespace mozilla;
 using media::TimeUnit;
 
 namespace mozilla {
 
 mozilla::LazyLogModule sAndroidDecoderModuleLog("AndroidDecoderModule");
 
 const nsCString TranslateMimeType(const nsACString& aMimeType) {
   if (VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP8)) {
-    static NS_NAMED_LITERAL_CSTRING(vp8, "video/x-vnd.on2.vp8");
+    static constexpr auto vp8 = "video/x-vnd.on2.vp8"_ns;
     return vp8;
   } else if (VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP9)) {
-    static NS_NAMED_LITERAL_CSTRING(vp9, "video/x-vnd.on2.vp9");
+    static constexpr auto vp9 = "video/x-vnd.on2.vp9"_ns;
     return vp9;
   }
   return nsCString(aMimeType);
 }
 
 static bool GetFeatureStatus(int32_t aFeature) {
   nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
   int32_t status = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -2187,18 +2187,18 @@ void nsPluginHost::RegisterWithCategoryM
        aMimeType.get(), aType == ePluginUnregister ? "yes" : "no"));
 
   nsCOMPtr<nsICategoryManager> catMan =
       do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
   if (!catMan) {
     return;
   }
 
-  NS_NAMED_LITERAL_CSTRING(
-      contractId, "@mozilla.org/content/plugin/document-loader-factory;1");
+  constexpr auto contractId =
+      "@mozilla.org/content/plugin/document-loader-factory;1"_ns;
 
   if (aType == ePluginRegister) {
     catMan->AddCategoryEntry("Gecko-Content-Viewers", aMimeType, contractId,
                              false, /* persist: broken by bug 193031 */
                              mOverrideInternalTypes);
   } else {
     if (aType == ePluginMaybeUnregister) {
       // Bail out if this type is still used by an enabled plugin
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -2866,17 +2866,17 @@ NS_IMETHODIMP nsPluginInstanceOwner::Cre
 #ifdef MOZ_X11
     // Fill in the display field.
     NPSetWindowCallbackStruct* ws_info =
         static_cast<NPSetWindowCallbackStruct*>(mPluginWindow->ws_info);
     ws_info->display = DefaultXDisplay();
 
     nsAutoCString description;
     GetPluginDescription(description);
-    NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10.");
+    constexpr auto flash10Head = "Shockwave Flash 10."_ns;
     mFlash10Quirks = StringBeginsWith(description, flash10Head);
 #endif
   } else if (mWidget) {
     // mPluginWindow->type is used in |GetPluginPort| so it must
     // be initialized first
     mPluginWindow->type = NPWindowTypeWindow;
     mPluginWindow->window = GetPluginPort();
     // tell the plugin window about the widget
--- a/dom/plugins/base/nsPluginsDirUnix.cpp
+++ b/dom/plugins/base/nsPluginsDirUnix.cpp
@@ -37,23 +37,23 @@
 #endif
 
 /* nsPluginsDir implementation */
 
 bool nsPluginsDir::IsPluginFile(nsIFile* file) {
   nsAutoCString filename;
   if (NS_FAILED(file->GetNativeLeafName(filename))) return false;
 
-  NS_NAMED_LITERAL_CSTRING(dllSuffix, LOCAL_PLUGIN_DLL_SUFFIX);
+  constexpr auto dllSuffix = nsLiteralCString{LOCAL_PLUGIN_DLL_SUFFIX};
   if (filename.Length() > dllSuffix.Length() &&
       StringEndsWith(filename, dllSuffix))
     return true;
 
 #ifdef LOCAL_PLUGIN_DLL_ALT_SUFFIX
-  NS_NAMED_LITERAL_CSTRING(dllAltSuffix, LOCAL_PLUGIN_DLL_ALT_SUFFIX);
+  constexpr auto dllAltSuffix = nsLiteralCString{LOCAL_PLUGIN_DLL_ALT_SUFFIX};
   if (filename.Length() > dllAltSuffix.Length() &&
       StringEndsWith(filename, dllAltSuffix))
     return true;
 #endif
   return false;
 }
 
 /* nsPluginFile implementation */
--- a/dom/plugins/ipc/FunctionHook.cpp
+++ b/dom/plugins/ipc/FunctionHook.cpp
@@ -200,17 +200,17 @@ static HANDLE WINAPI CreateFileAHookFn(L
                        aFlags, aFTemplate);
   }
 
   return sCreateFileAStub(aFname, aAccess, aShare, aSecurity, aCreation, aFlags,
                           aFTemplate);
 }
 
 static bool GetLocalLowTempPath(size_t aLen, LPWSTR aPath) {
-  NS_NAMED_LITERAL_STRING(tempname, "\\Temp");
+  constexpr auto tempname = u"\\Temp"_ns;
   LPWSTR path;
   if (SUCCEEDED(
           SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, nullptr, &path))) {
     if (wcslen(path) + tempname.Length() < aLen) {
       wcscpy(aPath, path);
       wcscat(aPath, tempname.get());
       CoTaskMemFree(path);
       return true;
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -250,17 +250,17 @@ bool PluginModuleChild::InitForChrome(co
     return false;
   }
 
 #if defined(XP_WIN)
   // XXX quirks isn't initialized yet
   mAsyncRenderSupport = info.fSupportsAsyncRender;
 #endif
 #if defined(MOZ_X11)
-  NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10.");
+  constexpr auto flash10Head = "Shockwave Flash 10."_ns;
   if (StringBeginsWith(nsDependentCString(info.fDescription), flash10Head)) {
     AddQuirk(QUIRK_FLASH_EXPOSE_COORD_TRANSLATION);
   }
 #endif
 #if defined(XP_MACOSX)
   const char* namePrefix = "Plugin Content";
   char nameBuffer[80];
   SprintfLiteral(nameBuffer, "%s (%s)", namePrefix, info.fName);
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -2036,35 +2036,35 @@ class nsCaseInsensitiveUTF8StringArrayCo
     return a.Equals(b.get(), nsCaseInsensitiveUTF8StringComparator);
   }
 };
 
 #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
 static void ForceWindowless(nsTArray<nsCString>& names,
                             nsTArray<nsCString>& values) {
   nsCaseInsensitiveUTF8StringArrayComparator comparator;
-  NS_NAMED_LITERAL_CSTRING(wmodeAttributeName, "wmode");
-  NS_NAMED_LITERAL_CSTRING(opaqueAttributeValue, "opaque");
+  constexpr auto wmodeAttributeName = "wmode"_ns;
+  constexpr auto opaqueAttributeValue = "opaque"_ns;
   auto wmodeAttributeIndex = names.IndexOf(wmodeAttributeName, 0, comparator);
   if (wmodeAttributeIndex != names.NoIndex) {
     if (!values[wmodeAttributeIndex].EqualsLiteral("transparent")) {
       values[wmodeAttributeIndex].Assign(opaqueAttributeValue);
     }
   } else {
     names.AppendElement(wmodeAttributeName);
     values.AppendElement(opaqueAttributeValue);
   }
 }
 #endif  // windows or linux
 #if defined(XP_WIN)
 static void ForceDirect(nsTArray<nsCString>& names,
                         nsTArray<nsCString>& values) {
   nsCaseInsensitiveUTF8StringArrayComparator comparator;
-  NS_NAMED_LITERAL_CSTRING(wmodeAttributeName, "wmode");
-  NS_NAMED_LITERAL_CSTRING(directAttributeValue, "direct");
+  constexpr auto wmodeAttributeName = "wmode"_ns;
+  constexpr auto directAttributeValue = "direct"_ns;
   auto wmodeAttributeIndex = names.IndexOf(wmodeAttributeName, 0, comparator);
   if (wmodeAttributeIndex != names.NoIndex) {
     if ((!values[wmodeAttributeIndex].EqualsLiteral("transparent")) &&
         (!values[wmodeAttributeIndex].EqualsLiteral("opaque"))) {
       values[wmodeAttributeIndex].Assign(directAttributeValue);
     }
   } else {
     names.AppendElement(wmodeAttributeName);
@@ -2078,17 +2078,17 @@ nsresult PluginModuleParent::NPP_NewInte
     nsTArray<nsCString>& values, NPSavedData* saved, NPError* error) {
   MOZ_ASSERT(names.Length() == values.Length());
   if (mPluginName.IsEmpty()) {
     GetPluginDetails();
     InitQuirksModes(nsDependentCString(pluginType));
   }
 
   nsCaseInsensitiveUTF8StringArrayComparator comparator;
-  NS_NAMED_LITERAL_CSTRING(srcAttributeName, "src");
+  constexpr auto srcAttributeName = "src"_ns;
   auto srcAttributeIndex = names.IndexOf(srcAttributeName, 0, comparator);
   nsAutoCString srcAttribute;
   if (srcAttributeIndex != names.NoIndex) {
     srcAttribute = values[srcAttributeIndex];
   }
 
   nsDependentCString strPluginType(pluginType);
   PluginInstanceParent* parentInstance =
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -182,23 +182,21 @@ static_assert(static_cast<uint32_t>(Stor
                   static_cast<uint32_t>(PERSISTENCE_TYPE_DEFAULT),
               "Enum values should match.");
 
 const char kChromeOrigin[] = "chrome";
 const char kAboutHomeOriginPrefix[] = "moz-safe-about:home";
 const char kIndexedDBOriginPrefix[] = "indexeddb://";
 const char kResourceOriginPrefix[] = "resource://";
 
-constexpr auto kPersistentOriginTelemetryKey =
-    NS_LITERAL_CSTRING("PersistentOrigin");
-constexpr auto kTemporaryOriginTelemetryKey =
-    NS_LITERAL_CSTRING("TemporaryOrigin");
-
-constexpr auto kStorageName = NS_LITERAL_STRING("storage");
-constexpr auto kSQLiteSuffix = NS_LITERAL_STRING(".sqlite");
+constexpr auto kPersistentOriginTelemetryKey = "PersistentOrigin"_ns;
+constexpr auto kTemporaryOriginTelemetryKey = "TemporaryOrigin"_ns;
+
+constexpr auto kStorageName = u"storage"_ns;
+constexpr auto kSQLiteSuffix = u".sqlite"_ns;
 
 #define INDEXEDDB_DIRECTORY_NAME u"indexedDB"
 #define PERSISTENT_DIRECTORY_NAME u"persistent"
 #define PERMANENT_DIRECTORY_NAME u"permanent"
 #define TEMPORARY_DIRECTORY_NAME u"temporary"
 #define DEFAULT_DIRECTORY_NAME u"default"
 
 // The name of the file that we use to load/save the last access time of an
--- a/dom/quota/PersistenceType.cpp
+++ b/dom/quota/PersistenceType.cpp
@@ -7,19 +7,19 @@
 #include "PersistenceType.h"
 
 namespace mozilla {
 namespace dom {
 namespace quota {
 
 namespace {
 
-constexpr auto kPersistentCString = NS_LITERAL_CSTRING("persistent");
-constexpr auto kTemporaryCString = NS_LITERAL_CSTRING("temporary");
-constexpr auto kDefaultCString = NS_LITERAL_CSTRING("default");
+constexpr auto kPersistentCString = "persistent"_ns;
+constexpr auto kTemporaryCString = "temporary"_ns;
+constexpr auto kDefaultCString = "default"_ns;
 
 static_assert(PERSISTENCE_TYPE_PERSISTENT == 0 &&
                   PERSISTENCE_TYPE_TEMPORARY == 1 &&
                   PERSISTENCE_TYPE_DEFAULT == 2 &&
                   PERSISTENCE_TYPE_INVALID == 3,
               "Incorrect enum values!");
 
 template <PersistenceType type>
--- a/dom/quota/QuotaCommon.cpp
+++ b/dom/quota/QuotaCommon.cpp
@@ -56,18 +56,18 @@ void AnonymizeCString(nsACString& aCStri
   }
 }
 
 }  // namespace
 
 const char kQuotaGenericDelimiter = '|';
 
 #ifdef NIGHTLY_BUILD
-NS_NAMED_LITERAL_CSTRING(kQuotaInternalError, "internal");
-NS_NAMED_LITERAL_CSTRING(kQuotaExternalError, "external");
+const nsLiteralCString kQuotaInternalError = "internal"_ns;
+const nsLiteralCString kQuotaExternalError = "external"_ns;
 #endif
 
 LogModule* GetQuotaManagerLogger() { return gLogger; }
 
 void AnonymizeCString(nsACString& aCString) {
   if (aCString.IsEmpty()) {
     return;
   }
--- a/dom/quota/test/gtest/TestQuotaManager.cpp
+++ b/dom/quota/test/gtest/TestQuotaManager.cpp
@@ -71,25 +71,25 @@ void CheckUnknownFileEntry(nsIFile& aBas
 
 TEST(QuotaManager, OriginScope)
 {
   OriginScope originScope;
 
   // Sanity checks.
 
   {
-    NS_NAMED_LITERAL_CSTRING(origin, "http://www.mozilla.org");
+    constexpr auto origin = "http://www.mozilla.org"_ns;
     originScope.SetFromOrigin(origin);
     EXPECT_TRUE(originScope.IsOrigin());
     EXPECT_TRUE(originScope.GetOrigin().Equals(origin));
     EXPECT_TRUE(originScope.GetOriginNoSuffix().Equals(origin));
   }
 
   {
-    NS_NAMED_LITERAL_CSTRING(prefix, "http://www.mozilla.org");
+    constexpr auto prefix = "http://www.mozilla.org"_ns;
     originScope.SetFromPrefix(prefix);
     EXPECT_TRUE(originScope.IsPrefix());
     EXPECT_TRUE(originScope.GetOriginNoSuffix().Equals(prefix));
   }
 
   {
     originScope.SetFromNull();
     EXPECT_TRUE(originScope.IsNull());
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -126,17 +126,17 @@ LazyLogModule ScriptLoader::gScriptLoade
 #define LOG(args) \
   MOZ_LOG(ScriptLoader::gScriptLoaderLog, mozilla::LogLevel::Debug, args)
 
 #define LOG_ENABLED() \
   MOZ_LOG_TEST(ScriptLoader::gScriptLoaderLog, mozilla::LogLevel::Debug)
 
 // Alternate Data MIME type used by the ScriptLoader to register that we want to
 // store bytecode without reading it.
-static NS_NAMED_LITERAL_CSTRING(kNullMimeType, "javascript/null");
+static constexpr auto kNullMimeType = "javascript/null"_ns;
 
 //////////////////////////////////////////////////////////////
 // ScriptLoader::PreloadInfo
 //////////////////////////////////////////////////////////////
 
 inline void ImplCycleCollectionUnlink(ScriptLoader::PreloadInfo& aField) {
   ImplCycleCollectionUnlink(aField.mRequest);
 }
--- a/dom/security/nsContentSecurityUtils.cpp
+++ b/dom/security/nsContentSecurityUtils.cpp
@@ -207,37 +207,35 @@ nsString OptimizeFileName(const nsAStrin
  *
  * Function is a static member of the class to enable gtests.
  */
 
 /* static */
 FilenameTypeAndDetails nsContentSecurityUtils::FilenameToFilenameType(
     const nsString& fileName, bool collectAdditionalExtensionData) {
   // These are strings because the Telemetry Events API only accepts strings
-  static NS_NAMED_LITERAL_CSTRING(kChromeURI, "chromeuri");
-  static NS_NAMED_LITERAL_CSTRING(kResourceURI, "resourceuri");
-  static NS_NAMED_LITERAL_CSTRING(kBlobUri, "bloburi");
-  static NS_NAMED_LITERAL_CSTRING(kDataUri, "dataurl");
-  static NS_NAMED_LITERAL_CSTRING(kSingleString, "singlestring");
-  static NS_NAMED_LITERAL_CSTRING(kMozillaExtension, "mozillaextension");
-  static NS_NAMED_LITERAL_CSTRING(kOtherExtension, "otherextension");
-  static NS_NAMED_LITERAL_CSTRING(kSuspectedUserChromeJS,
-                                  "suspectedUserChromeJS");
+  static constexpr auto kChromeURI = "chromeuri"_ns;
+  static constexpr auto kResourceURI = "resourceuri"_ns;
+  static constexpr auto kBlobUri = "bloburi"_ns;
+  static constexpr auto kDataUri = "dataurl"_ns;
+  static constexpr auto kSingleString = "singlestring"_ns;
+  static constexpr auto kMozillaExtension = "mozillaextension"_ns;
+  static constexpr auto kOtherExtension = "otherextension"_ns;
+  static constexpr auto kSuspectedUserChromeJS = "suspectedUserChromeJS"_ns;
 #if defined(XP_WIN)
-  static NS_NAMED_LITERAL_CSTRING(kSanitizedWindowsURL, "sanitizedWindowsURL");
-  static NS_NAMED_LITERAL_CSTRING(kSanitizedWindowsPath,
-                                  "sanitizedWindowsPath");
+  static constexpr auto kSanitizedWindowsURL = "sanitizedWindowsURL"_ns;
+  static constexpr auto kSanitizedWindowsPath = "sanitizedWindowsPath"_ns;
 #endif
-  static NS_NAMED_LITERAL_CSTRING(kOther, "other");
-  static NS_NAMED_LITERAL_CSTRING(kOtherWorker, "other-on-worker");
-  static NS_NAMED_LITERAL_CSTRING(kRegexFailure, "regexfailure");
+  static constexpr auto kOther = "other"_ns;
+  static constexpr auto kOtherWorker = "other-on-worker"_ns;
+  static constexpr auto kRegexFailure = "regexfailure"_ns;
 
-  static NS_NAMED_LITERAL_STRING(kUCJSRegex, "(.+).uc.js\\?*[0-9]*$");
-  static NS_NAMED_LITERAL_STRING(kExtensionRegex, "extensions/(.+)@(.+)!(.+)$");
-  static NS_NAMED_LITERAL_STRING(kSingleFileRegex, "^[a-zA-Z0-9.?]+$");
+  static constexpr auto kUCJSRegex = u"(.+).uc.js\\?*[0-9]*$"_ns;
+  static constexpr auto kExtensionRegex = u"extensions/(.+)@(.+)!(.+)$"_ns;
+  static constexpr auto kSingleFileRegex = u"^[a-zA-Z0-9.?]+$"_ns;
 
   // resource:// and chrome://
   if (StringBeginsWith(fileName, u"chrome://"_ns)) {
     return FilenameTypeAndDetails(kChromeURI, Some(fileName));
   }
   if (StringBeginsWith(fileName, u"resource://"_ns)) {
     return FilenameTypeAndDetails(kResourceURI, Some(fileName));
   }
@@ -414,19 +412,19 @@ bool nsContentSecurityUtils::IsEvalAllow
 
       // The Browser Toolbox/Console
       "debugger"_ns,
   };
 
   // We also permit two specific idioms in eval()-like contexts. We'd like to
   // elminate these too; but there are in-the-wild Mozilla privileged extensions
   // that use them.
-  static NS_NAMED_LITERAL_STRING(sAllowedEval1, "this");
-  static NS_NAMED_LITERAL_STRING(sAllowedEval2,
-                                 "function anonymous(\n) {\nreturn this\n}");
+  static constexpr auto sAllowedEval1 = u"this"_ns;
+  static constexpr auto sAllowedEval2 =
+      u"function anonymous(\n) {\nreturn this\n}"_ns;
 
   if (MOZ_LIKELY(!aIsSystemPrincipal && !XRE_IsE10sParentProcess())) {
     // We restrict eval in the system principal and parent process.
     // Other uses (like web content and null principal) are allowed.
     return true;
   }
 
   if (JS::ContextOptionsRef(cx).disableEvalSecurityChecks()) {
--- a/dom/security/test/gtest/TestFilenameEvalParser.cpp
+++ b/dom/security/test/gtest/TestFilenameEvalParser.cpp
@@ -12,272 +12,269 @@
 #include "nsContentSecurityUtils.h"
 #include "nsStringFwd.h"
 
 #include "mozilla/ExtensionPolicyService.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/SimpleGlobalObject.h"
 #include "mozilla/extensions/WebExtensionPolicy.h"
 
-static NS_NAMED_LITERAL_CSTRING(kChromeURI, "chromeuri");
-static NS_NAMED_LITERAL_CSTRING(kResourceURI, "resourceuri");
-static NS_NAMED_LITERAL_CSTRING(kBlobUri, "bloburi");
-static NS_NAMED_LITERAL_CSTRING(kDataUri, "dataurl");
-static NS_NAMED_LITERAL_CSTRING(kSingleString, "singlestring");
-static NS_NAMED_LITERAL_CSTRING(kMozillaExtension, "mozillaextension");
-static NS_NAMED_LITERAL_CSTRING(kOtherExtension, "otherextension");
-static NS_NAMED_LITERAL_CSTRING(kSuspectedUserChromeJS,
-                                "suspectedUserChromeJS");
-static NS_NAMED_LITERAL_CSTRING(kSanitizedWindowsURL, "sanitizedWindowsURL");
-static NS_NAMED_LITERAL_CSTRING(kSanitizedWindowsPath, "sanitizedWindowsPath");
-static NS_NAMED_LITERAL_CSTRING(kOther, "other");
+static constexpr auto kChromeURI = "chromeuri"_ns;
+static constexpr auto kResourceURI = "resourceuri"_ns;
+static constexpr auto kBlobUri = "bloburi"_ns;
+static constexpr auto kDataUri = "dataurl"_ns;
+static constexpr auto kSingleString = "singlestring"_ns;
+static constexpr auto kMozillaExtension = "mozillaextension"_ns;
+static constexpr auto kOtherExtension = "otherextension"_ns;
+static constexpr auto kSuspectedUserChromeJS = "suspectedUserChromeJS"_ns;
+static constexpr auto kSanitizedWindowsURL = "sanitizedWindowsURL"_ns;
+static constexpr auto kSanitizedWindowsPath = "sanitizedWindowsPath"_ns;
+static constexpr auto kOther = "other"_ns;
 
 #define ASSERT_AND_PRINT(first, second, condition)                      \
   fprintf(stderr, "First: %s\n", first.get());                          \
   fprintf(stderr, "Second: %s\n", NS_ConvertUTF16toUTF8(second).get()); \
   ASSERT_TRUE((condition));
 // Usage: ASSERT_AND_PRINT(ret.first, ret.second.value(), ...
 
 TEST(FilenameEvalParser, ResourceChrome)
 {
   {
-    NS_NAMED_LITERAL_STRING(str, "chrome://firegestures/content/browser.js");
+    constexpr auto str = u"chrome://firegestures/content/browser.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kChromeURI && ret.second.isSome() &&
                 ret.second.value() == str);
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "resource://firegestures/content/browser.js");
+    constexpr auto str = u"resource://firegestures/content/browser.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kResourceURI && ret.second.isSome() &&
                 ret.second.value() == str);
   }
 }
 
 TEST(FilenameEvalParser, BlobData)
 {
   {
-    NS_NAMED_LITERAL_STRING(str, "blob://000-000");
+    constexpr auto str = u"blob://000-000"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kBlobUri && !ret.second.isSome());
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "blob:000-000");
+    constexpr auto str = u"blob:000-000"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kBlobUri && !ret.second.isSome());
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "data://blahblahblah");
+    constexpr auto str = u"data://blahblahblah"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kDataUri && !ret.second.isSome());
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "data:blahblahblah");
+    constexpr auto str = u"data:blahblahblah"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kDataUri && !ret.second.isSome());
   }
 }
 
 TEST(FilenameEvalParser, MozExtension)
 {
   {  // Test shield.mozilla.org replacing
-    NS_NAMED_LITERAL_STRING(
-        str,
-        "jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/foo/"
+    constexpr auto str =
+        u"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/"
+        u"foo/"
         "extensions/federated-learning@shield.mozilla.org.xpi!/experiments/"
-        "study/api.js");
+        "study/api.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kMozillaExtension &&
                 ret.second.value() ==
                     u"federated-learning@s!/experiments/study/api.js"_ns);
   }
   {  // Test mozilla.org replacing
-    NS_NAMED_LITERAL_STRING(
-        str,
-        "jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/foo/"
+    constexpr auto str =
+        u"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/"
+        u"foo/"
         "extensions/federated-learning@shigeld.mozilla.org.xpi!/experiments/"
-        "study/api.js");
+        "study/api.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(
         ret.first == kMozillaExtension &&
         ret.second.value() ==
             nsLiteralString(
                 u"federated-learning@shigeld.m!/experiments/study/api.js"));
   }
   {  // Test truncating
-    NS_NAMED_LITERAL_STRING(
-        str,
-        "jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/foo/"
+    constexpr auto str =
+        u"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/"
+        u"foo/"
         "extensions/federated-learning@shigeld.mozilla.org.xpi!/experiments/"
-        "study/apiiiiiiiiiiiiiiiiiiiiiiiiiiiiii.js");
+        "study/apiiiiiiiiiiiiiiiiiiiiiiiiiiiiii.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kMozillaExtension &&
                 ret.second.value() ==
                     u"federated-learning@shigeld.m!/experiments/"
                     "study/apiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"_ns);
   }
 }
 
 TEST(FilenameEvalParser, UserChromeJS)
 {
   {
-    NS_NAMED_LITERAL_STRING(str, "firegestures/content/browser.uc.js");
-    FilenameTypeAndDetails ret =
-        nsContentSecurityUtils::FilenameToFilenameType(str, false);
-    ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
-  }
-  {
-    NS_NAMED_LITERAL_STRING(str, "firegestures/content/browser.uc.js?");
+    constexpr auto str = u"firegestures/content/browser.uc.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
   }
   {
-    nsLiteralString str =
-        NS_LITERAL_STRING("firegestures/content/browser.uc.js?243244224");
+    constexpr auto str = u"firegestures/content/browser.uc.js?"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
   }
   {
-    NS_NAMED_LITERAL_STRING(
-        str,
-        "file:///b:/fxprofiles/mark/chrome/"
-        "addbookmarkherewithmiddleclick.uc.js?1558444389291");
+    constexpr auto str = u"firegestures/content/browser.uc.js?243244224"_ns;
+    FilenameTypeAndDetails ret =
+        nsContentSecurityUtils::FilenameToFilenameType(str, false);
+    ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
+  }
+  {
+    constexpr auto str =
+        u"file:///b:/fxprofiles/mark/chrome/"
+        "addbookmarkherewithmiddleclick.uc.js?1558444389291"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
   }
 }
 
 TEST(FilenameEvalParser, SingleFile)
 {
   {
-    NS_NAMED_LITERAL_STRING(str, "browser.uc.js?2456");
+    constexpr auto str = u"browser.uc.js?2456"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kSingleString && ret.second.isSome() &&
                 ret.second.value() == str);
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "debugger");
+    constexpr auto str = u"debugger"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kSingleString && ret.second.isSome() &&
                 ret.second.value() == str);
   }
 }
 
 TEST(FilenameEvalParser, Other)
 {
   {
-    NS_NAMED_LITERAL_STRING(str, "firegestures--content");
+    constexpr auto str = u"firegestures--content"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "gallop://thing/fire");
+    constexpr auto str = u"gallop://thing/fire"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
                 ret.second.value() == u"gallop"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "gallop://fire");
+    constexpr auto str = u"gallop://fire"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
                 ret.second.value() == u"gallop"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "firegestures/content");
+    constexpr auto str = u"firegestures/content"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsPath &&
                 ret.second.value() == u"content"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "firegestures\\content");
+    constexpr auto str = u"firegestures\\content"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsPath &&
                 ret.second.value() == u"content"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "/home/tom/files/thing");
+    constexpr auto str = u"/home/tom/files/thing"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsPath &&
                 ret.second.value() == u"thing"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "file://c/uers/tom/file.txt");
+    constexpr auto str = u"file://c/uers/tom/file.txt"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
                 ret.second.value() == u"file://.../file.txt"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "c:/uers/tom/file.txt");
+    constexpr auto str = u"c:/uers/tom/file.txt"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsPath &&
                 ret.second.value() == u"file.txt"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "http://example.com/");
+    constexpr auto str = u"http://example.com/"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
                 ret.second.value() == u"http"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
   }
   {
-    NS_NAMED_LITERAL_STRING(str, "http://example.com/thing.html");
+    constexpr auto str = u"http://example.com/thing.html"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
 #if defined(XP_WIN)
     ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
                 ret.second.value() == u"http"_ns);
 #else
     ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
 #endif
@@ -316,54 +313,51 @@ TEST(FilenameEvalParser, WebExtensionPat
     wEI->mBaseURL = u"file://foo"_ns;
     wEI->mMozExtensionHostname = "e37c3c08-beac-a04b-8032-c4f699a1a856"_ns;
 
     mozilla::ErrorResult eR;
     RefPtr<mozilla::WebExtensionPolicy> w =
         mozilla::extensions::WebExtensionPolicy::Constructor(go, *wEI, eR);
     w->SetActive(true, eR);
 
-    NS_NAMED_LITERAL_STRING(
-        str,
-        "moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/file.js");
+    constexpr auto str =
+        u"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/file.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, true);
 
     ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
                 ret.second.value() ==
                     u"moz-extension://[gtesttestextension@mozilla.org: "
                     "gtest Test Extension]/path/to/file.js"_ns);
 
     w->SetActive(false, eR);
   }
   {
-    NS_NAMED_LITERAL_STRING(
-        str,
-        "moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/file.js");
+    constexpr auto str =
+        u"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/file.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, false);
     ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
                 ret.second.value() == u"moz-extension"_ns);
   }
   {
-    NS_NAMED_LITERAL_STRING(
-        str, "moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/file.js");
+    constexpr auto str =
+        u"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/file.js"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, true);
     ASSERT_TRUE(
         ret.first == kSanitizedWindowsURL &&
         ret.second.value() ==
             nsLiteralString(
                 u"moz-extension://[failed finding addon by host]/file.js"));
   }
   {
-    NS_NAMED_LITERAL_STRING(
-        str,
-        "moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/"
-        "file.js?querystringx=6");
+    constexpr auto str =
+        u"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/"
+        "file.js?querystringx=6"_ns;
     FilenameTypeAndDetails ret =
         nsContentSecurityUtils::FilenameToFilenameType(str, true);
     ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
                 ret.second.value() ==
                     u"moz-extension://[failed finding addon "
                     "by host]/path/to/file.js"_ns);
   }
 }
--- a/dom/serviceworkers/ServiceWorkerContainer.cpp
+++ b/dom/serviceworkers/ServiceWorkerContainer.cpp
@@ -281,17 +281,17 @@ already_AddRefed<Promise> ServiceWorkerC
   }
 
   // In ServiceWorkerContainer.register() the scope argument is parsed against
   // different base URLs depending on whether it was passed or not.
   nsCOMPtr<nsIURI> scopeURI;
 
   // Step 4. If none passed, parse against script's URL
   if (!aOptions.mScope.WasPassed()) {
-    NS_NAMED_LITERAL_CSTRING(defaultScope, "./");
+    constexpr auto defaultScope = "./"_ns;
     rv = NS_NewURI(getter_AddRefs(scopeURI), defaultScope, nullptr, scriptURI);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       nsAutoCString spec;
       scriptURI->GetSpec(spec);
       aRv.ThrowTypeError<MSG_INVALID_SCOPE>(defaultScope, spec);
       return nullptr;
     }
   } else {
--- a/dom/simpledb/ActorsParent.cpp
+++ b/dom/simpledb/ActorsParent.cpp
@@ -43,17 +43,17 @@ using namespace mozilla::ipc;
 namespace {
 
 /*******************************************************************************
  * Constants
  ******************************************************************************/
 
 const uint32_t kCopyBufferSize = 32768;
 
-constexpr auto kSDBSuffix = NS_LITERAL_STRING(".sdb");
+constexpr auto kSDBSuffix = u".sdb"_ns;
 
 /*******************************************************************************
  * Actor class declarations
  ******************************************************************************/
 
 class StreamHelper final : public Runnable {
   nsCOMPtr<nsIEventTarget> mOwningEventTarget;
   nsCOMPtr<nsIFileStream> mFileStream;
--- a/dom/u2f/U2F.cpp
+++ b/dom/u2f/U2F.cpp
@@ -26,25 +26,24 @@ class nsHTMLDocument {
  public:
   bool IsRegistrableDomainSuffixOfOrEqualTo(const nsAString& aHostSuffixString,
                                             const nsACString& aOrigHost);
 };
 
 namespace mozilla {
 namespace dom {
 
-NS_NAMED_LITERAL_STRING(kFinishEnrollment, "navigator.id.finishEnrollment");
-NS_NAMED_LITERAL_STRING(kGetAssertion, "navigator.id.getAssertion");
+constexpr auto kFinishEnrollment = u"navigator.id.finishEnrollment"_ns;
+constexpr auto kGetAssertion = u"navigator.id.getAssertion"_ns;
 
 // Bug #1436078 - Permit Google Accounts. Remove in Bug #1436085 in Jan 2023.
-NS_NAMED_LITERAL_STRING(kGoogleAccountsAppId1,
-                        "https://www.gstatic.com/securitykey/origins.json");
-NS_NAMED_LITERAL_STRING(
-    kGoogleAccountsAppId2,
-    "https://www.gstatic.com/securitykey/a/google.com/origins.json");
+constexpr auto kGoogleAccountsAppId1 =
+    u"https://www.gstatic.com/securitykey/origins.json"_ns;
+constexpr auto kGoogleAccountsAppId2 =
+    u"https://www.gstatic.com/securitykey/a/google.com/origins.json"_ns;
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(U2F)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
 NS_INTERFACE_MAP_END_INHERITING(WebAuthnManagerBase)
 
 NS_IMPL_ADDREF_INHERITED(U2F, WebAuthnManagerBase)
 NS_IMPL_RELEASE_INHERITED(U2F, WebAuthnManagerBase)
 
--- a/dom/u2f/U2FAuthenticator.h
+++ b/dom/u2f/U2FAuthenticator.h
@@ -21,14 +21,14 @@ enum class ErrorCode {
   BAD_REQUEST = 2,
   CONFIGURATION_UNSUPPORTED = 3,
   DEVICE_INELIGIBLE = 4,
   TIMEOUT = 5
 };
 
 typedef MozPromise<nsString, ErrorCode, false> U2FPromise;
 
-NS_NAMED_LITERAL_STRING(kRequiredU2FVersion, "U2F_V2");
+constexpr auto kRequiredU2FVersion = u"U2F_V2"_ns;
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_U2FAuthenticator_h
--- a/dom/webauthn/AndroidWebAuthnTokenManager.h
+++ b/dom/webauthn/AndroidWebAuthnTokenManager.h
@@ -10,27 +10,27 @@
 #include "mozilla/dom/CryptoBuffer.h"
 #include "mozilla/dom/U2FTokenTransport.h"
 
 namespace mozilla {
 namespace dom {
 
 // Collected from
 // https://developers.google.com/android/reference/com/google/android/gms/fido/fido2/api/common/ErrorCode
-NS_NAMED_LITERAL_STRING(kSecurityError, "SECURITY_ERR");
-NS_NAMED_LITERAL_STRING(kConstraintError, "CONSTRAINT_ERR");
-NS_NAMED_LITERAL_STRING(kNotSupportedError, "NOT_SUPPORTED_ERR");
-NS_NAMED_LITERAL_STRING(kInvalidStateError, "INVALID_STATE_ERR");
-NS_NAMED_LITERAL_STRING(kNotAllowedError, "NOT_ALLOWED_ERR");
-NS_NAMED_LITERAL_STRING(kAbortError, "ABORT_ERR");
-NS_NAMED_LITERAL_STRING(kEncodingError, "ENCODING_ERR");
-NS_NAMED_LITERAL_STRING(kDataError, "DATA_ERR");
-NS_NAMED_LITERAL_STRING(kTimeoutError, "TIMEOUT_ERR");
-NS_NAMED_LITERAL_STRING(kNetworkError, "NETWORK_ERR");
-NS_NAMED_LITERAL_STRING(kUnknownError, "UNKNOWN_ERR");
+constexpr auto kSecurityError = u"SECURITY_ERR"_ns;
+constexpr auto kConstraintError = u"CONSTRAINT_ERR"_ns;
+constexpr auto kNotSupportedError = u"NOT_SUPPORTED_ERR"_ns;
+constexpr auto kInvalidStateError = u"INVALID_STATE_ERR"_ns;
+constexpr auto kNotAllowedError = u"NOT_ALLOWED_ERR"_ns;
+constexpr auto kAbortError = u"ABORT_ERR"_ns;
+constexpr auto kEncodingError = u"ENCODING_ERR"_ns;
+constexpr auto kDataError = u"DATA_ERR"_ns;
+constexpr auto kTimeoutError = u"TIMEOUT_ERR"_ns;
+constexpr auto kNetworkError = u"NETWORK_ERR"_ns;
+constexpr auto kUnknownError = u"UNKNOWN_ERR"_ns;
 
 class AndroidWebAuthnResult {
  public:
   explicit AndroidWebAuthnResult(const nsAString& aErrorCode)
       : mErrorCode(aErrorCode) {}
 
   explicit AndroidWebAuthnResult() {}
 
--- a/dom/webauthn/U2FSoftTokenManager.cpp
+++ b/dom/webauthn/U2FSoftTokenManager.cpp
@@ -22,17 +22,17 @@ namespace mozilla {
 namespace dom {
 
 using namespace mozilla;
 using mozilla::dom::CreateECParamsForCurve;
 
 const nsCString U2FSoftTokenManager::mSecretNickname = "U2F_NSSTOKEN"_ns;
 
 namespace {
-NS_NAMED_LITERAL_CSTRING(kAttestCertSubjectName, "CN=Firefox U2F Soft Token");
+constexpr auto kAttestCertSubjectName = "CN=Firefox U2F Soft Token"_ns;
 
 // This U2F-compatible soft token uses FIDO U2F-compatible ECDSA keypairs
 // on the SEC_OID_SECG_EC_SECP256R1 curve. When asked to Register, it will
 // generate and return a new keypair KP, where the private component is wrapped
 // using AES-KW with the 128-bit mWrappingKey to make an opaque "key handle".
 // In other words, Register yields { KP_pub, AES-KW(KP_priv, key=mWrappingKey) }
 //
 // The value mWrappingKey is long-lived; it is persisted as part of the NSS DB
--- a/dom/webauthn/WebAuthnManagerBase.cpp
+++ b/dom/webauthn/WebAuthnManagerBase.cpp
@@ -8,18 +8,18 @@
 #include "mozilla/dom/WebAuthnTransactionChild.h"
 #include "mozilla/dom/Event.h"
 #include "nsGlobalWindowInner.h"
 #include "nsPIWindowRoot.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_NAMED_LITERAL_STRING(kDeactivateEvent, "deactivate");
-NS_NAMED_LITERAL_STRING(kVisibilityChange, "visibilitychange");
+constexpr auto kDeactivateEvent = u"deactivate"_ns;
+constexpr auto kVisibilityChange = u"visibilitychange"_ns;
 
 WebAuthnManagerBase::WebAuthnManagerBase(nsPIDOMWindowInner* aParent)
     : mParent(aParent) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aParent);
 }
 
 WebAuthnManagerBase::~WebAuthnManagerBase() { MOZ_ASSERT(NS_IsMainThread()); }
--- a/dom/webauthn/WebAuthnUtil.cpp
+++ b/dom/webauthn/WebAuthnUtil.cpp
@@ -8,21 +8,20 @@
 #include "nsIEffectiveTLDService.h"
 #include "nsNetUtil.h"
 #include "mozpkix/pkixutil.h"
 
 namespace mozilla {
 namespace dom {
 
 // Bug #1436078 - Permit Google Accounts. Remove in Bug #1436085 in Jan 2023.
-NS_NAMED_LITERAL_STRING(kGoogleAccountsAppId1,
-                        "https://www.gstatic.com/securitykey/origins.json");
-NS_NAMED_LITERAL_STRING(
-    kGoogleAccountsAppId2,
-    "https://www.gstatic.com/securitykey/a/google.com/origins.json");
+constexpr auto kGoogleAccountsAppId1 =
+    u"https://www.gstatic.com/securitykey/origins.json"_ns;
+constexpr auto kGoogleAccountsAppId2 =
+    u"https://www.gstatic.com/securitykey/a/google.com/origins.json"_ns;
 
 const uint8_t FLAG_TUP = 0x01;  // Test of User Presence required
 const uint8_t FLAG_AT = 0x40;   // Authenticator Data is provided
 
 bool EvaluateAppID(nsPIDOMWindowInner* aParent, const nsString& aOrigin,
                    /* in/out */ nsString& aAppId) {
   // Facet is the specification's way of referring to the web origin.
   nsAutoCString facetString = NS_ConvertUTF16toUTF8(aOrigin);
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -1004,17 +1004,17 @@ PersistNodeFixup::FixupNode(nsINode* aNo
       nsCOMPtr<nsIImageLoadingContent> imgCon = do_QueryInterface(*aNodeOut);
       if (imgCon) {
         imgCon->SetLoadingEnabled(false);
       }
 
       FixupAttribute(*aNodeOut, "src");
 
       nsAutoString valueStr;
-      NS_NAMED_LITERAL_STRING(valueAttr, "value");
+      constexpr auto valueAttr = u"value"_ns;
       // Update element node attributes with user-entered form state
       RefPtr<dom::HTMLInputElement> outElt =
           dom::HTMLInputElement::FromNode((*aNodeOut)->AsContent());
       nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(*aNodeOut);
       switch (formControl->ControlType()) {
         case NS_FORM_INPUT_EMAIL:
         case NS_FORM_INPUT_SEARCH:
         case NS_FORM_INPUT_TEXT:
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -362,18 +362,18 @@ void LoadJSGCMemoryOptions(const char* a
 
   RuntimeService* rts = RuntimeService::GetService();
 
   if (!rts) {
     // May be shutting down, just bail.
     return;
   }
 
-  NS_NAMED_LITERAL_CSTRING(jsPrefix, PREF_JS_OPTIONS_PREFIX);
-  NS_NAMED_LITERAL_CSTRING(workersPrefix, PREF_WORKERS_OPTIONS_PREFIX);
+  constexpr auto jsPrefix = nsLiteralCString{PREF_JS_OPTIONS_PREFIX};
+  constexpr auto workersPrefix = nsLiteralCString{PREF_WORKERS_OPTIONS_PREFIX};
 
   const nsDependentCString fullPrefName(aPrefName);
 
   // Pull out the string that actually distinguishes the parameter we need to
   // change.
   nsDependentCSubstring memPrefName;
   if (StringBeginsWith(fullPrefName, jsPrefix)) {
     memPrefName.Rebind(fullPrefName, jsPrefix.Length());
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -1303,18 +1303,18 @@ nsXMLContentSink::ReportError(const char
   // prepare to set <parsererror> as the document root
   rv = HandleProcessingInstruction(
       u"xml-stylesheet",
       u"href=\"chrome://global/locale/intl.css\" type=\"text/css\"");
   NS_ENSURE_SUCCESS(rv, rv);
 
   const char16_t* noAtts[] = {0, 0};
 
-  NS_NAMED_LITERAL_STRING(
-      errorNs, "http://www.mozilla.org/newlayout/xml/parsererror.xml");
+  constexpr auto errorNs =
+      u"http://www.mozilla.org/newlayout/xml/parsererror.xml"_ns;
 
   nsAutoString parsererror(errorNs);
   parsererror.Append((char16_t)0xFFFF);
   parsererror.AppendLiteral("parsererror");
 
   rv = HandleStartElement(parsererror.get(), noAtts, 0, (uint32_t)-1, false);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -971,18 +971,18 @@ void txMozillaXSLTProcessor::notifyError
 
   URIUtils::ResetWithSource(document, mSource);
 
   MOZ_ASSERT(
       document->GetReadyStateEnum() == Document::READYSTATE_UNINITIALIZED,
       "Bad readyState.");
   document->SetReadyStateInternal(Document::READYSTATE_LOADING);
 
-  NS_NAMED_LITERAL_STRING(
-      ns, "http://www.mozilla.org/newlayout/xml/parsererror.xml");
+  constexpr auto ns =
+      u"http://www.mozilla.org/newlayout/xml/parsererror.xml"_ns;
 
   IgnoredErrorResult rv;
   ElementCreationOptionsOrString options;
   options.SetAsString();
 
   nsCOMPtr<Element> element =
       document->CreateElementNS(ns, u"parsererror"_ns, options, rv);
   if (rv.Failed()) {
--- a/dom/xul/nsXULContentSink.cpp
+++ b/dom/xul/nsXULContentSink.cpp
@@ -564,18 +564,18 @@ XULContentSinkImpl::ReportError(const ch
   // root node
   nsCOMPtr<Document> idoc = do_QueryReferent(mDocument);
   if (idoc && idoc->SuppressParserErrorElement()) {
     return NS_OK;
   };
 
   const char16_t* noAtts[] = {0, 0};
 
-  NS_NAMED_LITERAL_STRING(
-      errorNs, "http://www.mozilla.org/newlayout/xml/parsererror.xml");
+  constexpr auto errorNs =
+      u"http://www.mozilla.org/newlayout/xml/parsererror.xml"_ns;
 
   nsAutoString parsererror(errorNs);
   parsererror.Append((char16_t)0xFFFF);
   parsererror.AppendLiteral("parsererror");
 
   rv = HandleStartElement(parsererror.get(), noAtts, 0, 0, 0);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/editor/libeditor/CSSEditUtils.cpp
+++ b/editor/libeditor/CSSEditUtils.cpp
@@ -1039,17 +1039,17 @@ bool CSSEditUtils::IsCSSEquivalentToHTML
             // This should only be hit by the "transparent" keyword, which
             // currently serializes to "transparent" (not "rgba(0, 0, 0, 0)").
             MOZ_ASSERT(NS_GET_R(rgba) == 0 && NS_GET_G(rgba) == 0 &&
                        NS_GET_B(rgba) == 0 && NS_GET_A(rgba) == 0);
             htmlColor.AppendLiteral("transparent");
           } else {
             htmlColor.AppendLiteral("rgb(");
 
-            NS_NAMED_LITERAL_STRING(comma, ", ");
+            constexpr auto comma = u", "_ns;
 
             tmpStr.AppendInt(NS_GET_R(rgba), 10);
             htmlColor.Append(tmpStr + comma);
 
             tmpStr.Truncate();
             tmpStr.AppendInt(NS_GET_G(rgba), 10);
             htmlColor.Append(tmpStr + comma);
 
--- a/editor/libeditor/HTMLEditSubActionHandler.cpp
+++ b/editor/libeditor/HTMLEditSubActionHandler.cpp
@@ -1613,18 +1613,18 @@ EditActionResult HTMLEditor::HandleInser
             NS_WARNING("HTMLEditor::InsertTextWithTransaction() failed");
             return EditActionHandled(rv);
           }
           currentPoint = pointAfterInsertedString;
           pointToInsert = pointAfterInsertedString;
         }
       }
     } else {
-      NS_NAMED_LITERAL_STRING(tabStr, "\t");
-      NS_NAMED_LITERAL_STRING(spacesStr, "    ");
+      constexpr auto tabStr = u"\t"_ns;
+      constexpr auto spacesStr = u"    "_ns;
       char specialChars[] = {TAB, nsCRT::LF, 0};
       nsAutoString insertionString(aInsertionString);  // For FindCharInSet().
       while (pos != -1 &&
              pos < static_cast<int32_t>(insertionString.Length())) {
         int32_t oldPos = pos;
         int32_t subStrLen;
         pos = insertionString.FindCharInSet(specialChars, oldPos);
 
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -1381,17 +1381,17 @@ NS_IMETHODIMP HTMLEditor::RebuildDocumen
             "HTMLEditor::ReplaceHeadContentsWithSourceWithTransaction() "
             "failed");
         return rv;
       }
     }
   } else {
     nsReadingIterator<char16_t> begintotal;
     aSourceString.BeginReading(begintotal);
-    NS_NAMED_LITERAL_STRING(head, "<head>");
+    constexpr auto head = u"<head>"_ns;
     if (foundclosehead) {
       nsresult rv = ReplaceHeadContentsWithSourceWithTransaction(
           head + Substring(begintotal, beginclosehead));
       if (NS_FAILED(rv)) {
         NS_WARNING(
             "HTMLEditor::ReplaceHeadContentsWithSourceWithTransaction() "
             "failed");
         return rv;
@@ -1421,17 +1421,17 @@ NS_IMETHODIMP HTMLEditor::RebuildDocumen
 
   rv = SelectAll();
   if (NS_FAILED(rv)) {
     NS_WARNING("EditorBase::SelectAll() failed");
     return rv;
   }
 
   if (!foundbody) {
-    NS_NAMED_LITERAL_STRING(body, "<body>");
+    constexpr auto body = u"<body>"_ns;
     // XXX Without recourse to some parser/content sink/docshell hackery we
     // don't really know where the head ends and the body begins
     if (foundclosehead) {
       // assume body starts after the head ends
       nsresult rv = LoadHTML(body + Substring(endclosehead, endtotal));
       if (NS_FAILED(rv)) {
         NS_WARNING("HTMLEditor::LoadHTML() failed");
         return rv;
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -541,17 +541,17 @@ nsresult HTMLEditor::HideResizersInterna
 
   // get the presshell's document observer interface.
   RefPtr<PresShell> presShell = GetPresShell();
   NS_WARNING_ASSERTION(presShell, "There is no presShell");
   // We allow the pres shell to be null; when it is, we presume there
   // are no document observers to notify, but we still want to
   // UnbindFromTree.
 
-  NS_NAMED_LITERAL_STRING(mousedown, "mousedown");
+  constexpr auto mousedown = u"mousedown"_ns;
 
   // HTMLEditor should forget all members related to resizers first since
   // removing a part of UI may cause showing the resizers again.  In such
   // case, the members may be overwritten by ShowResizers() and this will
   // lose the chance to release the old resizers.
   ManualNACPtr topLeftHandle(std::move(mTopLeftHandle));
   ManualNACPtr topHandle(std::move(mTopHandle));
   ManualNACPtr topRightHandle(std::move(mTopRightHandle));
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -241,17 +241,17 @@ bool TextEditor::UpdateMetaCharset(Docum
 
     if (!FindInReadable(u"content-type"_ns, currentValue,
                         nsCaseInsensitiveStringComparator)) {
       continue;
     }
 
     metaElement->GetAttr(kNameSpaceID_None, nsGkAtoms::content, currentValue);
 
-    NS_NAMED_LITERAL_STRING(charsetEquals, "charset=");
+    constexpr auto charsetEquals = u"charset="_ns;
     nsAString::const_iterator originalStart, start, end;
     originalStart = currentValue.BeginReading(start);
     currentValue.EndReading(end);
     if (!FindInReadable(charsetEquals, start, end,
                         nsCaseInsensitiveStringComparator)) {
       continue;
     }
 
--- a/extensions/auth/nsAuthGSSAPI.cpp
+++ b/extensions/auth/nsAuthGSSAPI.cpp
@@ -112,19 +112,19 @@ static nsresult gssInit() {
 #ifdef XP_WIN
     lib = LoadLibraryWithFlags(libPathU.get());
 #else
     lib = LoadLibraryWithFlags(libPath.get());
 #endif
   } else {
 #ifdef XP_WIN
 #  ifdef _WIN64
-    NS_NAMED_LITERAL_STRING(kLibName, "gssapi64.dll");
+    constexpr auto kLibName = u"gssapi64.dll"_ns;
 #  else
-    NS_NAMED_LITERAL_STRING(kLibName, "gssapi32.dll");
+    constexpr auto kLibName = u"gssapi32.dll"_ns;
 #  endif
 
     lib = LoadLibraryWithFlags(kLibName.get());
 #elif defined(__OpenBSD__)
     /* OpenBSD doesn't register inter-library dependencies in basesystem
      * libs therefor we need to load all the libraries gssapi depends on,
      * in the correct order and with LD_GLOBAL for GSSAPI auth to work
      * fine.
--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp
@@ -127,17 +127,17 @@ nsresult nsReadConfig::readConfigFile() 
   nsCOMPtr<nsIPrefService> prefService =
       do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
   rv =
       prefService->GetDefaultBranch(nullptr, getter_AddRefs(defaultPrefBranch));
   if (NS_FAILED(rv)) return rv;
 
-  NS_NAMED_LITERAL_CSTRING(channel, MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL));
+  constexpr auto channel = nsLiteralCString{MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL)};
 
   bool sandboxEnabled =
       channel.EqualsLiteral("beta") || channel.EqualsLiteral("release");
 
   mozilla::Unused << defaultPrefBranch->GetBoolPref(
       "general.config.sandbox_enabled", &sandboxEnabled);
 
   rv = defaultPrefBranch->GetCharPref("general.config.filename", lockFileName);
--- a/image/ImageMemoryReporter.cpp
+++ b/image/ImageMemoryReporter.cpp
@@ -118,17 +118,17 @@ void ImageMemoryReporter::ReportSharedSu
   // If this memory has already been reported elsewhere (e.g. as part of our
   // explicit section in the surface cache), we don't want report it again as
   // KIND_NONHEAP and have it counted again.
   bool sameProcess = aEntry.mCreatorPid == base::GetCurrentProcId();
   int32_t kind = aIsForCompositor && !sameProcess
                      ? nsIMemoryReporter::KIND_NONHEAP
                      : nsIMemoryReporter::KIND_OTHER;
 
-  NS_NAMED_LITERAL_CSTRING(desc, "Decoded image data stored in shared memory.");
+  constexpr auto desc = "Decoded image data stored in shared memory."_ns;
   aHandleReport->Callback(EmptyCString(), path, kind,
                           nsIMemoryReporter::UNITS_BYTES, surfaceSize, desc,
                           aData);
 }
 
 /* static */
 void ImageMemoryReporter::AppendSharedSurfacePrefix(
     nsACString& aPathPrefix, const SurfaceMemoryCounter& aCounter,
--- a/intl/strres/nsStringBundle.cpp
+++ b/intl/strres/nsStringBundle.cpp
@@ -379,21 +379,20 @@ nsStringBundleBase::CollectReports(nsIHa
 
   if (sharedSize) {
     path.AppendLiteral(", sharedMemorySize=");
     path.AppendInt(uint32_t(sharedSize));
   }
 
   path.AppendLiteral(")");
 
-  NS_NAMED_LITERAL_CSTRING(
-      desc,
+  constexpr auto desc =
       "A StringBundle instance representing the data in a (probably "
       "localized) .properties file. Data may be shared between "
-      "processes.");
+      "processes."_ns;
 
   aHandleReport->Callback(EmptyCString(), path, KIND_HEAP, UNITS_BYTES,
                           heapSize, desc, aData);
 
   if (sharedSize) {
     path.ReplaceLiteral(0, sizeof("explicit/") - 1, "shared-");
 
     aHandleReport->Callback(EmptyCString(), path, KIND_OTHER, UNITS_BYTES,
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -865,17 +865,17 @@ void BaseProcessLauncher::GetChildLogNam
   } else
 #endif
   {
     buffer.Append(origLogName);
   }
 
   // Remove .moz_log extension to avoid its duplication, it will be added
   // automatically by the logging backend
-  static NS_NAMED_LITERAL_CSTRING(kMozLogExt, MOZ_LOG_FILE_EXTENSION);
+  static constexpr auto kMozLogExt = nsLiteralCString{MOZ_LOG_FILE_EXTENSION};
   if (StringEndsWith(buffer, kMozLogExt)) {
     buffer.Truncate(buffer.Length() - kMozLogExt.Length());
   }
 
   // Append child-specific postfix to name
   buffer.AppendLiteral(".child-");
   buffer.AppendInt(gChildCounter);
 }
--- a/js/xpconnect/loader/ScriptPreloader.cpp
+++ b/js/xpconnect/loader/ScriptPreloader.cpp
@@ -768,17 +768,17 @@ void ScriptPreloader::NoteScript(const n
 
   // Don't bother trying to cache any URLs with cache-busting query
   // parameters.
   if (cachePath.FindChar('?') >= 0) {
     return;
   }
 
   // Don't bother caching files that belong to the mochitest harness.
-  NS_NAMED_LITERAL_CSTRING(mochikitPrefix, "chrome://mochikit/");
+  constexpr auto mochikitPrefix = "chrome://mochikit/"_ns;
   if (StringHead(url, mochikitPrefix.Length()) == mochikitPrefix) {
     return;
   }
 
   auto script =
       mScripts.LookupOrAdd(cachePath, *this, url, cachePath, jsscript);
   if (isRunOnce) {
     script->mIsRunOnce = true;
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -249,19 +249,19 @@ void RealmPrivate::Init(HandleObject aGl
                                   BasePrincipal::Cast(principal), aSite);
     JS_SetCompartmentPrivate(c, priv);
   }
 }
 
 static bool TryParseLocationURICandidate(
     const nsACString& uristr, RealmPrivate::LocationHint aLocationHint,
     nsIURI** aURI) {
-  static NS_NAMED_LITERAL_CSTRING(kGRE, "resource://gre/");
-  static NS_NAMED_LITERAL_CSTRING(kToolkit, "chrome://global/");
-  static NS_NAMED_LITERAL_CSTRING(kBrowser, "chrome://browser/");
+  static constexpr auto kGRE = "resource://gre/"_ns;
+  static constexpr auto kToolkit = "chrome://global/"_ns;
+  static constexpr auto kBrowser = "chrome://browser/"_ns;
 
   if (aLocationHint == RealmPrivate::LocationHintAddon) {
     // Blacklist some known locations which are clearly not add-on related.
     if (StringBeginsWith(uristr, kGRE) || StringBeginsWith(uristr, kToolkit) ||
         StringBeginsWith(uristr, kBrowser))
       return false;
 
     // -- GROSS HACK ALERT --
--- a/layout/base/AccessibleCaret.cpp
+++ b/layout/base/AccessibleCaret.cpp
@@ -26,18 +26,19 @@ using namespace dom;
   AC_LOG_BASE("AccessibleCaret (%p): " message, this, ##__VA_ARGS__);
 
 #undef AC_LOGV
 #define AC_LOGV(message, ...) \
   AC_LOGV_BASE("AccessibleCaret (%p): " message, this, ##__VA_ARGS__);
 
 NS_IMPL_ISUPPORTS(AccessibleCaret::DummyTouchListener, nsIDOMEventListener)
 
-NS_NAMED_LITERAL_STRING(AccessibleCaret::sTextOverlayElementId, "text-overlay");
-NS_NAMED_LITERAL_STRING(AccessibleCaret::sCaretImageElementId, "image");
+const nsLiteralString AccessibleCaret::sTextOverlayElementId =
+    u"text-overlay"_ns;
+const nsLiteralString AccessibleCaret::sCaretImageElementId = u"image"_ns;
 
 #define AC_PROCESS_ENUM_TO_STREAM(e) \
   case (e):                          \
     aStream << #e;                   \
     break;
 std::ostream& operator<<(std::ostream& aStream,
                          const AccessibleCaret::Appearance& aAppearance) {
   using Appearance = AccessibleCaret::Appearance;
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -3120,17 +3120,17 @@ nsresult PresShell::GoToAnchor(const nsA
           break;
         }
       }
     }
   }
 
   // Search for anchor in the HTML namespace with a matching name
   if (!content && !mDocument->IsHTMLDocument()) {
-    NS_NAMED_LITERAL_STRING(nameSpace, "http://www.w3.org/1999/xhtml");
+    constexpr auto nameSpace = u"http://www.w3.org/1999/xhtml"_ns;
     // Get the list of anchor elements
     nsCOMPtr<nsINodeList> list =
         mDocument->GetElementsByTagNameNS(nameSpace, u"a"_ns);
     // Loop through the anchors looking for the first one with the given name.
     for (uint32_t i = 0; true; i++) {
       nsIContent* node = list->Item(i);
       if (!node) {  // End of list
         break;
@@ -3210,17 +3210,17 @@ nsresult PresShell::GoToAnchor(const nsA
     }
 
     // If the target is an animation element, activate the animation
     if (content->IsNodeOfType(nsINode::eANIMATION)) {
       SVGContentUtils::ActivateByHyperlink(content.get());
     }
   } else {
     rv = NS_ERROR_FAILURE;
-    NS_NAMED_LITERAL_STRING(top, "top");
+    constexpr auto top = u"top"_ns;
     if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) {
       // Scroll to the top/left if aAnchorName is "top" and there is no element
       // with such a name or id.
       rv = NS_OK;
       nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable();
       // Check |aScroll| after setting |rv| so we set |rv| to the same
       // thing whether or not |aScroll| is true.
       if (aScroll && sf) {
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -2530,20 +2530,18 @@ void nsImageFrame::GetLoadGroup(nsPresCo
   }
 
   *aLoadGroup = doc->GetDocumentLoadGroup().take();
 }
 
 nsresult nsImageFrame::LoadIcons(nsPresContext* aPresContext) {
   NS_ASSERTION(!gIconLoad, "called LoadIcons twice");
 
-  NS_NAMED_LITERAL_STRING(loadingSrc,
-                          "resource://gre-resources/loading-image.png");
-  NS_NAMED_LITERAL_STRING(brokenSrc,
-                          "resource://gre-resources/broken-image.png");
+  constexpr auto loadingSrc = u"resource://gre-resources/loading-image.png"_ns;
+  constexpr auto brokenSrc = u"resource://gre-resources/broken-image.png"_ns;
 
   gIconLoad = new IconLoad();
 
   nsresult rv;
   // create a loader and load the images
   rv = LoadIcon(loadingSrc, aPresContext,
                 getter_AddRefs(gIconLoad->mLoadingImage));
   if (NS_FAILED(rv)) {
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -171,54 +171,54 @@ nsresult nsPageFrame::GetFrameName(nsASt
 }
 #endif
 
 void nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) {
   aNewStr = aStr;
 
   // Search to see if the &D code is in the string
   // then subst in the current date/time
-  NS_NAMED_LITERAL_STRING(kDate, "&D");
+  constexpr auto kDate = u"&D"_ns;
   if (aStr.Find(kDate) != kNotFound) {
     aNewStr.ReplaceSubstring(kDate, mPD->mDateTimeStr);
   }
 
   // NOTE: Must search for &PT before searching for &P
   //
   // Search to see if the "page number and page" total code are in the string
   // and replace the page number and page total code with the actual
   // values
-  NS_NAMED_LITERAL_STRING(kPageAndTotal, "&PT");
+  constexpr auto kPageAndTotal = u"&PT"_ns;
   if (aStr.Find(kPageAndTotal) != kNotFound) {
     nsAutoString uStr;
     nsTextFormatter::ssprintf(uStr, mPD->mPageNumAndTotalsFormat.get(),
                               mPageNum, mTotNumPages);
     aNewStr.ReplaceSubstring(kPageAndTotal, uStr);
   }
 
   // Search to see if the page number code is in the string
   // and replace the page number code with the actual value
-  NS_NAMED_LITERAL_STRING(kPage, "&P");
+  constexpr auto kPage = u"&P"_ns;
   if (aStr.Find(kPage) != kNotFound) {
     nsAutoString uStr;
     nsTextFormatter::ssprintf(uStr, mPD->mPageNumFormat.get(), mPageNum);
     aNewStr.ReplaceSubstring(kPage, uStr);
   }
 
-  NS_NAMED_LITERAL_STRING(kTitle, "&T");
+  constexpr auto kTitle = u"&T"_ns;
   if (aStr.Find(kTitle) != kNotFound) {
     aNewStr.ReplaceSubstring(kTitle, mPD->mDocTitle);
   }
 
-  NS_NAMED_LITERAL_STRING(kDocURL, "&U");
+  constexpr auto kDocURL = u"&U"_ns;
   if (aStr.Find(kDocURL) != kNotFound) {
     aNewStr.ReplaceSubstring(kDocURL, mPD->mDocURL);
   }
 
-  NS_NAMED_LITERAL_STRING(kPageTotal, "&L");
+  constexpr auto kPageTotal = u"&L"_ns;
   if (aStr.Find(kPageTotal) != kNotFound) {
     nsAutoString uStr;
     nsTextFormatter::ssprintf(uStr, mPD->mPageNumFormat.get(), mTotNumPages);
     aNewStr.ReplaceSubstring(kPageTotal, uStr);
   }
 }
 
 //------------------------------------------------------------------------------
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -91,17 +91,17 @@ void nsDisplayMathMLError::Paint(nsDispl
   DrawTarget* drawTarget = aCtx->GetDrawTarget();
   Rect rect = NSRectToSnappedRect(nsRect(pt, mFrame->GetSize()),
                                   appUnitsPerDevPixel, *drawTarget);
   ColorPattern red(ToDeviceColor(sRGBColor(1.f, 0.f, 0.f, 1.f)));
   drawTarget->FillRect(rect, red);
 
   aCtx->SetColor(sRGBColor::OpaqueWhite());
   nscoord ascent = fm->MaxAscent();
-  NS_NAMED_LITERAL_STRING(errorMsg, "invalid-markup");
+  constexpr auto errorMsg = u"invalid-markup"_ns;
   nsLayoutUtils::DrawUniDirString(errorMsg.get(), uint32_t(errorMsg.Length()),
                                   nsPoint(pt.x, pt.y + ascent), *fm, *aCtx);
 }
 
 /* /////////////
  * nsIMathMLFrame - support methods for stretchy elements
  * =============================================================================
  */
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -2113,17 +2113,17 @@ bool nsPrintJob::PrintDocContent(const U
       if (printed || NS_FAILED(aStatus)) {
         return true;
       }
     }
   }
   return false;
 }
 
-static NS_NAMED_LITERAL_STRING(kEllipsis, u"\x2026");
+static constexpr auto kEllipsis = u"\x2026"_ns;
 
 /**
  * Builds the complement set of ranges and adds those to the selection.
  * Deletes all of the nodes contained in the complement set of ranges
  * leaving behind only nodes that were originally selected.
  * Adds ellipses to a selected node's text if text is truncated by a range.
  * This is used to implement the "Print Selection Only" user interface option.
  */
--- a/layout/style/test/gtest/StyloParsingBench.cpp
+++ b/layout/style/test/gtest/StyloParsingBench.cpp
@@ -72,17 +72,17 @@ static void ServoGetPropertyValueById() 
   RefPtr<RawServoDeclarationBlock> block =
       Servo_DeclarationBlock_CreateEmpty().Consume();
 
   RefPtr<NullPrincipalURI> uri = new NullPrincipalURI();
   nsCOMPtr<nsIReferrerInfo> referrerInfo = new ReferrerInfo(nullptr);
   RefPtr<URLExtraData> data =
       new URLExtraData(uri.forget(), referrerInfo.forget(),
                        NullPrincipal::CreateWithoutOriginAttributes());
-  NS_NAMED_LITERAL_CSTRING(css_, "10px");
+  constexpr auto css_ = "10px"_ns;
   const nsACString& css = css_;
   Servo_DeclarationBlock_SetPropertyById(
       block, eCSSProperty_width, &css,
       /* is_important = */ false, data, ParsingMode::Default,
       eCompatibility_FullStandards, nullptr, {});
 
   for (int i = 0; i < GETPROPERTY_REPETITIONS; i++) {
     DOMString value_;
--- a/layout/xul/nsMenuBarFrame.cpp
+++ b/layout/xul/nsMenuBarFrame.cpp
@@ -85,18 +85,18 @@ nsMenuBarFrame::SetActive(bool aActiveFl
   mIsActive = aActiveFlag;
   if (mIsActive) {
     InstallKeyboardNavigator();
   } else {
     mActiveByKeyboard = false;
     RemoveKeyboardNavigator();
   }
 
-  NS_NAMED_LITERAL_STRING(active, "DOMMenuBarActive");
-  NS_NAMED_LITERAL_STRING(inactive, "DOMMenuBarInactive");
+  constexpr auto active = u"DOMMenuBarActive"_ns;
+  constexpr auto inactive = u"DOMMenuBarInactive"_ns;
 
   FireDOMEvent(mIsActive ? active : inactive, mContent);
 
   return NS_OK;
 }
 
 nsMenuFrame* nsMenuBarFrame::ToggleMenuActiveState() {
   if (mIsActive) {
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -954,17 +954,17 @@ nsresult nsTreeBodyFrame::GetCoordsForCe
     // We don't want to consider any of the decorations that may be present
     // on the current row, so we have to deflate the rect by the border and
     // padding and offset its left and top coordinates appropriately.
     AdjustForBorderPadding(rowContext, cellRect);
 
     ComputedStyle* cellContext =
         GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell());
 
-    NS_NAMED_LITERAL_CSTRING(cell, "cell");
+    constexpr auto cell = "cell"_ns;
     if (currCol->IsCycler() || cell.Equals(aElement)) {
       // If the current Column is a Cycler, then the Rect is just the cell - the
       // margins. Similarly, if we're just being asked for the cell rect,
       // provide it.
 
       theRect = cellRect;
       nsMargin cellMargin;
       cellContext->StyleMargin()->GetMargin(cellMargin);
--- a/layout/xul/tree/nsTreeSelection.cpp
+++ b/layout/xul/tree/nsTreeSelection.cpp
@@ -556,18 +556,18 @@ NS_IMETHODIMP nsTreeSelection::SetCurren
   mCurrentIndex = aIndex;
   if (!mTree) return NS_OK;
 
   if (aIndex != -1) mTree->InvalidateRow(aIndex);
 
   // Fire DOMMenuItemActive or DOMMenuItemInactive event for tree.
   NS_ENSURE_STATE(mTree);
 
-  NS_NAMED_LITERAL_STRING(DOMMenuItemActive, "DOMMenuItemActive");
-  NS_NAMED_LITERAL_STRING(DOMMenuItemInactive, "DOMMenuItemInactive");
+  constexpr auto DOMMenuItemActive = u"DOMMenuItemActive"_ns;
+  constexpr auto DOMMenuItemInactive = u"DOMMenuItemInactive"_ns;
 
   RefPtr<AsyncEventDispatcher> asyncDispatcher = new AsyncEventDispatcher(
       mTree, (aIndex != -1 ? DOMMenuItemActive : DOMMenuItemInactive),
       CanBubble::eYes, ChromeOnlyDispatch::eNo);
   return asyncDispatcher->PostDOMEvent();
 }
 
 #define ADD_NEW_RANGE(macro_range, macro_selection, macro_start, macro_end) \
--- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
+++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp
@@ -21,17 +21,17 @@
 #include "nsNativeCharsetUtils.h"
 
 using mozilla::LogLevel;
 
 #if defined(ANDROID)
 static const char* default_tmp_dir = "/dev/null";
 static const char* default_log_name = "nspr";
 #else  // Assume a POSIX environment
-NS_NAMED_LITERAL_CSTRING(default_log_name, "WebRTC.log");
+constexpr auto default_log_name = "WebRTC.log"_ns;
 #endif
 
 static mozilla::LazyLogModule sWebRtcLog("webrtc_trace");
 static mozilla::LazyLogModule sLogAEC("AEC");
 
 class LogSinkImpl : public rtc::LogSink {
  public:
   LogSinkImpl() {}
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -3348,17 +3348,17 @@ void Preferences::SetupTelemetryPref() {
 
 #else  // !MOZ_WIDGET_ANDROID
 
 static bool TelemetryPrefValue() {
   // For platforms with Unified Telemetry (here meaning not-Android),
   // toolkit.telemetry.enabled determines whether we send "extended" data.
   // We only want extended data from pre-release channels due to size.
 
-  NS_NAMED_LITERAL_CSTRING(channel, MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL));
+  constexpr auto channel = nsLiteralCString{MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL)};
 
   // Easy cases: Nightly, Aurora, Beta.
   if (channel.EqualsLiteral("nightly") || channel.EqualsLiteral("aurora") ||
       channel.EqualsLiteral("beta")) {
     return true;
   }
 
 #  ifndef MOZILLA_OFFICIAL
--- a/mozglue/tests/gtest/TestDLLBlocklist.cpp
+++ b/mozglue/tests/gtest/TestDLLBlocklist.cpp
@@ -34,52 +34,52 @@ static nsString GetFullPath(const nsAStr
   EXPECT_TRUE(NS_SUCCEEDED(f->GetPath(ret)));
   return ret;
 }
 
 TEST(TestDllBlocklist, BlockDllByName)
 {
   // The DLL name has capital letters, so this also tests that the comparison
   // is case-insensitive.
-  NS_NAMED_LITERAL_STRING(kLeafName, "TestDllBlocklist_MatchByName.dll");
+  constexpr auto kLeafName = u"TestDllBlocklist_MatchByName.dll"_ns;
   nsString dllPath = GetFullPath(kLeafName);
 
   nsModuleHandle hDll(::LoadLibraryW(dllPath.get()));
 
   EXPECT_TRUE(!hDll);
   EXPECT_TRUE(!::GetModuleHandleW(kLeafName.get()));
 }
 
 TEST(TestDllBlocklist, BlockDllByVersion)
 {
-  NS_NAMED_LITERAL_STRING(kLeafName, "TestDllBlocklist_MatchByVersion.dll");
+  constexpr auto kLeafName = u"TestDllBlocklist_MatchByVersion.dll"_ns;
   nsString dllPath = GetFullPath(kLeafName);
 
   nsModuleHandle hDll(::LoadLibraryW(dllPath.get()));
 
   EXPECT_TRUE(!hDll);
   EXPECT_TRUE(!::GetModuleHandleW(kLeafName.get()));
 }
 
 TEST(TestDllBlocklist, AllowDllByVersion)
 {
-  NS_NAMED_LITERAL_STRING(kLeafName, "TestDllBlocklist_AllowByVersion.dll");
+  constexpr auto kLeafName = u"TestDllBlocklist_AllowByVersion.dll"_ns;
   nsString dllPath = GetFullPath(kLeafName);
 
   nsModuleHandle hDll(::LoadLibraryW(dllPath.get()));
 
   EXPECT_TRUE(!!hDll);
   EXPECT_TRUE(!!::GetModuleHandleW(kLeafName.get()));
 }
 
 TEST(TestDllBlocklist, NoOpEntryPoint)
 {
   // DllMain of this dll has MOZ_RELEASE_ASSERT.  This test makes sure we load
   // the module successfully without running DllMain.
-  NS_NAMED_LITERAL_STRING(kLeafName, "TestDllBlocklist_NoOpEntryPoint.dll");
+  constexpr auto kLeafName = u"TestDllBlocklist_NoOpEntryPoint.dll"_ns;
   nsString dllPath = GetFullPath(kLeafName);
 
   nsModuleHandle hDll(::LoadLibraryW(dllPath.get()));
 
 #if defined(MOZ_ASAN)
   // With ASAN, the test uses mozglue's blocklist where
   // REDIRECT_TO_NOOP_ENTRYPOINT is ignored.  So LoadLibraryW
   // is expected to fail.
@@ -125,17 +125,17 @@ TEST(TestDllBlocklist, BlocklistIntegrit
 }
 
 TEST(TestDllBlocklist, BlockThreadWithLoadLibraryEntryPoint)
 {
   // Only supported on Nightly
 #if defined(NIGHTLY_BUILD)
   using ThreadProc = unsigned(__stdcall*)(void*);
 
-  NS_NAMED_LITERAL_STRING(kLeafNameW, "TestDllBlocklist_MatchByVersion.dll");
+  constexpr auto kLeafNameW = u"TestDllBlocklist_MatchByVersion.dll"_ns;
 
   nsString fullPathW = GetFullPath(kLeafNameW);
   EXPECT_FALSE(fullPathW.IsEmpty());
 
   nsAutoHandle threadW(reinterpret_cast<HANDLE>(
       _beginthreadex(nullptr, 0, reinterpret_cast<ThreadProc>(&::LoadLibraryW),
                      (void*)fullPathW.get(), 0, nullptr)));
 
--- a/netwerk/base/CaptivePortalService.cpp
+++ b/netwerk/base/CaptivePortalService.cpp
@@ -6,17 +6,17 @@
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Services.h"
 #include "mozilla/Preferences.h"
 #include "nsIObserverService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsXULAppAPI.h"
 #include "xpcpublic.h"
 
-static NS_NAMED_LITERAL_STRING(kInterfaceName, u"captive-portal-inteface");
+static constexpr auto kInterfaceName = u"captive-portal-inteface"_ns;
 
 static const char kOpenCaptivePortalLoginEvent[] = "captive-portal-login";
 static const char kAbortCaptivePortalLoginEvent[] =
     "captive-portal-login-abort";
 static const char kCaptivePortalLoginSuccessEvent[] =
     "captive-portal-login-success";
 
 static const uint32_t kDefaultInterval = 60 * 1000;  // check every 60 seconds
--- a/netwerk/base/nsIncrementalDownload.cpp
+++ b/netwerk/base/nsIncrementalDownload.cpp
@@ -753,17 +753,17 @@ nsIncrementalDownload::AsyncOnChannelRed
   // 311595.  Any failure code returned from this function aborts the redirect.
 
   nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(oldChannel);
   NS_ENSURE_STATE(http);
 
   nsCOMPtr<nsIHttpChannel> newHttpChannel = do_QueryInterface(newChannel);
   NS_ENSURE_STATE(newHttpChannel);
 
-  NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");
+  constexpr auto rangeHdr = "Range"_ns;
 
   nsresult rv = ClearRequestHeader(newHttpChannel);
   if (NS_FAILED(rv)) return rv;
 
   // If we didn't have a Range header, then we must be doing a full download.
   nsAutoCString rangeVal;
   Unused << http->GetRequestHeader(rangeHdr, rangeVal);
   if (!rangeVal.IsEmpty()) {
--- a/netwerk/base/nsURLHelperOSX.cpp
+++ b/netwerk/base/nsURLHelperOSX.cpp
@@ -113,17 +113,17 @@ nsresult net_GetURLSpecFromActualFile(ns
   nsresult rv;
   nsAutoCString ePath;
 
   // construct URL spec from native file path
   rv = aFile->GetNativePath(ePath);
   if (NS_FAILED(rv)) return rv;
 
   nsAutoCString escPath;
-  NS_NAMED_LITERAL_CSTRING(prefix, "file://");
+  constexpr auto prefix = "file://"_ns;
 
   // Escape the path with the directory mask
   if (NS_EscapeURL(ePath.get(), ePath.Length(), esc_Directory + esc_Forced,
                    escPath))
     escPath.Insert(prefix, 0);
   else
     escPath.Assign(prefix + ePath);
 
--- a/netwerk/base/nsURLHelperUnix.cpp
+++ b/netwerk/base/nsURLHelperUnix.cpp
@@ -27,17 +27,17 @@ nsresult net_GetURLSpecFromActualFile(ns
 
   // Use UTF8 version if conversion was successful
   if (nativePath == ePath)
     CopyUTF16toUTF8(path, ePath);
   else
     ePath = nativePath;
 
   nsAutoCString escPath;
-  NS_NAMED_LITERAL_CSTRING(prefix, "file://");
+  constexpr auto prefix = "file://"_ns;
 
   // Escape the path with the directory mask
   if (NS_EscapeURL(ePath.get(), -1, esc_Directory + esc_Forced, escPath))
     escPath.Insert(prefix, 0);
   else
     escPath.Assign(prefix + ePath);
 
   // esc_Directory does not escape the semicolons, so if a filename
--- a/netwerk/base/nsURLHelperWin.cpp
+++ b/netwerk/base/nsURLHelperWin.cpp
@@ -26,17 +26,17 @@ nsresult net_GetURLSpecFromActualFile(ns
   // Replace \ with / to convert to an url
   path.ReplaceChar(char16_t(0x5Cu), char16_t(0x2Fu));
 
   nsAutoCString escPath;
 
   // Windows Desktop paths begin with a drive letter, so need an 'extra'
   // slash at the begining
   // C:\Windows =>  file:///C:/Windows
-  NS_NAMED_LITERAL_CSTRING(prefix, "file:///");
+  constexpr auto prefix = "file:///"_ns;
 
   // Escape the path with the directory mask
   NS_ConvertUTF16toUTF8 ePath(path);
   if (NS_EscapeURL(ePath.get(), -1, esc_Directory + esc_Forced, escPath))
     escPath.Insert(prefix, 0);
   else
     escPath.Assign(prefix + ePath);
 
--- a/netwerk/cookie/CookiePersistentStorage.cpp
+++ b/netwerk/cookie/CookiePersistentStorage.cpp
@@ -1083,18 +1083,18 @@ CookiePersistentStorage::OpenDBResult Co
         NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
 
         // Copy data from old table without the two deprecated columns appId and
         // inBrowserElement.
         nsCOMPtr<mozIStorageFunction> convertToOriginAttrs(
             new ConvertAppIdToOriginAttrsSQLFunction());
         NS_ENSURE_TRUE(convertToOriginAttrs, RESULT_RETRY);
 
-        NS_NAMED_LITERAL_CSTRING(convertToOriginAttrsName,
-                                 "CONVERT_TO_ORIGIN_ATTRIBUTES");
+        constexpr auto convertToOriginAttrsName =
+            "CONVERT_TO_ORIGIN_ATTRIBUTES"_ns;
 
         rv = mSyncConn->CreateFunction(convertToOriginAttrsName, 2,
                                        convertToOriginAttrs);
         NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
 
         rv = mSyncConn->ExecuteSimpleSQL(nsLiteralCString(
             "INSERT INTO moz_cookies "
             "(baseDomain, originAttributes, name, value, host, path, expiry,"
@@ -1136,26 +1136,26 @@ CookiePersistentStorage::OpenDBResult Co
         NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
 
         // Compute and populate the values of appId and inBrwoserElement from
         // originAttributes.
         nsCOMPtr<mozIStorageFunction> setAppId(
             new SetAppIdFromOriginAttributesSQLFunction());
         NS_ENSURE_TRUE(setAppId, RESULT_RETRY);
 
-        NS_NAMED_LITERAL_CSTRING(setAppIdName, "SET_APP_ID");
+        constexpr auto setAppIdName = "SET_APP_ID"_ns;
 
         rv = mSyncConn->CreateFunction(setAppIdName, 1, setAppId);
         NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
 
         nsCOMPtr<mozIStorageFunction> setInBrowser(
             new SetInBrowserFromOriginAttributesSQLFunction());
         NS_ENSURE_TRUE(setInBrowser, RESULT_RETRY);
 
-        NS_NAMED_LITERAL_CSTRING(setInBrowserName, "SET_IN_BROWSER");
+        constexpr auto setInBrowserName = "SET_IN_BROWSER"_ns;
 
         rv = mSyncConn->CreateFunction(setInBrowserName, 1, setInBrowser);
         NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
 
         rv = mSyncConn->ExecuteSimpleSQL(nsLiteralCString(
             "UPDATE moz_cookies SET appId = SET_APP_ID(originAttributes), "
             "inBrowserElement = SET_IN_BROWSER(originAttributes);"));
         NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
--- a/netwerk/cookie/CookieService.cpp
+++ b/netwerk/cookie/CookieService.cpp
@@ -49,21 +49,21 @@ namespace net {
 
 /******************************************************************************
  * CookieService impl:
  * useful types & constants
  ******************************************************************************/
 
 static StaticRefPtr<CookieService> gCookieService;
 
-constexpr auto CONSOLE_SAMESITE_CATEGORY = NS_LITERAL_CSTRING("cookieSameSite");
-constexpr auto CONSOLE_OVERSIZE_CATEGORY =
-    NS_LITERAL_CSTRING("cookiesOversize");
-constexpr auto SAMESITE_MDN_URL = NS_LITERAL_STRING(
-    "https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite");
+constexpr auto CONSOLE_SAMESITE_CATEGORY = "cookieSameSite"_ns;
+constexpr auto CONSOLE_OVERSIZE_CATEGORY = "cookiesOversize"_ns;
+constexpr auto SAMESITE_MDN_URL =
+    "https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/"
+    u"SameSite"_ns;
 
 namespace {
 
 void ComposeCookieString(nsTArray<Cookie*>& aCookieList,
                          nsACString& aCookieString) {
   for (Cookie* cookie : aCookieList) {
     // check if we have anything to write
     if (!cookie->Name().IsEmpty() || !cookie->Value().IsEmpty()) {
--- a/netwerk/dns/TRRService.cpp
+++ b/netwerk/dns/TRRService.cpp
@@ -103,18 +103,18 @@ bool TRRService::CheckCaptivePortalIsPas
     }
     LOG(("TRRService::Init mCaptiveState=%d mCaptiveIsPassed=%d\n",
          captiveState, (int)result));
   }
 
   return result;
 }
 
-NS_NAMED_LITERAL_CSTRING(kTRRIsAutoDetectedKey, "(auto-detected)");
-NS_NAMED_LITERAL_CSTRING(kTRRNotAutoDetectedKey, "(default)");
+constexpr auto kTRRIsAutoDetectedKey = "(auto-detected)"_ns;
+constexpr auto kTRRNotAutoDetectedKey = "(default)"_ns;
 // static
 const nsCString& TRRService::AutoDetectedKey() {
   if (gTRRService && gTRRService->IsUsingAutoDetectedURL()) {
     return kTRRIsAutoDetectedKey.AsString();
   }
 
   return kTRRNotAutoDetectedKey.AsString();
 }
--- a/netwerk/protocol/about/nsAboutCacheEntry.cpp
+++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp
@@ -132,31 +132,30 @@ nsresult nsAboutCacheEntry::Channel::Get
   nsresult rv;
 
   // Init: (block size, maximum length)
   nsCOMPtr<nsIAsyncInputStream> inputStream;
   rv = NS_NewPipe2(getter_AddRefs(inputStream), getter_AddRefs(mOutputStream),
                    true, false, 256, UINT32_MAX);
   if (NS_FAILED(rv)) return rv;
 
-  NS_NAMED_LITERAL_CSTRING(
-      buffer,
+  constexpr auto buffer =
       "<!DOCTYPE html>\n"
       "<html>\n"
       "<head>\n"
       "  <meta http-equiv=\"Content-Security-Policy\" content=\"default-src "
       "chrome:; object-src 'none'\" />\n"
       "  <title>Cache entry information</title>\n"
       "  <link rel=\"stylesheet\" "
       "href=\"chrome://global/skin/about.css\" type=\"text/css\"/>\n"
       "  <link rel=\"stylesheet\" "
       "href=\"chrome://global/skin/aboutCacheEntry.css\" type=\"text/css\"/>\n"
       "</head>\n"
       "<body>\n"
-      "<h1>Cache entry information</h1>\n");
+      "<h1>Cache entry information</h1>\n"_ns;
   uint32_t n;
   rv = mOutputStream->Write(buffer.get(), buffer.Length(), &n);
   if (NS_FAILED(rv)) return rv;
   if (n != buffer.Length()) return NS_ERROR_UNEXPECTED;
 
   rv = OpenCacheEntry(uri);
   if (NS_FAILED(rv)) return rv;
 
@@ -459,18 +458,17 @@ nsresult nsAboutCacheEntry::Channel::Wri
   }
 
   mWaitingForData = true;
   return NS_OK;
 }
 
 nsresult nsAboutCacheEntry::Channel::WriteCacheEntryUnavailable() {
   uint32_t n;
-  NS_NAMED_LITERAL_CSTRING(buffer,
-                           "The cache entry you selected is not available.");
+  constexpr auto buffer = "The cache entry you selected is not available."_ns;
   mOutputStream->Write(buffer.get(), buffer.Length(), &n);
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsICacheEntryMetaDataVisitor implementation
 //-----------------------------------------------------------------------------
 
@@ -495,17 +493,17 @@ nsAboutCacheEntry::Channel::OnMetaDataEl
 //-----------------------------------------------------------------------------
 // nsIStreamListener implementation
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsAboutCacheEntry::Channel::OnStartRequest(nsIRequest* request) {
   mHexDumpState = 0;
 
-  NS_NAMED_LITERAL_CSTRING(buffer, "<hr/>\n<pre>");
+  constexpr auto buffer = "<hr/>\n<pre>"_ns;
   uint32_t n;
   return mOutputStream->Write(buffer.get(), buffer.Length(), &n);
 }
 
 NS_IMETHODIMP
 nsAboutCacheEntry::Channel::OnDataAvailable(nsIRequest* request,
                                             nsIInputStream* aInputStream,
                                             uint64_t aOffset, uint32_t aCount) {
@@ -530,25 +528,25 @@ nsresult nsAboutCacheEntry::Channel::Pri
   *aWriteCount = aCount;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAboutCacheEntry::Channel::OnStopRequest(nsIRequest* request,
                                           nsresult result) {
-  NS_NAMED_LITERAL_CSTRING(buffer, "</pre>\n");
+  constexpr auto buffer = "</pre>\n"_ns;
   uint32_t n;
   mOutputStream->Write(buffer.get(), buffer.Length(), &n);
 
   CloseContent();
 
   return NS_OK;
 }
 
 void nsAboutCacheEntry::Channel::CloseContent() {
-  NS_NAMED_LITERAL_CSTRING(buffer, "</body>\n</html>\n");
+  constexpr auto buffer = "</body>\n</html>\n"_ns;
   uint32_t n;
   mOutputStream->Write(buffer.get(), buffer.Length(), &n);
 
   mOutputStream->Close();
   mOutputStream = nullptr;
 }
--- a/netwerk/protocol/data/nsDataHandler.cpp
+++ b/netwerk/protocol/data/nsDataHandler.cpp
@@ -145,18 +145,18 @@ static bool FindOffsetOf(const nsACStrin
   aOffset = nsACString::size_type(begin.get() - aSrc.Data());
   return true;
 }
 
 nsresult nsDataHandler::ParsePathWithoutRef(
     const nsACString& aPath, nsCString& aContentType,
     nsCString* aContentCharset, bool& aIsBase64,
     nsDependentCSubstring* aDataBuffer) {
-  static NS_NAMED_LITERAL_CSTRING(kBase64, "base64");
-  static NS_NAMED_LITERAL_CSTRING(kCharset, "charset");
+  static constexpr auto kBase64 = "base64"_ns;
+  static constexpr auto kCharset = "charset"_ns;
 
   aIsBase64 = false;
 
   // First, find the start of the data
   int32_t commaIdx = aPath.FindChar(',');
 
   // This is a hack! When creating a URL using the DOM API we want to ignore
   // if a comma is missing. But if we're actually loading a data: URI, in which
@@ -237,17 +237,17 @@ nsresult nsDataHandler::ParsePathWithout
   }
 
   return NS_OK;
 }
 
 nsresult nsDataHandler::ParseURI(nsCString& spec, nsCString& contentType,
                                  nsCString* contentCharset, bool& isBase64,
                                  nsCString* dataBuffer) {
-  static NS_NAMED_LITERAL_CSTRING(kDataScheme, "data:");
+  static constexpr auto kDataScheme = "data:"_ns;
 
   // move past "data:"
   int32_t scheme = spec.Find(kDataScheme, /* aIgnoreCase = */ true);
   if (scheme == kNotFound) {
     // malformed uri
     return NS_ERROR_MALFORMED_URI;
   }
 
--- a/netwerk/protocol/http/AlternateServices.cpp
+++ b/netwerk/protocol/http/AlternateServices.cpp
@@ -1177,18 +1177,18 @@ void AltSvcCache::ClearHostMapping(const
         host, port, originAttributes, topWindowOrigin);
     if (event) {
       NS_DispatchToMainThread(event);
     }
     return;
   }
   nsAutoCString key;
   for (int secure = 0; secure < 2; ++secure) {
-    NS_NAMED_LITERAL_CSTRING(http, "http");
-    NS_NAMED_LITERAL_CSTRING(https, "https");
+    constexpr auto http = "http"_ns;
+    constexpr auto https = "https"_ns;
     const nsLiteralCString& scheme = secure ? https : http;
     for (int pb = 1; pb >= 0; --pb) {
       for (int isolate = 0; isolate < 2; ++isolate) {
         AltSvcMapping::MakeHashKey(key, scheme, host, port, bool(pb),
                                    bool(isolate), topWindowOrigin,
                                    originAttributes);
         RefPtr<AltSvcMapping> existing = LookupMapping(key, bool(pb));
         if (existing) {
--- a/netwerk/protocol/http/HttpTrafficAnalyzer.cpp
+++ b/netwerk/protocol/http/HttpTrafficAnalyzer.cpp
@@ -9,17 +9,17 @@
 #include "mozilla/StaticPrefs_network.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Unused.h"
 #include "nsSocketTransportService2.h"
 
 namespace mozilla {
 namespace net {
 
-NS_NAMED_LITERAL_CSTRING(kInvalidCategory, "INVALID_CATEGORY");
+constexpr auto kInvalidCategory = "INVALID_CATEGORY"_ns;
 
 #define DEFINE_CATEGORY(_name, _idx) nsLiteralCString("Y" #_idx "_" #_name),
 static const nsCString gKeyName[] = {
 #include "HttpTrafficAnalyzer.inc"
     kInvalidCategory,
 };
 #undef DEFINE_CATEGORY
 
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3389,17 +3389,17 @@ nsresult nsHttpChannel::ResolveProxy() {
   return rv;
 }
 
 bool nsHttpChannel::ResponseWouldVary(nsICacheEntry* entry) {
   nsresult rv;
   nsAutoCString buf, metaKey;
   Unused << mCachedResponseHead->GetHeader(nsHttp::Vary, buf);
   if (!buf.IsEmpty()) {
-    NS_NAMED_LITERAL_CSTRING(prefix, "request-");
+    constexpr auto prefix = "request-"_ns;
 
     // enumerate the elements of the Vary header...
     char* val = buf.BeginWriting();  // going to munge buf
     char* token = nsCRT::strtok(val, NS_HTTP_HEADER_SEPS, &val);
     while (token) {
       LOG(
           ("nsHttpChannel::ResponseWouldVary [channel=%p] "
            "processing %s\n",
@@ -5636,17 +5636,17 @@ nsresult DoAddCacheEntryHeaders(nsHttpCh
   // NOTE: if "Vary: accept, cookie", then we will store the "accept" header
   // in the cache.  we could try to avoid needlessly storing the "accept"
   // header in this case, but it doesn't seem worth the extra code to perform
   // the check.
   {
     nsAutoCString buf, metaKey;
     Unused << responseHead->GetHeader(nsHttp::Vary, buf);
     if (!buf.IsEmpty()) {
-      NS_NAMED_LITERAL_CSTRING(prefix, "request-");
+      constexpr auto prefix = "request-"_ns;
 
       char* bufData = buf.BeginWriting();  // going to munge buf
       char* token = nsCRT::strtok(bufData, NS_HTTP_HEADER_SEPS, &bufData);
       while (token) {
         LOG(
             ("nsHttpChannel::AddCacheEntryHeaders [this=%p] "
              "processing %s",
              self, token));
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -715,18 +715,18 @@ nsresult nsHttpHandler::AddStandardReque
 
 nsresult nsHttpHandler::AddConnectionHeader(nsHttpRequestHead* request,
                                             uint32_t caps) {
   // RFC2616 section 19.6.2 states that the "Connection: keep-alive"
   // and "Keep-alive" request headers should not be sent by HTTP/1.1
   // user-agents.  But this is not a problem in practice, and the
   // alternative proxy-connection is worse. see 570283
 
-  NS_NAMED_LITERAL_CSTRING(close, "close");
-  NS_NAMED_LITERAL_CSTRING(keepAlive, "keep-alive");
+  constexpr auto close = "close"_ns;
+  constexpr auto keepAlive = "keep-alive"_ns;
 
   const nsLiteralCString* connectionType = &close;
   if (caps & NS_HTTP_ALLOW_KEEPALIVE) {
     connectionType = &keepAlive;
   }
 
   return request->SetHeader(nsHttp::Connection, *connectionType);
 }
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
@@ -918,17 +918,17 @@ nsViewSourceChannel::SetResponseHeader(c
   return !mHttpChannel ? NS_ERROR_NULL_POINTER
                        : mHttpChannel->SetResponseHeader(header, value, merge);
 }
 
 NS_IMETHODIMP
 nsViewSourceChannel::VisitResponseHeaders(nsIHttpHeaderVisitor* aVisitor) {
   if (!mHttpChannel) return NS_ERROR_NULL_POINTER;
 
-  NS_NAMED_LITERAL_CSTRING(contentTypeStr, "Content-Type");
+  constexpr auto contentTypeStr = "Content-Type"_ns;
   nsAutoCString contentType;
   nsresult rv = mHttpChannel->GetResponseHeader(contentTypeStr, contentType);
   if (NS_SUCCEEDED(rv)) {
     return aVisitor->VisitHeader(contentTypeStr, contentType);
   }
   return NS_OK;
 }
 
--- a/netwerk/test/gtest/TestIsValidIp.cpp
+++ b/netwerk/test/gtest/TestIsValidIp.cpp
@@ -1,179 +1,178 @@
 #include "gtest/MozGTestBench.h"  // For MOZ_GTEST_BENCH
 #include "gtest/gtest.h"
 
 #include "nsURLHelper.h"
 
 TEST(TestIsValidIp, IPV4Localhost)
 {
-  NS_NAMED_LITERAL_CSTRING(ip, "127.0.0.1");
+  constexpr auto ip = "127.0.0.1"_ns;
   ASSERT_EQ(true, net_IsValidIPv4Addr(ip));
 }
 
 TEST(TestIsValidIp, IPV4Only0)
 {
-  NS_NAMED_LITERAL_CSTRING(ip, "0.0.0.0");
+  constexpr auto ip = "0.0.0.0"_ns;
   ASSERT_EQ(true, net_IsValidIPv4Addr(ip));
 }
 
 TEST(TestIsValidIp, IPV4Max)
 {
-  NS_NAMED_LITERAL_CSTRING(ip, "255.255.255.255");
+  constexpr auto ip = "255.255.255.255"_ns;
   ASSERT_EQ(true, net_IsValidIPv4Addr(ip));
 }
 
 TEST(TestIsValidIp, IPV4LeadingZero)
 {
-  NS_NAMED_LITERAL_CSTRING(ip, "055.225.255.255");
+  constexpr auto ip = "055.225.255.255"_ns;
   ASSERT_EQ(false, net_IsValidIPv4Addr(ip));
 
-  NS_NAMED_LITERAL_CSTRING(ip2, "255.055.255.255");
+  constexpr auto ip2 = "255.055.255.255"_ns;
   ASSERT_EQ(false, net_IsValidIPv4Addr(ip2));
 
-  NS_NAMED_LITERAL_CSTRING(ip3, "255.255.055.255");
+  constexpr auto ip3 = "255.255.055.255"_ns;
   ASSERT_EQ(false, net_IsValidIPv4Addr(ip3));
 
-  NS_NAMED_LITERAL_CSTRING(ip4, "255.255.255.055");
+  constexpr auto ip4 = "255.255.255.055"_ns;
   ASSERT_EQ(false, net_IsValidIPv4Addr(ip4));
 }
 
 TEST(TestIsValidIp, IPV4StartWithADot)
 {
-  NS_NAMED_LITERAL_CSTRING(ip, ".192.168.120.197");
+  constexpr auto ip = ".192.168.120.197"_ns;
   ASSERT_EQ(false, net_IsValidIPv4Addr(ip));
 }
 
 TEST(TestIsValidIp, IPV4StartWith4Digits)
 {
-  NS_NAMED_LITERAL_CSTRING(ip, "1927.168.120.197");
+  constexpr auto ip = "1927.168.120.197"_ns;
   ASSERT_EQ(false, net_IsValidIPv4Addr(ip));
 }
 
 TEST(TestIsValidIp, IPV4OutOfRange)
 {
-  NS_NAMED_LITERAL_CSTRING(invalid1, "421.168.120.124");
-  NS_NAMED_LITERAL_CSTRING(invalid2, "192.997.120.124");
-  NS_NAMED_LITERAL_CSTRING(invalid3, "192.168.300.124");
-  NS_NAMED_LITERAL_CSTRING(invalid4, "192.168.120.256");
+  constexpr auto invalid1 = "421.168.120.124"_ns;
+  constexpr auto invalid2 = "192.997.120.124"_ns;
+  constexpr auto invalid3 = "192.168.300.124"_ns;
+  constexpr auto invalid4 = "192.168.120.256"_ns;
 
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid1));
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid2));
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid3));
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid4));
 }
 
 TEST(TestIsValidIp, IPV4EmptyDigits)
 {
-  NS_NAMED_LITERAL_CSTRING(invalid1, "..0.0.0");
-  NS_NAMED_LITERAL_CSTRING(invalid2, "127..0.0");
-  NS_NAMED_LITERAL_CSTRING(invalid3, "127.0..0");
-  NS_NAMED_LITERAL_CSTRING(invalid4, "127.0.0.");
+  constexpr auto invalid1 = "..0.0.0"_ns;
+  constexpr auto invalid2 = "127..0.0"_ns;
+  constexpr auto invalid3 = "127.0..0"_ns;
+  constexpr auto invalid4 = "127.0.0."_ns;
 
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid1));
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid2));
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid3));
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid4));
 }
 
 TEST(TestIsValidIp, IPV4NonNumeric)
 {
-  NS_NAMED_LITERAL_CSTRING(invalid1, "127.0.0.f");
-  NS_NAMED_LITERAL_CSTRING(invalid2, "127.0.0.!");
-  NS_NAMED_LITERAL_CSTRING(invalid3, "127#0.0.1");
+  constexpr auto invalid1 = "127.0.0.f"_ns;
+  constexpr auto invalid2 = "127.0.0.!"_ns;
+  constexpr auto invalid3 = "127#0.0.1"_ns;
 
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid1));
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid2));
   ASSERT_EQ(false, net_IsValidIPv4Addr(invalid3));
 }
 
 TEST(TestIsValidIp, IPV4TooManyDigits)
 {
-  NS_NAMED_LITERAL_CSTRING(ip, "127.0.0.1.2");
+  constexpr auto ip = "127.0.0.1.2"_ns;
   ASSERT_EQ(false, net_IsValidIPv4Addr(ip));
 }
 
 TEST(TestIsValidIp, IPV4TooFewDigits)
 {
-  NS_NAMED_LITERAL_CSTRING(ip, "127.0.1");
+  constexpr auto ip = "127.0.1"_ns;
   ASSERT_EQ(false, net_IsValidIPv4Addr(ip));
 }
 
 TEST(TestIsValidIp, IPV6WithIPV4Inside)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "0123:4567:89ab:cdef:0123:4567:127.0.0.1");
+  constexpr auto ipv6 = "0123:4567:89ab:cdef:0123:4567:127.0.0.1"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPv6FullForm)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "0123:4567:89ab:cdef:0123:4567:890a:bcde");
+  constexpr auto ipv6 = "0123:4567:89ab:cdef:0123:4567:890a:bcde"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPv6TrimLeading0)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "123:4567:0:0:123:4567:890a:bcde");
+  constexpr auto ipv6 = "123:4567:0:0:123:4567:890a:bcde"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPv6Collapsed)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "FF01::101");
+  constexpr auto ipv6 = "FF01::101"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPV6WithIPV4InsideCollapsed)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "::FFFF:129.144.52.38");
+  constexpr auto ipv6 = "::FFFF:129.144.52.38"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPV6Localhost)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "::1");
+  constexpr auto ipv6 = "::1"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPV6LinkLocalPrefix)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "fe80::");
+  constexpr auto ipv6 = "fe80::"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPV6GlobalUnicastPrefix)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "2001::");
+  constexpr auto ipv6 = "2001::"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPV6Unspecified)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "::");
+  constexpr auto ipv6 = "::"_ns;
   ASSERT_EQ(true, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPV6InvalidIPV4Inside)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "0123:4567:89ab:cdef:0123:4567:127.0.");
+  constexpr auto ipv6 = "0123:4567:89ab:cdef:0123:4567:127.0."_ns;
   ASSERT_EQ(false, net_IsValidIPv6Addr(ipv6));
 }
 
 TEST(TestIsValidIp, IPV6InvalidCharacters)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "012g:4567:89ab:cdef:0123:4567:127.0.0.1");
+  constexpr auto ipv6 = "012g:4567:89ab:cdef:0123:4567:127.0.0.1"_ns;
   ASSERT_EQ(false, net_IsValidIPv6Addr(ipv6));
 
-  NS_NAMED_LITERAL_CSTRING(ipv6pound,
-                           "0123:456#:89ab:cdef:0123:4567:127.0.0.1");
+  constexpr auto ipv6pound = "0123:456#:89ab:cdef:0123:4567:127.0.0.1"_ns;
   ASSERT_EQ(false, net_IsValidIPv6Addr(ipv6pound));
 }
 
 TEST(TestIsValidIp, IPV6TooManyCharacters)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "0123:45671:89ab:cdef:0123:4567:127.0.0.1");
+  constexpr auto ipv6 = "0123:45671:89ab:cdef:0123:4567:127.0.0.1"_ns;
   ASSERT_EQ(false, net_IsValidIPv6Addr(ipv6));
 }
 TEST(TestIsValidIp, IPV6DoubleDoubleDots)
 {
-  NS_NAMED_LITERAL_CSTRING(ipv6, "0123::4567:890a::bcde:0123:4567");
+  constexpr auto ipv6 = "0123::4567:890a::bcde:0123:4567"_ns;
   ASSERT_EQ(false, net_IsValidIPv6Addr(ipv6));
 }
--- a/security/manager/ssl/ContentSignatureVerifier.cpp
+++ b/security/manager/ssl/ContentSignatureVerifier.cpp
@@ -388,17 +388,17 @@ static nsresult VerifyContentSignatureIn
 
   return NS_OK;
 }
 
 static nsresult ParseContentSignatureHeader(
     const nsACString& aContentSignatureHeader,
     /* out */ nsCString& aSignature) {
   // We only support p384 ecdsa.
-  NS_NAMED_LITERAL_CSTRING(signature_var, "p384ecdsa");
+  constexpr auto signature_var = "p384ecdsa"_ns;
 
   aSignature.Truncate();
 
   const nsCString& flatHeader = PromiseFlatCString(aContentSignatureHeader);
   nsSecurityHeaderParser parser(flatHeader);
   nsresult rv = parser.Parse();
   if (NS_FAILED(rv)) {
     CSVerifier_LOG(("CSVerifier: could not parse ContentSignature header"));
--- a/security/manager/ssl/LocalCertService.cpp
+++ b/security/manager/ssl/LocalCertService.cpp
@@ -25,17 +25,17 @@ namespace mozilla {
 
 // Given a name, searches the internal certificate/key database for a
 // self-signed certificate with subject and issuer distinguished name equal to
 // "CN={name}". This assumes that the user has already authenticated to the
 // internal DB if necessary.
 static nsresult FindLocalCertByName(const nsACString& aName,
                                     /*out*/ UniqueCERTCertificate& aResult) {
   aResult.reset(nullptr);
-  NS_NAMED_LITERAL_CSTRING(commonNamePrefix, "CN=");
+  constexpr auto commonNamePrefix = "CN="_ns;
   nsAutoCString expectedDistinguishedName(commonNamePrefix + aName);
   UniquePK11SlotInfo slot(PK11_GetInternalKeySlot());
   if (!slot) {
     return mozilla::psm::GetXPCOMFromNSSError(PR_GetError());
   }
   UniqueCERTCertList certList(PK11_ListCertsInSlot(slot.get()));
   if (!certList) {
     return NS_ERROR_UNEXPECTED;
@@ -131,17 +131,17 @@ class LocalCertGetTask final : public Lo
 
     // Remove existing certs with this name (if any)
     rv = RemoveExisting();
     if (NS_FAILED(rv)) {
       return rv;
     }
 
     // Generate a new cert
-    NS_NAMED_LITERAL_CSTRING(commonNamePrefix, "CN=");
+    constexpr auto commonNamePrefix = "CN="_ns;
     nsAutoCString subjectNameStr(commonNamePrefix + mNickname);
     UniqueCERTName subjectName(CERT_AsciiToName(subjectNameStr.get()));
     if (!subjectName) {
       return mozilla::psm::GetXPCOMFromNSSError(PR_GetError());
     }
 
     // Use the well-known NIST P-256 curve
     SECOidData* curveOidData = SECOID_FindOIDByTag(SEC_OID_SECG_EC_SECP256R1);
@@ -286,17 +286,17 @@ class LocalCertGetTask final : public Lo
     // Check that subject and issuer match nickname
     nsAutoString subjectName;
     nsAutoString issuerName;
     mCert->GetSubjectName(subjectName);
     mCert->GetIssuerName(issuerName);
     if (!subjectName.Equals(issuerName)) {
       return NS_ERROR_FAILURE;
     }
-    NS_NAMED_LITERAL_STRING(commonNamePrefix, "CN=");
+    constexpr auto commonNamePrefix = u"CN="_ns;
     nsAutoString subjectNameFromNickname(commonNamePrefix +
                                          NS_ConvertASCIItoUTF16(mNickname));
     if (!subjectName.Equals(subjectNameFromNickname)) {
       return NS_ERROR_FAILURE;
     }
 
     nsCOMPtr<nsIX509CertValidity> validity;
     mCert->GetValidity(getter_AddRefs(validity));
--- a/security/manager/ssl/nsNSSCallbacks.cpp
+++ b/security/manager/ssl/nsNSSCallbacks.cpp
@@ -194,19 +194,18 @@ nsresult OCSPRequest::GetResponse(/*out*
   }
   response.clear();
   if (!response.append(mResponseBytes.begin(), mResponseBytes.length())) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   return NS_OK;
 }
 
-static NS_NAMED_LITERAL_CSTRING(OCSP_REQUEST_MIME_TYPE,
-                                "application/ocsp-request");
-static NS_NAMED_LITERAL_CSTRING(OCSP_REQUEST_METHOD, "POST");
+static constexpr auto OCSP_REQUEST_MIME_TYPE = "application/ocsp-request"_ns;
+static constexpr auto OCSP_REQUEST_METHOD = "POST"_ns;
 
 NS_IMETHODIMP
 OCSPRequest::Run() {
   MOZ_ASSERT(NS_IsMainThread());
   if (!NS_IsMainThread()) {
     return NS_ERROR_FAILURE;
   }
 
--- a/security/manager/ssl/nsNSSComponent.cpp
+++ b/security/manager/ssl/nsNSSComponent.cpp
@@ -364,26 +364,25 @@ static nsresult AccountHasFamilySafetyEn
   MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("AccountHasFamilySafetyEnabled?"));
   nsCOMPtr<nsIWindowsRegKey> parentalControlsKey(
       do_CreateInstance("@mozilla.org/windows-registry-key;1"));
   if (!parentalControlsKey) {
     MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("couldn't create nsIWindowsRegKey"));
     return NS_ERROR_FAILURE;
   }
   uint32_t flags = nsIWindowsRegKey::ACCESS_READ | nsIWindowsRegKey::WOW64_64;
-  NS_NAMED_LITERAL_STRING(
-      familySafetyPath,
-      "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Parental Controls");
+  constexpr auto familySafetyPath =
+      u"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Parental Controls"_ns;
   nsresult rv = parentalControlsKey->Open(
       nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE, familySafetyPath, flags);
   if (NS_FAILED(rv)) {
     MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("couldn't open parentalControlsKey"));
     return rv;
   }
-  NS_NAMED_LITERAL_STRING(usersString, "Users");
+  constexpr auto usersString = u"Users"_ns;
   bool hasUsers;
   rv = parentalControlsKey->HasChild(usersString, &hasUsers);
   if (NS_FAILED(rv)) {
     MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("HasChild(Users) failed"));
     return rv;
   }
   if (!hasUsers) {
     MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
@@ -1738,18 +1737,18 @@ static nsresult AttemptToRenamePKCS11Mod
 // The platform now only uses the sqlite-backed databases, so we'll try to
 // rename "pkcs11.txt". However, if we're upgrading from a version that used the
 // old format, we need to try to rename the old "secmod.db" as well (if we were
 // to only rename "pkcs11.txt", initializing NSS will still fail due to the old
 // database being in FIPS mode).
 // |profilePath| is encoded in UTF-8.
 static nsresult AttemptToRenameBothPKCS11ModuleDBVersions(
     const nsACString& profilePath) {
-  NS_NAMED_LITERAL_CSTRING(legacyModuleDBFilename, "secmod.db");
-  NS_NAMED_LITERAL_CSTRING(sqlModuleDBFilename, "pkcs11.txt");
+  constexpr auto legacyModuleDBFilename = "secmod.db"_ns;
+  constexpr auto sqlModuleDBFilename = "pkcs11.txt"_ns;
   nsresult rv =
       AttemptToRenamePKCS11ModuleDB(profilePath, legacyModuleDBFilename);
   if (NS_FAILED(rv)) {
     return rv;
   }
   return AttemptToRenamePKCS11ModuleDB(profilePath, sqlModuleDBFilename);
 }
 
@@ -1813,30 +1812,30 @@ static void MaybeCleanUpOldNSSFiles(cons
   // Unfortunately we can't now tell the difference between "there already was a
   // password when the upgrade happened" and "there was not a password but then
   // the user added one after upgrading".
   bool hasPassword =
       PK11_NeedLogin(slot.get()) && !PK11_NeedUserInit(slot.get());
   if (!hasPassword) {
     return;
   }
-  NS_NAMED_LITERAL_CSTRING(newKeyDBFilename, "key4.db");
+  constexpr auto newKeyDBFilename = "key4.db"_ns;
   nsCOMPtr<nsIFile> newDBFile;
   nsresult rv =
       GetFileIfExists(profilePath, newKeyDBFilename, getter_AddRefs(newDBFile));
   if (NS_FAILED(rv)) {
     return;
   }
   // If the new key DB file doesn't exist, we don't want to remove the old DB
   // file. This can happen if the system is configured to use the old DB format
   // even though we're a version of Firefox that expects to use the new format.
   if (!newDBFile) {
     return;
   }
-  NS_NAMED_LITERAL_CSTRING(oldKeyDBFilename, "key3.db");
+  constexpr auto oldKeyDBFilename = "key3.db"_ns;
   nsCOMPtr<nsIFile> oldDBFile;
   rv =
       GetFileIfExists(profilePath, oldKeyDBFilename, getter_AddRefs(oldDBFile));
   if (NS_FAILED(rv)) {
     return;
   }
   if (!oldDBFile) {
     return;
--- a/security/manager/ssl/nsSiteSecurityService.cpp
+++ b/security/manager/ssl/nsSiteSecurityService.cpp
@@ -633,18 +633,18 @@ static uint32_t ParseSSSHeaders(uint32_t
   //  The order of the directives is not significant.
   //  All directives must appear only once.
   //  Directive names are case-insensitive.
   //  The entire header is invalid if a directive not conforming to the
   //  syntax is encountered.
   //  Unrecognized directives (that are otherwise syntactically valid) are
   //  ignored, and the rest of the header is parsed as normal.
 
-  NS_NAMED_LITERAL_CSTRING(max_age_var, "max-age");
-  NS_NAMED_LITERAL_CSTRING(include_subd_var, "includesubdomains");
+  constexpr auto max_age_var = "max-age"_ns;
+  constexpr auto include_subd_var = "includesubdomains"_ns;
 
   nsSecurityHeaderParser parser(aHeader);
   nsresult rv = parser.Parse();
   if (NS_FAILED(rv)) {
     SSSLOG(("SSS: could not parse header"));
     return nsISiteSecurityService::ERROR_COULD_NOT_PARSE_HEADER;
   }
   mozilla::LinkedList<nsSecurityHeaderDirective>* directives =
--- a/security/manager/ssl/tests/gtest/DataStorageTest.cpp
+++ b/security/manager/ssl/tests/gtest/DataStorageTest.cpp
@@ -24,19 +24,19 @@ class psm_DataStorageTest : public ::tes
     NS_ConvertUTF8toUTF16 testName(testInfo->name());
     storage = DataStorage::GetFromRawFileName(testName);
     storage->Init(nullptr);
   }
 
   RefPtr<DataStorage> storage;
 };
 
-NS_NAMED_LITERAL_CSTRING(testKey, "test");
-NS_NAMED_LITERAL_CSTRING(testValue, "value");
-NS_NAMED_LITERAL_CSTRING(privateTestValue, "private");
+constexpr auto testKey = "test"_ns;
+constexpr auto testValue = "value"_ns;
+constexpr auto privateTestValue = "private"_ns;
 
 TEST_F(psm_DataStorageTest, GetPutRemove) {
   // Test Put/Get on Persistent data
   EXPECT_EQ(NS_OK, storage->Put(testKey, testValue, DataStorage_Persistent));
   // Don't re-use testKey / testValue here, to make sure that this works as
   // expected with objects that have the same semantic value but are not
   // literally the same object.
   nsCString result = storage->Get("test"_ns, DataStorage_Persistent);
@@ -44,30 +44,30 @@ TEST_F(psm_DataStorageTest, GetPutRemove
 
   // Get on Temporary/Private data with the same key should give nothing
   result = storage->Get(testKey, DataStorage_Temporary);
   EXPECT_TRUE(result.IsEmpty());
   result = storage->Get(testKey, DataStorage_Private);
   EXPECT_TRUE(result.IsEmpty());
 
   // Put with Temporary/Private data shouldn't affect Persistent data
-  NS_NAMED_LITERAL_CSTRING(temporaryTestValue, "temporary");
+  constexpr auto temporaryTestValue = "temporary"_ns;
   EXPECT_EQ(NS_OK,
             storage->Put(testKey, temporaryTestValue, DataStorage_Temporary));
   EXPECT_EQ(NS_OK,
             storage->Put(testKey, privateTestValue, DataStorage_Private));
   result = storage->Get(testKey, DataStorage_Temporary);
   EXPECT_STREQ("temporary", result.get());
   result = storage->Get(testKey, DataStorage_Private);
   EXPECT_STREQ("private", result.get());
   result = storage->Get(testKey, DataStorage_Persistent);
   EXPECT_STREQ("value", result.get());
 
   // Put of a previously-present key overwrites it (if of the same type)
-  NS_NAMED_LITERAL_CSTRING(newValue, "new");
+  constexpr auto newValue = "new"_ns;
   EXPECT_EQ(NS_OK, storage->Put(testKey, newValue, DataStorage_Persistent));
   result = storage->Get(testKey, DataStorage_Persistent);
   EXPECT_STREQ("new", result.get());
 
   // Removal should work
   storage->Remove(testKey, DataStorage_Temporary);
   result = storage->Get(testKey, DataStorage_Temporary);
   EXPECT_TRUE(result.IsEmpty());
--- a/security/manager/ssl/tests/gtest/TLSIntoleranceTest.cpp
+++ b/security/manager/ssl/tests/gtest/TLSIntoleranceTest.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsNSSIOLayer.h"
 #include "sslproto.h"
 #include "sslerr.h"
 
 #include "gtest/gtest.h"
 
-NS_NAMED_LITERAL_CSTRING(HOST, "example.org");
+constexpr auto HOST = "example.org"_ns;
 const int16_t PORT = 443;
 
 class psm_TLSIntoleranceTest : public ::testing::Test {
  protected:
   nsSSLIOLayerHelpers helpers;
 };
 
 TEST_F(psm_TLSIntoleranceTest, FullFallbackProcess) {
@@ -246,19 +246,19 @@ TEST_F(psm_TLSIntoleranceTest, TLSDontFo
                              SSL_LIBRARY_VERSION_TLS_1_2};
     helpers.adjustForTLSIntolerance(HOST, PORT, range);
     ASSERT_EQ(SSL_LIBRARY_VERSION_TLS_1_0, range.min);
     ASSERT_EQ(SSL_LIBRARY_VERSION_TLS_1_2, range.max);
   }
 }
 
 TEST_F(psm_TLSIntoleranceTest, TLSPerSiteFallbackLimit) {
-  NS_NAMED_LITERAL_CSTRING(example_com, "example.com");
-  NS_NAMED_LITERAL_CSTRING(example_net, "example.net");
-  NS_NAMED_LITERAL_CSTRING(example_org, "example.org");
+  constexpr auto example_com = "example.com"_ns;
+  constexpr auto example_net = "example.net"_ns;
+  constexpr auto example_org = "example.org"_ns;
 
   helpers.mVersionFallbackLimit = SSL_LIBRARY_VERSION_TLS_1_0;
 
   ASSERT_FALSE(
       helpers.fallbackLimitReached(example_com, SSL_LIBRARY_VERSION_TLS_1_2));
   ASSERT_FALSE(
       helpers.fallbackLimitReached(example_com, SSL_LIBRARY_VERSION_TLS_1_1));
   ASSERT_TRUE(
--- a/startupcache/test/TestStartupCache.cpp
+++ b/startupcache/test/TestStartupCache.cpp
@@ -116,17 +116,17 @@ TEST_F(TestStartupCache, WriteInvalidate
   EXPECT_EQ(rv, NS_ERROR_NOT_AVAILABLE);
 }
 
 TEST_F(TestStartupCache, WriteObject) {
   nsresult rv;
 
   nsCOMPtr<nsIURI> obj;
 
-  NS_NAMED_LITERAL_CSTRING(spec, "http://www.mozilla.org");
+  constexpr auto spec = "http://www.mozilla.org"_ns;
   rv = NS_MutateURI(NS_SIMPLEURIMUTATOR_CONTRACTID).SetSpec(spec).Finalize(obj);
   EXPECT_TRUE(NS_SUCCEEDED(rv));
 
   StartupCache* sc = StartupCache::GetSingleton();
 
   // Create an object stream. Usually this is done with
   // NewObjectOutputWrappedStorageStream, but that uses
   // StartupCache::GetSingleton in debug builds, and we
--- a/storage/mozStorageService.cpp
+++ b/storage/mozStorageService.cpp
@@ -122,34 +122,31 @@ Service::CollectReports(nsIHandleReportC
 
       nsCString pathHead("explicit/storage/sqlite/");
       // This filename isn't privacy-sensitive, and so is never anonymized.
       pathHead.Append(conn->getFilename());
       pathHead.Append('/');
 
       SQLiteMutexAutoLock lockedScope(conn->sharedDBMutex);
 
-      NS_NAMED_LITERAL_CSTRING(
-          stmtDesc,
+      constexpr auto stmtDesc =
           "Memory (approximate) used by all prepared statements used by "
-          "connections to this database.");
+          "connections to this database."_ns;
       ReportConn(aHandleReport, aData, conn, pathHead, "stmt"_ns, stmtDesc,
                  SQLITE_DBSTATUS_STMT_USED, &totalConnSize);
 
-      NS_NAMED_LITERAL_CSTRING(
-          cacheDesc,
+      constexpr auto cacheDesc =
           "Memory (approximate) used by all pager caches used by connections "
-          "to this database.");
+          "to this database."_ns;
       ReportConn(aHandleReport, aData, conn, pathHead, "cache"_ns, cacheDesc,
                  SQLITE_DBSTATUS_CACHE_USED_SHARED, &totalConnSize);
 
-      NS_NAMED_LITERAL_CSTRING(
-          schemaDesc,
+      constexpr auto schemaDesc =
           "Memory (approximate) used to store the schema for all databases "
-          "associated with connections to this database.");
+          "associated with connections to this database."_ns;
       ReportConn(aHandleReport, aData, conn, pathHead, "schema"_ns, schemaDesc,
                  SQLITE_DBSTATUS_SCHEMA_USED, &totalConnSize);
     }
 
 #ifdef MOZ_DMD
     if (::sqlite3_memory_used() != int64_t(gSqliteMemoryUsed)) {
       NS_WARNING(
           "memory consumption reported by SQLite doesn't match "
@@ -271,17 +268,17 @@ void Service::minimizeMemory() {
   for (uint32_t i = 0; i < connections.Length(); i++) {
     RefPtr<Connection> conn = connections[i];
     // For non-main-thread owning/opening threads, we may be racing against them
     // closing their connection or their thread.  That's okay, see below.
     if (!conn->connectionReady()) {
       continue;
     }
 
-    NS_NAMED_LITERAL_CSTRING(shrinkPragma, "PRAGMA shrink_memory");
+    constexpr auto shrinkPragma = "PRAGMA shrink_memory"_ns;
     bool onOpenedThread = false;
 
     if (!conn->operationSupported(Connection::SYNCHRONOUS)) {
       // This is a mozIStorageAsyncConnection, it can only be used on the main
       // thread, so we can do a straight API call.
       nsCOMPtr<mozIStoragePendingStatement> ps;
       DebugOnly<nsresult> rv = conn->ExecuteSimpleSQLAsync(
           shrinkPragma, nullptr, getter_AddRefs(ps));
--- a/toolkit/components/antitracking/ContentBlockingLog.cpp
+++ b/toolkit/components/antitracking/ContentBlockingLog.cpp
@@ -23,17 +23,17 @@
 
 namespace mozilla {
 
 using ipc::AutoIPCStream;
 
 typedef Telemetry::OriginMetricID OriginMetricID;
 
 // sync with TelemetryOriginData.inc
-NS_NAMED_LITERAL_CSTRING(ContentBlockingLog::kDummyOriginHash, "PAGELOAD");
+const nsLiteralCString ContentBlockingLog::kDummyOriginHash = "PAGELOAD"_ns;
 
 // randomly choose 1% users included in the content blocking measurement
 // based on their client id.
 static constexpr double kRatioReportUser = 0.01;
 
 // randomly choose 0.14% documents when the page is unload.
 static constexpr double kRatioReportDocument = 0.0014;
 
--- a/toolkit/components/extensions/MatchPattern.cpp
+++ b/toolkit/components/extensions/MatchPattern.cpp
@@ -632,17 +632,17 @@ void MatchGlob::Init(JSContext* aCx, con
   // at the end of the string.
   if (index == (int32_t)mGlob.Length() - 1 && mGlob[index] == '*') {
     mPathLiteral = StringHead(mGlob, index);
     mIsPrefix = true;
     return;
   }
 
   // Fall back to the regexp slow path.
-  NS_NAMED_LITERAL_CSTRING(metaChars, ".+*?^${}()|[]\\");
+  constexpr auto metaChars = ".+*?^${}()|[]\\"_ns;
 
   nsAutoString escaped;
   escaped.Append('^');
 
   for (uint32_t i = 0; i < mGlob.Length(); i++) {
     auto c = mGlob[i];
     if (c == '*') {
       escaped.AppendLiteral(".*");
--- a/toolkit/components/telemetry/core/Telemetry.cpp
+++ b/toolkit/components/telemetry/core/Telemetry.cpp
@@ -592,31 +592,31 @@ TelemetryImpl::SetHistogramRecordingEnab
   return TelemetryHistogram::SetHistogramRecordingEnabled(id, aEnabled);
 }
 
 NS_IMETHODIMP
 TelemetryImpl::GetSnapshotForHistograms(const nsACString& aStoreName,
                                         bool aClearStore, bool aFilterTest,
                                         JSContext* aCx,
                                         JS::MutableHandleValue aResult) {
-  NS_NAMED_LITERAL_CSTRING(defaultStore, "main");
+  constexpr auto defaultStore = "main"_ns;
   unsigned int dataset = mCanRecordExtended
                              ? nsITelemetry::DATASET_PRERELEASE_CHANNELS
                              : nsITelemetry::DATASET_ALL_CHANNELS;
   return TelemetryHistogram::CreateHistogramSnapshots(
       aCx, aResult, aStoreName.IsVoid() ? defaultStore : aStoreName, dataset,
       aClearStore, aFilterTest);
 }
 
 NS_IMETHODIMP
 TelemetryImpl::GetSnapshotForKeyedHistograms(const nsACString& aStoreName,
                                              bool aClearStore, bool aFilterTest,
                                              JSContext* aCx,
                                              JS::MutableHandleValue aResult) {
-  NS_NAMED_LITERAL_CSTRING(defaultStore, "main");
+  constexpr auto defaultStore = "main"_ns;
   unsigned int dataset = mCanRecordExtended
                              ? nsITelemetry::DATASET_PRERELEASE_CHANNELS
                              : nsITelemetry::DATASET_ALL_CHANNELS;
   return TelemetryHistogram::GetKeyedHistogramSnapshots(
       aCx, aResult, aStoreName.IsVoid() ? defaultStore : aStoreName, dataset,
       aClearStore, aFilterTest);
 }
 
@@ -626,31 +626,31 @@ TelemetryImpl::GetCategoricalLabels(JSCo
   return TelemetryHistogram::GetCategoricalHistogramLabels(aCx, aResult);
 }
 
 NS_IMETHODIMP
 TelemetryImpl::GetSnapshotForScalars(const nsACString& aStoreName,
                                      bool aClearStore, bool aFilterTest,
                                      JSContext* aCx,
                                      JS::MutableHandleValue aResult) {
-  NS_NAMED_LITERAL_CSTRING(defaultStore, "main");
+  constexpr auto defaultStore = "main"_ns;
   unsigned int dataset = mCanRecordExtended
                              ? nsITelemetry::DATASET_PRERELEASE_CHANNELS
                              : nsITelemetry::DATASET_ALL_CHANNELS;
   return TelemetryScalar::CreateSnapshots(
       dataset, aClearStore, aCx, 1, aResult, aFilterTest,
       aStoreName.IsVoid() ? defaultStore : aStoreName);
 }
 
 NS_IMETHODIMP
 TelemetryImpl::GetSnapshotForKeyedScalars(const nsACString& aStoreName,
                                           bool aClearStore, bool aFilterTest,
                                           JSContext* aCx,
                                           JS::MutableHandleValue aResult) {
-  NS_NAMED_LITERAL_CSTRING(defaultStore, "main");
+  constexpr auto defaultStore = "main"_ns;
   unsigned int dataset = mCanRecordExtended
                              ? nsITelemetry::DATASET_PRERELEASE_CHANNELS
                              : nsITelemetry::DATASET_ALL_CHANNELS;
   return TelemetryScalar::CreateKeyedSnapshots(
       dataset, aClearStore, aCx, 1, aResult, aFilterTest,
       aStoreName.IsVoid() ? defaultStore : aStoreName);
 }
 
@@ -1023,17 +1023,17 @@ static void ReadStack(PathCharPtr aFileN
 }
 
 void TelemetryImpl::ReadLateWritesStacks(nsIFile* aProfileDir) {
   nsCOMPtr<nsIDirectoryEnumerator> files;
   if (NS_FAILED(aProfileDir->GetDirectoryEntries(getter_AddRefs(files)))) {
     return;
   }
 
-  NS_NAMED_LITERAL_STRING(prefix, "Telemetry.LateWriteFinal-");
+  constexpr auto prefix = u"Telemetry.LateWriteFinal-"_ns;
   nsCOMPtr<nsIFile> file;
   while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(file))) && file) {
     nsAutoString leafName;
     if (NS_FAILED(file->GetLeafName(leafName)) ||
         !StringBeginsWith(leafName, prefix)) {
       continue;
     }
 
--- a/toolkit/components/telemetry/core/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/core/TelemetryHistogram.cpp
@@ -3410,17 +3410,17 @@ nsresult TelemetryHistogram::Deserialize
         Histogram* w = internal_GetHistogramById(locker, id, procID);
         MOZ_ASSERT(w);
 
         if (!w || w->IsExpired()) {
           continue;
         }
 
         base::Histogram* h = nullptr;
-        NS_NAMED_LITERAL_CSTRING(store, "main");
+        constexpr auto store = "main"_ns;
         if (!w->GetHistogram(store, &h)) {
           continue;
         }
         MOZ_ASSERT(h);
 
         if (!h) {
           // Don't restore expired histograms.
           continue;
--- a/toolkit/components/telemetry/core/TelemetryOrigin.cpp
+++ b/toolkit/components/telemetry/core/TelemetryOrigin.cpp
@@ -138,17 +138,17 @@ typedef nsTArray<std::pair<OriginMetricI
 // equivalent to "how many bitvectors do we need to encode this whole list of
 // origins?"
 static uint32_t gPrioDatasPerMetric;
 
 // The number of "meta-origins": in-band metadata about origin telemetry.
 // Currently 1: the "unknown origin recorded" meta-origin.
 static uint32_t kNumMetaOrigins = 1;
 
-NS_NAMED_LITERAL_CSTRING(kUnknownOrigin, "__UNKNOWN__");
+constexpr auto kUnknownOrigin = "__UNKNOWN__"_ns;
 
 }  // namespace
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // PRIVATE: thread-safe helpers
 
--- a/toolkit/components/telemetry/geckoview/gtest/TestGeckoViewStreaming.cpp
+++ b/toolkit/components/telemetry/geckoview/gtest/TestGeckoViewStreaming.cpp
@@ -20,20 +20,19 @@ using ::testing::_;
 using ::testing::Eq;
 using ::testing::StrictMock;
 
 namespace {
 
 const char* kGeckoViewStreamingPref = "toolkit.telemetry.geckoview.streaming";
 const char* kBatchTimeoutPref = "toolkit.telemetry.geckoview.batchDurationMS";
 
-NS_NAMED_LITERAL_CSTRING(kTestHgramName, "TELEMETRY_TEST_STREAMING");
-NS_NAMED_LITERAL_CSTRING(kTestHgramName2, "TELEMETRY_TEST_STREAMING_2");
-NS_NAMED_LITERAL_CSTRING(kTestCategoricalName,
-                         "TELEMETRY_TEST_CATEGORICAL_OPTOUT");
+constexpr auto kTestHgramName = "TELEMETRY_TEST_STREAMING"_ns;
+constexpr auto kTestHgramName2 = "TELEMETRY_TEST_STREAMING_2"_ns;
+constexpr auto kTestCategoricalName = "TELEMETRY_TEST_CATEGORICAL_OPTOUT"_ns;
 const HistogramID kTestHgram = Telemetry::TELEMETRY_TEST_STREAMING;
 const HistogramID kTestHgram2 = Telemetry::TELEMETRY_TEST_STREAMING_2;
 
 class TelemetryStreamingFixture : public TelemetryTestFixture {
  protected:
   virtual void SetUp() {
     TelemetryTestFixture::SetUp();
     Preferences::SetBool(kGeckoViewStreamingPref, true);
@@ -169,22 +168,22 @@ TEST_F(TelemetryStreamingFixture, Multip
   // Give the threads a chance to do their work.
   PR_Sleep(PR_MillisecondsToInterval(1));
 
   Preferences::SetInt(kBatchTimeoutPref, 0);
   Telemetry::Accumulate(kTestHgram2, kSample1);
 }
 
 TEST_F(TelemetryStreamingFixture, ScalarValues) {
-  NS_NAMED_LITERAL_CSTRING(kBoolScalarName, "telemetry.test.boolean_kind");
-  NS_NAMED_LITERAL_CSTRING(kStringScalarName, "telemetry.test.string_kind");
-  NS_NAMED_LITERAL_CSTRING(kUintScalarName, "telemetry.test.unsigned_int_kind");
+  constexpr auto kBoolScalarName = "telemetry.test.boolean_kind"_ns;
+  constexpr auto kStringScalarName = "telemetry.test.string_kind"_ns;
+  constexpr auto kUintScalarName = "telemetry.test.unsigned_int_kind"_ns;
 
   const bool kBoolScalarValue = true;
-  NS_NAMED_LITERAL_CSTRING(kStringScalarValue, "a string scalar value");
+  constexpr auto kStringScalarValue = "a string scalar value"_ns;
   const uint32_t kUintScalarValue = 42;
 
   auto md = MakeRefPtr<MockDelegate>();
   EXPECT_CALL(
       *md, ReceiveBoolScalarValue(Eq(kBoolScalarName), Eq(kBoolScalarValue)));
   EXPECT_CALL(*md, ReceiveStringScalarValue(Eq(kStringScalarName),
                                             Eq(kStringScalarValue)));
   EXPECT_CALL(
@@ -209,17 +208,17 @@ TEST_F(TelemetryStreamingFixture, Expire
   auto md = MakeRefPtr<StrictMock<MockDelegate>>();
   GeckoViewStreamingTelemetry::RegisterDelegate(md);
 
   Preferences::SetInt(kBatchTimeoutPref, 0);
   Telemetry::Accumulate(kExpiredHistogram, kSample);
 }
 
 TEST_F(TelemetryStreamingFixture, SendOnAppBackground) {
-  NS_NAMED_LITERAL_CSTRING(kBoolScalarName, "telemetry.test.boolean_kind");
+  constexpr auto kBoolScalarName = "telemetry.test.boolean_kind"_ns;
   const bool kBoolScalarValue = true;
   const char* kApplicationBackgroundTopic = "application-background";
 
   auto md = MakeRefPtr<MockDelegate>();
   EXPECT_CALL(
       *md, ReceiveBoolScalarValue(Eq(kBoolScalarName), Eq(kBoolScalarValue)));
 
   GeckoViewStreamingTelemetry::RegisterDelegate(md);
--- a/toolkit/components/telemetry/other/UntrustedModules.cpp
+++ b/toolkit/components/telemetry/other/UntrustedModules.cpp
@@ -40,17 +40,17 @@ static const uint32_t kMaxModulesArrayLe
  * @param  aStr            [in,out] The string to transform
  * @param  aMaxFieldLength [in] The maximum length of the resulting string.
  */
 static void LimitStringLength(nsAString& aStr, size_t aMaxFieldLength) {
   if (aStr.Length() <= aMaxFieldLength) {
     return;
   }
 
-  NS_NAMED_LITERAL_STRING(kEllipsis, "...");
+  constexpr auto kEllipsis = u"..."_ns;
 
   if (aMaxFieldLength <= (kEllipsis.Length() + 3)) {
     // An ellipsis is useless in this case, as it would obscure the string to
     // the point that we cannot even determine the string's contents. We might
     // as well just truncate.
     aStr.Truncate(aMaxFieldLength);
     return;
   }
@@ -85,17 +85,17 @@ static bool AddLengthLimitedStringProp(J
 };
 
 static JSString* ModuleVersionToJSString(JSContext* aCx,
                                          const ModuleVersion& aVersion) {
   uint16_t major, minor, patch, build;
 
   Tie(major, minor, patch, build) = aVersion.AsTuple();
 
-  NS_NAMED_LITERAL_STRING(dot, ".");
+  constexpr auto dot = u"."_ns;
 
   nsAutoString strVer;
   strVer.AppendInt(major);
   strVer.Append(dot);
   strVer.AppendInt(minor);
   strVer.Append(dot);
   strVer.AppendInt(patch);
   strVer.Append(dot);
--- a/toolkit/components/telemetry/tests/gtest/TestOrigins.cpp
+++ b/toolkit/components/telemetry/tests/gtest/TestOrigins.cpp
@@ -16,34 +16,32 @@
 
 using namespace mozilla;
 using namespace TelemetryTestHelpers;
 using mozilla::Telemetry::OriginMetricID;
 using ::testing::_;
 using ::testing::AtLeast;
 using ::testing::StrEq;
 
-NS_NAMED_LITERAL_CSTRING(kTelemetryTest1Metric, "telemetry.test_test1");
+constexpr auto kTelemetryTest1Metric = "telemetry.test_test1"_ns;
 
-NS_NAMED_LITERAL_CSTRING(kDoubleclickOrigin, "doubleclick.net");
-NS_NAMED_LITERAL_CSTRING(kDoubleclickOriginHash,
-                         "uXNT1PzjAVau8b402OMAIGDejKbiXfQX5iXvPASfO/s=");
-NS_NAMED_LITERAL_CSTRING(kFacebookOrigin, "fb.com");
-NS_NAMED_LITERAL_CSTRING(kUnknownOrigin1,
-                         "this origin isn't known to Origin Telemetry");
-NS_NAMED_LITERAL_CSTRING(kUnknownOrigin2, "neither is this one");
+constexpr auto kDoubleclickOrigin = "doubleclick.net"_ns;
+constexpr auto kDoubleclickOriginHash =
+    "uXNT1PzjAVau8b402OMAIGDejKbiXfQX5iXvPASfO/s="_ns;
+constexpr auto kFacebookOrigin = "fb.com"_ns;
+constexpr auto kUnknownOrigin1 =
+    "this origin isn't known to Origin Telemetry"_ns;
+constexpr auto kUnknownOrigin2 = "neither is this one"_ns;
 
 // Properly prepare the prio prefs
 // (Sourced from PrioEncoder.cpp from when it was being prototyped)
-NS_NAMED_LITERAL_CSTRING(
-    prioKeyA,
-    "35AC1C7576C7C6EDD7FED6BCFC337B34D48CB4EE45C86BEEFB40BD8875707733");
-NS_NAMED_LITERAL_CSTRING(
-    prioKeyB,
-    "26E6674E65425B823F1F1D5F96E3BB3EF9E406EC7FBA7DEF8B08A35DD135AF50");
+constexpr auto prioKeyA =
+    "35AC1C7576C7C6EDD7FED6BCFC337B34D48CB4EE45C86BEEFB40BD8875707733"_ns;
+constexpr auto prioKeyB =
+    "26E6674E65425B823F1F1D5F96E3BB3EF9E406EC7FBA7DEF8B08A35DD135AF50"_ns;
 
 // Test that we can properly record origin stuff using the C++ API.
 TEST_F(TelemetryTestFixture, RecordOrigin) {
   AutoJSContextWithGlobal cx(mCleanGlobal);
   JSContext* aCx = cx.GetJSContext();
 
   Unused << mTelemetry->ClearOrigins();
 
--- a/toolkit/mozapps/extensions/AddonManagerStartup.cpp
+++ b/toolkit/mozapps/extensions/AddonManagerStartup.cpp
@@ -637,17 +637,17 @@ nsresult AddonManagerStartup::EnumerateJ
 nsresult AddonManagerStartup::EnumerateJARSubtree(nsIURI* uri,
                                                   nsTArray<nsString>& results) {
   nsCOMPtr<nsIURI> fileURI;
   nsCString entry;
   MOZ_TRY(ParseJARURI(uri, getter_AddRefs(fileURI), entry));
 
   // Mangle the path into a pattern to match all child entries by escaping any
   // existing pattern matching metacharacters it contains and appending "/*".
-  NS_NAMED_LITERAL_CSTRING(metaChars, "[]()?*~|$\\");
+  constexpr auto metaChars = "[]()?*~|$\\"_ns;
 
   nsCString pattern;
   pattern.SetCapacity(entry.Length());
 
   // The first character of the entry name is "/", which we want to skip.
   for (auto chr : MakeSpan(Substring(entry, 1))) {
     if (metaChars.FindChar(chr) >= 0) {
       pattern.Append('\\');
--- a/toolkit/profile/nsProfileLock.cpp
+++ b/toolkit/profile/nsProfileLock.cpp
@@ -382,23 +382,23 @@ nsresult nsProfileLock::LockWithSymlink(
 nsresult nsProfileLock::GetReplacedLockTime(PRTime* aResult) {
   *aResult = mReplacedLockTime;
   return NS_OK;
 }
 
 nsresult nsProfileLock::Lock(nsIFile* aProfileDir,
                              nsIProfileUnlocker** aUnlocker) {
 #if defined(XP_MACOSX)
-  NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock");
-  NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock");
+  constexpr auto LOCKFILE_NAME = u".parentlock"_ns;
+  constexpr auto OLD_LOCKFILE_NAME = u"parent.lock"_ns;
 #elif defined(XP_UNIX)
-  NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "lock");
-  NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock");
+  constexpr auto OLD_LOCKFILE_NAME = u"lock"_ns;
+  constexpr auto LOCKFILE_NAME = u".parentlock"_ns;
 #else
-  NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, "parent.lock");
+  constexpr auto LOCKFILE_NAME = u"parent.lock"_ns;
 #endif
 
   nsresult rv;
   if (aUnlocker) *aUnlocker = nullptr;
 
   NS_ENSURE_STATE(!mHaveLock);
 
   bool isDir;
--- a/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
+++ b/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
@@ -182,17 +182,17 @@ nsresult nsWindowsSystemProxySettings::G
 
   if (MatchOverride(aHost)) {
     SetProxyResultDirect(aResult);
     return NS_OK;
   }
 
   NS_ConvertUTF16toUTF8 cbuf(buf);
 
-  NS_NAMED_LITERAL_CSTRING(kSocksPrefix, "socks=");
+  constexpr auto kSocksPrefix = "socks="_ns;
   nsAutoCString prefix;
   ToLowerCase(aScheme, prefix);
 
   prefix.Append('=');
 
   nsAutoCString specificProxy;
   nsAutoCString defaultProxy;
   nsAutoCString socksProxy;
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2225,17 +2225,17 @@ static void SubmitDowngradeTelemetry(con
   time_t now;
   time(&now);
   char date[sizeof "YYYY-MM-DDThh:mm:ss.000Z"];
   strftime(date, sizeof date, "%FT%T.000Z", gmtime(&now));
 
   // NSID_LENGTH includes the trailing \0 and we also want to strip off the
   // surrounding braces so the length becomes NSID_LENGTH - 3.
   nsDependentCSubstring pingId(strid + 1, NSID_LENGTH - 3);
-  NS_NAMED_LITERAL_CSTRING(pingType, "downgrade");
+  constexpr auto pingType = "downgrade"_ns;
 
   int32_t pos = aLastVersion.Find("_");
   if (pos == kNotFound) {
     return;
   }
 
   const nsDependentCSubstring lastVersion = Substring(aLastVersion, 0, pos);
   const nsDependentCSubstring lastBuildId =
@@ -4130,20 +4130,20 @@ int XREMain::XRE_mainStartup(bool* aExit
   }
 
   gProfileLock = mProfileLock;
 
   nsAutoCString version;
   BuildVersion(version);
 
 #ifdef TARGET_OS_ABI
-  NS_NAMED_LITERAL_CSTRING(osABI, TARGET_OS_ABI);
+  constexpr auto osABI = nsLiteralCString{TARGET_OS_ABI};
 #else
   // No TARGET_XPCOM_ABI, but at least the OS is known
-  NS_NAMED_LITERAL_CSTRING(osABI, OS_TARGET "_UNKNOWN");
+  constexpr auto osABI = nsLiteralCString{OS_TARGET "_UNKNOWN"};
 #endif
 
   // Check for version compatibility with the last version of the app this
   // profile was started with.  The format of the version stamp is defined
   // by the BuildVersion function.
   // Also check to see if something has happened to invalidate our
   // fastload caches, like an app upgrade.
 
--- a/toolkit/xre/nsGDKErrorHandler.cpp
+++ b/toolkit/xre/nsGDKErrorHandler.cpp
@@ -30,55 +30,55 @@ static void GdkErrorHandler(const gchar*
     XErrorEvent event;
     nsDependentCString buffer(message);
     char* endptr;
 
     /* Parse Gdk X Window error message which has this format:
      * (Details: serial XXXX error_code XXXX request_code XXXX (XXXX) minor_code
      * XXXX)
      */
-    NS_NAMED_LITERAL_CSTRING(serialString, "(Details: serial ");
+    constexpr auto serialString = "(Details: serial "_ns;
     int32_t start = buffer.Find(serialString);
     if (start == kNotFound) {
       MOZ_CRASH_UNSAFE(message);
     }
 
     start += serialString.Length();
     errno = 0;
     event.serial = strtol(buffer.BeginReading() + start, &endptr, 10);
     if (errno) {
       MOZ_CRASH_UNSAFE(message);
     }
 
-    NS_NAMED_LITERAL_CSTRING(errorCodeString, " error_code ");
+    constexpr auto errorCodeString = " error_code "_ns;
     if (!StringBeginsWith(Substring(endptr, buffer.EndReading()),
                           errorCodeString)) {
       MOZ_CRASH_UNSAFE(message);
     }
 
     errno = 0;
     event.error_code = strtol(endptr + errorCodeString.Length(), &endptr, 10);
     if (errno) {
       MOZ_CRASH_UNSAFE(message);
     }
 
-    NS_NAMED_LITERAL_CSTRING(requestCodeString, " request_code ");
+    constexpr auto requestCodeString = " request_code "_ns;
     if (!StringBeginsWith(Substring(endptr, buffer.EndReading()),
                           requestCodeString)) {
       MOZ_CRASH_UNSAFE(message);
     }
 
     errno = 0;
     event.request_code =
         strtol(endptr + requestCodeString.Length(), &endptr, 10);
     if (errno) {
       MOZ_CRASH_UNSAFE(message);
     }
 
-    NS_NAMED_LITERAL_CSTRING(minorCodeString, " minor_code ");
+    constexpr auto minorCodeString = " minor_code "_ns;
     start = buffer.Find(minorCodeString, /* aIgnoreCase = */ false,
                         endptr - buffer.BeginReading());
     if (!start) {
       MOZ_CRASH_UNSAFE(message);
     }
 
     errno = 0;
     event.minor_code = strtol(
--- a/toolkit/xre/nsNativeAppSupportUnix.cpp
+++ b/toolkit/xre/nsNativeAppSupportUnix.cpp
@@ -596,17 +596,17 @@ nsNativeAppSupportUnix::Start(bool* aRet
             ("Could not determine executable path. Falling back to %s.",
              path.get()));
   }
 
   SmProp propRestart, propClone, propProgram, propUser, *props[4];
   SmPropValue valsRestart[3], valsClone[1], valsProgram[1], valsUser[1];
   int n = 0;
 
-  NS_NAMED_LITERAL_CSTRING(kClientIDParam, "--sm-client-id");
+  constexpr auto kClientIDParam = "--sm-client-id"_ns;
 
   SetSMValue(valsRestart[0], path);
   SetSMValue(valsRestart[1], kClientIDParam);
   SetSMValue(valsRestart[2], nsDependentCString(client_id));
   SetSMProperty(propRestart, SmRestartCommand, SmLISTofARRAY8, 3, valsRestart);
   props[n++] = &propRestart;
 
   SetSMValue(valsClone[0], path);
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -289,25 +289,25 @@ static nsresult GetSystemParentDirectory
   nsCOMPtr<nsIFile> localDir;
 #  if defined(XP_MACOSX)
   rv = GetOSXFolderType(kOnSystemDisk, kApplicationSupportFolderType,
                         getter_AddRefs(localDir));
   if (NS_SUCCEEDED(rv)) {
     rv = localDir->AppendNative("Mozilla"_ns);
   }
 #  else
-  NS_NAMED_LITERAL_CSTRING(dirname,
+  constexpr auto dirname =
 #    ifdef HAVE_USR_LIB64_DIR
-                           "/usr/lib64/mozilla"
+      "/usr/lib64/mozilla"_ns
 #    elif defined(__OpenBSD__) || defined(__FreeBSD__)
-                           "/usr/local/lib/mozilla"
+      "/usr/local/lib/mozilla"_ns
 #    else
-                           "/usr/lib/mozilla"
+      "/usr/lib/mozilla"_ns
 #    endif
-  );
+      ;
   rv = NS_NewNativeLocalFile(dirname, false, getter_AddRefs(localDir));
 #  endif
 
   if (NS_SUCCEEDED(rv)) {
     localDir.forget(aFile);
   }
   return rv;
 }
@@ -1513,23 +1513,23 @@ nsresult nsXREDirProvider::GetSysUserExt
 
 #if defined(XP_UNIX) || defined(XP_MACOSX)
 nsresult nsXREDirProvider::GetSystemExtensionsDirectory(nsIFile** aFile) {
   nsresult rv;
   nsCOMPtr<nsIFile> localDir;
 
   rv = GetSystemParentDirectory(getter_AddRefs(localDir));
   if (NS_SUCCEEDED(rv)) {
-    NS_NAMED_LITERAL_CSTRING(sExtensions,
+    constexpr auto sExtensions =
 #  if defined(XP_MACOSX)
-                             "Extensions"
+        "Extensions"_ns
 #  else
-                             "extensions"
+        "extensions"_ns
 #  endif
-    );
+        ;
 
     rv = localDir->AppendNative(sExtensions);
     if (NS_SUCCEEDED(rv)) {
       localDir.forget(aFile);
     }
   }
   return rv;
 }
--- a/tools/profiler/core/shared-libraries-win32.cc
+++ b/tools/profiler/core/shared-libraries-win32.cc
@@ -165,17 +165,17 @@ SharedLibraryInfo SharedLibraryInfo::Get
     LPCWSTR kNvidiaInitDriver = L"nvinitx.dll";
 #  elif defined(_M_IX86)
     LPCWSTR kNvidiaShimDriver = L"nvd3d9wrap.dll";
     LPCWSTR kNvidiaInitDriver = L"nvinit.dll";
 #  endif
     if (moduleNameStr.LowerCaseEqualsLiteral("detoured.dll") &&
         !mozilla::IsWin8OrLater() && ::GetModuleHandle(kNvidiaShimDriver) &&
         !::GetModuleHandle(kNvidiaInitDriver)) {
-      NS_NAMED_LITERAL_STRING(pdbNameStr, "detoured.pdb");
+      constexpr auto pdbNameStr = u"detoured.pdb"_ns;
       SharedLibrary shlib((uintptr_t)module.lpBaseOfDll,
                           (uintptr_t)module.lpBaseOfDll + module.SizeOfImage,
                           0,  // DLLs are always mapped at offset 0 on Windows
                           "000000000000000000000000000000000"_ns, moduleNameStr,
                           modulePathStr, pdbNameStr, pdbNameStr, ""_ns, "");
       sharedLibraryInfo.AddSharedLibrary(shlib);
       continue;
     }
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -233,17 +233,17 @@ nsresult nsDocumentOpenInfo::DispatchCon
 
   nsresult rv;
   nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
   if (!aChannel) {
     LOG_ERROR(("  Request is not a channel.  Bailing."));
     return NS_ERROR_FAILURE;
   }
 
-  NS_NAMED_LITERAL_CSTRING(anyType, "*/*");
+  constexpr auto anyType = "*/*"_ns;
   if (mContentType.IsEmpty() || mContentType == anyType) {
     rv = aChannel->GetContentType(mContentType);
     if (NS_FAILED(rv)) return rv;
     LOG(("  Got type from channel: '%s'", mContentType.get()));
   }
 
   bool isGuessFromExt =
       mContentType.LowerCaseEqualsASCII(APPLICATION_GUESS_FROM_EXT);
@@ -512,17 +512,17 @@ nsresult nsDocumentOpenInfo::ConvertData
   // converter will convert it and pass the converted data to nextLink.
   return StreamConvService->AsyncConvertData(
       PromiseFlatCString(aSrcContentType).get(),
       PromiseFlatCString(aOutContentType).get(), nextLink, request,
       getter_AddRefs(m_targetStreamListener));
 }
 
 nsresult nsDocumentOpenInfo::TryStreamConversion(nsIChannel* aChannel) {
-  NS_NAMED_LITERAL_CSTRING(anyType, "*/*");
+  constexpr auto anyType = "*/*"_ns;
   nsresult rv = ConvertData(aChannel, m_contentListener, mContentType, anyType);
   if (NS_FAILED(rv)) {
     m_targetStreamListener = nullptr;
   } else if (m_targetStreamListener) {
     // We found a converter for this MIME type.  We'll just pump data into
     // it and let the downstream nsDocumentOpenInfo handle things.
     LOG(("  Converter taking over now"));
   }
--- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp
+++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp
@@ -477,27 +477,27 @@ bool nsMIMEInfoWin::GetDllLaunchInfo(nsI
                                      destination.get(), bufLength))
       return false;
 
     appFilesystemCommand.Assign(destination.get());
 
     // C:\Windows\System32\rundll32.exe "C:\Program Files\Windows
     // Photo Gallery\PhotoViewer.dll", ImageView_Fullscreen %1
     nsAutoString params;
-    NS_NAMED_LITERAL_STRING(rundllSegment, "rundll32.exe ");
+    constexpr auto rundllSegment = u"rundll32.exe "_ns;
     int32_t index = appFilesystemCommand.Find(rundllSegment);
     if (index > kNotFound) {
       params.Append(
           Substring(appFilesystemCommand, index + rundllSegment.Length()));
     } else {
       params.Append(appFilesystemCommand);
     }
 
     // check to make sure we have a %1 and fill it
-    NS_NAMED_LITERAL_STRING(percentOneParam, "%1");
+    constexpr auto percentOneParam = u"%1"_ns;
     index = params.Find(percentOneParam);
     if (index == kNotFound)  // no parameter
       return false;
 
     nsString target;
     aFile->GetTarget(target);
     params.Replace(index, 2, target);
 
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -805,17 +805,17 @@ static void GetSystemFontInfo(GtkStyleCo
   // As in
   // https://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c?h=3.22.19#n10333
   PangoFontDescription* desc;
   gtk_style_context_get(aStyle, gtk_style_context_get_state(aStyle), "font",
                         &desc, nullptr);
 
   aFontStyle->systemFont = true;
 
-  NS_NAMED_LITERAL_STRING(quote, "\"");
+  constexpr auto quote = u"\""_ns;
   NS_ConvertUTF8toUTF16 family(pango_font_description_get_family(desc));
   *aFontName = quote + family + quote;
 
   aFontStyle->weight = FontWeight(pango_font_description_get_weight(desc));
 
   // FIXME: Set aFontStyle->stretch correctly!
   aFontStyle->stretch = FontStretch::Normal();
 
--- a/widget/nsPrintSettingsService.cpp
+++ b/widget/nsPrintSettingsService.cpp
@@ -976,17 +976,17 @@ static nsresult GetAdjustedPrinterName(n
 
   // Get the Printer Name from the PrintSettings
   // to use as a prefix for Pref Names
   nsresult rv = aPS->GetPrinterName(aPrinterName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Convert any whitespaces, carriage returns or newlines to _
   // The below algorithm is supposedly faster than using iterators
-  NS_NAMED_LITERAL_STRING(replSubstr, "_");
+  constexpr auto replSubstr = u"_"_ns;
   const char* replaceStr = " \n\r";
 
   int32_t x;
   for (x = 0; x < (int32_t)strlen(replaceStr); x++) {
     char16_t uChar = replaceStr[x];
 
     int32_t i = 0;
     while ((i = aPrinterName.FindChar(uChar, i)) != kNotFound) {
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -535,18 +535,18 @@ nsresult GfxInfo::Init() {
     HKEY key;
     LONG result;
     WCHAR value[255];
     DWORD dwcbData;
     SP_DEVINFO_DATA devinfoData;
     DWORD memberIndex = 0;
 
     devinfoData.cbSize = sizeof(devinfoData);
-    NS_NAMED_LITERAL_STRING(driverKeyPre,
-                            "System\\CurrentControlSet\\Control\\Class\\");
+    constexpr auto driverKeyPre =
+        u"System\\CurrentControlSet\\Control\\Class\\"_ns;
     /* enumerate device information elements in the device information set */
     while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
       /* get a string that identifies the device's driver key */
       if (SetupDiGetDeviceRegistryPropertyW(devinfo, &devinfoData, SPDRP_DRIVER,
                                             nullptr, (PBYTE)value,
                                             sizeof(value), nullptr)) {
         nsAutoString driverKey(driverKeyPre);
         driverKey += value;
@@ -616,18 +616,18 @@ nsresult GfxInfo::Init() {
       DWORD memberIndex = 0;
       devinfoData.cbSize = sizeof(devinfoData);
 
       nsAutoString adapterDriver2;
       nsAutoString deviceID2;
       nsAutoString driverVersion2;
       nsAutoString driverDate2;
 
-      NS_NAMED_LITERAL_STRING(driverKeyPre,
-                              "System\\CurrentControlSet\\Control\\Class\\");
+      constexpr auto driverKeyPre =
+          u"System\\CurrentControlSet\\Control\\Class\\"_ns;
       /* enumerate device information elements in the device information set */
       while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
         /* get a string that identifies the device's driver key */
         if (SetupDiGetDeviceRegistryPropertyW(
                 devinfo, &devinfoData, SPDRP_DRIVER, nullptr, (PBYTE)value,
                 sizeof(value), nullptr)) {
           nsAutoString driverKey2(driverKeyPre);
           driverKey2 += value;
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -2078,17 +2078,17 @@ WinUtils::WhitelistVec WinUtils::BuildWh
     // GetTempPath's result always ends with a backslash, which we don't want
     uint32_t tmpPathLen = wcslen(tmpPath);
     if (tmpPathLen) {
       tmpPath[tmpPathLen - 1] = 0;
     }
 
     nsAutoString cleanTmpPath(tmpPath);
     if (UnexpandEnvVars(cleanTmpPath)) {
-      NS_NAMED_LITERAL_STRING(tempVar, "%TEMP%");
+      constexpr auto tempVar = u"%TEMP%"_ns;
       Unused << result.emplaceBack(std::make_pair(
           nsString(cleanTmpPath), nsDependentString(tempVar, 0)));
     }
   }
 
   // If we add more items to the whitelist, ensure we still don't invoke an
   // unnecessary heap allocation.
   MOZ_ASSERT(result.length() <= kMaxWhitelistedItems);
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -1968,19 +1968,19 @@ nsresult nsDataObj ::BuildPlatformHTML(c
   const int32_t kNumberLength = strlen(numPlaceholder);
 
   const int32_t kTotalHeaderLen =
       strlen(startHTMLPrefix) + strlen(endHTMLPrefix) +
       strlen(startFragPrefix) + strlen(endFragPrefix) + strlen(endFragTrailer) +
       (kSourceURLLength > 0 ? strlen(startSourceURLPrefix) : 0) +
       kSourceURLLength + (4 * kNumberLength);
 
-  NS_NAMED_LITERAL_CSTRING(htmlHeaderString, "<html><body>\r\n");
+  constexpr auto htmlHeaderString = "<html><body>\r\n"_ns;
 
-  NS_NAMED_LITERAL_CSTRING(fragmentHeaderString, "<!--StartFragment-->");
+  constexpr auto fragmentHeaderString = "<!--StartFragment-->"_ns;
 
   nsDependentCString trailingString(
       "<!--EndFragment-->\r\n"
       "</body>\r\n"
       "</html>");
 
   // calculate the offsets
   int32_t startHTMLOffset = kTotalHeaderLen;
--- a/widget/windows/tests/TestWinDND.cpp
+++ b/widget/windows/tests/TestWinDND.cpp
@@ -162,34 +162,34 @@ nsresult GetTransferableFile(nsCOMPtr<ns
   pTransferable->Init(nullptr);
   rv = pTransferable->SetTransferData("application/x-moz-file", genericWrapper,
                                       0);
   return rv;
 }
 
 nsresult GetTransferableText(nsCOMPtr<nsITransferable>& pTransferable) {
   nsresult rv;
-  NS_NAMED_LITERAL_STRING(mozString, "Mozilla can drag and drop");
+  constexpr auto mozString = u"Mozilla can drag and drop"_ns;
   nsCOMPtr<nsISupportsString> xferString =
       do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
   rv = xferString->SetData(mozString);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsISupports> genericWrapper = do_QueryInterface(xferString);
 
   pTransferable = do_CreateInstance("@mozilla.org/widget/transferable;1");
   pTransferable->Init(nullptr);
   rv = pTransferable->SetTransferData("text/unicode", genericWrapper,
                                       mozString.Length() * sizeof(char16_t));
   return rv;
 }
 
 nsresult GetTransferableTextTwo(nsCOMPtr<nsITransferable>& pTransferable) {
   nsresult rv;
-  NS_NAMED_LITERAL_STRING(mozString, " twice over");
+  constexpr auto mozString = u" twice over"_ns;
   nsCOMPtr<nsISupportsString> xferString =
       do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
   rv = xferString->SetData(mozString);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsISupports> genericWrapper = do_QueryInterface(xferString);
 
   pTransferable = do_CreateInstance("@mozilla.org/widget/transferable;1");
--- a/xpcom/build/Omnijar.cpp
+++ b/xpcom/build/Omnijar.cpp
@@ -39,17 +39,17 @@ void Omnijar::CleanUpOne(Type aType) {
 void Omnijar::InitOne(nsIFile* aPath, Type aType) {
   nsCOMPtr<nsIFile> file;
   if (aPath) {
     file = aPath;
   } else {
     nsCOMPtr<nsIFile> dir;
     nsDirectoryService::gService->Get(SPROP(aType), NS_GET_IID(nsIFile),
                                       getter_AddRefs(dir));
-    NS_NAMED_LITERAL_CSTRING(kOmnijarName, MOZ_STRINGIFY(OMNIJAR_NAME));
+    constexpr auto kOmnijarName = nsLiteralCString{MOZ_STRINGIFY(OMNIJAR_NAME)};
     if (NS_FAILED(dir->Clone(getter_AddRefs(file))) ||
         NS_FAILED(file->AppendNative(kOmnijarName))) {
       return;
     }
   }
   bool isFile;
   if (NS_FAILED(file->IsFile(&isFile)) || !isFile) {
     // If we're not using an omni.jar for GRE, and we don't have an
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -384,35 +384,35 @@ struct CachedDirective {
 
 void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
                    bool aChromeOnly) {
   nsComponentManagerImpl::ManifestProcessingContext mgrcx(aType, aFile,
                                                           aChromeOnly);
   nsChromeRegistry::ManifestProcessingContext chromecx(aType, aFile);
   nsresult rv;
 
-  NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible");
-  NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled");
-  NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired");
-  NS_NAMED_LITERAL_STRING(kApplication, "application");
-  NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
-  NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
-  NS_NAMED_LITERAL_STRING(kOs, "os");
-  NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
-  NS_NAMED_LITERAL_STRING(kABI, "abi");
-  NS_NAMED_LITERAL_STRING(kProcess, "process");
+  constexpr auto kContentAccessible = u"contentaccessible"_ns;
+  constexpr auto kRemoteEnabled = u"remoteenabled"_ns;
+  constexpr auto kRemoteRequired = u"remoterequired"_ns;
+  constexpr auto kApplication = u"application"_ns;
+  constexpr auto kAppVersion = u"appversion"_ns;
+  constexpr auto kGeckoVersion = u"platformversion"_ns;
+  constexpr auto kOs = u"os"_ns;
+  constexpr auto kOsVersion = u"osversion"_ns;
+  constexpr auto kABI = u"abi"_ns;
+  constexpr auto kProcess = u"process"_ns;
 #if defined(MOZ_WIDGET_ANDROID)
-  NS_NAMED_LITERAL_STRING(kTablet, "tablet");
+  constexpr auto kTablet = u"tablet"_ns;
 #endif
 
-  NS_NAMED_LITERAL_STRING(kMain, "main");
-  NS_NAMED_LITERAL_STRING(kContent, "content");
+  constexpr auto kMain = u"main"_ns;
+  constexpr auto kContent = u"content"_ns;
 
   // Obsolete
-  NS_NAMED_LITERAL_STRING(kXPCNativeWrappers, "xpcnativewrappers");
+  constexpr auto kXPCNativeWrappers = u"xpcnativewrappers"_ns;
 
   nsAutoString appID;
   nsAutoString appVersion;
   nsAutoString geckoVersion;
   nsAutoString osTarget;
   nsAutoString abi;
   nsAutoString process;
 
--- a/xpcom/io/FileUtilsWin.h
+++ b/xpcom/io/FileUtilsWin.h
@@ -36,17 +36,17 @@ inline bool EnsureLongPath(nsAString& aD
   }
 }
 
 inline bool NtPathToDosPath(const nsAString& aNtPath, nsAString& aDosPath) {
   aDosPath.Truncate();
   if (aNtPath.IsEmpty()) {
     return true;
   }
-  NS_NAMED_LITERAL_STRING(symLinkPrefix, "\\??\\");
+  constexpr auto symLinkPrefix = u"\\??\\"_ns;
   uint32_t ntPathLen = aNtPath.Length();
   uint32_t symLinkPrefixLen = symLinkPrefix.Length();
   if (ntPathLen >= 6 && aNtPath.CharAt(5) == L':' &&
       ntPathLen >= symLinkPrefixLen &&
       Substring(aNtPath, 0, symLinkPrefixLen).Equals(symLinkPrefix)) {
     // Symbolic link for DOS device. Just strip off the prefix.
     aDosPath = aNtPath;
     aDosPath.Cut(0, 4);
@@ -115,25 +115,25 @@ inline bool NtPathToDosPath(const nsAStr
       cur++;
     }
     // Skip over the U+0000 that ends a drive entry
     // within the logical string
     cur++;
   }
   // Try to handle UNC paths. NB: This must happen after we've checked drive
   // mappings in case a UNC path is mapped to a drive!
-  NS_NAMED_LITERAL_STRING(uncPrefix, "\\\\");
-  NS_NAMED_LITERAL_STRING(deviceMupPrefix, "\\Device\\Mup\\");
+  constexpr auto uncPrefix = u"\\\\"_ns;
+  constexpr auto deviceMupPrefix = u"\\Device\\Mup\\"_ns;
   if (StringBeginsWith(aNtPath, deviceMupPrefix)) {
     aDosPath = uncPrefix;
     aDosPath += Substring(aNtPath, deviceMupPrefix.Length());
     return true;
   }
-  NS_NAMED_LITERAL_STRING(deviceLanmanRedirectorPrefix,
-                          "\\Device\\LanmanRedirector\\");
+  constexpr auto deviceLanmanRedirectorPrefix =
+      u"\\Device\\LanmanRedirector\\"_ns;
   if (StringBeginsWith(aNtPath, deviceLanmanRedirectorPrefix)) {
     aDosPath = uncPrefix;
     aDosPath += Substring(aNtPath, deviceLanmanRedirectorPrefix.Length());
     return true;
   }
   return false;
 }
 
--- a/xpcom/io/nsLocalFileCommon.cpp
+++ b/xpcom/io/nsLocalFileCommon.cpp
@@ -349,17 +349,17 @@ nsLocalFile::GetRelativeDescriptor(nsIFi
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::SetRelativeDescriptor(nsIFile* aFromFile,
                                    const nsACString& aRelativeDesc) {
-  NS_NAMED_LITERAL_CSTRING(kParentDirStr, "../");
+  constexpr auto kParentDirStr = "../"_ns;
 
   nsCOMPtr<nsIFile> targetFile;
   nsresult rv = aFromFile->Clone(getter_AddRefs(targetFile));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   //
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -955,18 +955,18 @@ static void CleanupHandlerPath(nsString&
 // from a handler's command string if it exists.
 static void StripRundll32(nsString& aCommandString) {
   // Example rundll formats:
   // C:\Windows\System32\rundll32.exe "path to dll"
   // rundll32.exe "path to dll"
   // C:\Windows\System32\rundll32.exe "path to dll", var var
   // rundll32.exe "path to dll", var var
 
-  NS_NAMED_LITERAL_STRING(rundllSegment, "rundll32.exe ");
-  NS_NAMED_LITERAL_STRING(rundllSegmentShort, "rundll32 ");
+  constexpr auto rundllSegment = u"rundll32.exe "_ns;
+  constexpr auto rundllSegmentShort = u"rundll32 "_ns;
 
   // case insensitive
   int32_t strLen = rundllSegment.Length();
   int32_t index = aCommandString.Find(rundllSegment, true);
   if (index == kNotFound) {
     strLen = rundllSegmentShort.Length();
     index = aCommandString.Find(rundllSegmentShort, true);
   }
@@ -1192,17 +1192,17 @@ nsresult nsLocalFile::AppendInternal(con
     return NS_ERROR_FILE_UNRECOGNIZED_PATH;
   }
 
   if (aMultipleComponents) {
     // can't contain .. as a path component. Ensure that the valid components
     // "foo..foo", "..foo", and "foo.." are not falsely detected,
     // but the invalid paths "..\", "foo\..", "foo\..\foo",
     // "..\foo", etc are.
-    NS_NAMED_LITERAL_STRING(doubleDot, "\\..");
+    constexpr auto doubleDot = u"\\.."_ns;
     nsAString::const_iterator start, end, offset;
     aNode.BeginReading(start);
     aNode.EndReading(end);
     offset = end;
     while (FindInReadable(doubleDot, start, offset)) {
       if (offset == end || *offset == L'\\') {
         return NS_ERROR_FILE_UNRECOGNIZED_PATH;
       }
--- a/xpcom/string/nsLiteralString.h
+++ b/xpcom/string/nsLiteralString.h
@@ -17,21 +17,19 @@
 #define NS_CSTRING_LITERAL_AS_STRING_LITERAL(s) u"" s
 
 #define NS_LITERAL_STRING_FROM_CSTRING(s) \
   static_cast<const nsLiteralString&>(    \
       nsLiteralString(NS_CSTRING_LITERAL_AS_STRING_LITERAL(s)))
 
 #define NS_LITERAL_STRING(s) \
   static_cast<const nsLiteralString&>(nsLiteralString(u"" s))
-#define NS_NAMED_LITERAL_STRING(n, s) const nsLiteralString n(u"" s)
 
 #define NS_LITERAL_CSTRING(s) \
   static_cast<const nsLiteralCString&>(nsLiteralCString("" s))
-#define NS_NAMED_LITERAL_CSTRING(n, s) const nsLiteralCString n("" s)
 
 constexpr auto operator""_ns(const char* aStr, std::size_t aLen) {
   return nsLiteralCString{aStr, aLen};
 }
 
 constexpr auto operator""_ns(const char16_t* aStr, std::size_t aLen) {
   return nsLiteralString{aStr, aLen};
 }
--- a/xpcom/tests/gtest/TestArenaAllocator.cpp
+++ b/xpcom/tests/gtest/TestArenaAllocator.cpp
@@ -288,21 +288,21 @@ TEST(ArenaAllocator, Extensions)
   char* c_dup = mozilla::ArenaStrdup(kTestCStr, a);
   EXPECT_STREQ(c_dup, kTestCStr);
 
   const char16_t* const kTestStr = u"This is a wide test string.";
   char16_t* dup = mozilla::ArenaStrdup(kTestStr, a);
   EXPECT_TRUE(nsString(dup).Equals(kTestStr));
 
   // Make sure it works with literal strings.
-  NS_NAMED_LITERAL_STRING(wideStr, "A wide string.");
+  constexpr auto wideStr = u"A wide string."_ns;
   nsLiteralString::char_type* wide = mozilla::ArenaStrdup(wideStr, a);
   EXPECT_TRUE(wideStr.Equals(wide));
 
-  NS_NAMED_LITERAL_CSTRING(cStr, "A c-string.");
+  constexpr auto cStr = "A c-string."_ns;
   nsLiteralCString::char_type* cstr = mozilla::ArenaStrdup(cStr, a);
   EXPECT_TRUE(cStr.Equals(cstr));
 
   // Make sure it works with normal strings.
   nsAutoString x(u"testing wide");
   nsAutoString::char_type* x_copy = mozilla::ArenaStrdup(x, a);
   EXPECT_TRUE(x.Equals(x_copy));
 
--- a/xpcom/tests/gtest/TestBase64.cpp
+++ b/xpcom/tests/gtest/TestBase64.cpp
@@ -386,25 +386,25 @@ TEST(Base64, DecodeNon8BitWideString)
     nsresult rv = mozilla::Base64Decode(non8Bit, out);
     ASSERT_TRUE(NS_SUCCEEDED(rv));
     ASSERT_TRUE(out.Equals(expectedOutput));
   }
 }
 
 TEST(Base64, TruncateOnInvalidDecodeCString)
 {
-  NS_NAMED_LITERAL_CSTRING(invalid, "@@==");
+  constexpr auto invalid = "@@=="_ns;
   nsAutoCString out("I should be truncated!");
   nsresult rv = mozilla::Base64Decode(invalid, out);
   ASSERT_TRUE(NS_FAILED(rv));
   ASSERT_EQ(out.Length(), 0u);
 }
 
 TEST(Base64, TruncateOnInvalidDecodeWideString)
 {
-  NS_NAMED_LITERAL_STRING(invalid, "@@==");
+  constexpr auto invalid = u"@@=="_ns;
   nsAutoString out(u"I should be truncated!");
   nsresult rv = mozilla::Base64Decode(invalid, out);
   ASSERT_TRUE(NS_FAILED(rv));
   ASSERT_EQ(out.Length(), 0u);
 }
 
 // TODO: Add tests for OOM handling.
--- a/xpcom/tests/gtest/TestStrings.cpp
+++ b/xpcom/tests/gtest/TestStrings.cpp
@@ -576,17 +576,17 @@ TEST_F(Strings, assign) {
 
 TEST_F(Strings, assign_c) {
   nsCString c;
   c.Assign('c');
   EXPECT_STREQ(c.get(), "c");
 }
 
 TEST_F(Strings, test1) {
-  NS_NAMED_LITERAL_STRING(empty, "");
+  constexpr auto empty = u""_ns;
   const nsAString& aStr = empty;
 
   nsAutoString buf(aStr);
 
   int32_t n = buf.FindChar(',');
   EXPECT_EQ(n, kNotFound);
 
   n = buf.Length();
@@ -2458,17 +2458,17 @@ CONVERSION_BENCH(PerfUTF8toUTF16VIHundre
                  nsAutoString);
 
 CONVERSION_BENCH(PerfUTF8toUTF16VIThousand, CopyUTF8toUTF16, mViThousandUtf8,
                  nsAutoString);
 
 // Tests for usability of nsTLiteralString in constant expressions.
 static_assert(u""_ns.IsEmpty());
 
-constexpr auto testStringA = NS_LITERAL_STRING("a");
+constexpr auto testStringA = u"a"_ns;
 static_assert(!testStringA.IsEmpty());
 static_assert(!testStringA.IsVoid());
 static_assert(testStringA.IsLiteral());
 static_assert(testStringA.IsTerminated());
 static_assert(testStringA.GetDataFlags() ==
               (nsLiteralString::DataFlags::LITERAL |
                nsLiteralString::DataFlags::TERMINATED));
 static_assert(*static_cast<const char16_t*>(testStringA.Data()) == 'a');
--- a/xpcom/tests/gtest/TestTokenizer.cpp
+++ b/xpcom/tests/gtest/TestTokenizer.cpp
@@ -969,17 +969,17 @@ TEST(Tokenizer, Incremental)
           case 8:
             EXPECT_TRUE(t.Equals(Token::EndOfFile()));
             break;
         }
 
         return NS_OK;
       });
 
-  NS_NAMED_LITERAL_CSTRING(input, "test1,test2,,,test3");
+  constexpr auto input = "test1,test2,,,test3"_ns;
   auto cur = input.BeginReading();
   auto end = input.EndReading();
   for (; cur < end; ++cur) {
     i.FeedInput(nsDependentCSubstring(cur, 1));
   }
 
   EXPECT_TRUE(test == 6);
   i.FinishInput();
@@ -1022,17 +1022,17 @@ TEST(Tokenizer, IncrementalRollback)
           case 9:
             EXPECT_TRUE(t.Equals(Token::EndOfFile()));
             break;
         }
 
         return NS_OK;
       });
 
-  NS_NAMED_LITERAL_CSTRING(input, "test1,test2,,,test3");
+  constexpr auto input = "test1,test2,,,test3"_ns;
   auto cur = input.BeginReading();
   auto end = input.EndReading();
   for (; cur < end; ++cur) {
     i.FeedInput(nsDependentCSubstring(cur, 1));
   }
 
   EXPECT_TRUE(test == 7);
   i.FinishInput();
@@ -1073,17 +1073,17 @@ TEST(Tokenizer, IncrementalNeedMoreInput
           default:
             EXPECT_TRUE(false);
             break;
         }
 
         return NS_OK;
       });
 
-  NS_NAMED_LITERAL_CSTRING(input, "a bb,c");
+  constexpr auto input = "a bb,c"_ns;
   auto cur = input.BeginReading();
   auto end = input.EndReading();
 
   nsresult rv;
   for (; cur < end; ++cur) {
     rv = i.FeedInput(nsDependentCSubstring(cur, 1));
     if (NS_FAILED(rv)) {
       break;
@@ -1172,17 +1172,17 @@ TEST(Tokenizer, IncrementalCustomRaw)
         }
 
         return NS_OK;
       });
 
   custom = i.AddCustomToken("test2", Tokenizer::CASE_SENSITIVE);
   i.SetTokenizingMode(Tokenizer::Mode::CUSTOM_ONLY);
 
-  NS_NAMED_LITERAL_CSTRING(input, "test1,test2!,,test3test2tes");
+  constexpr auto input = "test1,test2!,,test3test2tes"_ns;
   auto cur = input.BeginReading();
   auto end = input.EndReading();
   for (; cur < end; ++cur) {
     i.FeedInput(nsDependentCSubstring(cur, 1));
   }
 
   EXPECT_TRUE(test == 6);
   i.FinishInput();
@@ -1210,17 +1210,17 @@ TEST(Tokenizer, IncrementalCustomRemove)
             break;
         }
 
         return NS_OK;
       });
 
   custom = i.AddCustomToken("custom1", Tokenizer::CASE_SENSITIVE);
 
-  NS_NAMED_LITERAL_CSTRING(input, "custom1custom1");
+  constexpr auto input = "custom1custom1"_ns;
   i.FeedInput(input);
   EXPECT_TRUE(test == 1);
   i.FinishInput();
   EXPECT_TRUE(test == 3);
 }
 
 TEST(Tokenizer, IncrementalBuffering1)
 {