Bug 869836 - Part 9: Use AssignLiteral instead of `Assign(NS_LITERAL_STRING(...))`. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 22 May 2014 06:48:52 +0300
changeset 184355 75287df86a00c67c9bc91649c6ef79a9af37b8c1
parent 184354 ff0eb85179cd93b259ee76bfdac3a032809c360e
child 184356 c98d18c4e751746966e0f695f978ef1255434ef5
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 9: Use AssignLiteral instead of `Assign(NS_LITERAL_STRING(...))`. r=ehsan
content/base/src/nsDocument.cpp
content/base/src/nsHTMLContentSerializer.cpp
content/base/src/nsXMLHttpRequest.cpp
content/media/webrtc/MediaEngineDefault.cpp
content/media/webrtc/MediaEngineTabVideoSource.cpp
docshell/base/nsDefaultURIFixup.cpp
docshell/base/nsDocShell.cpp
dom/media/MediaManager.cpp
dom/plugins/base/nsPluginTags.cpp
gfx/thebes/gfxFontUtils.cpp
gfx/thebes/gfxWindowsPlatform.cpp
image/decoders/icon/gtk/nsIconChannel.cpp
layout/base/nsPresShell.cpp
layout/style/nsROCSSPrimitiveValue.cpp
layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp
modules/libpref/src/prefapi.cpp
netwerk/base/src/Dashboard.cpp
netwerk/base/src/nsSocketTransport2.cpp
netwerk/cache2/OldWrappers.cpp
netwerk/test/TestSocketTransport.cpp
toolkit/components/places/nsNavHistory.cpp
toolkit/components/places/nsNavHistoryQuery.cpp
toolkit/xre/nsAppRunner.cpp
uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
widget/gtk/nsWindow.cpp
widget/qt/nsWindow.cpp
xpcom/base/VisualEventTracer.cpp
xpcom/io/nsLocalFileWin.cpp
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -2976,17 +2976,17 @@ nsDocument::GetLastModified(nsAString& a
 void
 nsIDocument::GetLastModified(nsAString& aLastModified) const
 {
   if (!mLastModified.IsEmpty()) {
     aLastModified.Assign(mLastModified);
   } else {
     // If we for whatever reason failed to find the last modified time
     // (or even the current time), fall back to what NS4.x returned.
-    aLastModified.Assign(NS_LITERAL_STRING("01/01/1970 00:00:00"));
+    aLastModified.AssignLiteral("01/01/1970 00:00:00");
   }
 }
 
 void
 nsDocument::AddToNameTable(Element *aElement, nsIAtom* aName)
 {
   MOZ_ASSERT(nsGenericHTMLElement::ShouldExposeNameAsHTMLDocumentProperty(aElement),
              "Only put elements that need to be exposed as document['name'] in "
@@ -9207,26 +9207,26 @@ nsDocument::GetReadyState(nsAString& aRe
   return NS_OK;
 }
 
 void
 nsIDocument::GetReadyState(nsAString& aReadyState) const
 {
   switch(mReadyState) {
   case READYSTATE_LOADING :
-    aReadyState.Assign(NS_LITERAL_STRING("loading"));
+    aReadyState.AssignLiteral("loading");
     break;
   case READYSTATE_INTERACTIVE :
-    aReadyState.Assign(NS_LITERAL_STRING("interactive"));
+    aReadyState.AssignLiteral("interactive");
     break;
   case READYSTATE_COMPLETE :
-    aReadyState.Assign(NS_LITERAL_STRING("complete"));
+    aReadyState.AssignLiteral("complete");
     break;
   default:
-    aReadyState.Assign(NS_LITERAL_STRING("uninitialized"));
+    aReadyState.AssignLiteral("uninitialized");
   }
 }
 
 namespace {
 
 struct SuppressArgs
 {
   nsIDocument::SuppressionType mWhat;
--- a/content/base/src/nsHTMLContentSerializer.cpp
+++ b/content/base/src/nsHTMLContentSerializer.cpp
@@ -152,19 +152,19 @@ nsHTMLContentSerializer::SerializeHTMLAt
         valueStr = NS_LITERAL_STRING("text/html; charset=") +
           NS_ConvertASCIItoUTF16(mCharset);
       }
     }
 
     nsDependentAtomString nameStr(attrName);
     nsAutoString prefix;
     if (namespaceID == kNameSpaceID_XML) {
-      prefix.Assign(NS_LITERAL_STRING("xml"));
+      prefix.AssignLiteral("xml");
     } else if (namespaceID == kNameSpaceID_XLink) {
-      prefix.Assign(NS_LITERAL_STRING("xlink"));
+      prefix.AssignLiteral("xlink");
     }
 
     // Expand shorthand attribute.
     if (aNamespace == kNameSpaceID_XHTML &&
         namespaceID == kNameSpaceID_None &&
         IsShorthandAttr(attrName, aTagName) &&
         valueStr.IsEmpty()) {
       valueStr = nameStr;
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -1597,27 +1597,27 @@ nsXMLHttpRequest::Open(const nsACString&
       inMethod.LowerCaseEqualsLiteral("connect") ||
       inMethod.LowerCaseEqualsLiteral("track")) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   nsAutoCString method;
   // GET, POST, DELETE, HEAD, OPTIONS, PUT methods normalized to upper case
   if (inMethod.LowerCaseEqualsLiteral("get")) {
-    method.Assign(NS_LITERAL_CSTRING("GET"));
+    method.AssignLiteral("GET");
   } else if (inMethod.LowerCaseEqualsLiteral("post")) {
-    method.Assign(NS_LITERAL_CSTRING("POST"));
+    method.AssignLiteral("POST");
   } else if (inMethod.LowerCaseEqualsLiteral("delete")) {
-    method.Assign(NS_LITERAL_CSTRING("DELETE"));
+    method.AssignLiteral("DELETE");
   } else if (inMethod.LowerCaseEqualsLiteral("head")) {
-    method.Assign(NS_LITERAL_CSTRING("HEAD"));
+    method.AssignLiteral("HEAD");
   } else if (inMethod.LowerCaseEqualsLiteral("options")) {
-    method.Assign(NS_LITERAL_CSTRING("OPTIONS"));
+    method.AssignLiteral("OPTIONS");
   } else if (inMethod.LowerCaseEqualsLiteral("put")) {
-    method.Assign(NS_LITERAL_CSTRING("PUT"));
+    method.AssignLiteral("PUT");
   } else {
     method = inMethod; // other methods are not normalized
   }
 
   // sync request is not allowed using withCredential or responseType
   // in window context
   if (!async && HasOrHasHadOwner() &&
       (mState & XML_HTTP_REQUEST_AC_WITH_CREDENTIALS ||
--- a/content/media/webrtc/MediaEngineDefault.cpp
+++ b/content/media/webrtc/MediaEngineDefault.cpp
@@ -46,24 +46,24 @@ MediaEngineDefaultVideoSource::MediaEngi
 }
 
 MediaEngineDefaultVideoSource::~MediaEngineDefaultVideoSource()
 {}
 
 void
 MediaEngineDefaultVideoSource::GetName(nsAString& aName)
 {
-  aName.Assign(NS_LITERAL_STRING("Default Video Device"));
+  aName.AssignLiteral("Default Video Device");
   return;
 }
 
 void
 MediaEngineDefaultVideoSource::GetUUID(nsAString& aUUID)
 {
-  aUUID.Assign(NS_LITERAL_STRING("1041FCBD-3F12-4F7B-9E9B-1EC556DD5676"));
+  aUUID.AssignLiteral("1041FCBD-3F12-4F7B-9E9B-1EC556DD5676");
   return;
 }
 
 nsresult
 MediaEngineDefaultVideoSource::Allocate(const VideoTrackConstraintsN &aConstraints,
                                         const MediaEnginePrefs &aPrefs)
 {
   if (mState != kReleased) {
@@ -357,24 +357,24 @@ MediaEngineDefaultAudioSource::MediaEngi
 }
 
 MediaEngineDefaultAudioSource::~MediaEngineDefaultAudioSource()
 {}
 
 void
 MediaEngineDefaultAudioSource::GetName(nsAString& aName)
 {
-  aName.Assign(NS_LITERAL_STRING("Default Audio Device"));
+  aName.AssignLiteral("Default Audio Device");
   return;
 }
 
 void
 MediaEngineDefaultAudioSource::GetUUID(nsAString& aUUID)
 {
-  aUUID.Assign(NS_LITERAL_STRING("B7CBD7C1-53EF-42F9-8353-73F61C70C092"));
+  aUUID.AssignLiteral("B7CBD7C1-53EF-42F9-8353-73F61C70C092");
   return;
 }
 
 nsresult
 MediaEngineDefaultAudioSource::Allocate(const AudioTrackConstraintsN &aConstraints,
                                         const MediaEnginePrefs &aPrefs)
 {
   if (mState != kReleased) {
--- a/content/media/webrtc/MediaEngineTabVideoSource.cpp
+++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp
@@ -104,23 +104,23 @@ MediaEngineTabVideoSource::InitRunnable:
   nsCOMPtr<nsIRunnable> start(new StartRunnable(mVideoSource));
   start->Run();
   return NS_OK;
 }
 
 void
 MediaEngineTabVideoSource::GetName(nsAString_internal& aName)
 {
-  aName.Assign(NS_LITERAL_STRING("&getUserMedia.videoDevice.tabShare;"));
+  aName.AssignLiteral("&getUserMedia.videoDevice.tabShare;");
 }
 
 void
 MediaEngineTabVideoSource::GetUUID(nsAString_internal& aUuid)
 {
-  aUuid.Assign(NS_LITERAL_STRING("uuid"));
+  aUuid.AssignLiteral("uuid");
 }
 
 nsresult
 MediaEngineTabVideoSource::Allocate(const VideoTrackConstraintsN&,
                                     const MediaEnginePrefs&)
 {
   return NS_OK;
 }
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -150,17 +150,18 @@ nsDefaultURIFixup::CreateFixupURI(const 
                                        sizeof("view-source:") - 1,
                                        uriString.Length() -
                                          (sizeof("view-source:") - 1)),
                              newFixupFlags, aPostData, getter_AddRefs(uri));
         if (NS_FAILED(rv))
             return NS_ERROR_FAILURE;
         nsAutoCString spec;
         uri->GetSpec(spec);
-        uriString.Assign(NS_LITERAL_CSTRING("view-source:") + spec);
+        uriString.AssignLiteral("view-source:");
+        uriString.Append(spec);
     }
     else {
         // Check for if it is a file URL
         FileURIFixup(uriString, aURI);
         if(*aURI)
             return NS_OK;
 
 #if defined(XP_WIN)
@@ -315,19 +316,19 @@ nsDefaultURIFixup::CreateFixupURI(const 
             hostPos = uriString.Length();
 
         // extract host name
         nsAutoCString hostSpec;
         uriString.Left(hostSpec, hostPos);
 
         // insert url spec corresponding to host name
         if (IsLikelyFTP(hostSpec))
-            uriString.Assign(NS_LITERAL_CSTRING("ftp://") + uriString);
+            uriString.InsertLiteral("ftp://", 0);
         else 
-            uriString.Assign(NS_LITERAL_CSTRING("http://") + uriString);
+            uriString.InsertLiteral("http://", 0);
     } // end if checkprotocol
 
     rv = NS_NewURI(aURI, uriString, nullptr);
 
     // Did the caller want us to try an alternative URI?
     // If so, attempt to fixup http://foo into http://www.foo.com
 
     if (*aURI && aFixupFlags & FIXUP_FLAGS_MAKE_ALTERNATE_URI) {
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4607,17 +4607,17 @@ nsDocShell::DisplayLoadError(nsresult aE
         nsCOMPtr<Element> element = do_QueryInterface(handler);
         element->GetAttribute(NS_LITERAL_STRING("crashedPageTitle"), messageStr);
       }
 
       // DisplayLoadError requires a non-empty messageStr to proceed and call LoadErrorPage.
       // If the page doesn't have a title, we will use a blank space which will be trimmed
       // and thus treated as empty by the front-end.
       if (messageStr.IsEmpty()) {
-        messageStr.Assign(NS_LITERAL_STRING(" "));
+        messageStr.Assign(' ');
       }
     }
     else {
         // Errors requiring simple formatting
         switch (aError) {
         case NS_ERROR_MALFORMED_URI:
             // URI is malformed
             error.AssignLiteral("malformedURI");
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -326,24 +326,24 @@ NS_IMETHODIMP
 MediaDevice::GetType(nsAString& aType)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 VideoDevice::GetType(nsAString& aType)
 {
-  aType.Assign(NS_LITERAL_STRING("video"));
+  aType.AssignLiteral("video");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AudioDevice::GetType(nsAString& aType)
 {
-  aType.Assign(NS_LITERAL_STRING("audio"));
+  aType.AssignLiteral("audio");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 MediaDevice::GetId(nsAString& aID)
 {
   aID.Assign(mID);
   return NS_OK;
@@ -1829,17 +1829,17 @@ MediaManager::Observe(nsISupports* aSubj
   } else if (!strcmp(aTopic, "getUserMedia:response:deny")) {
     nsString errorMessage(NS_LITERAL_STRING("PERMISSION_DENIED"));
 
     if (aSubject) {
       nsCOMPtr<nsISupportsString> msg(do_QueryInterface(aSubject));
       MOZ_ASSERT(msg);
       msg->GetData(errorMessage);
       if (errorMessage.IsEmpty())
-        errorMessage.Assign(NS_LITERAL_STRING("UNKNOWN_ERROR"));
+        errorMessage.AssignLiteral("UNKNOWN_ERROR");
     }
 
     nsString key(aData);
     nsRefPtr<GetUserMediaRunnable> runnable;
     if (!mActiveCallbacks.Get(key, getter_AddRefs(runnable))) {
       return NS_OK;
     }
     mActiveCallbacks.Remove(key);
--- a/dom/plugins/base/nsPluginTags.cpp
+++ b/dom/plugins/base/nsPluginTags.cpp
@@ -496,22 +496,22 @@ void nsPluginTag::TryUnloadPlugin(bool i
 }
 
 nsCString nsPluginTag::GetNiceFileName() {
   if (!mNiceFileName.IsEmpty()) {
     return mNiceFileName;
   }
 
   if (mIsFlashPlugin) {
-    mNiceFileName.Assign(NS_LITERAL_CSTRING("flash"));
+    mNiceFileName.AssignLiteral("flash");
     return mNiceFileName;
   }
 
   if (mIsJavaPlugin) {
-    mNiceFileName.Assign(NS_LITERAL_CSTRING("java"));
+    mNiceFileName.AssignLiteral("java");
     return mNiceFileName;
   }
 
   mNiceFileName.Assign(mFileName);
   int32_t niceNameLength = mFileName.RFind(".");
   NS_ASSERTION(niceNameLength != kNotFound, "mFileName doesn't have a '.'?");
   while (niceNameLength > 0) {
     char chr = mFileName[niceNameLength - 1];
--- a/gfx/thebes/gfxFontUtils.cpp
+++ b/gfx/thebes/gfxFontUtils.cpp
@@ -780,17 +780,17 @@ nsresult gfxFontUtils::MakeUniqueUserFon
 
     // all b64 characters except for '/' are allowed in Postscript names, so convert / ==> -
     char *p;
     for (p = guidB64; *p; p++) {
         if (*p == '/')
             *p = '-';
     }
 
-    aName.Assign(NS_LITERAL_STRING("uf"));
+    aName.AssignLiteral("uf");
     aName.AppendASCII(guidB64);
     return NS_OK;
 }
 
 
 // TrueType/OpenType table handling code
 
 // need byte aligned structs
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1125,17 +1125,17 @@ gfxWindowsPlatform::UseClearTypeAlways()
     return mUseClearTypeAlways;
 }
 
 void 
 gfxWindowsPlatform::GetDLLVersion(char16ptr_t aDLLPath, nsAString& aVersion)
 {
     DWORD versInfoSize, vers[4] = {0};
     // version info not available case
-    aVersion.Assign(NS_LITERAL_STRING("0.0.0.0"));
+    aVersion.AssignLiteral("0.0.0.0");
     versInfoSize = GetFileVersionInfoSizeW(aDLLPath, nullptr);
     nsAutoTArray<BYTE,512> versionInfo;
     
     if (versInfoSize == 0 ||
         !versionInfo.AppendElements(uint32_t(versInfoSize)))
     {
         return;
     }
--- a/image/decoders/icon/gtk/nsIconChannel.cpp
+++ b/image/decoders/icon/gtk/nsIconChannel.cpp
@@ -320,17 +320,17 @@ nsIconChannel::InitWithGnome(nsIMozIconU
                                 getter_AddRefs(bundle));
     nsAutoString appName;
 
     if (bundle) {
       bundle->GetStringFromName(MOZ_UTF16("brandShortName"),
                                 getter_Copies(appName));
     } else {
       NS_WARNING("brand.properties not present, using default application name");
-      appName.Assign(NS_LITERAL_STRING("Gecko"));
+      appName.AssignLiteral("Gecko");
     }
 
     char* empty[] = { "" };
     _gnome_init(NS_ConvertUTF16toUTF8(appName).get(),
                 "1.0", 1, empty, nullptr, 0, nullptr);
   }
 
   uint32_t iconSize = GetIconSize(aIconURI);
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -8933,23 +8933,23 @@ PresShell::DelayedKeyEvent::DelayedKeyEv
 
 static void
 LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
 {
   nsAutoString n1, n2;
   if (k1) {
     k1->GetFrameName(n1);
   } else {
-    n1.Assign(NS_LITERAL_STRING("(null)"));
+    n1.AssignLiteral("(null)");
   }
 
   if (k2) {
     k2->GetFrameName(n2);
   } else {
-    n2.Assign(NS_LITERAL_STRING("(null)"));
+    n2.AssignLiteral("(null)");
   }
 
   printf("verifyreflow: %s %p != %s %p  %s\n",
          NS_LossyConvertUTF16toASCII(n1).get(), (void*)k1,
          NS_LossyConvertUTF16toASCII(n2).get(), (void*)k2, aMsg);
 }
 
 static void
--- a/layout/style/nsROCSSPrimitiveValue.cpp
+++ b/layout/style/nsROCSSPrimitiveValue.cpp
@@ -108,17 +108,17 @@ nsROCSSPrimitiveValue::GetCssText(nsAStr
           nsStyleUtil::AppendEscapedCSSString(NS_ConvertUTF8toUTF16(specUTF8),
                                               tmpStr);
           tmpStr.Append(')');
         } else {
           // http://dev.w3.org/csswg/css3-values/#attr defines
           // 'about:invalid' as the default value for url attributes,
           // so let's also use it here as the default computed value
           // for invalid URLs.
-          tmpStr.Assign(NS_LITERAL_STRING("url(about:invalid)"));
+          tmpStr.AssignLiteral("url(about:invalid)");
         }
         break;
       }
     case CSS_ATTR :
       {
         tmpStr.AppendLiteral("attr(");
         tmpStr.Append(mValue.mString);
         tmpStr.Append(char16_t(')'));
--- a/layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp
+++ b/layout/tools/layout-debug/src/nsLayoutDebugCLH.cpp
@@ -73,12 +73,12 @@ nsLayoutDebugCLH::Handle(nsICommandLine*
                        getter_AddRefs(opened));
     aCmdLine->SetPreventDefault(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLayoutDebugCLH::GetHelpInfo(nsACString& aResult)
 {
-    aResult.Assign(NS_LITERAL_CSTRING("  -layoutdebug [<url>] Start with Layout Debugger\n"));
+    aResult.AssignLiteral("  -layoutdebug [<url>] Start with Layout Debugger\n");
     return NS_OK;
 }
 
--- a/modules/libpref/src/prefapi.cpp
+++ b/modules/libpref/src/prefapi.cpp
@@ -328,30 +328,30 @@ pref_savePref(PLDHashTable *table, PLDHa
     PrefHashEntry *pref = static_cast<PrefHashEntry *>(heh);
 
     PR_ASSERT(pref);
     if (!pref)
         return PL_DHASH_NEXT;
 
     nsAutoCString prefValue;
     nsAutoCString prefPrefix;
-    prefPrefix.Assign(NS_LITERAL_CSTRING("user_pref(\""));
+    prefPrefix.AssignLiteral("user_pref(\"");
 
     // where we're getting our pref from
     PrefValue* sourcePref;
 
     if (PREF_HAS_USER_VALUE(pref) &&
         (pref_ValueChanged(pref->defaultPref,
                            pref->userPref,
                            (PrefType) PREF_TYPE(pref)) ||
          !(pref->flags & PREF_HAS_DEFAULT))) {
         sourcePref = &pref->userPref;
     } else {
         if (argData->saveTypes == SAVE_ALL_AND_DEFAULTS) {
-            prefPrefix.Assign(NS_LITERAL_CSTRING("pref(\""));
+            prefPrefix.AssignLiteral("pref(\"");
             sourcePref = &pref->defaultPref;
         }
         else
             // do not save default prefs that haven't changed
             return PL_DHASH_NEXT;
     }
 
     // strings are in quotes!
--- a/netwerk/base/src/Dashboard.cpp
+++ b/netwerk/base/src/Dashboard.cpp
@@ -186,17 +186,17 @@ ConnectionData::Notify(nsITimer *aTimer)
     if (mSocket) {
         mSocket->Close(NS_ERROR_ABORT);
         mSocket = nullptr;
         mStreamIn = nullptr;
     }
 
     mTimer = nullptr;
 
-    mStatus.Assign(NS_LITERAL_STRING("NS_ERROR_NET_TIMEOUT"));
+    mStatus.AssignLiteral("NS_ERROR_NET_TIMEOUT");
     nsCOMPtr<nsIRunnable> event =
         NS_NewRunnableMethodWithArg<nsRefPtr<ConnectionData> >
         (mDashboard, &Dashboard::GetConnectionStatus, this);
     mThread->Dispatch(event, NS_DISPATCH_NORMAL);
 
     return NS_OK;
 }
 
@@ -749,39 +749,39 @@ Dashboard::RequestDNSLookup(const nsACSt
     return rv;
 }
 
 void
 HttpConnInfo::SetHTTP1ProtocolVersion(uint8_t pv)
 {
     switch (pv) {
     case NS_HTTP_VERSION_0_9:
-        protocolVersion.Assign(NS_LITERAL_STRING("http/0.9"));
+        protocolVersion.AssignLiteral("http/0.9");
         break;
     case NS_HTTP_VERSION_1_0:
-        protocolVersion.Assign(NS_LITERAL_STRING("http/1.0"));
+        protocolVersion.AssignLiteral("http/1.0");
         break;
     case NS_HTTP_VERSION_1_1:
-        protocolVersion.Assign(NS_LITERAL_STRING("http/1.1"));
+        protocolVersion.AssignLiteral("http/1.1");
         break;
     case NS_HTTP_VERSION_2_0:
-        protocolVersion.Assign(NS_LITERAL_STRING("http/2.0"));
+        protocolVersion.AssignLiteral("http/2.0");
         break;
     default:
-        protocolVersion.Assign(NS_LITERAL_STRING("unknown protocol version"));
+        protocolVersion.AssignLiteral("unknown protocol version");
     }
 }
 
 void
 HttpConnInfo::SetHTTP2ProtocolVersion(uint8_t pv)
 {
     if (pv == SPDY_VERSION_3) {
-        protocolVersion.Assign(NS_LITERAL_STRING("spdy/3"));
+        protocolVersion.AssignLiteral("spdy/3");
     } else if (pv == SPDY_VERSION_31) {
-        protocolVersion.Assign(NS_LITERAL_STRING("spdy/3.1"));
+        protocolVersion.AssignLiteral("spdy/3.1");
     } else {
         MOZ_ASSERT (pv == NS_HTTP2_DRAFT_VERSION);
         protocolVersion.Assign(NS_LITERAL_STRING(NS_HTTP2_DRAFT_TOKEN));
     }
 }
 
 NS_IMETHODIMP
 Dashboard::RequestConnection(const nsACString& aHost, uint32_t aPort,
--- a/netwerk/base/src/nsSocketTransport2.cpp
+++ b/netwerk/base/src/nsSocketTransport2.cpp
@@ -2678,32 +2678,34 @@ DumpBytesToFile(const char *path, const 
 void
 nsSocketTransport::TraceInBuf(const char *buf, int32_t n)
 {
     char *val = PR_GetEnv("NECKO_SOCKET_TRACE_LOG");
     if (!val || !*val)
         return;
 
     nsAutoCString header;
-    header.Assign(NS_LITERAL_CSTRING("Reading from: ") + mHost);
+    header.AssignLiteral("Reading from: ");
+    header.Append(mHost);
     header.Append(':');
     header.AppendInt(mPort);
 
     DumpBytesToFile(val, header.get(), buf, n);
 }
 
 void
 nsSocketTransport::TraceOutBuf(const char *buf, int32_t n)
 {
     char *val = PR_GetEnv("NECKO_SOCKET_TRACE_LOG");
     if (!val || !*val)
         return;
 
     nsAutoCString header;
-    header.Assign(NS_LITERAL_CSTRING("Writing to: ") + mHost);
+    header.AssignLiteral("Writing to: ");
+    header.Append(mHost);
     header.Append(':');
     header.AppendInt(mPort);
 
     DumpBytesToFile(val, header.get(), buf, n);
 }
 
 #endif
 
--- a/netwerk/cache2/OldWrappers.cpp
+++ b/netwerk/cache2/OldWrappers.cpp
@@ -522,54 +522,54 @@ GetCacheSessionNameForStoragePolicy(
   MOZ_ASSERT(!isPrivate || storagePolicy == nsICache::STORE_IN_MEMORY);
 
   // HTTP
   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"));
+        sessionName.AssignLiteral("HTTP-memory-only-PB");
       else
-        sessionName.Assign(NS_LITERAL_CSTRING("HTTP-memory-only"));
+        sessionName.AssignLiteral("HTTP-memory-only");
       break;
     case nsICache::STORE_OFFLINE:
       // XXX This is actually never used, only added to prevent
       // any compatibility damage.
-      sessionName.Assign(NS_LITERAL_CSTRING("HTTP-offline"));
+      sessionName.AssignLiteral("HTTP-offline");
       break;
     default:
-      sessionName.Assign(NS_LITERAL_CSTRING("HTTP"));
+      sessionName.AssignLiteral("HTTP");
       break;
     }
   }
   // WYCIWYG
   else if (scheme.EqualsLiteral("wyciwyg")) {
     if (isPrivate)
-      sessionName.Assign(NS_LITERAL_CSTRING("wyciwyg-private"));
+      sessionName.AssignLiteral("wyciwyg-private");
     else
-      sessionName.Assign(NS_LITERAL_CSTRING("wyciwyg"));
+      sessionName.AssignLiteral("wyciwyg");
   }
   // FTP
   else if (scheme.EqualsLiteral("ftp")) {
     if (isPrivate)
-      sessionName.Assign(NS_LITERAL_CSTRING("FTP-private"));
+      sessionName.AssignLiteral("FTP-private");
     else
-      sessionName.Assign(NS_LITERAL_CSTRING("FTP"));
+      sessionName.AssignLiteral("FTP");
   }
   // all remaining URL scheme
   else {
     // Since with the new API a consumer cannot specify its own session name
     // and partitioning of the cache is handled stricly only by the cache
     // back-end internally, we will use a separate session name to pretend
     // functionality of the new API wrapping the Darin's cache for all other
     // URL schemes.
     // Deliberately omitting |anonymous| since other session types don't
     // recognize it too.
-    sessionName.Assign(NS_LITERAL_CSTRING("other"));
+    sessionName.AssignLiteral("other");
     if (isPrivate)
       sessionName.AppendLiteral("-private");
   }
 
   if (appId != nsILoadContextInfo::NO_APP_ID || inBrowser) {
     sessionName.Append('~');
     sessionName.AppendInt(appId);
     sessionName.Append('~');
--- a/netwerk/test/TestSocketTransport.cpp
+++ b/netwerk/test/TestSocketTransport.cpp
@@ -49,17 +49,17 @@ public:
 
     MyHandler(const char *path,
               nsIAsyncInputStream *in,
               nsIAsyncOutputStream *out)
         : mInput(in)
         , mOutput(out)
         , mWriteOffset(0)
         {
-            mBuf.Assign(NS_LITERAL_CSTRING("GET "));
+            mBuf.AssignLiteral("GET ");
             mBuf.Append(path);
             mBuf.AppendLiteral(" HTTP/1.0\r\n\r\n");
         }
     virtual ~MyHandler() {}
 
     // called on any thread
     NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream *out)
     {
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -3655,17 +3655,17 @@ const int64_t UNDEFINED_URN_VALUE = -1;
 nsresult
 CreatePlacesPersistURN(nsNavHistoryQueryResultNode *aResultNode, 
                        int64_t aValue, const nsCString& aTitle, nsCString& aURN)
 {
   nsAutoCString uri;
   nsresult rv = aResultNode->GetUri(uri);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  aURN.Assign(NS_LITERAL_CSTRING("urn:places-persist:"));
+  aURN.AssignLiteral("urn:places-persist:");
   aURN.Append(uri);
 
   aURN.Append(',');
   if (aValue != UNDEFINED_URN_VALUE)
     aURN.AppendInt(aValue);
 
   aURN.Append(',');
   if (!aTitle.IsEmpty()) {
--- a/toolkit/components/places/nsNavHistoryQuery.cpp
+++ b/toolkit/components/places/nsNavHistoryQuery.cpp
@@ -570,17 +570,18 @@ nsNavHistory::QueriesToQueryString(nsINa
   }
 
   // async enabled
   if (options->AsyncEnabled()) {
     AppendAmpersandIfNonempty(queryString);
     queryString += NS_LITERAL_CSTRING(QUERYKEY_ASYNC_ENABLED "=1");
   }
 
-  aQueryString.Assign(NS_LITERAL_CSTRING("place:") + queryString);
+  aQueryString.AssignLiteral("place:");
+  aQueryString.Append(queryString);
   return NS_OK;
 }
 
 
 // TokenizeQueryString
 
 nsresult
 TokenizeQueryString(const nsACString& aQuery,
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2263,17 +2263,17 @@ SelectProfile(nsIProfileLock* *aResult, 
     nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
                                              NS_LITERAL_CSTRING("default"),
                                              getter_AddRefs(profile));
     if (NS_SUCCEEDED(rv)) {
       aProfileSvc->Flush();
       rv = profile->Lock(nullptr, aResult);
       if (NS_SUCCEEDED(rv)) {
         if (aProfileName)
-          aProfileName->Assign(NS_LITERAL_CSTRING("default"));
+          aProfileName->AssignLiteral("default");
         return NS_OK;
       }
     }
   }
 
   bool useDefault = true;
   if (count > 1 && CanShowProfileManager()) {
     aProfileSvc->GetStartWithLastProfile(&useDefault);
--- a/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
+++ b/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
@@ -377,28 +377,28 @@ nsMIMEInfoAndroid::nsMIMEInfoAndroid(con
   mHandlerApps = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   mHandlerApps->AppendElement(mPrefApp, false);
 }
 
 NS_IMPL_ISUPPORTS(nsMIMEInfoAndroid::SystemChooser, nsIHandlerApp)
 
 
 nsresult nsMIMEInfoAndroid::SystemChooser::GetName(nsAString & aName) {
-  aName.Assign(NS_LITERAL_STRING("Android chooser"));
+  aName.AssignLiteral("Android chooser");
   return NS_OK;
 }
 
 nsresult
 nsMIMEInfoAndroid::SystemChooser::SetName(const nsAString&) {
   return NS_OK;
 }
 
 nsresult
 nsMIMEInfoAndroid::SystemChooser::GetDetailedDescription(nsAString & aDesc) {
-  aDesc.Assign(NS_LITERAL_STRING("Android's default handler application chooser"));
+  aDesc.AssignLiteral("Android's default handler application chooser");
   return NS_OK;
 }
 
 nsresult
 nsMIMEInfoAndroid::SystemChooser::SetDetailedDescription(const nsAString&) {
   return NS_OK;
 }
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3284,17 +3284,17 @@ GetBrandName(nsXPIDLString& brandName)
             getter_AddRefs(bundle));
 
     if (bundle)
         bundle->GetStringFromName(
             MOZ_UTF16("brandShortName"),
             getter_Copies(brandName));
 
     if (brandName.IsEmpty())
-        brandName.Assign(NS_LITERAL_STRING("Mozilla"));
+        brandName.AssignLiteral("Mozilla");
 }
 
 static GdkWindow *
 CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
 {
     GdkWindowAttr attributes;
     gint          attributes_mask = GDK_WA_VISUAL;
 
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -1968,17 +1968,17 @@ GetBrandName(nsXPIDLString& brandName)
 
     if (bundle) {
         bundle->GetStringFromName(
             MOZ_UTF16("brandShortName"),
             getter_Copies(brandName));
     }
 
     if (brandName.IsEmpty()) {
-        brandName.Assign(NS_LITERAL_STRING("Mozilla"));
+        brandName.AssignLiteral("Mozilla");
     }
 }
 
 NS_IMETHODIMP
 nsWindow::SetWindowClass(const nsAString &xulWinType)
 {
     if (!mWidget) {
         return NS_ERROR_FAILURE;
--- a/xpcom/base/VisualEventTracer.cpp
+++ b/xpcom/base/VisualEventTracer.cpp
@@ -559,18 +559,17 @@ VisualEventTracerLog::~VisualEventTracer
 {
   RecordBatch::Delete(mBatch);
 }
 
 NS_IMETHODIMP
 VisualEventTracerLog::GetJSONString(nsACString& aResult)
 {
   nsCString buffer;
-
-  buffer.Assign(NS_LITERAL_CSTRING("{\n\"version\": 1,\n\"records\":[\n"));
+  buffer.AssignLiteral("{\n\"version\": 1,\n\"records\":[\n");
 
   RecordBatch* batch = mBatch;
   while (batch) {
     if (batch != mBatch) {
       // This is not the first batch we are writting, add comma
       buffer.AppendLiteral(",\n");
     }
 
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -233,18 +233,18 @@ private:
     if (ShellExecuteExW(&seinfo)) {
       return NS_OK;
     }
     DWORD r = GetLastError();
     // if the file has no association, we launch windows'
     // "what do you want to do" dialog
     if (r == SE_ERR_NOASSOC) {
       nsAutoString shellArg;
-      shellArg.Assign(NS_LITERAL_STRING("shell32.dll,OpenAs_RunDLL ") +
-                      mResolvedPath);
+      shellArg.AssignLiteral("shell32.dll,OpenAs_RunDLL ");
+      shellArg.Append(mResolvedPath);
       seinfo.lpFile = L"RUNDLL32.EXE";
       seinfo.lpParameters = shellArg.get();
       if (ShellExecuteExW(&seinfo)) {
         return NS_OK;
       }
       r = GetLastError();
     }
     if (r < 32) {