Bug 869836 - Part 4: Use EqualsLiteral instead of `Equals(NS_LITERAL_STRING(...))`. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 22 May 2014 06:48:51 +0300
changeset 184350 59c2ce52a920eff0ca75be2ea86c22e2746762c5
parent 184349 b8e712a8ea3f54831ee974cee5a1ac6d69c4b35e
child 184351 441c66cbe3d7de1e15296924da54117f87926619
push id26819
push usercbook@mozilla.com
push dateThu, 22 May 2014 13:13:01 +0000
treeherdermozilla-central@582bd1b5934c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs869836
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 869836 - Part 4: Use EqualsLiteral instead of `Equals(NS_LITERAL_STRING(...))`. r=ehsan
content/html/content/src/HTMLCanvasElement.cpp
content/html/content/src/HTMLInputElement.h
content/media/webspeech/recognition/SpeechRecognition.cpp
dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
dom/bluetooth/bluez/BluetoothHfpManager.cpp
dom/src/storage/DOMStorageManager.cpp
extensions/spellcheck/src/mozInlineSpellChecker.cpp
layout/xul/nsTextBoxFrame.cpp
modules/libpref/src/Preferences.cpp
netwerk/cache2/OldWrappers.cpp
netwerk/dns/nsIDNService.cpp
netwerk/protocol/http/Http2Compression.cpp
netwerk/protocol/http/Http2Stream.cpp
netwerk/protocol/http/SpdyStream3.cpp
netwerk/protocol/http/SpdyStream31.cpp
netwerk/protocol/res/nsResProtocolHandler.cpp
netwerk/protocol/websocket/WebSocketChannel.cpp
security/manager/boot/src/nsSiteSecurityService.cpp
toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
toolkit/xre/nsXREDirProvider.cpp
widget/android/GfxInfo.cpp
widget/windows/nsAppShell.cpp
widget/windows/tests/TestWinDND.cpp
widget/windows/winrt/WakeLockListener.cpp
xpcom/components/nsComponentManager.cpp
xpcom/tests/TestStringAPI.cpp
xpcom/tests/TestUTF.cpp
xpcom/tests/external/TestMinStringAPI.cpp
--- a/content/html/content/src/HTMLCanvasElement.cpp
+++ b/content/html/content/src/HTMLCanvasElement.cpp
@@ -740,17 +740,17 @@ HTMLCanvasElement::MozGetIPCContext(cons
                                     nsISupports **aContext)
 {
   if(!nsContentUtils::IsCallerChrome()) {
     // XXX ERRMSG we need to report an error to developers here! (bug 329026)
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   // We only support 2d shmem contexts for now.
-  if (!aContextId.Equals(NS_LITERAL_STRING("2d")))
+  if (!aContextId.EqualsLiteral("2d"))
     return NS_ERROR_INVALID_ARG;
 
   if (mCurrentContextId.IsEmpty()) {
     nsresult rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext));
     NS_ENSURE_SUCCESS(rv, rv);
     if (!mCurrentContext) {
       return NS_OK;
     }
--- a/content/html/content/src/HTMLInputElement.h
+++ b/content/html/content/src/HTMLInputElement.h
@@ -587,17 +587,17 @@ public:
   {
     SetHTMLAttr(nsGkAtoms::step, aValue, aRv);
   }
 
   // XPCOM GetType() is OK
   void SetType(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::type, aValue, aRv);
-    if (aValue.Equals(NS_LITERAL_STRING("number"))) {
+    if (aValue.EqualsLiteral("number")) {
       // For NS_FORM_INPUT_NUMBER we rely on having frames to process key
       // events. Make sure we have them in case someone changes the type of
       // this element to "number" and then expects to be able to send key
       // events to it (type changes are rare, so not a big perf issue):
       FlushFrames();
     }
   }
 
--- a/content/media/webspeech/recognition/SpeechRecognition.cpp
+++ b/content/media/webspeech/recognition/SpeechRecognition.cpp
@@ -950,17 +950,17 @@ SpeechRecognition::GetUserMediaSuccessCa
 
 NS_IMPL_ISUPPORTS(SpeechRecognition::GetUserMediaErrorCallback, nsIDOMGetUserMediaErrorCallback)
 
 NS_IMETHODIMP
 SpeechRecognition::GetUserMediaErrorCallback::OnError(const nsAString& aError)
 {
   SpeechRecognitionErrorCode errorCode;
 
-  if (aError.Equals(NS_LITERAL_STRING("PERMISSION_DENIED"))) {
+  if (aError.EqualsLiteral("PERMISSION_DENIED")) {
     errorCode = SpeechRecognitionErrorCode::Not_allowed;
   } else {
     errorCode = SpeechRecognitionErrorCode::Audio_capture;
   }
 
   mRecognition->DispatchError(SpeechRecognition::EVENT_AUDIO_ERROR, errorCode,
                               aError);
 
--- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
@@ -1196,17 +1196,17 @@ BluetoothHfpManager::HandleCallStateChan
       }
       break;
     case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
       // -1 is necessary because call 0 is an invalid (padding) call object.
       if (mCurrentCallArray.Length() - 1 ==
           GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_DISCONNECTED)) {
         // In order to let user hear busy tone via connected Bluetooth headset,
         // we postpone the timing of dropping SCO.
-        if (aError.Equals(NS_LITERAL_STRING("BusyError"))) {
+        if (aError.EqualsLiteral("BusyError")) {
           // FIXME: UpdatePhoneCIND later since it causes SCO close but
           // Dialer is still playing busy tone via HF.
           BT_HF_DISPATCH_MAIN(MainThreadTaskCmd::POST_TASK_CLOSE_SCO);
         }
 
         ResetCallArray();
       }
       break;
--- a/dom/bluetooth/bluez/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/bluez/BluetoothHfpManager.cpp
@@ -1634,17 +1634,17 @@ BluetoothHfpManager::HandleCallStateChan
         UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_ACTIVE, aSend);
       }
 
       // -1 is necessary because call 0 is an invalid (padding) call object.
       if (mCurrentCallArray.Length() - 1 ==
           GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_DISCONNECTED)) {
         // In order to let user hear busy tone via connected Bluetooth headset,
         // we postpone the timing of dropping SCO.
-        if (!(aError.Equals(NS_LITERAL_STRING("BusyError")))) {
+        if (!(aError.EqualsLiteral("BusyError"))) {
           DisconnectSco();
         } else {
           // Close Sco later since Dialer is still playing busy tone via HF.
           MessageLoop::current()->PostDelayedTask(FROM_HERE,
                                                   new CloseScoTask(),
                                                   sBusyToneInterval);
         }
 
--- a/dom/src/storage/DOMStorageManager.cpp
+++ b/dom/src/storage/DOMStorageManager.cpp
@@ -351,17 +351,17 @@ DOMStorageManager::GetStorageInternal(bo
       // This is demand to just preload the cache, if the scope has
       // no data stored, bypass creation and preload of the cache.
       DOMStorageDBBridge* db = DOMStorageCache::GetDatabase();
       if (db) {
         if (!db->ShouldPreloadScope(scope)) {
           return NS_OK;
         }
       } else {
-        if (scope.Equals(NS_LITERAL_CSTRING("knalb.:about"))) {
+        if (scope.EqualsLiteral("knalb.:about")) {
           return NS_OK;
         }
       }
     }
 
     // There is always a single instance of a cache per scope
     // in a single instance of a DOM storage manager.
     cache = PutCache(scope, aPrincipal);
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -1246,17 +1246,17 @@ mozInlineSpellChecker::SkipSpellCheckFor
           *checkSpelling = false;
           break;
         }
       }
       else if (parentTagName.Equals(NS_LITERAL_STRING("pre"), nsCaseInsensitiveStringComparator()))
       {
         nsAutoString classname;
         parentElement->GetAttribute(NS_LITERAL_STRING("class"),classname);
-        if (classname.Equals(NS_LITERAL_STRING("moz-signature")))
+        if (classname.EqualsLiteral("moz-signature"))
           *checkSpelling = false;
       }
 
       nsCOMPtr<nsIDOMNode> nextParent;
       parent->GetParentNode(getter_AddRefs(nextParent));
       parent = nextParent;
     }
   }
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -133,17 +133,17 @@ bool
 nsTextBoxFrame::AlwaysAppendAccessKey()
 {
   if (!gAccessKeyPrefInitialized) 
   {
     gAccessKeyPrefInitialized = true;
 
     const char* prefName = "intl.menuitems.alwaysappendaccesskeys";
     nsAdoptingString val = Preferences::GetLocalizedString(prefName);
-    gAlwaysAppendAccessKey = val.Equals(NS_LITERAL_STRING("true"));
+    gAlwaysAppendAccessKey = val.EqualsLiteral("true");
   }
   return gAlwaysAppendAccessKey;
 }
 
 bool
 nsTextBoxFrame::InsertSeparatorBeforeAccessKey()
 {
   if (!gInsertSeparatorPrefInitialized)
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -1156,17 +1156,17 @@ static nsresult pref_LoadPrefsInDirList(
     nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
     if (!path)
       continue;
 
     nsAutoCString leaf;
     path->GetNativeLeafName(leaf);
 
     // Do we care if a file provided by this process fails to load?
-    if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi")))
+    if (Substring(leaf, leaf.Length() - 4).EqualsLiteral(".xpi"))
       ReadExtensionPrefs(path);
     else
       pref_LoadPrefsInDir(path, nullptr, 0);
   }
   return NS_OK;
 }
 
 static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
--- a/netwerk/cache2/OldWrappers.cpp
+++ b/netwerk/cache2/OldWrappers.cpp
@@ -517,18 +517,18 @@ GetCacheSessionNameForStoragePolicy(
         bool isPrivate,
         uint32_t appId,
         bool inBrowser,
         nsACString& sessionName)
 {
   MOZ_ASSERT(!isPrivate || storagePolicy == nsICache::STORE_IN_MEMORY);
 
   // HTTP
-  if (scheme.Equals(NS_LITERAL_CSTRING("http")) ||
-      scheme.Equals(NS_LITERAL_CSTRING("https"))) {
+  if (scheme.EqualsLiteral("http") ||
+      scheme.EqualsLiteral("https")) {
     switch (storagePolicy) {
     case nsICache::STORE_IN_MEMORY:
       if (isPrivate)
         sessionName.Assign(NS_LITERAL_CSTRING("HTTP-memory-only-PB"));
       else
         sessionName.Assign(NS_LITERAL_CSTRING("HTTP-memory-only"));
       break;
     case nsICache::STORE_OFFLINE:
@@ -537,24 +537,24 @@ GetCacheSessionNameForStoragePolicy(
       sessionName.Assign(NS_LITERAL_CSTRING("HTTP-offline"));
       break;
     default:
       sessionName.Assign(NS_LITERAL_CSTRING("HTTP"));
       break;
     }
   }
   // WYCIWYG
-  else if (scheme.Equals(NS_LITERAL_CSTRING("wyciwyg"))) {
+  else if (scheme.EqualsLiteral("wyciwyg")) {
     if (isPrivate)
       sessionName.Assign(NS_LITERAL_CSTRING("wyciwyg-private"));
     else
       sessionName.Assign(NS_LITERAL_CSTRING("wyciwyg"));
   }
   // FTP
-  else if (scheme.Equals(NS_LITERAL_CSTRING("ftp"))) {
+  else if (scheme.EqualsLiteral("ftp")) {
     if (isPrivate)
       sessionName.Assign(NS_LITERAL_CSTRING("FTP-private"));
     else
       sessionName.Assign(NS_LITERAL_CSTRING("FTP"));
   }
   // all remaining URL scheme
   else {
     // Since with the new API a consumer cannot specify its own session name
@@ -1091,18 +1091,18 @@ nsresult _OldStorage::AssembleCacheKey(n
   aCacheKey.Truncate();
 
   nsresult rv;
 
   rv = aURI->GetScheme(aScheme);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString uriSpec;
-  if (aScheme.Equals(NS_LITERAL_CSTRING("http")) ||
-      aScheme.Equals(NS_LITERAL_CSTRING("https"))) {
+  if (aScheme.EqualsLiteral("http") ||
+      aScheme.EqualsLiteral("https")) {
     if (mLoadInfo->IsAnonymous()) {
       aCacheKey.AssignLiteral("anon&");
     }
 
     if (!aIdExtension.IsEmpty()) {
       aCacheKey.AppendPrintf("id=%s&", aIdExtension.BeginReading());
     }
 
@@ -1112,17 +1112,17 @@ nsresult _OldStorage::AssembleCacheKey(n
 
     rv = noRefURI->GetAsciiSpec(uriSpec);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (!aCacheKey.IsEmpty()) {
       aCacheKey.AppendLiteral("uri=");
     }
   }
-  else if (aScheme.Equals(NS_LITERAL_CSTRING("wyciwyg"))) {
+  else if (aScheme.EqualsLiteral("wyciwyg")) {
     rv = aURI->GetSpec(uriSpec);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else {
     rv = aURI->GetAsciiSpec(uriSpec);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
--- a/netwerk/dns/nsIDNService.cpp
+++ b/netwerk/dns/nsIDNService.cpp
@@ -118,19 +118,19 @@ void nsIDNService::prefsChanged(nsIPrefB
       mIDNUseWhitelist = val;
   }
   if (!pref || NS_LITERAL_STRING(NS_NET_PREF_IDNRESTRICTION).Equals(pref)) {
     nsXPIDLCString profile;
     if (NS_FAILED(prefBranch->GetCharPref(NS_NET_PREF_IDNRESTRICTION,
                                           getter_Copies(profile)))) {
       profile.Truncate();
     }
-    if (profile.Equals(NS_LITERAL_CSTRING("moderate"))) {
+    if (profile.EqualsLiteral("moderate")) {
       mRestrictionProfile = eModeratelyRestrictiveProfile;
-    } else if (profile.Equals(NS_LITERAL_CSTRING("high"))) {
+    } else if (profile.EqualsLiteral("high")) {
       mRestrictionProfile = eHighlyRestrictiveProfile;
     } else {
       mRestrictionProfile = eASCIIOnlyProfile;
     }
   }
 }
 
 nsIDNService::nsIDNService()
--- a/netwerk/protocol/http/Http2Compression.cpp
+++ b/netwerk/protocol/http/Http2Compression.cpp
@@ -378,23 +378,23 @@ Http2Decompressor::DecodeInteger(uint32_
   }
   return NS_OK;
 }
 
 nsresult
 Http2Decompressor::OutputHeader(const nsACString &name, const nsACString &value)
 {
     // exclusions
-  if (name.Equals(NS_LITERAL_CSTRING("connection")) ||
-      name.Equals(NS_LITERAL_CSTRING("host")) ||
-      name.Equals(NS_LITERAL_CSTRING("keep-alive")) ||
-      name.Equals(NS_LITERAL_CSTRING("proxy-connection")) ||
-      name.Equals(NS_LITERAL_CSTRING("te")) ||
-      name.Equals(NS_LITERAL_CSTRING("transfer-encoding")) ||
-      name.Equals(NS_LITERAL_CSTRING("upgrade")) ||
+  if (name.EqualsLiteral("connection") ||
+      name.EqualsLiteral("host") ||
+      name.EqualsLiteral("keep-alive") ||
+      name.EqualsLiteral("proxy-connection") ||
+      name.EqualsLiteral("te") ||
+      name.EqualsLiteral("transfer-encoding") ||
+      name.EqualsLiteral("upgrade") ||
       name.Equals(("accept-encoding"))) {
     nsCString toLog(name);
     LOG3(("HTTP Decompressor illegal response header found : %s",
           toLog.get()));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   // Look for upper case characters in the name.
@@ -416,43 +416,43 @@ Http2Decompressor::OutputHeader(const ns
        ++cPtr) {
     if (*cPtr == '\r' || *cPtr== '\n') {
       char *wPtr = const_cast<char *>(cPtr);
       *wPtr = ' ';
     }
   }
 
   // Status comes first
-  if (name.Equals(NS_LITERAL_CSTRING(":status"))) {
+  if (name.EqualsLiteral(":status")) {
     nsAutoCString status(NS_LITERAL_CSTRING("HTTP/2.0 "));
     status.Append(value);
     status.AppendLiteral("\r\n");
     mOutput->Insert(status, 0);
     mHeaderStatus = value;
-  } else if (name.Equals(NS_LITERAL_CSTRING(":authority"))) {
+  } else if (name.EqualsLiteral(":authority")) {
     mHeaderHost = value;
-  } else if (name.Equals(NS_LITERAL_CSTRING(":scheme"))) {
+  } else if (name.EqualsLiteral(":scheme")) {
     mHeaderScheme = value;
-  } else if (name.Equals(NS_LITERAL_CSTRING(":path"))) {
+  } else if (name.EqualsLiteral(":path")) {
     mHeaderPath = value;
-  } else if (name.Equals(NS_LITERAL_CSTRING(":method"))) {
+  } else if (name.EqualsLiteral(":method")) {
     mHeaderMethod = value;
   }
 
   // http/2 transport level headers shouldn't be gatewayed into http/1
   if(*(name.BeginReading()) == ':') {
     LOG3(("HTTP Decompressor not gatewaying %s into http/1",
           name.BeginReading()));
     return NS_OK;
   }
 
   mOutput->Append(name);
   mOutput->AppendLiteral(": ");
   // Special handling for set-cookie according to the spec
-  bool isSetCookie = name.Equals(NS_LITERAL_CSTRING("set-cookie"));
+  bool isSetCookie = name.EqualsLiteral("set-cookie");
   int32_t valueLen = value.Length();
   for (int32_t i = 0; i < valueLen; ++i) {
     if (value[i] == '\0') {
       if (isSetCookie) {
         mOutput->AppendLiteral("\r\n");
         mOutput->Append(name);
         mOutput->AppendLiteral(": ");
       } else {
--- a/netwerk/protocol/http/Http2Stream.cpp
+++ b/netwerk/protocol/http/Http2Stream.cpp
@@ -911,17 +911,17 @@ Http2Stream::ConvertPushHeaders(Http2Dec
   if (mHeaderHost.IsEmpty() || mHeaderScheme.IsEmpty() || mHeaderPath.IsEmpty()) {
     LOG3(("Http2Stream::ConvertPushHeaders %p Error - missing required "
           "host=%s scheme=%s path=%s\n", this, mHeaderHost.get(), mHeaderScheme.get(),
           mHeaderPath.get()));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   decompressor->GetMethod(method);
-  if (!method.Equals(NS_LITERAL_CSTRING("GET"))) {
+  if (!method.EqualsLiteral("GET")) {
     LOG3(("Http2Stream::ConvertPushHeaders %p Error - method not supported: %s\n",
           this, method.get()));
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   aHeadersIn.Truncate();
   LOG (("decoded push headers are:\n%s", aHeadersOut.BeginReading()));
   return NS_OK;
--- a/netwerk/protocol/http/SpdyStream3.cpp
+++ b/netwerk/protocol/http/SpdyStream3.cpp
@@ -1214,35 +1214,35 @@ SpdyStream3::ConvertHeaders(nsACString &
         if (*cPtr == '\0')
           return NS_ERROR_ILLEGAL_VALUE;
       }
 
       // HTTP Chunked responses are not legal over spdy. We do not need
       // to look for chunked specifically because it is the only HTTP
       // allowed default encoding and we did not negotiate further encodings
       // via TE
-      if (nameString.Equals(NS_LITERAL_CSTRING("transfer-encoding"))) {
+      if (nameString.EqualsLiteral("transfer-encoding")) {
         LOG3(("SpdyStream3::ConvertHeaders session=%p stream=%p "
               "transfer-encoding found. Chunked is invalid and no TE sent.",
               mSession, this));
 
         return NS_ERROR_ILLEGAL_VALUE;
       }
 
       uint32_t valueLen =
         (nvpair[4 + nameLen] << 24) + (nvpair[5 + nameLen] << 16) +
         (nvpair[6 + nameLen] << 8)  +   nvpair[7 + nameLen];
 
       if (lastHeaderByte < nvpair + 8 + nameLen + valueLen)
         return NS_ERROR_ILLEGAL_VALUE;
 
       // spdy transport level headers shouldn't be gatewayed into http/1
       if (!nameString.IsEmpty() && nameString[0] != ':' &&
-          !nameString.Equals(NS_LITERAL_CSTRING("connection")) &&
-          !nameString.Equals(NS_LITERAL_CSTRING("keep-alive"))) {
+          !nameString.EqualsLiteral("connection") &&
+          !nameString.EqualsLiteral("keep-alive")) {
         nsDependentCSubstring valueString =
           Substring(reinterpret_cast<const char *>(nvpair) + 8 + nameLen,
                     reinterpret_cast<const char *>(nvpair) + 8 + nameLen +
                     valueLen);
 
         aHeadersOut.Append(nameString);
         aHeadersOut.AppendLiteral(": ");
 
--- a/netwerk/protocol/http/SpdyStream31.cpp
+++ b/netwerk/protocol/http/SpdyStream31.cpp
@@ -1230,35 +1230,35 @@ SpdyStream31::ConvertHeaders(nsACString 
         if (*cPtr == '\0')
           return NS_ERROR_ILLEGAL_VALUE;
       }
 
       // HTTP Chunked responses are not legal over spdy. We do not need
       // to look for chunked specifically because it is the only HTTP
       // allowed default encoding and we did not negotiate further encodings
       // via TE
-      if (nameString.Equals(NS_LITERAL_CSTRING("transfer-encoding"))) {
+      if (nameString.EqualsLiteral("transfer-encoding")) {
         LOG3(("SpdyStream31::ConvertHeaders session=%p stream=%p "
               "transfer-encoding found. Chunked is invalid and no TE sent.",
               mSession, this));
 
         return NS_ERROR_ILLEGAL_VALUE;
       }
 
       uint32_t valueLen =
         (nvpair[4 + nameLen] << 24) + (nvpair[5 + nameLen] << 16) +
         (nvpair[6 + nameLen] << 8)  +   nvpair[7 + nameLen];
 
       if (lastHeaderByte < nvpair + 8 + nameLen + valueLen)
         return NS_ERROR_ILLEGAL_VALUE;
 
       // spdy transport level headers shouldn't be gatewayed into http/1
       if (!nameString.IsEmpty() && nameString[0] != ':' &&
-          !nameString.Equals(NS_LITERAL_CSTRING("connection")) &&
-          !nameString.Equals(NS_LITERAL_CSTRING("keep-alive"))) {
+          !nameString.EqualsLiteral("connection") &&
+          !nameString.EqualsLiteral("keep-alive")) {
         nsDependentCSubstring valueString =
           Substring(reinterpret_cast<const char *>(nvpair) + 8 + nameLen,
                     reinterpret_cast<const char *>(nvpair) + 8 + nameLen +
                     valueLen);
 
         aHeadersOut.Append(nameString);
         aHeadersOut.AppendLiteral(": ");
 
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -56,17 +56,17 @@ nsResURL::EnsureFile()
     rv = net_ExtractURLScheme(spec, nullptr, nullptr, &scheme);
     if (NS_FAILED(rv))
         return rv;
 
     // Bug 585869:
     // In most cases, the scheme is jar if it's not file.
     // Regardless, net_GetFileFromURLSpec should be avoided
     // when the scheme isn't file.
-    if (!scheme.Equals(NS_LITERAL_CSTRING("file")))
+    if (!scheme.EqualsLiteral("file"))
         return NS_ERROR_NO_INTERFACE;
 
     rv = net_GetFileFromURLSpec(spec, getter_AddRefs(mFile));
 #ifdef DEBUG_bsmedberg
     if (NS_SUCCEEDED(rv)) {
         bool exists = true;
         mFile->Exists(&exists);
         if (!exists) {
@@ -311,17 +311,17 @@ nsResProtocolHandler::SetSubstitution(co
         mSubstitutions.Remove(root);
         return NS_OK;
     }
 
     // If baseURI isn't a resource URI, we can set the substitution immediately.
     nsAutoCString scheme;
     nsresult rv = baseURI->GetScheme(scheme);
     NS_ENSURE_SUCCESS(rv, rv);
-    if (!scheme.Equals(NS_LITERAL_CSTRING("resource"))) {
+    if (!scheme.EqualsLiteral("resource")) {
         mSubstitutions.Put(root, baseURI);
         return NS_OK;
     }
 
     // baseURI is a resource URI, let's resolve it first.
     nsAutoCString newBase;
     rv = ResolveURI(baseURI, newBase);
     NS_ENSURE_SUCCESS(rv, rv);
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -2111,17 +2111,17 @@ WebSocketChannel::HandleExtensions()
   nsAutoCString extensions;
 
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread");
 
   rv = mHttpChannel->GetResponseHeader(
     NS_LITERAL_CSTRING("Sec-WebSocket-Extensions"), extensions);
   if (NS_SUCCEEDED(rv)) {
     if (!extensions.IsEmpty()) {
-      if (!extensions.Equals(NS_LITERAL_CSTRING("deflate-stream"))) {
+      if (!extensions.EqualsLiteral("deflate-stream")) {
         LOG(("WebSocketChannel::OnStartRequest: "
              "HTTP Sec-WebSocket-Exensions negotiated unknown value %s\n",
              extensions.get()));
         AbortSession(NS_ERROR_ILLEGAL_VALUE);
         return NS_ERROR_ILLEGAL_VALUE;
       }
 
       if (!mAllowCompression) {
@@ -2349,17 +2349,17 @@ WebSocketChannel::ReportConnectionTeleme
   nsCOMPtr<nsIProxyInfo> pi;
   nsCOMPtr<nsIProxiedChannel> pc = do_QueryInterface(mChannel);
   if (pc)
     pc->GetProxyInfo(getter_AddRefs(pi));
   if (pi) {
     nsAutoCString proxyType;
     pi->GetType(proxyType);
     if (!proxyType.IsEmpty() &&
-        !proxyType.Equals(NS_LITERAL_CSTRING("direct")))
+        !proxyType.EqualsLiteral("direct"))
       didProxy = true;
   }
 
   uint8_t value = (mEncrypted ? (1 << 2) : 0) | 
     (!mGotUpgradeOK ? (1 << 1) : 0) |
     (didProxy ? (1 << 0) : 0);
 
   LOG(("WebSocketChannel::ReportConnectionTelemetry() %p %d", this, value));
--- a/security/manager/boot/src/nsSiteSecurityService.cpp
+++ b/security/manager/boot/src/nsSiteSecurityService.cpp
@@ -456,17 +456,17 @@ nsSiteSecurityService::IsSecureURI(uint3
   NS_ENSURE_SUCCESS(rv, rv);
 
   /* An IP address never qualifies as a secure URI. */
   if (HostIsIPAddress(host.BeginReading())) {
     return NS_OK;
   }
 
   // Holepunch chart.apis.google.com and subdomains.
-  if (host.Equals(NS_LITERAL_CSTRING("chart.apis.google.com")) ||
+  if (host.EqualsLiteral("chart.apis.google.com") ||
       StringEndsWith(host, NS_LITERAL_CSTRING(".chart.apis.google.com"))) {
     return NS_OK;
   }
 
   const nsSTSPreload *preload = nullptr;
   nsSSSHostEntry *pbEntry = nullptr;
 
   bool isPrivate = aFlags & nsISocketProvider::NO_PERMANENT_STORAGE;
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
@@ -992,17 +992,17 @@ nsTypeAheadFind::Find(const nsAString& a
   }
 
   if (!mIsSoundInitialized && !mNotFoundSoundURL.IsEmpty()) {
     // This makes sure system sound library is loaded so that
     // there's no lag before the first sound is played
     // by waiting for the first keystroke, we still get the startup time benefits.
     mIsSoundInitialized = true;
     mSoundInterface = do_CreateInstance("@mozilla.org/sound;1");
-    if (mSoundInterface && !mNotFoundSoundURL.Equals(NS_LITERAL_CSTRING("beep"))) {
+    if (mSoundInterface && !mNotFoundSoundURL.EqualsLiteral("beep")) {
       mSoundInterface->Init();
     }
   }
 
 #ifdef XP_WIN
   // After each keystroke, ensure sound object is destroyed, to free up memory 
   // allocated for error sound, otherwise Windows' nsISound impl 
   // holds onto the last played sound, using up memory.
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -486,17 +486,17 @@ LoadDirsIntoArray(nsCOMArray<nsIFile>& a
 
   for (int32_t i = 0; i < aSourceDirs.Count(); ++i) {
     aSourceDirs[i]->Clone(getter_AddRefs(appended));
     if (!appended)
       continue;
 
     nsAutoCString leaf;
     appended->GetNativeLeafName(leaf);
-    if (!Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi"))) {
+    if (!Substring(leaf, leaf.Length() - 4).EqualsLiteral(".xpi")) {
       LoadDirIntoArray(appended,
                        aAppendList,
                        aDirectories);
     }
     else if (NS_SUCCEEDED(appended->Exists(&exists)) && exists)
       aDirectories.AppendObject(appended);
   }
 }
@@ -559,17 +559,17 @@ LoadExtensionDirectories(nsINIParser &pa
     if (NS_FAILED(rv))
       continue;
 
     rv = dir->SetPersistentDescriptor(path);
     if (NS_FAILED(rv))
       continue;
 
     aDirectories.AppendObject(dir);
-    if (Substring(path, path.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi"))) {
+    if (Substring(path, path.Length() - 4).EqualsLiteral(".xpi")) {
       XRE_AddJarManifestLocation(aType, dir);
     }
     else {
       nsCOMPtr<nsIFile> manifest =
         CloneAndAppend(dir, "chrome.manifest");
       XRE_AddManifestLocation(aType, manifest);
     }
   }
--- a/widget/android/GfxInfo.cpp
+++ b/widget/android/GfxInfo.cpp
@@ -393,17 +393,17 @@ GfxInfo::GetFeatureStatusImpl(int32_t aF
     if (aFeature == FEATURE_WEBGL_OPENGL) {
       if (mGLStrings->Renderer().Find("Adreno 200") != -1 ||
           mGLStrings->Renderer().Find("Adreno 205") != -1)
       {
         *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
         return NS_OK;
       }
 
-      if (mHardware.Equals(NS_LITERAL_STRING("ville"))) {
+      if (mHardware.EqualsLiteral("ville")) {
         *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
         return NS_OK;
       }
     }
 
     if (aFeature == FEATURE_STAGEFRIGHT) {
       NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer);
       NS_LossyConvertUTF16toASCII cModel(mModel);
--- a/widget/windows/nsAppShell.cpp
+++ b/widget/windows/nsAppShell.cpp
@@ -31,17 +31,17 @@ using namespace mozilla::widget;
 // don't want the screen saver to turn on.
 class WinWakeLockListener : public nsIDOMMozWakeLockListener {
 public:
   NS_DECL_ISUPPORTS;
 
 private:
   NS_IMETHOD Callback(const nsAString& aTopic, const nsAString& aState) {
     bool isLocked = mLockedTopics.Contains(aTopic);
-    bool shouldLock = aState.Equals(NS_LITERAL_STRING("locked-foreground"));
+    bool shouldLock = aState.EqualsLiteral("locked-foreground");
     if (isLocked == shouldLock) {
       return NS_OK;
     }
     if (shouldLock) {
       if (!mLockedTopics.Count()) {
         // This is the first topic to request the screen saver be disabled.
         // Prevent screen saver.
         SetThreadExecutionState(ES_DISPLAY_REQUIRED|ES_CONTINUOUS);
--- a/widget/windows/tests/TestWinDND.cpp
+++ b/widget/windows/tests/TestWinDND.cpp
@@ -73,17 +73,17 @@ nsresult CheckValidTEXT(STGMEDIUM* pSTG)
   if (!pText) {
     fail("There is no data at the given HGLOBAL");
     return NS_ERROR_UNEXPECTED;
   }
 
   nsCString string;
   string = pText;
 
-  if (!string.Equals(NS_LITERAL_CSTRING("Mozilla can drag and drop"))) {
+  if (!string.EqualsLiteral("Mozilla can drag and drop")) {
     fail("Text passed through drop object wrong");
     return NS_ERROR_UNEXPECTED;
   }
   return NS_OK;
 }
 
 nsresult CheckValidTEXTTwo(STGMEDIUM* pSTG)
 {
@@ -98,17 +98,17 @@ nsresult CheckValidTEXTTwo(STGMEDIUM* pS
   if (!pText) {
     fail("There is no data at the given HGLOBAL");
     return NS_ERROR_UNEXPECTED;
   }
 
   nsCString string;
   string = pText;
 
-  if (!string.Equals(NS_LITERAL_CSTRING("Mozilla can drag and drop twice over"))) {
+  if (!string.EqualsLiteral("Mozilla can drag and drop twice over")) {
     fail("Text passed through drop object wrong");
     return NS_ERROR_UNEXPECTED;
   }
   return NS_OK;
 }
 
 nsresult CheckValidUNICODE(STGMEDIUM* pSTG)
 {
@@ -123,17 +123,17 @@ nsresult CheckValidUNICODE(STGMEDIUM* pS
   if (!pText) {
     fail("There is no data at the given HGLOBAL");
     return NS_ERROR_UNEXPECTED;
   }
 
   nsString string;
   string = pText;
 
-  if (!string.Equals(NS_LITERAL_STRING("Mozilla can drag and drop"))) {
+  if (!string.EqualsLiteral("Mozilla can drag and drop")) {
     fail("Text passed through drop object wrong");
     return NS_ERROR_UNEXPECTED;
   }
   return NS_OK;
 }
 
 nsresult CheckValidUNICODETwo(STGMEDIUM* pSTG)
 {
@@ -148,17 +148,17 @@ nsresult CheckValidUNICODETwo(STGMEDIUM*
   if (!pText) {
     fail("There is no data at the given HGLOBAL");
     return NS_ERROR_UNEXPECTED;
   }
 
   nsString string;
   string = pText;
 
-  if (!string.Equals(NS_LITERAL_STRING("Mozilla can drag and drop twice over"))) {
+  if (!string.EqualsLiteral("Mozilla can drag and drop twice over")) {
     fail("Text passed through drop object wrong");
     return NS_ERROR_UNEXPECTED;
   }
   return NS_OK;
 }
 
 nsresult GetTransferableFile(nsCOMPtr<nsITransferable>& pTransferable)
 {
--- a/widget/windows/winrt/WakeLockListener.cpp
+++ b/widget/windows/winrt/WakeLockListener.cpp
@@ -14,16 +14,16 @@ WakeLockListener::Callback(const nsAStri
 {
   if (!mDisplayRequest) {
     if (FAILED(ActivateGenericInstance(RuntimeClass_Windows_System_Display_DisplayRequest, mDisplayRequest))) {
       NS_WARNING("Failed to instantiate IDisplayRequest, wakelocks will be broken!");
       return NS_OK;
     }
   }
 
-  if (aState.Equals(NS_LITERAL_STRING("locked-foreground"))) {
+  if (aState.EqualsLiteral("locked-foreground")) {
     mDisplayRequest->RequestActive();
   } else {
     mDisplayRequest->RequestRelease();
   }
 
   return NS_OK;
 }
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -1867,17 +1867,17 @@ XRE_AddStaticComponent(const mozilla::Mo
 NS_IMETHODIMP
 nsComponentManagerImpl::AddBootstrappedManifestLocation(nsIFile* aLocation)
 {
   nsString path;
   nsresult rv = aLocation->GetPath(path);
   if (NS_FAILED(rv))
     return rv;
 
-  if (Substring(path, path.Length() - 4).Equals(NS_LITERAL_STRING(".xpi"))) {
+  if (Substring(path, path.Length() - 4).EqualsLiteral(".xpi")) {
     return XRE_AddJarManifestLocation(NS_BOOTSTRAPPED_LOCATION, aLocation);
   }
 
   nsCOMPtr<nsIFile> manifest =
     CloneAndAppend(aLocation, NS_LITERAL_CSTRING("chrome.manifest"));
   return XRE_AddManifestLocation(NS_BOOTSTRAPPED_LOCATION, manifest);
 }
 
@@ -1892,17 +1892,17 @@ nsComponentManagerImpl::RemoveBootstrapp
   nsString path;
   nsresult rv = aLocation->GetPath(path);
   if (NS_FAILED(rv))
     return rv;
 
   nsComponentManagerImpl::ComponentLocation elem;
   elem.type = NS_BOOTSTRAPPED_LOCATION;
 
-  if (Substring(path, path.Length() - 4).Equals(NS_LITERAL_STRING(".xpi"))) {
+  if (Substring(path, path.Length() - 4).EqualsLiteral(".xpi")) {
     elem.location.Init(aLocation, "chrome.manifest");
   } else {
     nsCOMPtr<nsIFile> lf = CloneAndAppend(aLocation, NS_LITERAL_CSTRING("chrome.manifest"));
     elem.location.Init(lf);
   }
 
   // Remove reference.
   nsComponentManagerImpl::sModuleLocations->RemoveElement(elem, ComponentLocationComparator());
--- a/xpcom/tests/TestStringAPI.cpp
+++ b/xpcom/tests/TestStringAPI.cpp
@@ -50,21 +50,21 @@ int testWrite() {
   int res = CHECK(4 == s.Length());
   uint32_t len = s.BeginWriting(&begin, &end, 5);
   res += CHECK(5 == s.Length()) +
          CHECK(5 == len) +
          CHECK(end == begin + 5) +
          CHECK(begin == s.BeginWriting()) +
          CHECK(end == s.EndWriting());
   begin[4] = char16_t('y');
-  res += CHECK(s.Equals(NS_LITERAL_STRING("xyzzy")));
+  res += CHECK(s.EqualsLiteral("xyzzy"));
   s.SetLength(4);
   res += CHECK(4 == s.Length()) +
-         CHECK(s.Equals(NS_LITERAL_STRING("xyzz"))) +
-         CHECK(!s.Equals(NS_LITERAL_STRING("xyzzy"))) +
+         CHECK(s.EqualsLiteral("xyzz")) +
+         CHECK(!s.EqualsLiteral("xyzzy")) +
          CHECK(!s.IsEmpty());
   s.Truncate();
   res += CHECK(0 == s.Length()) +
          CHECK(s.IsEmpty());
   const char16_t sample[] = { 's', 'a', 'm', 'p', 'l', 'e', '\0' };
   s.Assign(sample);
   res += CHECK(s.EqualsLiteral("sample"));
   s.Assign(sample, 4);
--- a/xpcom/tests/TestUTF.cpp
+++ b/xpcom/tests/TestUTF.cpp
@@ -99,17 +99,17 @@ test_malformed8()
   for (unsigned int i = 0; i < ArrayLength(Malformed8Strings); ++i) {
     nsDependentCString str8(Malformed8Strings[i]);
 
     if (!NS_ConvertUTF8toUTF16(str8).IsEmpty())
       return false;
 
     nsString tmp16(NS_LITERAL_STRING("string"));
     AppendUTF8toUTF16(str8, tmp16);
-    if (!tmp16.Equals(NS_LITERAL_STRING("string")))
+    if (!tmp16.EqualsLiteral("string"))
       return false;
 
     if (CompareUTF8toUTF16(str8, EmptyString()) == 0)
       return false;
   }
 #endif
   
   return true;
--- a/xpcom/tests/external/TestMinStringAPI.cpp
+++ b/xpcom/tests/external/TestMinStringAPI.cpp
@@ -552,17 +552,17 @@ static bool test_find()
 
   return true;
 }
 
 static bool test_compressws()
 {
   nsString check(NS_LITERAL_STRING(" \tTesting  \n\t1\n 2 3\n "));
   CompressWhitespace(check);
-  return check.Equals(NS_LITERAL_STRING("Testing 1 2 3"));
+  return check.EqualsLiteral("Testing 1 2 3");
 }
 
 static bool test_comparisons()
 {
   bool result;
 
   // nsString