Bug 869836 - Part 5: Use AssignLiteral instead of Assign where possible. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 22 May 2014 06:48:51 +0300
changeset 204657 441c66cbe3d7de1e15296924da54117f87926619
parent 204656 59c2ce52a920eff0ca75be2ea86c22e2746762c5
child 204658 ff4debbbbf4232817f2e4c2a6babd1e66bd1a2fc
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [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 5: Use AssignLiteral instead of Assign where possible. r=ehsan
browser/components/shell/src/nsGNOMEShellService.cpp
content/base/src/nsScriptLoader.cpp
content/html/content/src/HTMLInputElement.cpp
content/html/document/src/nsHTMLDocument.cpp
dom/base/nsJSEnvironment.cpp
dom/camera/GonkCameraManager.cpp
dom/indexedDB/ProfilerHelpers.h
dom/plugins/base/nsPluginHost.cpp
embedding/tests/winEmbed/WebBrowserChrome.cpp
extensions/gio/nsGIOProtocolHandler.cpp
extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
intl/locale/src/unix/nsDateTimeFormatUnix.cpp
js/jsd/jsd_xpc.cpp
js/xpconnect/src/Sandbox.cpp
netwerk/cache2/CacheFileIOManager.cpp
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
parser/html/nsHtml5MetaScannerCppSupplement.h
parser/html/nsHtml5Parser.cpp
parser/html/nsHtml5StreamParser.cpp
toolkit/components/satchel/nsFormFillController.cpp
xulrunner/app/nsXULRunnerApp.cpp
--- a/browser/components/shell/src/nsGNOMEShellService.cpp
+++ b/browser/components/shell/src/nsGNOMEShellService.cpp
@@ -403,25 +403,25 @@ nsGNOMEShellService::SetDesktopBackgroun
   if (!request) return rv;
   nsCOMPtr<imgIContainer> container;
   rv = request->GetImage(getter_AddRefs(container));
   if (!container) return rv;
 
   // Set desktop wallpaper filling style
   nsAutoCString options;
   if (aPosition == BACKGROUND_TILE)
-    options.Assign("wallpaper");
+    options.AssignLiteral("wallpaper");
   else if (aPosition == BACKGROUND_STRETCH)
-    options.Assign("stretched");
+    options.AssignLiteral("stretched");
   else if (aPosition == BACKGROUND_FILL)
-    options.Assign("zoom");
+    options.AssignLiteral("zoom");
   else if (aPosition == BACKGROUND_FIT)
-    options.Assign("scaled");
+    options.AssignLiteral("scaled");
   else
-    options.Assign("centered");
+    options.AssignLiteral("centered");
 
   // Write the background file to the home directory.
   nsAutoCString filePath(PR_GetEnv("HOME"));
 
   // get the product brand name from localized strings
   nsString brandName;
   nsCID bundleCID = NS_STRINGBUNDLESERVICE_CID;
   nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(bundleCID));
@@ -576,19 +576,19 @@ nsGNOMEShellService::SetDesktopBackgroun
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGNOMEShellService::OpenApplication(int32_t aApplication)
 {
   nsAutoCString scheme;
   if (aApplication == APPLICATION_MAIL)
-    scheme.Assign("mailto");
+    scheme.AssignLiteral("mailto");
   else if (aApplication == APPLICATION_NEWS)
-    scheme.Assign("news");
+    scheme.AssignLiteral("news");
   else
     return NS_ERROR_NOT_AVAILABLE;
 
   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
   if (giovfs) {
     nsCOMPtr<nsIGIOMimeApp> gioApp;
     giovfs->GetAppForURIScheme(scheme, getter_AddRefs(gioApp));
     if (gioApp)
--- a/content/base/src/nsScriptLoader.cpp
+++ b/content/base/src/nsScriptLoader.cpp
@@ -1287,31 +1287,31 @@ DetectByteOrderMark(const unsigned char*
   if (aLen < 2)
     return false;
 
   switch(aBytes[0]) {
   case 0xEF:
     if (aLen >= 3 && 0xBB == aBytes[1] && 0xBF == aBytes[2]) {
       // EF BB BF
       // Win2K UTF-8 BOM
-      oCharset.Assign("UTF-8");
+      oCharset.AssignLiteral("UTF-8");
     }
     break;
   case 0xFE:
     if (0xFF == aBytes[1]) {
       // FE FF
       // UTF-16, big-endian
-      oCharset.Assign("UTF-16BE");
+      oCharset.AssignLiteral("UTF-16BE");
     }
     break;
   case 0xFF:
     if (0xFE == aBytes[1]) {
       // FF FE
       // UTF-16, little-endian
-      oCharset.Assign("UTF-16LE");
+      oCharset.AssignLiteral("UTF-16LE");
     }
     break;
   }
   return !oCharset.IsEmpty();
 }
 
 /* static */ nsresult
 nsScriptLoader::ConvertToUTF16(nsIChannel* aChannel, const uint8_t* aData,
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -6728,26 +6728,26 @@ HTMLInputElement::GetValidationMessage(n
     }
     case VALIDITY_STATE_VALUE_MISSING:
     {
       nsXPIDLString message;
       nsAutoCString key;
       switch (mType)
       {
         case NS_FORM_INPUT_FILE:
-          key.Assign("FormValidationFileMissing");
+          key.AssignLiteral("FormValidationFileMissing");
           break;
         case NS_FORM_INPUT_CHECKBOX:
-          key.Assign("FormValidationCheckboxMissing");
+          key.AssignLiteral("FormValidationCheckboxMissing");
           break;
         case NS_FORM_INPUT_RADIO:
-          key.Assign("FormValidationRadioMissing");
+          key.AssignLiteral("FormValidationRadioMissing");
           break;
         default:
-          key.Assign("FormValidationValueMissing");
+          key.AssignLiteral("FormValidationValueMissing");
       }
       rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                               key.get(), message);
       aValidationMessage = message;
       break;
     }
     case VALIDITY_STATE_TYPE_MISMATCH:
     {
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -2981,20 +2981,20 @@ ConvertToMidasInternalCommandInner(const
                                    bool& outBooleanValue,
                                    bool aIgnoreParams)
 {
   NS_ConvertUTF16toUTF8 convertedCommandID(inCommandID);
 
   // Hack to support old boolean commands that were backwards (see bug 301490).
   bool invertBool = false;
   if (convertedCommandID.LowerCaseEqualsLiteral("usecss")) {
-    convertedCommandID.Assign("styleWithCSS");
+    convertedCommandID.AssignLiteral("styleWithCSS");
     invertBool = true;
   } else if (convertedCommandID.LowerCaseEqualsLiteral("readonly")) {
-    convertedCommandID.Assign("contentReadOnly");
+    convertedCommandID.AssignLiteral("contentReadOnly");
     invertBool = true;
   }
 
   uint32_t i;
   bool found = false;
   for (i = 0; i < MidasCommandCount; ++i) {
     if (convertedCommandID.Equals(gMidasCommandTable[i].incomingCommandString,
                                   nsCaseInsensitiveCStringComparator())) {
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -598,17 +598,17 @@ NS_ScriptErrorReporter(JSContext *cx,
                              report->errorNumber != JSMSG_OUT_OF_MEMORY));
     }
   }
 
   if (nsContentUtils::DOMWindowDumpEnabled()) {
     // Print it to stderr as well, for the benefit of those invoking
     // mozilla with -console.
     nsAutoCString error;
-    error.Assign("JavaScript ");
+    error.AssignLiteral("JavaScript ");
     if (JSREPORT_IS_STRICT(report->flags))
       error.Append("strict ");
     if (JSREPORT_IS_WARNING(report->flags))
       error.Append("warning: ");
     else
       error.Append("error: ");
     error.Append(report->filename);
     error.Append(", line ");
--- a/dom/camera/GonkCameraManager.cpp
+++ b/dom/camera/GonkCameraManager.cpp
@@ -49,25 +49,25 @@ ICameraControl::GetCameraName(uint32_t a
   int rv = android::Camera::getCameraInfo(deviceNum, &info);
   if (rv != 0) {
     DOM_CAMERA_LOGE("GetCameraName : get_camera_info(%d) failed: %d\n", deviceNum, rv);
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   switch (info.facing) {
     case CAMERA_FACING_BACK:
-      aDeviceName.Assign("back");
+      aDeviceName.AssignLiteral("back");
       break;
 
     case CAMERA_FACING_FRONT:
-      aDeviceName.Assign("front");
+      aDeviceName.AssignLiteral("front");
       break;
 
     default:
-      aDeviceName.Assign("extra-camera-");
+      aDeviceName.AssignLiteral("extra-camera-");
       aDeviceName.AppendInt(deviceNum);
       break;
   }
   return NS_OK;
 }
 
 nsresult
 ICameraControl::GetListOfCameras(nsTArray<nsString>& aList)
--- a/dom/indexedDB/ProfilerHelpers.h
+++ b/dom/indexedDB/ProfilerHelpers.h
@@ -113,17 +113,17 @@ public:
       }
     }
   }
 
   explicit
   ProfilerString(const Key& aKey)
   {
     if (aKey.IsUnset()) {
-      Assign("null");
+      AssignLiteral("null");
     }
     else if (aKey.IsFloat()) {
       AppendPrintf("%g", aKey.ToFloat());
     }
     else if (aKey.IsDate()) {
       AppendPrintf("<Date %g>", aKey.ToDateMsec());
     }
     else if (aKey.IsString()) {
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1410,17 +1410,17 @@ NS_IMETHODIMP
 nsPluginHost::RegisterPlayPreviewMimeType(const nsACString& mimeType,
                                           bool ignoreCTP,
                                           const nsACString& redirectURL)
 {
   nsAutoCString mt(mimeType);
   nsAutoCString url(redirectURL);
   if (url.Length() == 0) {
     // using default play preview iframe URL, if redirectURL is not specified
-    url.Assign("data:application/x-moz-playpreview;,");
+    url.AssignLiteral("data:application/x-moz-playpreview;,");
     url.Append(mimeType);
   }
 
   nsRefPtr<nsPluginPlayPreviewInfo> playPreview =
     new nsPluginPlayPreviewInfo(mt.get(), ignoreCTP, url.get());
   mPlayPreviewMimeTypes.AppendElement(playPreview);
   return NS_OK;
 }
--- a/embedding/tests/winEmbed/WebBrowserChrome.cpp
+++ b/embedding/tests/winEmbed/WebBrowserChrome.cpp
@@ -389,69 +389,69 @@ WebBrowserChrome::SendHistoryStatusMessa
     {
         aURI->GetSpec(uriSpec);
     }
 
     nsCString status;
 
     if(!(strcmp(operation, "back")))
     {
-        status.Assign("Going back to url: ");
+        status.AssignLiteral("Going back to url: ");
         status.Append(uriSpec);
     }
     else if (!(strcmp(operation, "forward")))
     {
         // Going forward. XXX Get string from a resource file
-        status.Assign("Going forward to url: ");
+        status.AssignLiteral("Going forward to url: ");
         status.Append(uriSpec);
     }
     else if (!(strcmp(operation, "reload")))
     {
         // Reloading. XXX Get string from a resource file
         if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY && 
             aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
         {
-            status.Assign("Reloading url, (bypassing proxy and cache): ");
+            status.AssignLiteral("Reloading url, (bypassing proxy and cache): ");
         }
         else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY)
         {
-            status.Assign("Reloading url, (bypassing proxy): ");
+            status.AssignLiteral("Reloading url, (bypassing proxy): ");
         }
         else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
         {
-            status.Assign("Reloading url, (bypassing cache): ");
+            status.AssignLiteral("Reloading url, (bypassing cache): ");
         }
         else
         {
-            status.Assign("Reloading url, (normal): ");
+            status.AssignLiteral("Reloading url, (normal): ");
         }
         status.Append(uriSpec);
     }
     else if (!(strcmp(operation, "add")))
     {
         status.Assign(uriSpec);
         status.Append(" added to session History");
     }
     else if (!(strcmp(operation, "goto")))
     {
-        status.Assign("Going to HistoryIndex: ");
+        status.AssignLiteral("Going to HistoryIndex: ");
 
 	AppendIntToCString(info1, status);
 
         status.Append(" Url: ");
         status.Append(uriSpec);
     }
     else if (!(strcmp(operation, "purge")))
     {
         AppendIntToCString(info1, status);
         status.Append(" purged from Session History");
     }
     else if (!(strcmp(operation, "replace")))
     {
-        status.Assign("Replacing HistoryIndex: ");
+        status.AssignLiteral("Replacing HistoryIndex: ");
         AppendIntToCString(info1, status);
     }
 
     nsString wstatus;
     NS_CStringToUTF16(status, NS_CSTRING_ENCODING_UTF8, wstatus);
     WebBrowserChromeUI::UpdateStatusBarText(this, wstatus.get());
 
     return NS_OK;
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -468,17 +468,17 @@ nsGIOInputStream::DoRead(char *aBuf, uin
         const char * fname = g_file_info_get_name(info);
         if (fname && fname[0] == '.' && 
             (fname[1] == '\0' || (fname[1] == '.' && fname[2] == '\0')))
         {
           mDirListPtr = mDirListPtr->next;
           continue;
         }
 
-        mDirBuf.Assign("201: ");
+        mDirBuf.AssignLiteral("201: ");
 
         // The "filename" field
         nsCString escName;
         nsCOMPtr<nsINetUtil> nu = do_GetService(NS_NETUTIL_CONTRACTID);
         if (nu && fname) {
           nu->EscapeString(nsDependentCString(fname),
                            nsINetUtil::ESCAPE_URL_PATH, escName);
 
@@ -927,17 +927,17 @@ nsGIOProtocolHandler::InitSupportedProto
   // protocols so far.
   nsresult rv = prefs->GetCharPref(MOZ_GIO_SUPPORTED_PROTOCOLS,
                                    getter_Copies(mSupportedProtocols));
   if (NS_SUCCEEDED(rv)) {
     mSupportedProtocols.StripWhitespace();
     ToLowerCase(mSupportedProtocols);
   }
   else
-    mSupportedProtocols.Assign("smb:,sftp:"); // use defaults
+    mSupportedProtocols.AssignLiteral("smb:,sftp:"); // use defaults
 
   LOG(("gio: supported protocols \"%s\"\n", mSupportedProtocols.get()));
 }
 
 bool
 nsGIOProtocolHandler::IsSupportedProtocol(const nsCString &aSpec)
 {
   const char *specString = aSpec.get();
--- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
+++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
@@ -517,17 +517,17 @@ nsGnomeVFSInputStream::DoRead(char *aBuf
         if (info->name[0] == '.' &&
                (info->name[1] == '\0' ||
                    (info->name[1] == '.' && info->name[2] == '\0')))
         {
           mDirListPtr = mDirListPtr->next;
           continue;
         }
 
-        mDirBuf.Assign("201: ");
+        mDirBuf.AssignLiteral("201: ");
 
         // The "filename" field
         nsCString escName;
         nsCOMPtr<nsINetUtil> nu = do_GetService(NS_NETUTIL_CONTRACTID);
         if (nu) {
           nu->EscapeString(nsDependentCString(info->name),
                            nsINetUtil::ESCAPE_URL_PATH, escName);
 
@@ -789,17 +789,17 @@ nsGnomeVFSProtocolHandler::InitSupported
   // read preferences
   nsresult rv = prefs->GetCharPref(MOZ_GNOMEVFS_SUPPORTED_PROTOCOLS,
                                    getter_Copies(mSupportedProtocols));
   if (NS_SUCCEEDED(rv)) {
     mSupportedProtocols.StripWhitespace();
     ToLowerCase(mSupportedProtocols);
   }
   else
-    mSupportedProtocols.Assign("smb:,sftp:"); // use defaults
+    mSupportedProtocols.AssignLiteral("smb:,sftp:"); // use defaults
 
   LOG(("gnomevfs: supported protocols \"%s\"\n", mSupportedProtocols.get()));
 }
 
 bool
 nsGnomeVFSProtocolHandler::IsSupportedProtocol(const nsCString &aSpec)
 {
   const char *specString = aSpec.get();
--- a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp
+++ b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp
@@ -41,17 +41,17 @@ nsresult nsDateTimeFormatUnix::Initializ
           mLocale.Equals(localeStr,
                          nsCaseInsensitiveStringComparator())) {
         return NS_OK;
       }
     }
   }
 
   mCharset.AssignLiteral("windows-1252");
-  mPlatformLocale.Assign("en_US");
+  mPlatformLocale.AssignLiteral("en_US");
 
   // get locale name string, use app default if no locale specified
   if (!locale) {
     nsCOMPtr<nsILocaleService> localeService = 
              do_GetService(NS_LOCALESERVICE_CONTRACTID, &res);
     if (NS_SUCCEEDED(res)) {
       nsCOMPtr<nsILocale> appLocale;
       res = localeService->GetApplicationLocale(getter_AddRefs(appLocale));
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -1906,17 +1906,17 @@ jsdStackFrame::GetExecutionContext(jsdIC
 NS_IMETHODIMP
 jsdStackFrame::GetFunctionName(nsACString &_rval)
 {
     ASSERT_VALID_EPHEMERAL;
     JSString *str = JSD_GetIdForStackFrame(mCx, mThreadState, mStackFrameInfo);
     if (str)
         return AssignToJSString(mCx, &_rval, str);
     
-    _rval.Assign("anonymous");
+    _rval.AssignLiteral("anonymous");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 jsdStackFrame::GetIsDebugger(bool *_rval)
 {
     ASSERT_VALID_EPHEMERAL;
     *_rval = JSD_IsStackFrameDebugger (mCx, mThreadState, mStackFrameInfo);
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -502,17 +502,17 @@ EvalInWindow(JSContext *cx, const nsAStr
         JS_ReportError(cx, "Script context needed");
         return false;
     }
 
     nsCString filename;
     unsigned lineNo;
     if (!GetFilenameAndLineNumber(cx, filename, lineNo)) {
         // Default values for non-scripted callers.
-        filename.Assign("Unknown");
+        filename.AssignLiteral("Unknown");
         lineNo = 0;
     }
 
     RootedObject cxGlobal(cx, JS::CurrentGlobalOrNull(cx));
     {
         // CompileOptions must be created from the context
         // we will execute this script in.
         JSContext *wndCx = context->GetNativeContext();
--- a/netwerk/cache2/CacheFileIOManager.cpp
+++ b/netwerk/cache2/CacheFileIOManager.cpp
@@ -3293,17 +3293,17 @@ CacheFileIOManager::CreateFile(CacheFile
   aHandle->mFileSize = 0;
   return NS_OK;
 }
 
 // static
 void
 CacheFileIOManager::HashToStr(const SHA1Sum::Hash *aHash, nsACString &_retval)
 {
-  _retval.Assign("");
+  _retval.AssignLiteral("");
   const char hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7',
                            '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
   for (uint32_t i=0 ; i<sizeof(SHA1Sum::Hash) ; i++) {
     _retval.Append(hexChars[(*aHash)[i] >> 4]);
     _retval.Append(hexChars[(*aHash)[i] & 0xF]);
   }
 }
 
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -1595,17 +1595,17 @@ WebSocketChannel::ApplyMask(uint32_t mas
     len--;
   }
 }
 
 void
 WebSocketChannel::GeneratePing()
 {
   nsCString *buf = new nsCString();
-  buf->Assign("PING");
+  buf->AssignLiteral("PING");
   EnqueueOutgoingMessage(mOutgoingPingMessages,
                          new OutboundMessage(kMsgTypePing, buf));
 }
 
 void
 WebSocketChannel::GeneratePong(uint8_t *payload, uint32_t len)
 {
   nsCString *buf = new nsCString();
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
@@ -508,17 +508,17 @@ WyciwygChannelChild::SetContentType(cons
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /* attribute ACString contentCharset; */
 NS_IMETHODIMP
 WyciwygChannelChild::GetContentCharset(nsACString & aContentCharset)
 {
-  aContentCharset.Assign("UTF-16");
+  aContentCharset.AssignLiteral("UTF-16");
   return NS_OK;
 }
 NS_IMETHODIMP
 WyciwygChannelChild::SetContentCharset(const nsACString & aContentCharset)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
@@ -331,17 +331,17 @@ NS_IMETHODIMP
 nsWyciwygChannel::SetContentType(const nsACString &aContentType)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsWyciwygChannel::GetContentCharset(nsACString &aContentCharset)
 {
-  aContentCharset.Assign("UTF-16");
+  aContentCharset.AssignLiteral("UTF-16");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWyciwygChannel::SetContentCharset(const nsACString &aContentCharset)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/parser/html/nsHtml5MetaScannerCppSupplement.h
+++ b/parser/html/nsHtml5MetaScannerCppSupplement.h
@@ -27,19 +27,19 @@ nsHtml5MetaScanner::tryCharset(nsString*
   nsAutoCString label;
   CopyUTF16toUTF8(*charset, label);
   nsAutoCString encoding;
   if (!EncodingUtils::FindEncodingForLabel(label, encoding)) {
     return false;
   }
   if (encoding.EqualsLiteral("UTF-16BE") ||
       encoding.EqualsLiteral("UTF-16LE")) {
-    mCharset.Assign("UTF-8");
+    mCharset.AssignLiteral("UTF-8");
     return true;
   }
   if (encoding.EqualsLiteral("x-user-defined")) {
     // WebKit/Blink hack for Indian and Armenian legacy sites
-    mCharset.Assign("windows-1252");
+    mCharset.AssignLiteral("windows-1252");
     return true;
   }
   mCharset.Assign(encoding);
   return true;
 }
--- a/parser/html/nsHtml5Parser.cpp
+++ b/parser/html/nsHtml5Parser.cpp
@@ -65,17 +65,17 @@ NS_IMETHODIMP_(nsIContentSink*)
 nsHtml5Parser::GetContentSink()
 {
   return static_cast<nsIContentSink*> (mExecutor);
 }
 
 NS_IMETHODIMP_(void)
 nsHtml5Parser::GetCommand(nsCString& aCommand)
 {
-  aCommand.Assign("view");
+  aCommand.AssignLiteral("view");
 }
 
 NS_IMETHODIMP_(void)
 nsHtml5Parser::SetCommand(const char* aCommand)
 {
   NS_ASSERTION(!strcmp(aCommand, "view") ||
                !strcmp(aCommand, "view-source") ||
                !strcmp(aCommand, "external-resource") ||
--- a/parser/html/nsHtml5StreamParser.cpp
+++ b/parser/html/nsHtml5StreamParser.cpp
@@ -368,19 +368,19 @@ nsHtml5StreamParser::SniffBOMlessUTF16Ba
           return;
         }
         byteZero[(i + j) % 2] = true;
       }
     }
   }
 
   if (byteNonZero[0]) {
-    mCharset.Assign("UTF-16LE");
+    mCharset.AssignLiteral("UTF-16LE");
   } else {
-    mCharset.Assign("UTF-16BE");
+    mCharset.AssignLiteral("UTF-16BE");
   }
   mCharsetSource = kCharsetFromIrreversibleAutoDetection;
   mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource);
   mFeedChardet = false;
   mTreeBuilder->MaybeComplainAboutCharset("EncBomlessUtf16",
                                           true,
                                           0);
 
@@ -1196,25 +1196,25 @@ nsHtml5StreamParser::PreferredForInterna
     return false;
   }
 
   if (newEncoding.EqualsLiteral("UTF-16BE") ||
       newEncoding.EqualsLiteral("UTF-16LE")) {
     mTreeBuilder->MaybeComplainAboutCharset("EncMetaUtf16",
                                             true,
                                             mTokenizer->getLineNumber());
-    newEncoding.Assign("UTF-8");
+    newEncoding.AssignLiteral("UTF-8");
   }
 
   if (newEncoding.EqualsLiteral("x-user-defined")) {
     // WebKit/Blink hack for Indian and Armenian legacy sites
     mTreeBuilder->MaybeComplainAboutCharset("EncMetaUserDefined",
                                             true,
                                             mTokenizer->getLineNumber());
-    newEncoding.Assign("windows-1252");
+    newEncoding.AssignLiteral("windows-1252");
   }
 
   if (newEncoding.Equals(mCharset)) {
     if (mCharsetSource < kCharsetFromMetaPrescan) {
       if (mInitialEncodingWasFromParentFrame) {
         mTreeBuilder->MaybeComplainAboutCharset("EncLateMetaFrame",
                                                 false,
                                                 mTokenizer->getLineNumber());
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -461,17 +461,17 @@ nsFormFillController::GetSearchCount(uin
 {
   *aSearchCount = 1;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFormFillController::GetSearchAt(uint32_t index, nsACString & _retval)
 {
-  _retval.Assign("form-history");
+  _retval.AssignLiteral("form-history");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFormFillController::GetTextValue(nsAString & aTextValue)
 {
   if (mFocusedInput) {
     mFocusedInput->GetValue(aTextValue);
--- a/xulrunner/app/nsXULRunnerApp.cpp
+++ b/xulrunner/app/nsXULRunnerApp.cpp
@@ -87,19 +87,19 @@ static bool IsArg(const char* arg, const
 }
 
 static nsresult
 GetGREVersion(const char *argv0,
               nsACString *aMilestone,
               nsACString *aVersion)
 {
   if (aMilestone)
-    aMilestone->Assign("<Error>");
+    aMilestone->AssignLiteral("<Error>");
   if (aVersion)
-    aVersion->Assign("<Error>");
+    aVersion->AssignLiteral("<Error>");
 
   nsCOMPtr<nsIFile> iniFile;
   nsresult rv = BinaryPath::GetFile(argv0, getter_AddRefs(iniFile));
   if (NS_FAILED(rv))
     return rv;
 
   iniFile->SetNativeLeafName(NS_LITERAL_CSTRING("platform.ini"));