Bug 869836 - Part 7: Use AppendLiteral instead of Append where possible. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 22 May 2014 06:48:51 +0300
changeset 196813 1a64b22632bc5423e3c74f5eb819cdf45ee052d8
parent 196812 ff4debbbbf4232817f2e4c2a6babd1e66bd1a2fc
child 196814 ff0eb85179cd93b259ee76bfdac3a032809c360e
push id5990
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:40:24 +0000
treeherdermozilla-aurora@0796197efbc9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs869836
milestone32.0a1
Bug 869836 - Part 7: Use AppendLiteral instead of Append where possible. r=ehsan
accessible/src/atk/Platform.cpp
browser/components/shell/src/nsGNOMEShellService.cpp
content/base/src/nsXMLHttpRequest.cpp
content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
dom/base/nsJSEnvironment.cpp
dom/plugins/base/nsNPAPIPluginStreamListener.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/ipc/PluginModuleParent.cpp
dom/xbl/nsXBLWindowKeyHandler.cpp
embedding/tests/winEmbed/WebBrowserChrome.cpp
extensions/gio/nsGIOProtocolHandler.cpp
extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
gfx/gl/GLBlitTextureImageHelper.cpp
gfx/layers/LayerScope.cpp
gfx/thebes/gfxFT2FontList.cpp
image/src/imgLoader.cpp
intl/unicharutil/src/nsEntityConverter.cpp
ipc/glue/WindowsMessageLoop.cpp
layout/base/nsLayoutUtils.cpp
layout/style/nsFontFaceLoader.cpp
modules/libpref/src/prefapi.cpp
netwerk/protocol/http/Http2Compression.cpp
rdf/base/src/nsRDFService.cpp
rdf/base/src/rdfutil.cpp
rdf/util/src/nsRDFResource.cpp
security/manager/boot/src/nsSecureBrowserUIImpl.cpp
security/manager/ssl/src/nsNSSIOLayer.cpp
startupcache/StartupCacheUtils.cpp
storage/src/mozStorageConnection.cpp
storage/src/mozStoragePrivateHelpers.cpp
storage/test/storage_test_harness.h
toolkit/components/downloads/ApplicationReputation.cpp
toolkit/components/places/Helpers.cpp
toolkit/components/places/nsNavHistory.cpp
toolkit/components/url-classifier/Classifier.cpp
toolkit/system/gnome/nsGConfService.cpp
toolkit/xre/nsX11ErrorHandler.cpp
uriloader/exthandler/nsExternalHelperAppService.cpp
widget/gtk/nsCUPSShim.cpp
widget/tests/TestWinTSF.cpp
widget/windows/GfxInfo.cpp
widget/windows/WinUtils.cpp
widget/windows/nsDataObj.cpp
widget/windows/nsImageClipboard.cpp
widget/xpwidgets/GfxInfoX11.cpp
xpcom/base/SystemMemoryReporter.cpp
xpcom/glue/BlockingResourceBase.cpp
--- a/accessible/src/atk/Platform.cpp
+++ b/accessible/src/atk/Platform.cpp
@@ -74,32 +74,32 @@ LoadGtkModule(GnomeAccessibilityModule& 
 {
     NS_ENSURE_ARG(aModule.libName);
 
     if (!(aModule.lib = PR_LoadLibrary(aModule.libName))) {
         //try to load the module with "gtk-2.0/modules" appended
         char *curLibPath = PR_GetLibraryPath();
         nsAutoCString libPath(curLibPath);
 #if defined(LINUX) && defined(__x86_64__)
-        libPath.Append(":/usr/lib64:/usr/lib");
+        libPath.AppendLiteral(":/usr/lib64:/usr/lib");
 #else
-        libPath.Append(":/usr/lib");
+        libPath.AppendLiteral(":/usr/lib");
 #endif
         PR_FreeLibraryName(curLibPath);
 
         int16_t loc1 = 0, loc2 = 0;
         int16_t subLen = 0;
         while (loc2 >= 0) {
             loc2 = libPath.FindChar(':', loc1);
             if (loc2 < 0)
                 subLen = libPath.Length() - loc1;
             else
                 subLen = loc2 - loc1;
             nsAutoCString sub(Substring(libPath, loc1, subLen));
-            sub.Append("/gtk-2.0/modules/");
+            sub.AppendLiteral("/gtk-2.0/modules/");
             sub.Append(aModule.libName);
             aModule.lib = PR_LoadLibrary(sub.get());
             if (aModule.lib)
                 break;
 
             loc1 = loc2+1;
         }
         if (!aModule.lib)
--- a/browser/components/shell/src/nsGNOMEShellService.cpp
+++ b/browser/components/shell/src/nsGNOMEShellService.cpp
@@ -434,17 +434,17 @@ nsGNOMEShellService::SetDesktopBackgroun
                                           getter_Copies(brandName));
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
   // build the file name
   filePath.Append('/');
   filePath.Append(NS_ConvertUTF16toUTF8(brandName));
-  filePath.Append("_wallpaper.png");
+  filePath.AppendLiteral("_wallpaper.png");
 
   // write the image to a file in the home dir
   rv = WriteImage(filePath, container);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Try GSettings first. If we don't have GSettings or the right schema, fall back
   // to using GConf instead. Note that if GSettings works ok, the changes get
   // mirrored to GConf by the gsettings->gconf bridge in gnome-settings-daemon
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -1374,17 +1374,17 @@ nsXMLHttpRequest::GetResponseHeader(cons
         // Means no content type
         _retval.SetIsVoid(true);
         return;
       }
 
       nsCString value;
       if (NS_SUCCEEDED(mChannel->GetContentCharset(value)) &&
           !value.IsEmpty()) {
-        _retval.Append(";charset=");
+        _retval.AppendLiteral(";charset=");
         _retval.Append(value);
       }
     }
 
     // Content Length:
     else if (header.LowerCaseEqualsASCII("content-length")) {
       int64_t length;
       if (NS_SUCCEEDED(mChannel->GetContentLength(&length))) {
@@ -3872,19 +3872,19 @@ nsXMLHttpRequest::EnsureXPCOMifier()
 
 NS_IMPL_ISUPPORTS(nsXMLHttpRequest::nsHeaderVisitor, nsIHttpHeaderVisitor)
 
 NS_IMETHODIMP nsXMLHttpRequest::
 nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value)
 {
   if (mXHR->IsSafeHeader(header, mHttpChannel)) {
     mHeaders.Append(header);
-    mHeaders.Append(": ");
+    mHeaders.AppendLiteral(": ");
     mHeaders.Append(value);
-    mHeaders.Append("\r\n");
+    mHeaders.AppendLiteral("\r\n");
   }
   return NS_OK;
 }
 
 // nsXMLHttpRequestXPCOMifier implementation
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpRequestXPCOMifier)
   NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
   NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
--- a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
+++ b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
@@ -247,17 +247,17 @@ nsXULTemplateQueryProcessorRDF::GetDatas
         rv = gRDFService->GetDataSource(uristrC.get(), getter_AddRefs(ds));
 
         if (NS_FAILED(rv)) {
             // This is only a warning because the data source may not
             // be accessible for any number of reasons, including
             // security, a bad URL, etc.
   #ifdef DEBUG
             nsAutoCString msg;
-            msg.Append("unable to load datasource '");
+            msg.AppendLiteral("unable to load datasource '");
             msg.Append(uristrC);
             msg.Append('\'');
             NS_WARNING(msg.get());
   #endif
             continue;
         }
 
         compDB->AddDataSource(ds);
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -600,25 +600,25 @@ NS_ScriptErrorReporter(JSContext *cx,
   }
 
   if (nsContentUtils::DOMWindowDumpEnabled()) {
     // Print it to stderr as well, for the benefit of those invoking
     // mozilla with -console.
     nsAutoCString error;
     error.AssignLiteral("JavaScript ");
     if (JSREPORT_IS_STRICT(report->flags))
-      error.Append("strict ");
+      error.AppendLiteral("strict ");
     if (JSREPORT_IS_WARNING(report->flags))
-      error.Append("warning: ");
+      error.AppendLiteral("warning: ");
     else
-      error.Append("error: ");
+      error.AppendLiteral("error: ");
     error.Append(report->filename);
-    error.Append(", line ");
+    error.AppendLiteral(", line ");
     error.AppendInt(report->lineno, 10);
-    error.Append(": ");
+    error.AppendLiteral(": ");
     if (report->ucmessage) {
       AppendUTF16toUTF8(reinterpret_cast<const char16_t*>(report->ucmessage),
                         error);
     } else {
       error.Append(message);
     }
 
     fprintf(stderr, "%s\n", error.get());
--- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
+++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
@@ -817,17 +817,17 @@ nsNPAPIPluginStreamListener::StatusLine(
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNPAPIPluginStreamListener::NewResponseHeader(const char* headerName,
                                                const char* headerValue)
 {
   mResponseHeaders.Append(headerName);
-  mResponseHeaders.Append(": ");
+  mResponseHeaders.AppendLiteral(": ");
   mResponseHeaders.Append(headerValue);
   mResponseHeaders.Append('\n');
   return NS_OK;
 }
 
 bool
 nsNPAPIPluginStreamListener::HandleRedirectNotification(nsIChannel *oldChannel, nsIChannel *newChannel,
                                                         nsIAsyncVerifyRedirectCallback* callback)
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -2276,17 +2276,17 @@ nsPluginHost::WritePluginInfo()
 
   nsCOMPtr<nsIFile> pluginReg;
 
   rv = mPluginRegFile->Clone(getter_AddRefs(pluginReg));
   if (NS_FAILED(rv))
     return rv;
 
   nsAutoCString filename(kPluginRegistryFilename);
-  filename.Append(".tmp");
+  filename.AppendLiteral(".tmp");
   rv = pluginReg->AppendNative(filename);
   if (NS_FAILED(rv))
     return rv;
 
   rv = pluginReg->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd);
   if (NS_FAILED(rv))
     return rv;
 
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -469,21 +469,21 @@ PluginModuleParent::TerminateChildProces
         nsCOMPtr<nsIFile> pluginDumpFile;
 
         if (GetMinidumpForID(mPluginDumpID, getter_AddRefs(pluginDumpFile)) &&
             pluginDumpFile) {
           nsCOMPtr<nsIFile> childDumpFile;
 
           if (CreateFlashMinidump(mFlashProcess1, 0, pluginDumpFile,
                                   NS_LITERAL_CSTRING("flash1"))) {
-            additionalDumps.Append(",flash1");
+            additionalDumps.AppendLiteral(",flash1");
           }
           if (CreateFlashMinidump(mFlashProcess2, 0, pluginDumpFile,
                                   NS_LITERAL_CSTRING("flash2"))) {
-            additionalDumps.Append(",flash2");
+            additionalDumps.AppendLiteral(",flash2");
           }
         }
 #endif
 
         crashReporter->AnnotateCrashReport(
             NS_LITERAL_CSTRING("additional_minidumps"),
             additionalDumps);
     } else {
--- a/dom/xbl/nsXBLWindowKeyHandler.cpp
+++ b/dom/xbl/nsXBLWindowKeyHandler.cpp
@@ -144,17 +144,17 @@ nsXBLSpecialDocInfo::GetHandlers(nsXBLDo
 
 void
 nsXBLSpecialDocInfo::GetAllHandlers(const char* aType,
                                     nsXBLPrototypeHandler** aHandler,
                                     nsXBLPrototypeHandler** aUserHandler)
 {
   if (mUserHTMLBindings) {
     nsAutoCString type(aType);
-    type.Append("User");
+    type.AppendLiteral("User");
     GetHandlers(mUserHTMLBindings, type, aUserHandler);
   }
   if (mHTMLBindings) {
     GetHandlers(mHTMLBindings, nsDependentCString(aType), aHandler);
   }
 }
 
 // Init statics
--- a/embedding/tests/winEmbed/WebBrowserChrome.cpp
+++ b/embedding/tests/winEmbed/WebBrowserChrome.cpp
@@ -423,31 +423,31 @@ WebBrowserChrome::SendHistoryStatusMessa
         {
             status.AssignLiteral("Reloading url, (normal): ");
         }
         status.Append(uriSpec);
     }
     else if (!(strcmp(operation, "add")))
     {
         status.Assign(uriSpec);
-        status.Append(" added to session History");
+        status.AppendLiteral(" added to session History");
     }
     else if (!(strcmp(operation, "goto")))
     {
         status.AssignLiteral("Going to HistoryIndex: ");
 
 	AppendIntToCString(info1, status);
 
-        status.Append(" Url: ");
+        status.AppendLiteral(" Url: ");
         status.Append(uriSpec);
     }
     else if (!(strcmp(operation, "purge")))
     {
         AppendIntToCString(info1, status);
-        status.Append(" purged from Session History");
+        status.AppendLiteral(" purged from Session History");
     }
     else if (!(strcmp(operation, "replace")))
     {
         status.AssignLiteral("Replacing HistoryIndex: ");
         AppendIntToCString(info1, status);
     }
 
     nsString wstatus;
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -280,28 +280,28 @@ nsGIOInputStream::DoOpenDirectory()
   }
   mDirOpen = true;
 
   // Sort list of file infos by using FileInfoComparator function
   mDirList = g_list_sort(mDirList, FileInfoComparator);
   mDirListPtr = mDirList;
 
   // Write base URL (make sure it ends with a '/')
-  mDirBuf.Append("300: ");
+  mDirBuf.AppendLiteral("300: ");
   mDirBuf.Append(mSpec);
   if (mSpec.get()[mSpec.Length() - 1] != '/')
     mDirBuf.Append('/');
   mDirBuf.Append('\n');
 
   // Write column names
-  mDirBuf.Append("200: filename content-length last-modified file-type\n");
+  mDirBuf.AppendLiteral("200: filename content-length last-modified file-type\n");
 
   // Write charset (assume UTF-8)
   // XXX is this correct?
-  mDirBuf.Append("301: UTF-8\n");
+  mDirBuf.AppendLiteral("301: UTF-8\n");
   SetContentTypeOfChannel(APPLICATION_HTTP_INDEX_FORMAT);
   return NS_OK;
 }
 
 /**
  * Create file stream and set mime type for channel
  * @param info file info used to determine mime type
  * @return NS_OK when file stream created successfuly, error code otherwise
@@ -507,23 +507,23 @@ nsGIOInputStream::DoRead(char *aBuf, uin
               "%a,%%20%d%%20%b%%20%Y%%20%H:%M:%S%%20GMT ", &tm);
           mDirBuf.Append(buf);
         }
 
         // The "file-type" field
         switch (g_file_info_get_file_type(info))
         {
           case G_FILE_TYPE_REGULAR:
-            mDirBuf.Append("FILE ");
+            mDirBuf.AppendLiteral("FILE ");
             break;
           case G_FILE_TYPE_DIRECTORY:
-            mDirBuf.Append("DIRECTORY ");
+            mDirBuf.AppendLiteral("DIRECTORY ");
             break;
           case G_FILE_TYPE_SYMBOLIC_LINK:
-            mDirBuf.Append("SYMBOLIC-LINK ");
+            mDirBuf.AppendLiteral("SYMBOLIC-LINK ");
             break;
           default:
             break;
         }
         mDirBuf.Append('\n');
 
         mDirBufCursor = 0;
         mDirListPtr = mDirListPtr->next;
--- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
+++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
@@ -445,28 +445,28 @@ nsGnomeVFSInputStream::DoOpen()
     {
       mDirOpen = true;
 
       // Sort mDirList
       mDirList = g_list_sort(mDirList, FileInfoComparator);
       mDirListPtr = mDirList;
 
       // Write base URL (make sure it ends with a '/')
-      mDirBuf.Append("300: ");
+      mDirBuf.AppendLiteral("300: ");
       mDirBuf.Append(mSpec);
       if (mSpec.get()[mSpec.Length() - 1] != '/')
         mDirBuf.Append('/');
       mDirBuf.Append('\n');
 
       // Write column names
-      mDirBuf.Append("200: filename content-length last-modified file-type\n");
+      mDirBuf.AppendLiteral("200: filename content-length last-modified file-type\n");
 
       // Write charset (assume UTF-8)
       // XXX is this correct?
-      mDirBuf.Append("301: UTF-8\n");
+      mDirBuf.AppendLiteral("301: UTF-8\n");
 
       SetContentTypeOfChannel(APPLICATION_HTTP_INDEX_FORMAT);
     }
   }
 
   gnome_vfs_file_info_clear(&info);
   return rv;
 }
@@ -553,23 +553,23 @@ nsGnomeVFSInputStream::DoRead(char *aBuf
               "%a,%%20%d%%20%b%%20%Y%%20%H:%M:%S%%20GMT ", &tm);
           mDirBuf.Append(buf);
         }
 
         // The "file-type" field
         switch (info->type)
         {
           case GNOME_VFS_FILE_TYPE_REGULAR:
-            mDirBuf.Append("FILE ");
+            mDirBuf.AppendLiteral("FILE ");
             break;
           case GNOME_VFS_FILE_TYPE_DIRECTORY:
-            mDirBuf.Append("DIRECTORY ");
+            mDirBuf.AppendLiteral("DIRECTORY ");
             break;
           case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK:
-            mDirBuf.Append("SYMBOLIC-LINK ");
+            mDirBuf.AppendLiteral("SYMBOLIC-LINK ");
             break;
           default:
             break;
         }
 
         mDirBuf.Append('\n');
 
         mDirBufCursor = 0;
--- a/gfx/gl/GLBlitTextureImageHelper.cpp
+++ b/gfx/gl/GLBlitTextureImageHelper.cpp
@@ -184,17 +184,17 @@ GLBlitTextureImageHelper::SetBlitFramebu
                                LOCAL_GL_COLOR_ATTACHMENT0,
                                LOCAL_GL_TEXTURE_2D,
                                aTexture,
                                0);
 
     GLenum result = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
     if (aTexture && (result != LOCAL_GL_FRAMEBUFFER_COMPLETE)) {
         nsAutoCString msg;
-        msg.Append("Framebuffer not complete -- error 0x");
+        msg.AppendLiteral("Framebuffer not complete -- error 0x");
         msg.AppendInt(result, 16);
         // Note: if you are hitting this, it is likely that
         // your texture is not texture complete -- that is, you
         // allocated a texture name, but didn't actually define its
         // size via a call to TexImage2D.
         NS_RUNTIMEABORT(msg.get());
     }
 }
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -218,17 +218,19 @@ private:
                 }
             }
         }
 
         if (!isWebSocket) {
             return false;
         }
 
-        if (!(version.EqualsLiteral("7") || version.EqualsLiteral("8") || version.EqualsLiteral("13"))) {
+        if (!(version.EqualsLiteral("7") ||
+              version.EqualsLiteral("8") ||
+              version.EqualsLiteral("13"))) {
             return false;
         }
 
         if (!(protocol.EqualsIgnoreCase("binary"))) {
             return false;
         }
 
         // Client request is valid. Start to generate and send server response.
@@ -238,20 +240,20 @@ private:
         nsCString combined(wsKey + guid);
         sha1.update(combined.get(), combined.Length());
         uint8_t digest[SHA1Sum::HashSize]; // SHA1 digests are 20 bytes long.
         sha1.finish(digest);
         nsCString newString(reinterpret_cast<char*>(digest), SHA1Sum::HashSize);
         Base64Encode(newString, res);
 
         nsCString response("HTTP/1.1 101 Switching Protocols\r\n");
-        response.Append("Upgrade: websocket\r\n");
-        response.Append("Connection: Upgrade\r\n");
+        response.AppendLiteral("Upgrade: websocket\r\n");
+        response.AppendLiteral("Connection: Upgrade\r\n");
         response.Append(nsCString("Sec-WebSocket-Accept: ") + res + nsCString("\r\n"));
-        response.Append("Sec-WebSocket-Protocol: binary\r\n\r\n");
+        response.AppendLiteral("Sec-WebSocket-Protocol: binary\r\n\r\n");
         uint32_t written = 0;
         uint32_t size = response.Length();
         while (written < size) {
             uint32_t cnt;
             rv = mOutputStream->Write(const_cast<char*>(response.get()) + written,
                                      size - written, &cnt);
             if (NS_FAILED(rv))
                 return false;
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -1237,17 +1237,17 @@ gfxFT2FontList::FindFonts()
     // font files are in /$ANDROID_ROOT/fonts/
     nsCString root;
     char *androidRoot = PR_GetEnv("ANDROID_ROOT");
     if (androidRoot) {
         root = androidRoot;
     } else {
         root = NS_LITERAL_CSTRING("/system");
     }
-    root.Append("/fonts");
+    root.AppendLiteral("/fonts");
 
     FindFontsInDir(root, &fnc);
 
     if (mFontFamilies.Count() == 0) {
         // if we can't find/read the font directory, we are doomed!
         NS_RUNTIMEABORT("Could not read the system fonts directory");
     }
 #endif // XP_WIN && ANDROID
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -123,17 +123,17 @@ public:
            KIND_NONHEAP, content.mUnusedUncompressedNonheap,
            "Memory used by not in-use content images (uncompressed data).");
 
 #undef REPORT
 
 #define REPORT_VECTOR(_path, _uri, _amount, _desc)                            \
     do {                                                                      \
       nsAutoCString path(NS_LITERAL_CSTRING(_path));                          \
-      path.Append("/(");                                                      \
+      path.AppendLiteral("/(");                                               \
       path.Append(_uri);                                                      \
       path.Append(")");                                                       \
       nsresult rv;                                                            \
       rv = callback->Callback(EmptyCString(), path,                           \
                               KIND_HEAP, UNITS_BYTES, _amount,                \
                               NS_LITERAL_CSTRING(_desc), closure);            \
       NS_ENSURE_SUCCESS(rv, rv);                                              \
     } while (0)
--- a/intl/unicharutil/src/nsEntityConverter.cpp
+++ b/intl/unicharutil/src/nsEntityConverter.cpp
@@ -80,17 +80,17 @@ nsEntityConverter::LoadEntityBundle(uint
       do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, nullptr);
   
   const char16_t *versionName = GetVersionName(version);
   NS_ENSURE_TRUE(versionName, nullptr);
 
   // all property file names are ASCII, like "html40Latin1" so this is safe
   LossyAppendUTF16toASCII(versionName, url);
-  url.Append(".properties");
+  url.AppendLiteral(".properties");
 
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(url.get(), getter_AddRefs(bundle));
   NS_ENSURE_SUCCESS(rv, nullptr);
   
   return bundle.forget();
 }
 
--- a/ipc/glue/WindowsMessageLoop.cpp
+++ b/ipc/glue/WindowsMessageLoop.cpp
@@ -414,17 +414,17 @@ WindowIsDeferredWindow(HWND hWnd)
   // toolkit app's name. It's pretty expensive to calculate this so we only try
   // once.
   if (gAppMessageWindowNameLength == 0) {
     nsCOMPtr<nsIXULAppInfo> appInfo =
       do_GetService("@mozilla.org/xre/app-info;1");
     if (appInfo) {
       nsAutoCString appName;
       if (NS_SUCCEEDED(appInfo->GetName(appName))) {
-        appName.Append("MessageWindow");
+        appName.AppendLiteral("MessageWindow");
         nsDependentString windowName(gAppMessageWindowName);
         CopyUTF8toUTF16(appName, windowName);
         gAppMessageWindowNameLength = windowName.Length();
       }
     }
 
     // Don't try again if that failed.
     if (gAppMessageWindowNameLength == 0) {
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2818,17 +2818,17 @@ nsLayoutUtils::PaintFrame(nsRenderingCon
   }
 
 #ifdef MOZ_DUMP_PAINTING
   FILE* savedDumpFile = gfxUtils::sDumpPaintFile;
   if (gfxUtils::DumpPaintList() || gfxUtils::sDumpPainting) {
     if (gfxUtils::sDumpPaintingToFile) {
       nsCString string("dump-");
       string.AppendInt(gPaintCount);
-      string.Append(".html");
+      string.AppendLiteral(".html");
       gfxUtils::sDumpPaintFile = fopen(string.BeginReading(), "w");
     } else {
       gfxUtils::sDumpPaintFile = stderr;
     }
     if (gfxUtils::sDumpPaintingToFile) {
       fprintf_stderr(gfxUtils::sDumpPaintFile, "<html><head><script>var array = {}; function ViewImage(index) { window.location = array[index]; }</script></head><body>");
     }
     fprintf_stderr(gfxUtils::sDumpPaintFile, "Painting --- before optimization (dirty %d,%d,%d,%d):\n",
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -799,31 +799,31 @@ nsUserFontSet::LogMessage(gfxMixedFontFa
         familyName.get(),
         aProxy->IsItalic() ? "italic" : "normal",
         weightKeyword,
         nsCSSProps::ValueToKeyword(aProxy->Stretch(),
                                    nsCSSProps::kFontStretchKTable).get(),
         aProxy->mSrcIndex);
 
   if (NS_FAILED(aStatus)) {
-    message.Append(": ");
+    message.AppendLiteral(": ");
     switch (aStatus) {
     case NS_ERROR_DOM_BAD_URI:
-      message.Append("bad URI or cross-site access not allowed");
+      message.AppendLiteral("bad URI or cross-site access not allowed");
       break;
     case NS_ERROR_CONTENT_BLOCKED:
-      message.Append("content blocked");
+      message.AppendLiteral("content blocked");
       break;
     default:
-      message.Append("status=");
+      message.AppendLiteral("status=");
       message.AppendInt(static_cast<uint32_t>(aStatus));
       break;
     }
   }
-  message.Append("\nsource: ");
+  message.AppendLiteral("\nsource: ");
   message.Append(fontURI);
 
 #ifdef PR_LOGGING
   if (PR_LOG_TEST(GetUserFontsLog(), PR_LOG_DEBUG)) {
     PR_LOG(GetUserFontsLog(), PR_LOG_DEBUG,
            ("userfonts (%p) %s", this, message.get()));
   }
 #endif
--- a/modules/libpref/src/prefapi.cpp
+++ b/modules/libpref/src/prefapi.cpp
@@ -212,29 +212,29 @@ static void str_escape(const char * orig
         return;
 
     /* Paranoid worst case all slashes will free quickly */
     for  (p=original; *p; ++p)
     {
         switch (*p)
         {
             case '\n':
-                aResult.Append("\\n");
+                aResult.AppendLiteral("\\n");
                 break;
 
             case '\r':
-                aResult.Append("\\r");
+                aResult.AppendLiteral("\\r");
                 break;
 
             case '\\':
-                aResult.Append("\\\\");
+                aResult.AppendLiteral("\\\\");
                 break;
 
             case '\"':
-                aResult.Append("\\\"");
+                aResult.AppendLiteral("\\\"");
                 break;
 
             default:
                 aResult.Append(*p);
                 break;
         }
     }
 }
--- a/netwerk/protocol/http/Http2Compression.cpp
+++ b/netwerk/protocol/http/Http2Compression.cpp
@@ -1014,17 +1014,17 @@ Http2Compressor::EncodeHeaderBlock(const
           semiSpaceIndex = crlfIndex;
         }
         nsDependentCSubstring cookie = Substring(beginBuffer + nextCookie,
                                                  beginBuffer + semiSpaceIndex);
         ProcessHeader(nvPair(name, cookie), true);
         nextCookie = semiSpaceIndex + 2;
       }
     } else {
-      ProcessHeader(nvPair(name, value), name.EqualsLiteral("authorization") ? true : false);
+      ProcessHeader(nvPair(name, value), name.EqualsLiteral("authorization"));
     }
   }
 
   // iterate mreference set and if !alternate.contains(old[i])
   // toggle off
   uint32_t setLen = mReferenceSet.Length();
   for (uint32_t index = 0; index < setLen; ++index) {
     if (!mAlternateReferenceSet.Contains(mReferenceSet[index])) {
--- a/rdf/base/src/nsRDFService.cpp
+++ b/rdf/base/src/nsRDFService.cpp
@@ -1004,17 +1004,17 @@ static int32_t kShift = 6;
     nsAutoCString s;
 
     do {
         // Ugh, this is a really sloppy way to do this; I copied the
         // implementation from the days when it lived outside the RDF
         // service. Now that it's a member we can be more cleverer.
 
         s.Truncate();
-        s.Append("rdf:#$");
+        s.AppendLiteral("rdf:#$");
 
         uint32_t id = ++gCounter;
         while (id) {
             char ch = gChars[(id & kMask)];
             s.Append(ch);
             id >>= kShift;
         }
 
--- a/rdf/base/src/rdfutil.cpp
+++ b/rdf/base/src/rdfutil.cpp
@@ -62,17 +62,17 @@ rdf_FormatDate(PRTime aTime, nsACString 
     PRExplodedTime t;
     PR_ExplodeTime(aTime, PR_GMTParameters, &t);
 
     char buf[256];
     PR_FormatTimeUSEnglish(buf, sizeof buf, "%a %b %d %H:%M:%S %Y", &t);
     aResult.Append(buf);
 
     // usecs
-    aResult.Append(" +");
+    aResult.AppendLiteral(" +");
     int32_t usec = t.tm_usec;
     for (int32_t digit = 100000; digit > 1; digit /= 10) {
         aResult.Append(char('0' + (usec / digit)));
         usec %= digit;
     }
     aResult.Append(char('0' + usec));
 }
 
--- a/rdf/util/src/nsRDFResource.cpp
+++ b/rdf/util/src/nsRDFResource.cpp
@@ -150,17 +150,17 @@ nsRDFResource::GetDelegate(const char* a
         }
 
         entry = entry->mNext;
     }
 
     // Construct a ContractID of the form "@mozilla.org/rdf/delegate/[key]/[scheme];1
     nsAutoCString contractID(NS_RDF_DELEGATEFACTORY_CONTRACTID_PREFIX);
     contractID.Append(aKey);
-    contractID.Append("&scheme=");
+    contractID.AppendLiteral("&scheme=");
 
     int32_t i = mURI.FindChar(':');
     contractID += StringHead(mURI, i);
 
     nsCOMPtr<nsIRDFDelegateFactory> delegateFactory =
              do_CreateInstance(contractID.get(), &rv);
     if (NS_FAILED(rv)) return rv;
 
--- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
+++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp
@@ -809,107 +809,107 @@ nsSecureBrowserUIImpl::OnStateChange(nsI
 
 #if defined(DEBUG)
   nsCString info2;
   uint32_t testFlags = loadFlags;
 
   if (testFlags & nsIChannel::LOAD_DOCUMENT_URI)
   {
     testFlags -= nsIChannel::LOAD_DOCUMENT_URI;
-    info2.Append("LOAD_DOCUMENT_URI ");
+    info2.AppendLiteral("LOAD_DOCUMENT_URI ");
   }
   if (testFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
   {
     testFlags -= nsIChannel::LOAD_RETARGETED_DOCUMENT_URI;
-    info2.Append("LOAD_RETARGETED_DOCUMENT_URI ");
+    info2.AppendLiteral("LOAD_RETARGETED_DOCUMENT_URI ");
   }
   if (testFlags & nsIChannel::LOAD_REPLACE)
   {
     testFlags -= nsIChannel::LOAD_REPLACE;
-    info2.Append("LOAD_REPLACE ");
+    info2.AppendLiteral("LOAD_REPLACE ");
   }
 
   const char *_status = NS_SUCCEEDED(aStatus) ? "1" : "0";
 
   nsCString info;
   uint32_t f = aProgressStateFlags;
   if (f & nsIWebProgressListener::STATE_START)
   {
     f -= nsIWebProgressListener::STATE_START;
-    info.Append("START ");
+    info.AppendLiteral("START ");
   }
   if (f & nsIWebProgressListener::STATE_REDIRECTING)
   {
     f -= nsIWebProgressListener::STATE_REDIRECTING;
-    info.Append("REDIRECTING ");
+    info.AppendLiteral("REDIRECTING ");
   }
   if (f & nsIWebProgressListener::STATE_TRANSFERRING)
   {
     f -= nsIWebProgressListener::STATE_TRANSFERRING;
-    info.Append("TRANSFERRING ");
+    info.AppendLiteral("TRANSFERRING ");
   }
   if (f & nsIWebProgressListener::STATE_NEGOTIATING)
   {
     f -= nsIWebProgressListener::STATE_NEGOTIATING;
-    info.Append("NEGOTIATING ");
+    info.AppendLiteral("NEGOTIATING ");
   }
   if (f & nsIWebProgressListener::STATE_STOP)
   {
     f -= nsIWebProgressListener::STATE_STOP;
-    info.Append("STOP ");
+    info.AppendLiteral("STOP ");
   }
   if (f & nsIWebProgressListener::STATE_IS_REQUEST)
   {
     f -= nsIWebProgressListener::STATE_IS_REQUEST;
-    info.Append("IS_REQUEST ");
+    info.AppendLiteral("IS_REQUEST ");
   }
   if (f & nsIWebProgressListener::STATE_IS_DOCUMENT)
   {
     f -= nsIWebProgressListener::STATE_IS_DOCUMENT;
-    info.Append("IS_DOCUMENT ");
+    info.AppendLiteral("IS_DOCUMENT ");
   }
   if (f & nsIWebProgressListener::STATE_IS_NETWORK)
   {
     f -= nsIWebProgressListener::STATE_IS_NETWORK;
-    info.Append("IS_NETWORK ");
+    info.AppendLiteral("IS_NETWORK ");
   }
   if (f & nsIWebProgressListener::STATE_IS_WINDOW)
   {
     f -= nsIWebProgressListener::STATE_IS_WINDOW;
-    info.Append("IS_WINDOW ");
+    info.AppendLiteral("IS_WINDOW ");
   }
   if (f & nsIWebProgressListener::STATE_IS_INSECURE)
   {
     f -= nsIWebProgressListener::STATE_IS_INSECURE;
-    info.Append("IS_INSECURE ");
+    info.AppendLiteral("IS_INSECURE ");
   }
   if (f & nsIWebProgressListener::STATE_IS_BROKEN)
   {
     f -= nsIWebProgressListener::STATE_IS_BROKEN;
-    info.Append("IS_BROKEN ");
+    info.AppendLiteral("IS_BROKEN ");
   }
   if (f & nsIWebProgressListener::STATE_IS_SECURE)
   {
     f -= nsIWebProgressListener::STATE_IS_SECURE;
-    info.Append("IS_SECURE ");
+    info.AppendLiteral("IS_SECURE ");
   }
   if (f & nsIWebProgressListener::STATE_SECURE_HIGH)
   {
     f -= nsIWebProgressListener::STATE_SECURE_HIGH;
-    info.Append("SECURE_HIGH ");
+    info.AppendLiteral("SECURE_HIGH ");
   }
   if (f & nsIWebProgressListener::STATE_RESTORING)
   {
     f -= nsIWebProgressListener::STATE_RESTORING;
-    info.Append("STATE_RESTORING ");
+    info.AppendLiteral("STATE_RESTORING ");
   }
 
   if (f > 0)
   {
-    info.Append("f contains unknown flag!");
+    info.AppendLiteral("f contains unknown flag!");
   }
 
   PR_LOG(gSecureDocLog, PR_LOG_DEBUG,
          ("SecureUI:%p: OnStateChange: %s %s -- %s\n", this, _status, 
           info.get(), info2.get()));
 
   if (aProgressStateFlags & STATE_STOP
       &&
--- a/security/manager/ssl/src/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/src/nsNSSIOLayer.cpp
@@ -2334,20 +2334,20 @@ nsSSLIOLayerSetOptions(PRFileDesc* fd, b
     }
   }
 
   // Set the Peer ID so that SSL proxy connections work properly and to
   // separate anonymous and/or private browsing connections.
   uint32_t flags = infoObject->GetProviderFlags();
   nsAutoCString peerId;
   if (flags & nsISocketProvider::ANONYMOUS_CONNECT) { // See bug 466080
-    peerId.Append("anon:");
+    peerId.AppendLiteral("anon:");
   }
   if (flags & nsISocketProvider::NO_PERMANENT_STORAGE) {
-    peerId.Append("private:");
+    peerId.AppendLiteral("private:");
   }
   peerId.Append(host);
   peerId.Append(':');
   peerId.AppendInt(port);
   if (SECSuccess != SSL_SetSockPeerID(fd, peerId.get())) {
     return NS_ERROR_FAILURE;
   }
 
--- a/startupcache/StartupCacheUtils.cpp
+++ b/startupcache/StartupCacheUtils.cpp
@@ -130,17 +130,17 @@ canonicalizeBase(nsAutoCString &spec,
      * - the APP directory points to a subdirectory of the GRE directory,
      *   meaning spec points under APP.
      * Checking the GRE and APP path length is enough to know in which case
      * we are.
      */
     if (underGre && underApp && greBase.Length() < appBase.Length())
         underGre = false;
 
-    out.Append("/resource/");
+    out.AppendLiteral("/resource/");
     out.Append(baseName[underGre ? mozilla::Omnijar::GRE : mozilla::Omnijar::APP]);
     out.Append(Substring(spec, underGre ? greBase.Length() : appBase.Length()));
     return true;
 }
 
 /**
  * PathifyURI transforms uris into useful zip paths
  * to make it easier to manipulate startup cache entries
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -728,27 +728,27 @@ Connection::databaseElementExists(enum D
   if (ind == kNotFound) {
     element.Assign(aElementName);
   }
   else {
     nsDependentCSubstring db(Substring(aElementName, 0, ind + 1));
     element.Assign(Substring(aElementName, ind + 1, aElementName.Length()));
     query.Append(db);
   }
-  query.Append("sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = '");
+  query.AppendLiteral("sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = '");
 
   switch (aElementType) {
     case INDEX:
-      query.Append("index");
+      query.AppendLiteral("index");
       break;
     case TABLE:
-      query.Append("table");
+      query.AppendLiteral("table");
       break;
   }
-  query.Append("' AND name ='");
+  query.AppendLiteral("' AND name ='");
   query.Append(element);
   query.Append("'");
 
   sqlite3_stmt *stmt;
   int srv = prepareStatement(mDBConn, query, &stmt);
   if (srv != SQLITE_OK)
     return convertResultCode(srv);
 
--- a/storage/src/mozStoragePrivateHelpers.cpp
+++ b/storage/src/mozStoragePrivateHelpers.cpp
@@ -93,22 +93,22 @@ checkAndLogStatementPerformance(sqlite3_
 
   // Check to see if this is marked to not warn
   if (::strstr(sql, "/* do not warn (bug "))
     return;
 
   nsAutoCString message;
   message.AppendInt(count);
   if (count == 1)
-    message.Append(" sort operation has ");
+    message.AppendLiteral(" sort operation has ");
   else
-    message.Append(" sort operations have ");
-  message.Append("occurred for the SQL statement '");
+    message.AppendLiteral(" sort operations have ");
+  message.AppendLiteral("occurred for the SQL statement '");
 #ifdef MOZ_STORAGE_SORTWARNING_SQL_DUMP
-  message.Append("SQL command: ");
+  message.AppendLiteral("SQL command: ");
   message.Append(sql);
 #else
   nsPrintfCString address("0x%p", aStatement);
   message.Append(address);
 #endif
   message.Append("'.  See https://developer.mozilla.org/En/Storage/Warnings "
                  "details.");
   NS_WARNING(message.get());
--- a/storage/test/storage_test_harness.h
+++ b/storage/test/storage_test_harness.h
@@ -153,17 +153,17 @@ AsyncStatementSpinner::HandleError(mozIS
   int32_t result;
   nsresult rv = aError->GetResult(&result);
   NS_ENSURE_SUCCESS(rv, rv);
   nsAutoCString message;
   rv = aError->GetMessage(message);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString warnMsg;
-  warnMsg.Append("An error occurred while executing an async statement: ");
+  warnMsg.AppendLiteral("An error occurred while executing an async statement: ");
   warnMsg.AppendInt(result);
   warnMsg.Append(" ");
   warnMsg.Append(message);
   NS_WARNING(warnMsg.get());
 
   return NS_OK;
 }
 
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -410,21 +410,21 @@ PendingLookup::LookupNext()
 nsCString
 PendingLookup::EscapeCertificateAttribute(const nsACString& aAttribute)
 {
   // Escape '/' because it's a field separator, and '%' because Chrome does
   nsCString escaped;
   escaped.SetCapacity(aAttribute.Length());
   for (unsigned int i = 0; i < aAttribute.Length(); ++i) {
     if (aAttribute.Data()[i] == '%') {
-      escaped.Append("%25");
+      escaped.AppendLiteral("%25");
     } else if (aAttribute.Data()[i] == '/') {
-      escaped.Append("%2F");
+      escaped.AppendLiteral("%2F");
     } else if (aAttribute.Data()[i] == ' ') {
-      escaped.Append("%20");
+      escaped.AppendLiteral("%20");
     } else {
       escaped.Append(aAttribute.Data()[i]);
     }
   }
   return escaped;
 }
 
 nsCString
@@ -460,35 +460,35 @@ PendingLookup::GenerateWhitelistStringsF
   NS_ENSURE_SUCCESS(rv, rv);
   whitelistString.Append(
     EscapeFingerprint(NS_ConvertUTF16toUTF8(fingerprint)));
 
   nsString commonName;
   rv = certificate->GetCommonName(commonName);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!commonName.IsEmpty()) {
-    whitelistString.Append("/CN=");
+    whitelistString.AppendLiteral("/CN=");
     whitelistString.Append(
       EscapeCertificateAttribute(NS_ConvertUTF16toUTF8(commonName)));
   }
 
   nsString organization;
   rv = certificate->GetOrganization(organization);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!organization.IsEmpty()) {
-    whitelistString.Append("/O=");
+    whitelistString.AppendLiteral("/O=");
     whitelistString.Append(
       EscapeCertificateAttribute(NS_ConvertUTF16toUTF8(organization)));
   }
 
   nsString organizationalUnit;
   rv = certificate->GetOrganizationalUnit(organizationalUnit);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!organizationalUnit.IsEmpty()) {
-    whitelistString.Append("/OU=");
+    whitelistString.AppendLiteral("/OU=");
     whitelistString.Append(
       EscapeCertificateAttribute(NS_ConvertUTF16toUTF8(organizationalUnit)));
   }
   LOG(("Whitelisting %s", whitelistString.get()));
 
   mAllowlistSpecs.AppendElement(whitelistString);
   return NS_OK;
 }
--- a/toolkit/components/places/Helpers.cpp
+++ b/toolkit/components/places/Helpers.cpp
@@ -45,17 +45,17 @@ AsyncStatementCallback::HandleError(mozI
   int32_t result;
   nsresult rv = aError->GetResult(&result);
   NS_ENSURE_SUCCESS(rv, rv);
   nsAutoCString message;
   rv = aError->GetMessage(message);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString warnMsg;
-  warnMsg.Append("An error occurred while executing an async statement: ");
+  warnMsg.AppendLiteral("An error occurred while executing an async statement: ");
   warnMsg.AppendInt(result);
   warnMsg.Append(" ");
   warnMsg.Append(message);
   NS_WARNING(warnMsg.get());
 #endif
 
   return NS_OK;
 }
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -1893,17 +1893,17 @@ PlacesSQLQueryBuilder::Where()
   }
 
   if (mResultType == nsINavHistoryQueryOptions::RESULTS_AS_URI &&
       !additionalVisitsConditions.IsEmpty()) {
     // URI results don't join on visits.
     nsAutoCString tmp = additionalVisitsConditions;
     additionalVisitsConditions = "AND EXISTS (SELECT 1 FROM moz_historyvisits WHERE place_id = h.id ";
     additionalVisitsConditions.Append(tmp);
-    additionalVisitsConditions.Append("LIMIT 1)");
+    additionalVisitsConditions.AppendLiteral("LIMIT 1)");
   }
 
   mQueryString.ReplaceSubstring("{QUERY_OPTIONS_VISITS}",
                                 additionalVisitsConditions.get());
   mQueryString.ReplaceSubstring("{QUERY_OPTIONS_PLACES}",
                                 additionalPlacesConditions.get());
 
   // If we used WHERE already, we inject the conditions 
--- a/toolkit/components/url-classifier/Classifier.cpp
+++ b/toolkit/components/url-classifier/Classifier.cpp
@@ -192,26 +192,26 @@ Classifier::TableRequest(nsACString& aRe
 
     aResult.Append(store->TableName());
     aResult.Append(";");
 
     ChunkSet &adds = store->AddChunks();
     ChunkSet &subs = store->SubChunks();
 
     if (adds.Length() > 0) {
-      aResult.Append("a:");
+      aResult.AppendLiteral("a:");
       nsAutoCString addList;
       adds.Serialize(addList);
       aResult.Append(addList);
     }
 
     if (subs.Length() > 0) {
       if (adds.Length() > 0)
         aResult.Append(':');
-      aResult.Append("s:");
+      aResult.AppendLiteral("s:");
       nsAutoCString subList;
       subs.Serialize(subList);
       aResult.Append(subList);
     }
 
     aResult.Append('\n');
   }
 }
--- a/toolkit/system/gnome/nsGConfService.cpp
+++ b/toolkit/system/gnome/nsGConfService.cpp
@@ -232,17 +232,17 @@ nsGConfService::SetFloat(const nsACStrin
 }
 
 NS_IMETHODIMP
 nsGConfService::GetAppForProtocol(const nsACString &aScheme, bool *aEnabled,
                                   nsACString &aHandler)
 {
   nsAutoCString key("/desktop/gnome/url-handlers/");
   key.Append(aScheme);
-  key.Append("/command");
+  key.AppendLiteral("/command");
 
   GError *err = nullptr;
   gchar *command = gconf_client_get_string(mClient, key.get(), &err);
   if (!err && command) {
     key.Replace(key.Length() - 7, 7, NS_LITERAL_CSTRING("enabled"));
     *aEnabled = gconf_client_get_bool(mClient, key.get(), &err);
   } else {
     *aEnabled = false;
@@ -260,17 +260,17 @@ nsGConfService::GetAppForProtocol(const 
 }
 
 NS_IMETHODIMP
 nsGConfService::HandlerRequiresTerminal(const nsACString &aScheme,
                                         bool *aResult)
 {
   nsAutoCString key("/desktop/gnome/url-handlers/");
   key.Append(aScheme);
-  key.Append("/requires_terminal");
+  key.AppendLiteral("/requires_terminal");
 
   GError *err = nullptr;
   *aResult = gconf_client_get_bool(mClient, key.get(), &err);
   if (err) {
     g_error_free(err);
     return NS_ERROR_FAILURE;
   }
 
@@ -278,17 +278,17 @@ nsGConfService::HandlerRequiresTerminal(
 }
 
 NS_IMETHODIMP
 nsGConfService::SetAppForProtocol(const nsACString &aScheme,
                                   const nsACString &aCommand)
 {
   nsAutoCString key("/desktop/gnome/url-handlers/");
   key.Append(aScheme);
-  key.Append("/command");
+  key.AppendLiteral("/command");
 
   bool res = gconf_client_set_string(mClient, key.get(),
                                        PromiseFlatCString(aCommand).get(),
                                        nullptr);
   if (res) {
     key.Replace(key.Length() - 7, 7, NS_LITERAL_CSTRING("enabled"));
     res = gconf_client_set_bool(mClient, key.get(), true, nullptr);
     if (res) {
--- a/toolkit/xre/nsX11ErrorHandler.cpp
+++ b/toolkit/xre/nsX11ErrorHandler.cpp
@@ -78,23 +78,23 @@ X11Error(Display *display, XErrorEvent *
     XGetErrorDatabaseText(display, "XRequest", message.get(), "",
                           buffer, sizeof(buffer));
   }
 
   nsAutoCString notes;
   if (buffer[0]) {
     notes.Append(buffer);
   } else {
-    notes.Append("Request ");
+    notes.AppendLiteral("Request ");
     notes.AppendInt(event->request_code);
     notes.Append('.');
     notes.AppendInt(event->minor_code);
   }
 
-  notes.Append(": ");
+  notes.AppendLiteral(": ");
 
   // Get a string to describe the error.
   XGetErrorText(display, event->error_code, buffer, sizeof(buffer));
   notes.Append(buffer);
 
   // For requests where Xlib gets the reply synchronously, |age| will be 1
   // and the stack will include the function making the request.  For
   // asynchronous requests, the current stack will often be unrelated to the
@@ -104,21 +104,21 @@ X11Error(Display *display, XErrorEvent *
   // |age| will be 2 for asynchronous requests because XSynchronize is
   // implemented by an empty request from an XSync, which has not yet been
   // processed.
   if (age > 1) {
     // XSynchronize returns the previous "after function".  If a second
     // XSynchronize call returns the same function after an enable call then
     // synchronization must have already been enabled.
     if (XSynchronize(display, True) == XSynchronize(display, False)) {
-      notes.Append("; sync");
+      notes.AppendLiteral("; sync");
     } else {
-      notes.Append("; ");
+      notes.AppendLiteral("; ");
       notes.AppendInt(uint32_t(age));
-      notes.Append(" requests ago");
+      notes.AppendLiteral(" requests ago");
     }
   }
 
 #ifdef MOZ_CRASHREPORTER
   switch (XRE_GetProcessType()) {
   case GeckoProcessType_Default:
   case GeckoProcessType_Plugin:
   case GeckoProcessType_Content:
@@ -127,24 +127,24 @@ X11Error(Display *display, XErrorEvent *
   default: 
     ; // crash report notes not supported.
   }
 #endif
 
 #ifdef DEBUG
   // The resource id is unlikely to be useful in a crash report without
   // context of other ids, but add it to the debug console output.
-  notes.Append("; id=0x");
+  notes.AppendLiteral("; id=0x");
   notes.AppendInt(uint32_t(event->resourceid), 16);
 #ifdef MOZ_X11
   // Actually, for requests where Xlib gets the reply synchronously,
   // MOZ_X_SYNC=1 will not be necessary, but we don't have a table to tell us
   // which requests get a synchronous reply.
   if (!PR_GetEnv("MOZ_X_SYNC")) {
-    notes.Append("\nRe-running with MOZ_X_SYNC=1 in the environment may give a more helpful backtrace.");
+    notes.AppendLiteral("\nRe-running with MOZ_X_SYNC=1 in the environment may give a more helpful backtrace.");
   }
 #endif
 #endif
 
 #ifdef MOZ_WIDGET_QT
   // We should not abort here if MOZ_X_SYNC is not set
   // until http://bugreports.qt.nokia.com/browse/QTBUG-4042
   // not fixed, just print error value
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -2592,17 +2592,17 @@ NS_IMETHODIMP nsExternalHelperAppService
     if (NS_FAILED(rv) && !aFileExt.IsEmpty()) {
       rv = FillMIMEInfoForExtensionFromExtras(aFileExt, *_retval);
       LOG(("Searched extras (by ext), rv 0x%08X\n", rv));
     }
     // If that still didn't work, set the file description to "ext File"
     if (NS_FAILED(rv) && !aFileExt.IsEmpty()) {
       // XXXzpao This should probably be localized
       nsAutoCString desc(aFileExt);
-      desc.Append(" File");
+      desc.AppendLiteral(" File");
       (*_retval)->SetDescription(NS_ConvertASCIItoUTF16(desc));
       LOG(("Falling back to 'File' file description\n"));
     }
   }
 
   // Finally, check if we got a file extension and if yes, if it is an
   // extension on the mimeinfo, in which case we want it to be the primary one
   if (!aFileExt.IsEmpty()) {
--- a/widget/gtk/nsCUPSShim.cpp
+++ b/widget/gtk/nsCUPSShim.cpp
@@ -42,17 +42,17 @@ nsCUPSShim::Init()
         (void **)&mCupsTempFd,
     };
 
     for (int i = gSymNameCt; i--; ) {
         *(symAddr[i]) = PR_FindSymbol(mCupsLib, gSymName[i]);
         if (! *(symAddr[i])) {
 #ifdef DEBUG
             nsAutoCString msg(gSymName[i]);
-            msg.Append(" not found in CUPS library");
+            msg.AppendLiteral(" not found in CUPS library");
             NS_WARNING(msg.get());
 #endif
             PR_UnloadLibrary(mCupsLib);
             mCupsLib = nullptr;
             return false;
         }
     }
     return true;
--- a/widget/tests/TestWinTSF.cpp
+++ b/widget/tests/TestWinTSF.cpp
@@ -2898,17 +2898,17 @@ TestApp::TestScrollMessages(void)
     fail("TestScrollMessages: get nsIDOMElement");
     mTextArea->SetAttribute(NS_LITERAL_STRING("style"), EmptyString());
     return false;
   }
 
 #define DO_CHECK(aFailureCondition, aDescription) \
   if (aFailureCondition) { \
     nsAutoCString str(aDescription); \
-    str.Append(": "); \
+    str.AppendLiteral(": "); \
     str.Append(#aFailureCondition); \
     fail(str.get()); \
     mTextArea->SetAttribute(NS_LITERAL_STRING("style"), EmptyString()); \
     return false; \
   }
 
   HWND wnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW);
 
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -733,48 +733,48 @@ GfxInfo::AddCrashReportAnnotations()
                                      narrowVendorID);
   CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
                                      narrowDeviceID);
   
   /* Add an App Note for now so that we get the data immediately. These
    * can go away after we store the above in the socorro db */
   nsAutoCString note;
   /* AppendPrintf only supports 32 character strings, mrghh. */
-  note.Append("AdapterVendorID: ");
+  note.AppendLiteral("AdapterVendorID: ");
   note.Append(narrowVendorID);
-  note.Append(", AdapterDeviceID: ");
+  note.AppendLiteral(", AdapterDeviceID: ");
   note.Append(narrowDeviceID);
   note.AppendPrintf(", AdapterSubsysID: %08x, ", mAdapterSubsysID);
-  note.Append("AdapterDriverVersion: ");
+  note.AppendLiteral("AdapterDriverVersion: ");
   note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString));
 
   if (vendorID == GfxDriverInfo::GetDeviceVendor(VendorAll)) {
     /* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */
-    note.Append(", ");
+    note.AppendLiteral(", ");
     LossyAppendUTF16toASCII(mDeviceID, note);
-    note.Append(", ");
+    note.AppendLiteral(", ");
     LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
     LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
   }
   note.Append("\n");
 
   if (mHasDualGPU) {
     nsString deviceID2, vendorID2;
     nsAutoString adapterDriverVersionString2;
     nsCString narrowDeviceID2, narrowVendorID2;
 
     note.AppendLiteral("Has dual GPUs. GPU #2: ");
     GetAdapterDeviceID2(deviceID2);
     CopyUTF16toUTF8(deviceID2, narrowDeviceID2);
     GetAdapterVendorID2(vendorID2);
     CopyUTF16toUTF8(vendorID2, narrowVendorID2);
     GetAdapterDriverVersion2(adapterDriverVersionString2);
-    note.Append("AdapterVendorID2: ");
+    note.AppendLiteral("AdapterVendorID2: ");
     note.Append(narrowVendorID2);
-    note.Append(", AdapterDeviceID2: ");
+    note.AppendLiteral(", AdapterDeviceID2: ");
     note.Append(narrowDeviceID2);
     note.AppendPrintf(", AdapterSubsysID2: %08x, ", mAdapterSubsysID2);
     note.AppendPrintf("AdapterDriverVersion2: ");
     note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString2));
   }
   CrashReporter::AppendAppNotesToCrashReport(note);
 
 #endif
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -1120,17 +1120,17 @@ nsresult FaviconHelper::GetOutputIconPat
   NS_ENSURE_SUCCESS(rv, rv);
   if (!aURLShortcut)
     rv = aICOFile->AppendNative(nsDependentCString(kJumpListCacheDir));
   else
     rv = aICOFile->AppendNative(nsDependentCString(kShortcutCacheDir));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Append the icon extension
-  inputURIHash.Append(".ico");
+  inputURIHash.AppendLiteral(".ico");
   rv = aICOFile->AppendNative(inputURIHash);
 
   return rv;
 }
 
 // (static) Asynchronously creates a cached ICO file on disk for the favicon of
 // page aFaviconPageURI and stores it to disk at the path of aICOFile.
 nsresult 
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -1235,17 +1235,17 @@ HRESULT nsDataObj::GetPreferredDropEffec
 HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGMEDIUM& aSTG)
 {
   void* data = nullptr;
   uint32_t   len;
   
   // if someone asks for text/plain, look up text/unicode instead in the transferable.
   const char* flavorStr;
   const nsPromiseFlatCString& flat = PromiseFlatCString(aDataFlavor);
-  if ( aDataFlavor.EqualsLiteral("text/plain") )
+  if (aDataFlavor.EqualsLiteral("text/plain"))
     flavorStr = kUnicodeMime;
   else
     flavorStr = flat.get();
 
   // NOTE: CreateDataFromPrimitive creates new memory, that needs to be deleted
   nsCOMPtr<nsISupports> genericDataWrapper;
   mTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper), &len);
   if ( !len )
--- a/widget/windows/nsImageClipboard.cpp
+++ b/widget/windows/nsImageClipboard.cpp
@@ -239,17 +239,17 @@ nsImageFromClipboard ::GetEncodedImageSt
     // Convert the clipboard image into RGB packed pixel data
     rv = ConvertColorBitMap((unsigned char *) (pGlobal + header->bmiHeader.biSize), header, rgbData);
     // if that succeeded, encode the bitmap as aMIMEFormat data. Don't return early or we risk leaking rgbData
     if (NS_SUCCEEDED(rv)) {
       nsAutoCString encoderCID(NS_LITERAL_CSTRING("@mozilla.org/image/encoder;2?type="));
 
       // Map image/jpg to image/jpeg (which is how the encoder is registered).
       if (strcmp(aMIMEFormat, kJPGImageMime) == 0)
-        encoderCID.Append("image/jpeg");
+        encoderCID.AppendLiteral("image/jpeg");
       else
         encoderCID.Append(aMIMEFormat);
       nsCOMPtr<imgIEncoder> encoder = do_CreateInstance(encoderCID.get(), &rv);
       if (NS_SUCCEEDED(rv)){
         rv = encoder->InitFromData(rgbData, 0, width, height, 3 * width /* RGB * # pixels in a row */, 
                                    imgIEncoder::INPUT_FORMAT_RGB, EmptyString());
         if (NS_SUCCEEDED(rv))
           encoder->QueryInterface(NS_GET_IID(nsIInputStream), (void **) aInputStream);
--- a/widget/xpwidgets/GfxInfoX11.cpp
+++ b/widget/xpwidgets/GfxInfoX11.cpp
@@ -182,23 +182,23 @@ GfxInfo::GetData()
         return;
     }
 
     mAdapterDescription.Append(mVendor);
     mAdapterDescription.AppendLiteral(" -- ");
     mAdapterDescription.Append(mRenderer);
 
     nsAutoCString note;
-    note.Append("OpenGL: ");
+    note.AppendLiteral("OpenGL: ");
     note.Append(mAdapterDescription);
-    note.Append(" -- ");
+    note.AppendLiteral(" -- ");
     note.Append(mVersion);
     if (mHasTextureFromPixmap)
-        note.Append(" -- texture_from_pixmap");
-    note.Append("\n");
+        note.AppendLiteral(" -- texture_from_pixmap");
+    note.AppendLiteral("\n");
 #ifdef MOZ_CRASHREPORTER
     CrashReporter::AppendAppNotesToCrashReport(note);
 #endif
 
     // determine the major OpenGL version. That's the first integer in the version string.
     mGLMajorVersion = strtol(mVersion.get(), 0, 10);
 
     // determine driver type (vendor) and where in the version string
--- a/xpcom/base/SystemMemoryReporter.cpp
+++ b/xpcom/base/SystemMemoryReporter.cpp
@@ -250,21 +250,21 @@ private:
           static const size_t len = 256;
           char buf[len];
           if (fgets(buf, len, f)) {
             processName.Append(buf);
             // A hack: replace forward slashes with '\\' so they aren't treated
             // as path separators.  Consumers of this reporter (such as
             // about:memory) have to undo this change.
             processName.ReplaceChar('/', '\\');
-            processName.Append(", ");
+            processName.AppendLiteral(", ");
           }
           fclose(f);
         }
-        processName.Append("pid=");
+        processName.AppendLiteral("pid=");
         processName.Append(pidStr);
         processName.Append(")");
 
         // Read the PSS values from the smaps file.
         nsPrintfCString smapsPath("/proc/%s/smaps", pidStr);
         f = fopen(smapsPath.get(), "r");
         if (!f) {
           // Processes can terminate between the readdir() call above and now,
@@ -294,17 +294,17 @@ private:
     // Report the "processes/" tree.
 
     for (size_t i = 0; i < ProcessSizeKindLimit; i++) {
       nsAutoCString path("processes/");
       path.Append(kindPathSuffixes[i]);
 
       nsAutoCString desc("This is the sum of all processes' '");
       desc.Append(kindPathSuffixes[i]);
-      desc.Append("' numbers.");
+      desc.AppendLiteral("' numbers.");
 
       REPORT(path, processSizes.mSizes[i], desc);
     }
 
     return NS_OK;
   }
 
   nsresult ParseMapping(FILE* aFile,
@@ -392,87 +392,89 @@ private:
     nsAutoCString absPath;
     absPath.Append(aPath);
     absPath.StripChars(" ");
 
     nsAutoCString basename;
     GetBasename(absPath, basename);
 
     if (basename.EqualsLiteral("[heap]")) {
-      aName.Append("anonymous/brk-heap");
-      aDesc.Append("Memory in anonymous mappings within the boundaries "
-                   "defined by brk() / sbrk().  This is likely to be just "
-                   "a portion of the application's heap; the remainder "
-                   "lives in other anonymous mappings. This corresponds to "
-                   "'[heap]' in /proc/<pid>/smaps.");
+      aName.AppendLiteral("anonymous/brk-heap");
+      aDesc.AppendLiteral(
+        "Memory in anonymous mappings within the boundaries defined by "
+        "brk() / sbrk().  This is likely to be just a portion of the "
+        "application's heap; the remainder lives in other anonymous mappings. "
+        "This corresponds to '[heap]' in /proc/<pid>/smaps.");
       *aProcessSizeKind = AnonymousBrkHeap;
 
     } else if (basename.EqualsLiteral("[stack]")) {
-      aName.Append("main-thread-stack");
-      aDesc.Append("The stack size of the process's main thread.  This "
-                   "corresponds to '[stack]' in /proc/<pid>/smaps.");
+      aName.AppendLiteral("main-thread-stack");
+      aDesc.AppendLiteral(
+        "The stack size of the process's main thread.  This corresponds to "
+        "'[stack]' in /proc/<pid>/smaps.");
       *aProcessSizeKind = MainThreadStack;
 
     } else if (basename.EqualsLiteral("[vdso]")) {
-      aName.Append("vdso");
-      aDesc.Append("The virtual dynamically-linked shared object, also known "
-                   "as the 'vsyscall page'. This is a memory region mapped by "
-                   "the operating system for the purpose of allowing processes "
-                   "to perform some privileged actions without the overhead of "
-                   "a syscall.");
+      aName.AppendLiteral("vdso");
+      aDesc.AppendLiteral(
+        "The virtual dynamically-linked shared object, also known as the "
+        "'vsyscall page'. This is a memory region mapped by the operating "
+        "system for the purpose of allowing processes to perform some "
+        "privileged actions without the overhead of a syscall.");
       *aProcessSizeKind = Vdso;
 
     } else if (!IsAnonymous(basename)) {
       nsAutoCString dirname;
       GetDirname(absPath, dirname);
 
       // Hack: A file is a shared library if the basename contains ".so" and
       // its dirname contains "/lib", or if the basename ends with ".so".
       if (EndsWithLiteral(basename, ".so") ||
           (basename.Find(".so") != -1 && dirname.Find("/lib") != -1)) {
-        aName.Append("shared-libraries/");
+        aName.AppendLiteral("shared-libraries/");
 
         if (strncmp(aPerms, "r-x", 3) == 0) {
           *aProcessSizeKind = SharedLibrariesRX;
         } else if (strncmp(aPerms, "rw-", 3) == 0) {
           *aProcessSizeKind = SharedLibrariesRW;
         } else if (strncmp(aPerms, "r--", 3) == 0) {
           *aProcessSizeKind = SharedLibrariesR;
         } else {
           *aProcessSizeKind = SharedLibrariesOther;
         }
 
       } else {
-        aName.Append("other-files/");
+        aName.AppendLiteral("other-files/");
         if (EndsWithLiteral(basename, ".xpi")) {
-          aName.Append("extensions/");
+          aName.AppendLiteral("extensions/");
         } else if (dirname.Find("/fontconfig") != -1) {
-          aName.Append("fontconfig/");
+          aName.AppendLiteral("fontconfig/");
         }
         *aProcessSizeKind = OtherFiles;
       }
 
       aName.Append(basename);
       aDesc.Append(absPath);
 
     } else {
-      aName.Append("anonymous/outside-brk");
-      aDesc.Append("Memory in anonymous mappings outside the boundaries "
-                   "defined by brk() / sbrk().");
+      aName.AppendLiteral("anonymous/outside-brk");
+      aDesc.AppendLiteral(
+        "Memory in anonymous mappings outside the boundaries defined by "
+        "brk() / sbrk().");
       *aProcessSizeKind = AnonymousOutsideBrk;
     }
 
-    aName.Append("/[");
+    aName.AppendLiteral("/[");
     aName.Append(aPerms);
     aName.Append("]");
 
     // Append the permissions.  This is useful for non-verbose mode in
     // about:memory when the filename is long and goes of the right side of the
     // window.
-    aDesc.Append(" [");
+    aDesc.AppendLiteral(" [");
     aDesc.Append(aPerms);
     aDesc.Append("]");
   }
 
   nsresult ParseMapBody(
     FILE* aFile,
     const nsACString& aProcessName,
     const nsACString& aName,
--- a/xpcom/glue/BlockingResourceBase.cpp
+++ b/xpcom/glue/BlockingResourceBase.cpp
@@ -111,21 +111,21 @@ BlockingResourceBase::CheckAcquire(const
         return;
 
     fputs("###!!! ERROR: Potential deadlock detected:\n", stderr);
     nsAutoCString out("Potential deadlock detected:\n");
     bool maybeImminent = PrintCycle(cycle, out);
 
     if (maybeImminent) {
         fputs("\n###!!! Deadlock may happen NOW!\n\n", stderr);
-        out.Append("\n###!!! Deadlock may happen NOW!\n\n");
+        out.AppendLiteral("\n###!!! Deadlock may happen NOW!\n\n");
     } else {
         fputs("\nDeadlock may happen for some other execution\n\n",
               stderr);
-        out.Append("\nDeadlock may happen for some other execution\n\n");
+        out.AppendLiteral("\nDeadlock may happen for some other execution\n\n");
     }
 
     // XXX can customize behavior on whether we /think/ deadlock is
     // XXX about to happen.  for example:
     // XXX   if (maybeImminent)
     //           NS_RUNTIMEABORT(out.get());
     NS_ERROR(out.get());
 }