Bug 1380227 - Avoid many UTF16toUTF8 and UTF8toUTF16 conversions in nsStringBundle. r=emk.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 12 Jul 2017 15:13:37 +1000
changeset 368809 129793760f2d718ed61ba17d9aacd57c7ec6785b
parent 368808 770646a7519a830aa6a6703698985850987227b2
child 368810 010ba1c14577521798596bcdfca470f0a7d894f6
push id32173
push userryanvm@gmail.com
push dateFri, 14 Jul 2017 12:35:16 +0000
treeherdermozilla-central@66e27c932aae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk
bugs1380227
milestone56.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 1380227 - Avoid many UTF16toUTF8 and UTF8toUTF16 conversions in nsStringBundle. r=emk. Most of the names passed to nsIStringBundle::{Get,Format}StringFromUTF8Name have one of the two following forms: - a 16-bit C string literal, which is then converted to an 8-bit string in order for the lookup to occur; - an 8-bit C string literal converted to a 16-bit string, which is then converted back to an 8-bit string in order for the lookup to occur. This patch introduces and uses alternative methods that can take an 8-bit C string literal, which requires changing some signatures in other methods and functions. It replaces all C++ uses of the old methods. The patch also changes the existing {Get,Format}StringFromName() methods so they take an AUTF8String argument for the name instead of a wstring, because that's nicer for JS code. Even though there is a method for C++ code and a different one for JS code, |binaryname| is used so that the existing method names can be used for the common case in both languages. The change reduces the number of NS_ConvertUTF8toUTF16 and NS_ConvertUTF16toUTF8 conversions while running Speedometer v2 from ~270,000 to ~160,000. (Most of these conversions involved the string "deprecatedReferrerDirective" in nsCSPParser.cpp.)
accessible/generic/Accessible.cpp
accessible/generic/ApplicationAccessible.cpp
browser/components/shell/nsGNOMEShellService.cpp
browser/components/shell/nsWindowsShellService.cpp
caps/BasePrincipal.cpp
caps/nsScriptSecurityManager.cpp
caps/nsScriptSecurityManager.h
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
dom/base/EventSource.cpp
dom/base/WebSocket.cpp
dom/base/nsContentUtils.cpp
dom/base/nsDataDocumentContentPolicy.cpp
dom/html/HTMLFormElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/ImageDocument.cpp
dom/html/MediaDocument.cpp
dom/html/nsHTMLDocument.cpp
dom/media/CubebUtils.cpp
dom/security/FramingChecker.cpp
dom/security/nsCSPContext.cpp
dom/security/nsCSPContext.h
dom/security/nsCSPParser.cpp
dom/security/nsCSPUtils.cpp
dom/security/nsCSPUtils.h
dom/security/nsMixedContentBlocker.cpp
dom/webbrowserpersist/nsWebBrowserPersist.cpp
dom/xslt/xslt/txMozillaXSLTProcessor.cpp
extensions/pref/autoconfig/src/nsAutoConfig.cpp
extensions/pref/autoconfig/src/nsReadConfig.cpp
intl/strres/nsIStringBundle.idl
intl/strres/nsStringBundle.cpp
intl/strres/nsStringBundle.h
intl/unicharutil/nsEntityConverter.cpp
layout/printing/nsPrintData.cpp
layout/style/ErrorReporter.cpp
layout/xul/nsMenuFrame.cpp
modules/libpref/nsPrefBranch.cpp
netwerk/base/nsNetUtil.cpp
netwerk/protocol/ftp/nsFtpConnectionThread.cpp
netwerk/protocol/gio/nsGIOProtocolHandler.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
netwerk/protocol/http/nsHttpChannelAuthProvider.h
netwerk/streamconv/converters/nsIndexedToHTML.cpp
parser/html/nsHtml5PlainTextUtils.cpp
parser/htmlparser/nsParserMsgUtils.cpp
security/manager/pki/nsNSSDialogs.cpp
security/manager/ssl/NSSErrorsService.cpp
security/manager/ssl/nsNSSCertHelper.cpp
security/manager/ssl/nsNSSComponent.cpp
toolkit/components/downloads/nsDownloadManager.cpp
toolkit/components/places/Database.cpp
toolkit/components/places/nsNavHistory.cpp
toolkit/components/places/nsNavHistory.h
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/printingui/win/nsPrintDialogUtil.cpp
toolkit/mozapps/extensions/AddonContentPolicy.cpp
toolkit/system/gnome/nsAlertsIconListener.cpp
toolkit/xre/ProfileReset.cpp
toolkit/xre/nsAppRunner.cpp
uriloader/exthandler/nsExternalHelperAppService.cpp
widget/cocoa/OSXNotificationCenter.mm
widget/cocoa/nsFilePicker.mm
widget/cocoa/nsMenuBarX.mm
widget/cocoa/nsPrintDialogX.mm
widget/gtk/nsPrintDialogGTK.cpp
widget/gtk/nsSound.cpp
widget/gtk/nsWindow.cpp
widget/nsBaseFilePicker.cpp
widget/windows/AudioSession.cpp
widget/windows/nsDataObj.cpp
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -313,17 +313,19 @@ Accessible::TranslateString(const nsStri
   nsCOMPtr<nsIStringBundle> stringBundle;
   stringBundleService->CreateBundle(
     "chrome://global-platform/locale/accessible.properties",
     getter_AddRefs(stringBundle));
   if (!stringBundle)
     return;
 
   nsXPIDLString xsValue;
-  nsresult rv = stringBundle->GetStringFromName(aKey.get(), getter_Copies(xsValue));
+  nsresult rv =
+    stringBundle->GetStringFromName(NS_ConvertUTF16toUTF8(aKey).get(),
+                                    getter_Copies(xsValue));
   if (NS_SUCCEEDED(rv))
     aStringOut.Assign(xsValue);
 }
 
 uint64_t
 Accessible::VisibilityState()
 {
   nsIFrame* frame = GetFrame();
@@ -2828,46 +2830,46 @@ KeyBinding::ToPlatformFormat(nsAString& 
     stringBundleService->CreateBundle(
       "chrome://global-platform/locale/platformKeys.properties",
       getter_AddRefs(keyStringBundle));
 
   if (!keyStringBundle)
     return;
 
   nsAutoString separator;
-  keyStringBundle->GetStringFromName(u"MODIFIER_SEPARATOR",
+  keyStringBundle->GetStringFromName("MODIFIER_SEPARATOR",
                                      getter_Copies(separator));
 
   nsAutoString modifierName;
   if (mModifierMask & kControl) {
-    keyStringBundle->GetStringFromName(u"VK_CONTROL",
+    keyStringBundle->GetStringFromName("VK_CONTROL",
                                        getter_Copies(modifierName));
 
     aValue.Append(modifierName);
     aValue.Append(separator);
   }
 
   if (mModifierMask & kAlt) {
-    keyStringBundle->GetStringFromName(u"VK_ALT",
+    keyStringBundle->GetStringFromName("VK_ALT",
                                        getter_Copies(modifierName));
 
     aValue.Append(modifierName);
     aValue.Append(separator);
   }
 
   if (mModifierMask & kShift) {
-    keyStringBundle->GetStringFromName(u"VK_SHIFT",
+    keyStringBundle->GetStringFromName("VK_SHIFT",
                                        getter_Copies(modifierName));
 
     aValue.Append(modifierName);
     aValue.Append(separator);
   }
 
   if (mModifierMask & kMeta) {
-    keyStringBundle->GetStringFromName(u"VK_META",
+    keyStringBundle->GetStringFromName("VK_META",
                                        getter_Copies(modifierName));
 
     aValue.Append(modifierName);
     aValue.Append(separator);
   }
 
   aValue.Append(mKey);
 }
--- a/accessible/generic/ApplicationAccessible.cpp
+++ b/accessible/generic/ApplicationAccessible.cpp
@@ -49,18 +49,17 @@ ApplicationAccessible::Name(nsString& aN
 
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv = bundleService->CreateBundle("chrome://branding/locale/brand.properties",
                                             getter_AddRefs(bundle));
   if (NS_FAILED(rv))
     return eNameOK;
 
   nsXPIDLString appName;
-  rv = bundle->GetStringFromName(u"brandShortName",
-                                 getter_Copies(appName));
+  rv = bundle->GetStringFromName("brandShortName", getter_Copies(appName));
   if (NS_FAILED(rv) || appName.IsEmpty()) {
     NS_WARNING("brandShortName not found, using default app name");
     appName.AssignLiteral("Gecko based application");
   }
 
   aName.Assign(appName);
   return eNameOK;
 }
--- a/browser/components/shell/nsGNOMEShellService.cpp
+++ b/browser/components/shell/nsGNOMEShellService.cpp
@@ -284,17 +284,17 @@ nsGNOMEShellService::SetDefaultBrowser(b
       do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIStringBundle> brandBundle;
     rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsString brandShortName;
-    brandBundle->GetStringFromName(u"brandShortName",
+    brandBundle->GetStringFromName("brandShortName",
                                    getter_Copies(brandShortName));
 
     // use brandShortName as the application id.
     NS_ConvertUTF16toUTF8 id(brandShortName);
     nsCOMPtr<nsIGIOMimeApp> appInfo;
     rv = giovfs->CreateAppFromCommand(mAppPath,
                                       id,
                                       getter_AddRefs(appInfo));
@@ -402,17 +402,17 @@ nsGNOMEShellService::SetDesktopBackgroun
   nsString brandName;
   nsCID bundleCID = NS_STRINGBUNDLESERVICE_CID;
   nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(bundleCID));
   if (bundleService) {
     nsCOMPtr<nsIStringBundle> brandBundle;
     rv = bundleService->CreateBundle(BRAND_PROPERTIES,
                                      getter_AddRefs(brandBundle));
     if (NS_SUCCEEDED(rv) && brandBundle) {
-      rv = brandBundle->GetStringFromName(u"brandShortName",
+      rv = brandBundle->GetStringFromName("brandShortName",
                                           getter_Copies(brandName));
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
   // build the file name
   filePath.Append('/');
   filePath.Append(NS_ConvertUTF16toUTF8(brandName));
--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -611,17 +611,17 @@ nsWindowsShellService::SetDesktopBackgro
   nsCOMPtr<nsIStringBundle> shellBundle;
   rv = bundleService->CreateBundle(SHELLSERVICE_PROPERTIES,
                                    getter_AddRefs(shellBundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // e.g. "Desktop Background.bmp"
   nsString fileLeafName;
   rv = shellBundle->GetStringFromName
-                      (u"desktopBackgroundLeafNameWin",
+                      ("desktopBackgroundLeafNameWin",
                        getter_Copies(fileLeafName));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // get the profile root directory
   nsCOMPtr<nsIFile> file;
   rv = NS_GetSpecialDirectory(NS_APP_APPLICATION_REGISTRY_DIR,
                               getter_AddRefs(file));
   NS_ENSURE_SUCCESS(rv, rv);
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -155,17 +155,18 @@ BasePrincipal::CheckMayLoad(nsIURI* aURI
   if (NS_SUCCEEDED(rv) && fetchableByAnyone) {
     return NS_OK;
   }
 
   if (aReport) {
     nsCOMPtr<nsIURI> prinURI;
     rv = GetURI(getter_AddRefs(prinURI));
     if (NS_SUCCEEDED(rv) && prinURI) {
-      nsScriptSecurityManager::ReportError(nullptr, NS_LITERAL_STRING("CheckSameOriginError"), prinURI, aURI);
+      nsScriptSecurityManager::ReportError(nullptr, "CheckSameOriginError",
+                                           prinURI, aURI);
     }
   }
 
   return NS_ERROR_DOM_BAD_URI;
 }
 
 NS_IMETHODIMP
 BasePrincipal::GetCsp(nsIContentSecurityPolicy** aCsp)
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -506,18 +506,18 @@ nsScriptSecurityManager::JSPrincipalsSub
 NS_IMETHODIMP
 nsScriptSecurityManager::CheckSameOriginURI(nsIURI* aSourceURI,
                                             nsIURI* aTargetURI,
                                             bool reportError)
 {
     if (!SecurityCompareURIs(aSourceURI, aTargetURI))
     {
          if (reportError) {
-            ReportError(nullptr, NS_LITERAL_STRING("CheckSameOriginError"),
-                     aSourceURI, aTargetURI);
+            ReportError(nullptr, "CheckSameOriginError",
+                        aSourceURI, aTargetURI);
          }
          return NS_ERROR_DOM_BAD_URI;
     }
     return NS_OK;
 }
 
 /*static*/ uint32_t
 nsScriptSecurityManager::HashPrincipalByOrigin(nsIPrincipal* aPrincipal)
@@ -844,17 +844,17 @@ nsScriptSecurityManager::CheckLoadURIFla
                                            nsIURI *aTargetURI,
                                            nsIURI *aSourceBaseURI,
                                            nsIURI *aTargetBaseURI,
                                            uint32_t aFlags)
 {
     // Note that the order of policy checks here is very important!
     // We start from most restrictive and work our way down.
     bool reportErrors = !(aFlags & nsIScriptSecurityManager::DONT_REPORT_ERRORS);
-    NS_NAMED_LITERAL_STRING(errorTag, "CheckLoadURIError");
+    const char* errorTag = "CheckLoadURIError";
 
     nsAutoCString targetScheme;
     nsresult rv = aTargetBaseURI->GetScheme(targetScheme);
     if (NS_FAILED(rv)) return rv;
 
     // Check for system target URI
     rv = DenyAccessIfURIHasFlags(aTargetURI,
                                  nsIProtocolHandler::URI_DANGEROUS_TO_LOAD);
@@ -976,34 +976,34 @@ nsScriptSecurityManager::CheckLoadURIFla
                              nsIProtocolHandler::URI_LOADABLE_BY_SUBSUMERS,
                              &hasSubsumersFlag);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!hasFlags && !hasSubsumersFlag) {
         nsXPIDLString message;
         NS_ConvertASCIItoUTF16 ucsTargetScheme(targetScheme);
         const char16_t* formatStrings[] = { ucsTargetScheme.get() };
         rv = sStrBundle->
-            FormatStringFromName(u"ProtocolFlagError",
+            FormatStringFromName("ProtocolFlagError",
                                  formatStrings,
                                  ArrayLength(formatStrings),
                                  getter_Copies(message));
         if (NS_SUCCEEDED(rv)) {
             nsCOMPtr<nsIConsoleService> console(
               do_GetService("@mozilla.org/consoleservice;1"));
             NS_ENSURE_TRUE(console, NS_ERROR_FAILURE);
 
             console->LogStringMessage(message.get());
         }
     }
 
     return NS_OK;
 }
 
 nsresult
-nsScriptSecurityManager::ReportError(JSContext* cx, const nsAString& messageTag,
+nsScriptSecurityManager::ReportError(JSContext* cx, const char* aMessageTag,
                                      nsIURI* aSource, nsIURI* aTarget)
 {
     nsresult rv;
     NS_ENSURE_TRUE(aSource && aTarget, NS_ERROR_NULL_POINTER);
 
     // Get the source URL spec
     nsAutoCString sourceSpec;
     rv = aSource->GetAsciiSpec(sourceSpec);
@@ -1014,17 +1014,17 @@ nsScriptSecurityManager::ReportError(JSC
     rv = aTarget->GetAsciiSpec(targetSpec);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Localize the error message
     nsXPIDLString message;
     NS_ConvertASCIItoUTF16 ucsSourceSpec(sourceSpec);
     NS_ConvertASCIItoUTF16 ucsTargetSpec(targetSpec);
     const char16_t *formatStrings[] = { ucsSourceSpec.get(), ucsTargetSpec.get() };
-    rv = sStrBundle->FormatStringFromName(PromiseFlatString(messageTag).get(),
+    rv = sStrBundle->FormatStringFromName(aMessageTag,
                                           formatStrings,
                                           ArrayLength(formatStrings),
                                           getter_Copies(message));
     NS_ENSURE_SUCCESS(rv, rv);
 
     // If a JS context was passed in, set a JS exception.
     // Otherwise, print the error message directly to the JS console
     // and to standard output
@@ -1231,37 +1231,37 @@ nsScriptSecurityManager::CanCreateWrappe
 
       nsCOMPtr<nsITreeSelection> treeSelection = do_QueryInterface(aObj);
       if (treeSelection) {
         return NS_OK;
       }
     }
 
     //-- Access denied, report an error
-    NS_ConvertUTF8toUTF16 strName("CreateWrapperDenied");
     nsAutoCString origin;
     nsIPrincipal* subjectPrincipal = nsContentUtils::SubjectPrincipal();
     GetPrincipalDomainOrigin(subjectPrincipal, origin);
     NS_ConvertUTF8toUTF16 originUnicode(origin);
     NS_ConvertUTF8toUTF16 classInfoName(objClassInfo.GetName());
-    const char16_t* formatStrings[] = {
-        classInfoName.get(),
-        originUnicode.get()
-    };
-    uint32_t length = ArrayLength(formatStrings);
+    nsresult rv;
+    nsXPIDLString errorMsg;
     if (originUnicode.IsEmpty()) {
-        --length;
+        const char16_t* formatStrings[] = { classInfoName.get() };
+        rv = sStrBundle->FormatStringFromName("CreateWrapperDenied",
+                                              formatStrings,
+                                              1,
+                                              getter_Copies(errorMsg));
     } else {
-        strName.AppendLiteral("ForOrigin");
+        const char16_t* formatStrings[] = { classInfoName.get(),
+                                            originUnicode.get() };
+        rv = sStrBundle->FormatStringFromName("CreateWrapperDeniedForOrigin",
+                                              formatStrings,
+                                              2,
+                                              getter_Copies(errorMsg));
     }
-    nsXPIDLString errorMsg;
-    nsresult rv = sStrBundle->FormatStringFromName(strName.get(),
-                                                   formatStrings,
-                                                   length,
-                                                   getter_Copies(errorMsg));
     NS_ENSURE_SUCCESS(rv, rv);
 
     SetPendingException(cx, errorMsg.get());
     return NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED;
 }
 
 NS_IMETHODIMP
 nsScriptSecurityManager::CanCreateInstance(JSContext *cx,
--- a/caps/nsScriptSecurityManager.h
+++ b/caps/nsScriptSecurityManager.h
@@ -63,17 +63,17 @@ public:
      * are equivalent if their schemes, hosts, and ports (if any) match.  This
      * method returns true if aSubjectURI and aObjectURI have the same origin,
      * false otherwise.
      */
     static bool SecurityCompareURIs(nsIURI* aSourceURI, nsIURI* aTargetURI);
     static uint32_t SecurityHashURI(nsIURI* aURI);
 
     static nsresult
-    ReportError(JSContext* cx, const nsAString& messageTag,
+    ReportError(JSContext* cx, const char* aMessageTag,
                 nsIURI* aSource, nsIURI* aTarget);
 
     static uint32_t
     HashPrincipalByOrigin(nsIPrincipal* aPrincipal);
 
     static bool
     GetStrictFileOriginPolicy()
     {
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4918,17 +4918,17 @@ nsDocShell::DisplayLoadError(nsresult aE
   nsCOMPtr<nsIPrompt> prompter;
   nsCOMPtr<nsIStringBundle> stringBundle;
   GetPromptAndStringBundle(getter_AddRefs(prompter),
                            getter_AddRefs(stringBundle));
 
   NS_ENSURE_TRUE(stringBundle, NS_ERROR_FAILURE);
   NS_ENSURE_TRUE(prompter, NS_ERROR_FAILURE);
 
-  nsAutoString error;
+  const char* error = nullptr;
   const uint32_t kMaxFormatStrArgs = 3;
   nsAutoString formatStrs[kMaxFormatStrArgs];
   uint32_t formatStrCount = 0;
   bool addHostPort = false;
   nsresult rv = NS_OK;
   nsAutoString messageStr;
   nsAutoCString cssClass;
   nsAutoCString errorPage;
@@ -4951,53 +4951,53 @@ nsDocShell::DisplayLoadError(nsresult aE
       if (NS_SUCCEEDED(rv2) && tempURI) {
         tempURI->GetScheme(scheme);
         formatStrs[0].AppendLiteral(", ");
         AppendASCIItoUTF16(scheme, formatStrs[0]);
       }
       nestedURI = do_QueryInterface(tempURI);
     }
     formatStrCount = 1;
-    error.AssignLiteral("unknownProtocolFound");
+    error = "unknownProtocolFound";
   } else if (NS_ERROR_FILE_NOT_FOUND == aError) {
     NS_ENSURE_ARG_POINTER(aURI);
-    error.AssignLiteral("fileNotFound");
+    error = "fileNotFound";
   } else if (NS_ERROR_FILE_ACCESS_DENIED == aError) {
     NS_ENSURE_ARG_POINTER(aURI);
-    error.AssignLiteral("fileAccessDenied");
+    error = "fileAccessDenied";
   } else if (NS_ERROR_UNKNOWN_HOST == aError) {
     NS_ENSURE_ARG_POINTER(aURI);
     // Get the host
     nsAutoCString host;
     nsCOMPtr<nsIURI> innermostURI = NS_GetInnermostURI(aURI);
     innermostURI->GetHost(host);
     CopyUTF8toUTF16(host, formatStrs[0]);
     formatStrCount = 1;
-    error.AssignLiteral("dnsNotFound");
+    error = "dnsNotFound";
   } else if (NS_ERROR_CONNECTION_REFUSED == aError) {
     NS_ENSURE_ARG_POINTER(aURI);
     addHostPort = true;
-    error.AssignLiteral("connectionFailure");
+    error = "connectionFailure";
   } else if (NS_ERROR_NET_INTERRUPT == aError) {
     NS_ENSURE_ARG_POINTER(aURI);
     addHostPort = true;
-    error.AssignLiteral("netInterrupt");
+    error = "netInterrupt";
   } else if (NS_ERROR_NET_TIMEOUT == aError) {
     NS_ENSURE_ARG_POINTER(aURI);
     // Get the host
     nsAutoCString host;
     aURI->GetHost(host);
     CopyUTF8toUTF16(host, formatStrs[0]);
     formatStrCount = 1;
-    error.AssignLiteral("netTimeout");
+    error = "netTimeout";
   } else if (NS_ERROR_CSP_FRAME_ANCESTOR_VIOLATION == aError ||
              NS_ERROR_CSP_FORM_ACTION_VIOLATION == aError) {
     // CSP error
     cssClass.AssignLiteral("neterror");
-    error.AssignLiteral("cspBlocked");
+    error = "cspBlocked";
   } else if (NS_ERROR_GET_MODULE(aError) == NS_ERROR_MODULE_SECURITY) {
     nsCOMPtr<nsINSSErrorsService> nsserr =
       do_GetService(NS_NSS_ERRORS_SERVICE_CONTRACTID);
 
     uint32_t errorClass;
     if (!nsserr || NS_FAILED(nsserr->GetErrorClass(aError, &errorClass))) {
       errorClass = nsINSSErrorsService::ERROR_CLASS_SSL_PROTOCOL;
     }
@@ -5007,34 +5007,34 @@ nsDocShell::DisplayLoadError(nsresult aE
     if (aFailedChannel) {
       aFailedChannel->GetSecurityInfo(getter_AddRefs(securityInfo));
     }
     tsi = do_QueryInterface(securityInfo);
     if (tsi) {
       uint32_t securityState;
       tsi->GetSecurityState(&securityState);
       if (securityState & nsIWebProgressListener::STATE_USES_SSL_3) {
-        error.AssignLiteral("sslv3Used");
+        error = "sslv3Used";
         addHostPort = true;
       } else if (securityState & nsIWebProgressListener::STATE_USES_WEAK_CRYPTO) {
-        error.AssignLiteral("weakCryptoUsed");
+        error = "weakCryptoUsed";
         addHostPort = true;
       } else {
         // Usually we should have aFailedChannel and get a detailed message
         tsi->GetErrorMessage(getter_Copies(messageStr));
       }
     } else {
       // No channel, let's obtain the generic error message
       if (nsserr) {
         nsserr->GetErrorMessage(aError, messageStr);
       }
     }
     if (!messageStr.IsEmpty()) {
       if (errorClass == nsINSSErrorsService::ERROR_CLASS_BAD_CERT) {
-        error.AssignLiteral("nssBadCert");
+        error = "nssBadCert";
 
         // If this is an HTTP Strict Transport Security host or a pinned host
         // and the certificate is bad, don't allow overrides (RFC 6797 section
         // 12.1, HPKP draft spec section 2.6).
         uint32_t flags =
           UsePrivateBrowsing() ? nsISocketProvider::NO_PERMANENT_STORAGE : 0;
         bool isStsHost = false;
         bool isPinnedHost = false;
@@ -5090,17 +5090,17 @@ nsDocShell::DisplayLoadError(nsresult aE
           errorPage.Assign(alternateErrorPage);
         }
 
         if (!IsFrame() && errorPage.EqualsIgnoreCase("certerror")) {
           Telemetry::Accumulate(mozilla::Telemetry::SECURITY_UI, bucketId);
         }
 
       } else {
-        error.AssignLiteral("nssFailure2");
+        error = "nssFailure2";
       }
     }
   } else if (NS_ERROR_PHISHING_URI == aError ||
              NS_ERROR_MALWARE_URI == aError ||
              NS_ERROR_UNWANTED_URI == aError) {
     nsAutoCString host;
     aURI->GetHost(host);
     CopyUTF8toUTF16(host, formatStrs[0]);
@@ -5113,39 +5113,39 @@ nsDocShell::DisplayLoadError(nsresult aE
     if (alternateErrorPage) {
       errorPage.Assign(alternateErrorPage);
     }
 
     uint32_t bucketId;
     bool sendTelemetry = false;
     if (NS_ERROR_PHISHING_URI == aError) {
       sendTelemetry = true;
-      error.AssignLiteral("deceptiveBlocked");
+      error = "deceptiveBlocked";
       bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_PHISHING_PAGE_FRAME
                            : nsISecurityUITelemetry::WARNING_PHISHING_PAGE_TOP;
     } else if (NS_ERROR_MALWARE_URI == aError) {
       sendTelemetry = true;
-      error.AssignLiteral("malwareBlocked");
+      error = "malwareBlocked";
       bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_MALWARE_PAGE_FRAME
                            : nsISecurityUITelemetry::WARNING_MALWARE_PAGE_TOP;
     } else if (NS_ERROR_UNWANTED_URI == aError) {
       sendTelemetry = true;
-      error.AssignLiteral("unwantedBlocked");
+      error = "unwantedBlocked";
       bucketId = IsFrame() ? nsISecurityUITelemetry::WARNING_UNWANTED_PAGE_FRAME
                            : nsISecurityUITelemetry::WARNING_UNWANTED_PAGE_TOP;
     }
 
     if (sendTelemetry && errorPage.EqualsIgnoreCase("blocked")) {
       Telemetry::Accumulate(Telemetry::SECURITY_UI, bucketId);
     }
 
     cssClass.AssignLiteral("blacklist");
   } else if (NS_ERROR_CONTENT_CRASHED == aError) {
     errorPage.AssignLiteral("tabcrashed");
-    error.AssignLiteral("tabcrashed");
+    error = "tabcrashed";
 
     nsCOMPtr<EventTarget> handler = mChromeEventHandler;
     if (handler) {
       nsCOMPtr<Element> element = do_QueryInterface(handler);
       element->GetAttribute(NS_LITERAL_STRING("crashedPageTitle"), messageStr);
     }
 
     // DisplayLoadError requires a non-empty messageStr to proceed and call
@@ -5154,88 +5154,88 @@ nsDocShell::DisplayLoadError(nsresult aE
     if (messageStr.IsEmpty()) {
       messageStr.AssignLiteral(u" ");
     }
   } else {
     // Errors requiring simple formatting
     switch (aError) {
       case NS_ERROR_MALFORMED_URI:
         // URI is malformed
-        error.AssignLiteral("malformedURI");
+        error = "malformedURI";
         break;
       case NS_ERROR_REDIRECT_LOOP:
         // Doc failed to load because the server generated too many redirects
-        error.AssignLiteral("redirectLoop");
+        error = "redirectLoop";
         break;
       case NS_ERROR_UNKNOWN_SOCKET_TYPE:
         // Doc failed to load because PSM is not installed
-        error.AssignLiteral("unknownSocketType");
+        error = "unknownSocketType";
         break;
       case NS_ERROR_NET_RESET:
         // Doc failed to load because the server kept reseting the connection
         // before we could read any data from it
-        error.AssignLiteral("netReset");
+        error = "netReset";
         break;
       case NS_ERROR_DOCUMENT_NOT_CACHED:
         // Doc failed to load because the cache does not contain a copy of
         // the document.
-        error.AssignLiteral("notCached");
+        error = "notCached";
         break;
       case NS_ERROR_OFFLINE:
         // Doc failed to load because we are offline.
-        error.AssignLiteral("netOffline");
+        error = "netOffline";
         break;
       case NS_ERROR_DOCUMENT_IS_PRINTMODE:
         // Doc navigation attempted while Printing or Print Preview
-        error.AssignLiteral("isprinting");
+        error = "isprinting";
         break;
       case NS_ERROR_PORT_ACCESS_NOT_ALLOWED:
         // Port blocked for security reasons
         addHostPort = true;
-        error.AssignLiteral("deniedPortAccess");
+        error = "deniedPortAccess";
         break;
       case NS_ERROR_UNKNOWN_PROXY_HOST:
         // Proxy hostname could not be resolved.
-        error.AssignLiteral("proxyResolveFailure");
+        error = "proxyResolveFailure";
         break;
       case NS_ERROR_PROXY_CONNECTION_REFUSED:
         // Proxy connection was refused.
-        error.AssignLiteral("proxyConnectFailure");
+        error = "proxyConnectFailure";
         break;
       case NS_ERROR_INVALID_CONTENT_ENCODING:
         // Bad Content Encoding.
-        error.AssignLiteral("contentEncodingError");
+        error = "contentEncodingError";
         break;
       case NS_ERROR_REMOTE_XUL:
-        error.AssignLiteral("remoteXUL");
+        error = "remoteXUL";
         break;
       case NS_ERROR_UNSAFE_CONTENT_TYPE:
         // Channel refused to load from an unrecognized content type.
-        error.AssignLiteral("unsafeContentType");
+        error = "unsafeContentType";
         break;
       case NS_ERROR_CORRUPTED_CONTENT:
         // Broken Content Detected. e.g. Content-MD5 check failure.
-        error.AssignLiteral("corruptedContentErrorv2");
+        error = "corruptedContentErrorv2";
         break;
       case NS_ERROR_INTERCEPTION_FAILED:
         // ServiceWorker intercepted request, but something went wrong.
-        error.AssignLiteral("corruptedContentErrorv2");
+        error = "corruptedContentErrorv2";
         break;
       case NS_ERROR_NET_INADEQUATE_SECURITY:
         // Server negotiated bad TLS for HTTP/2.
-        error.AssignLiteral("inadequateSecurityError");
+        error = "inadequateSecurityError";
         addHostPort = true;
         break;
       default:
         break;
     }
   }
 
   // Test if the error should be displayed
-  if (error.IsEmpty()) {
+  if (!error) {
     return NS_OK;
   }
 
   // Test if the error needs to be formatted
   if (!messageStr.IsEmpty()) {
     // already obtained message
   } else {
     if (addHostPort) {
@@ -5280,38 +5280,38 @@ nsDocShell::DisplayLoadError(nsresult aE
     rv = NS_OK;
     ++formatStrCount;
 
     const char16_t* strs[kMaxFormatStrArgs];
     for (uint32_t i = 0; i < formatStrCount; i++) {
       strs[i] = formatStrs[i].get();
     }
     nsXPIDLString str;
-    rv = stringBundle->FormatStringFromName(error.get(), strs, formatStrCount,
+    rv = stringBundle->FormatStringFromName(error, strs, formatStrCount,
                                             getter_Copies(str));
     NS_ENSURE_SUCCESS(rv, rv);
     messageStr.Assign(str.get());
   }
 
   // Display the error as a page or an alert prompt
   NS_ENSURE_FALSE(messageStr.IsEmpty(), NS_ERROR_FAILURE);
 
   if (NS_ERROR_NET_INTERRUPT == aError || NS_ERROR_NET_RESET == aError) {
     bool isSecureURI = false;
     rv = aURI->SchemeIs("https", &isSecureURI);
     if (NS_SUCCEEDED(rv) && isSecureURI) {
       // Maybe TLS intolerant. Treat this as an SSL error.
-      error.AssignLiteral("nssFailure2");
+      error = "nssFailure2";
     }
   }
 
   if (UseErrorPages()) {
     // Display an error page
     nsresult loadedPage = LoadErrorPage(aURI, aURL, errorPage.get(),
-                                        error.get(), messageStr.get(),
+                                        error, messageStr.get(),
                                         cssClass.get(), aFailedChannel);
     *aDisplayedErrorPage = NS_SUCCEEDED(loadedPage);
   } else {
     // The prompter reqires that our private window has a document (or it
     // asserts). Satisfy that assertion now since GetDoc will force
     // creation of one if it hasn't already been created.
     if (mScriptGlobal) {
       Unused << mScriptGlobal->GetDoc();
@@ -5324,17 +5324,17 @@ nsDocShell::DisplayLoadError(nsresult aE
   return NS_OK;
 }
 
 #define PREF_SAFEBROWSING_ALLOWOVERRIDE "browser.safebrowsing.allowOverride"
 
 NS_IMETHODIMP
 nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
                           const char* aErrorPage,
-                          const char16_t* aErrorType,
+                          const char* aErrorType,
                           const char16_t* aDescription,
                           const char* aCSSClass,
                           nsIChannel* aFailedChannel)
 {
 #if defined(DEBUG)
   if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) {
     nsAutoCString chanName;
     if (aFailedChannel) {
@@ -5381,17 +5381,17 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, 
   if (NS_WARN_IF(!NS_Escape(input, output, params))) {                         \
     return NS_ERROR_OUT_OF_MEMORY;                                             \
   }
 
   nsCString escapedUrl, escapedCharset, escapedError, escapedDescription,
     escapedCSSClass;
   SAFE_ESCAPE(escapedUrl, url, url_Path);
   SAFE_ESCAPE(escapedCharset, charset, url_Path);
-  SAFE_ESCAPE(escapedError, NS_ConvertUTF16toUTF8(aErrorType), url_Path);
+  SAFE_ESCAPE(escapedError, nsDependentCString(aErrorType), url_Path);
   SAFE_ESCAPE(escapedDescription,
               NS_ConvertUTF16toUTF8(aDescription), url_Path);
   if (aCSSClass) {
     nsCString cssClass(aCSSClass);
     SAFE_ESCAPE(escapedCSSClass, cssClass, url_Path);
   }
   nsCString errorPageUrl("about:");
   errorPageUrl.AppendASCII(aErrorPage);
@@ -13331,38 +13331,38 @@ nsDocShell::ConfirmRepost(bool* aRepost)
   rv = stringBundleService->CreateBundle(kBrandBundleURL,
                                          getter_AddRefs(brandBundle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ASSERTION(prompter && brandBundle && appBundle,
                "Unable to set up repost prompter.");
 
   nsXPIDLString brandName;
-  rv = brandBundle->GetStringFromName(u"brandShortName",
+  rv = brandBundle->GetStringFromName("brandShortName",
                                       getter_Copies(brandName));
 
   nsXPIDLString msgString, button0Title;
   if (NS_FAILED(rv)) { // No brand, use the generic version.
-    rv = appBundle->GetStringFromName(u"confirmRepostPrompt",
+    rv = appBundle->GetStringFromName("confirmRepostPrompt",
                                       getter_Copies(msgString));
   } else {
     // Brand available - if the app has an override file with formatting, the
     // app name will be included. Without an override, the prompt will look
     // like the generic version.
     const char16_t* formatStrings[] = { brandName.get() };
-    rv = appBundle->FormatStringFromName(u"confirmRepostPrompt",
+    rv = appBundle->FormatStringFromName("confirmRepostPrompt",
                                          formatStrings,
                                          ArrayLength(formatStrings),
                                          getter_Copies(msgString));
   }
   if (NS_FAILED(rv)) {
     return rv;
   }
 
-  rv = appBundle->GetStringFromName(u"resendButton.label",
+  rv = appBundle->GetStringFromName("resendButton.label",
                                     getter_Copies(button0Title));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   int32_t buttonPressed;
   // The actual value here is irrelevant, but we can't pass an invalid
   // bool through XPConnect.
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -608,17 +608,17 @@ protected:
   nsIScrollableFrame* GetRootScrollFrame();
   NS_IMETHOD EnsureScriptEnvironment();
   NS_IMETHOD EnsureEditorData();
   nsresult EnsureTransferableHookData();
   NS_IMETHOD EnsureFind();
   nsresult RefreshURIFromQueue();
   NS_IMETHOD LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
                            const char* aErrorPage,
-                           const char16_t* aErrorType,
+                           const char* aErrorType,
                            const char16_t* aDescription,
                            const char* aCSSClass,
                            nsIChannel* aFailedChannel);
   bool IsPrintingOrPP(bool aDisplayErrorDialog = true);
   bool IsNavigationAllowed(bool aDisplayPrintErrorDialog = true,
                            bool aCheckIfUnloadFired = true);
 
   nsresult SetBaseUrlForWyciwyg(nsIContentViewer* aContentViewer);
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -109,17 +109,17 @@ public:
   void FailConnection();
 
   nsresult Thaw();
   nsresult Freeze();
 
   static void TimerCallback(nsITimer* aTimer, void* aClosure);
 
   nsresult PrintErrorOnConsole(const char* aBundleURI,
-                               const char16_t* aError,
+                               const char* aError,
                                const char16_t** aFormatStrings,
                                uint32_t aFormatStringsLen);
   nsresult ConsoleError();
 
   static nsresult StreamReaderFunc(nsIInputStream* aInputStream,
                                    void* aClosure,
                                    const char* aFromRawSegment,
                                    uint32_t aToOffset,
@@ -1214,17 +1214,17 @@ EventSourceImpl::SetReconnectionTimeout(
     "dom::EventSourceImpl::SetReconnectionTimeout");
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 nsresult
 EventSourceImpl::PrintErrorOnConsole(const char* aBundleURI,
-                                     const char16_t* aError,
+                                     const char* aError,
                                      const char16_t** aFormatStrings,
                                      uint32_t aFormatStringsLen)
 {
   AssertIsOnMainThread();
   MOZ_ASSERT(!IsShutDown());
   nsCOMPtr<nsIStringBundleService> bundleService =
     mozilla::services::GetStringBundleService();
   NS_ENSURE_STATE(bundleService);
@@ -1277,21 +1277,21 @@ EventSourceImpl::ConsoleError()
   nsresult rv = mSrc->GetSpec(targetSpec);
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ConvertUTF8toUTF16 specUTF16(targetSpec);
   const char16_t* formatStrings[] = { specUTF16.get() };
 
   if (ReadyState() == CONNECTING) {
     rv = PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
-                             u"connectionFailure",
+                             "connectionFailure",
                              formatStrings, ArrayLength(formatStrings));
   } else {
     rv = PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
-                             u"netInterrupt",
+                             "netInterrupt",
                              formatStrings, ArrayLength(formatStrings));
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 void
--- a/dom/base/WebSocket.cpp
+++ b/dom/base/WebSocket.cpp
@@ -144,17 +144,17 @@ public:
                       const nsACString& aReasonString = EmptyCString());
   nsresult CloseConnection(uint16_t reasonCode,
                            const nsACString& aReasonString = EmptyCString());
   void Disconnect();
   void DisconnectInternal();
 
   nsresult ConsoleError();
   void PrintErrorOnConsole(const char* aBundleURI,
-                           const char16_t* aError,
+                           const char* aError,
                            const char16_t** aFormatStrings,
                            uint32_t aFormatStringsLen);
 
   nsresult DoOnMessageAvailable(const nsACString& aMsg,
                                 bool isBinary);
 
   // ConnectionCloseEvents: 'error' event if needed, then 'close' event.
   nsresult ScheduleConnectionCloseEvents(nsISupports* aContext,
@@ -293,17 +293,17 @@ private:
 
 namespace {
 
 class PrintErrorOnConsoleRunnable final : public WorkerMainThreadRunnable
 {
 public:
   PrintErrorOnConsoleRunnable(WebSocketImpl* aImpl,
                               const char* aBundleURI,
-                              const char16_t* aError,
+                              const char* aError,
                               const char16_t** aFormatStrings,
                               uint32_t aFormatStringsLen)
     : WorkerMainThreadRunnable(aImpl->mWorkerPrivate,
                                NS_LITERAL_CSTRING("WebSocket :: print error on console"))
     , mImpl(aImpl)
     , mBundleURI(aBundleURI)
     , mError(aError)
     , mFormatStrings(aFormatStrings)
@@ -317,26 +317,26 @@ public:
     return true;
   }
 
 private:
   // Raw pointer because this runnable is sync.
   WebSocketImpl* mImpl;
 
   const char* mBundleURI;
-  const char16_t* mError;
+  const char* mError;
   const char16_t** mFormatStrings;
   uint32_t mFormatStringsLen;
 };
 
 } // namespace
 
 void
 WebSocketImpl::PrintErrorOnConsole(const char *aBundleURI,
-                                   const char16_t *aError,
+                                   const char *aError,
                                    const char16_t **aFormatStrings,
                                    uint32_t aFormatStringsLen)
 {
   // This method must run on the main thread.
 
   if (!NS_IsMainThread()) {
     MOZ_ASSERT(mWorkerPrivate);
 
@@ -556,21 +556,21 @@ WebSocketImpl::ConsoleError()
     }
   }
 
   NS_ConvertUTF8toUTF16 specUTF16(mURI);
   const char16_t* formatStrings[] = { specUTF16.get() };
 
   if (mWebSocket->ReadyState() < WebSocket::OPEN) {
     PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
-                        u"connectionFailure",
+                        "connectionFailure",
                         formatStrings, ArrayLength(formatStrings));
   } else {
     PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
-                        u"netInterrupt",
+                        "netInterrupt",
                         formatStrings, ArrayLength(formatStrings));
   }
   /// todo some specific errors - like for message too large
   return NS_OK;
 }
 
 void
 WebSocketImpl::FailConnection(uint16_t aReasonCode,
@@ -1613,17 +1613,17 @@ WebSocketImpl::Init(JSContext* aCx,
     // upgrade the request from ws:// to wss:// and mark as secure
     mURI.ReplaceSubstring("ws://", "wss://");
     if (NS_WARN_IF(mURI.Find("wss://") != 0)) {
       return NS_OK;
     }
     mSecure = true;
 
     const char16_t* params[] = { reportSpec.get(), u"wss" };
-    CSP_LogLocalizedStr(u"upgradeInsecureRequest",
+    CSP_LogLocalizedStr("upgradeInsecureRequest",
                         params, ArrayLength(params),
                         EmptyString(), // aSourceFile
                         EmptyString(), // aScriptSample
                         0, // aLineNumber
                         0, // aColumnNumber
                         nsIScriptError::warningFlag, "CSP",
                         mInnerWindowID);
   }
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -866,22 +866,22 @@ nsContentUtils::InitializeModifierString
   nsXPIDLString shiftModifier;
   nsXPIDLString metaModifier;
   nsXPIDLString osModifier;
   nsXPIDLString altModifier;
   nsXPIDLString controlModifier;
   nsXPIDLString modifierSeparator;
   if (bundle) {
     //macs use symbols for each modifier key, so fetch each from the bundle, which also covers i18n
-    bundle->GetStringFromName(u"VK_SHIFT", getter_Copies(shiftModifier));
-    bundle->GetStringFromName(u"VK_META", getter_Copies(metaModifier));
-    bundle->GetStringFromName(u"VK_WIN", getter_Copies(osModifier));
-    bundle->GetStringFromName(u"VK_ALT", getter_Copies(altModifier));
-    bundle->GetStringFromName(u"VK_CONTROL", getter_Copies(controlModifier));
-    bundle->GetStringFromName(u"MODIFIER_SEPARATOR", getter_Copies(modifierSeparator));
+    bundle->GetStringFromName("VK_SHIFT", getter_Copies(shiftModifier));
+    bundle->GetStringFromName("VK_META", getter_Copies(metaModifier));
+    bundle->GetStringFromName("VK_WIN", getter_Copies(osModifier));
+    bundle->GetStringFromName("VK_ALT", getter_Copies(altModifier));
+    bundle->GetStringFromName("VK_CONTROL", getter_Copies(controlModifier));
+    bundle->GetStringFromName("MODIFIER_SEPARATOR", getter_Copies(modifierSeparator));
   }
   //if any of these don't exist, we get  an empty string
   sShiftText = new nsString(shiftModifier);
   sMetaText = new nsString(metaModifier);
   sOSText = new nsString(osModifier);
   sAltText = new nsString(altModifier);
   sControlText = new nsString(controlModifier);
   sModifierSeparator = new nsString(modifierSeparator);
@@ -3945,37 +3945,35 @@ nsContentUtils::EnsureStringBundle(Prope
 nsresult nsContentUtils::GetLocalizedString(PropertiesFile aFile,
                                             const char* aKey,
                                             nsXPIDLString& aResult)
 {
   nsresult rv = EnsureStringBundle(aFile);
   NS_ENSURE_SUCCESS(rv, rv);
   nsIStringBundle *bundle = sStringBundles[aFile];
 
-  return bundle->GetStringFromName(NS_ConvertASCIItoUTF16(aKey).get(),
-                                   getter_Copies(aResult));
+  return bundle->GetStringFromName(aKey, getter_Copies(aResult));
 }
 
 /* static */
 nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile,
                                                const char* aKey,
                                                const char16_t **aParams,
                                                uint32_t aParamsLength,
                                                nsXPIDLString& aResult)
 {
   nsresult rv = EnsureStringBundle(aFile);
   NS_ENSURE_SUCCESS(rv, rv);
   nsIStringBundle *bundle = sStringBundles[aFile];
 
   if (!aParams || !aParamsLength) {
-    return bundle->GetStringFromName(NS_ConvertASCIItoUTF16(aKey).get(),
-                                     getter_Copies(aResult));
-  }
-
-  return bundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aKey).get(),
+    return bundle->GetStringFromName(aKey, getter_Copies(aResult));
+  }
+
+  return bundle->FormatStringFromName(aKey,
                                       aParams, aParamsLength,
                                       getter_Copies(aResult));
 }
 
 /* static */
 nsresult nsContentUtils::FormatLocalizedString(
                                           PropertiesFile aFile,
                                           const char* aKey,
--- a/dom/base/nsDataDocumentContentPolicy.cpp
+++ b/dom/base/nsDataDocumentContentPolicy.cpp
@@ -98,18 +98,17 @@ nsDataDocumentContentPolicy::ShouldLoad(
       // Report error, if we can.
       if (node) {
         nsIPrincipal* requestingPrincipal = node->NodePrincipal();
         RefPtr<nsIURI> principalURI;
         nsresult rv =
           requestingPrincipal->GetURI(getter_AddRefs(principalURI));
         if (NS_SUCCEEDED(rv) && principalURI) {
           nsScriptSecurityManager::ReportError(
-            nullptr, NS_LITERAL_STRING("ExternalDataError"), principalURI,
-            aContentLocation);
+            nullptr, "ExternalDataError", principalURI, aContentLocation);
         }
       }
     } else if ((aContentType == nsIContentPolicy::TYPE_IMAGE ||
                 aContentType == nsIContentPolicy::TYPE_IMAGESET) &&
                doc->GetDocumentURI()) {
       // Check for (& disallow) recursive image-loads
       bool isRecursiveLoad;
       nsresult rv = aContentLocation->EqualsExceptRef(doc->GetDocumentURI(),
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -914,23 +914,21 @@ HTMLFormElement::DoSecureToInsecureSubmi
     getter_AddRefs(stringBundle));
   if (NS_FAILED(rv)) {
     return rv;
   }
   nsAutoString title;
   nsAutoString message;
   nsAutoString cont;
   stringBundle->GetStringFromName(
-    u"formPostSecureToInsecureWarning.title", getter_Copies(title));
+    "formPostSecureToInsecureWarning.title", getter_Copies(title));
   stringBundle->GetStringFromName(
-    u"formPostSecureToInsecureWarning.message",
-    getter_Copies(message));
+    "formPostSecureToInsecureWarning.message", getter_Copies(message));
   stringBundle->GetStringFromName(
-    u"formPostSecureToInsecureWarning.continue",
-    getter_Copies(cont));
+    "formPostSecureToInsecureWarning.continue", getter_Copies(cont));
   int32_t buttonPressed;
   bool checkState = false; // this is unused (ConfirmEx requires this parameter)
   rv = prompt->ConfirmEx(title.get(), message.get(),
                          (nsIPrompt::BUTTON_TITLE_IS_STRING *
                           nsIPrompt::BUTTON_POS_0) +
                          (nsIPrompt::BUTTON_TITLE_CANCEL *
                           nsIPrompt::BUTTON_POS_1),
                          cont.get(), nullptr, nullptr, nullptr,
@@ -1723,17 +1721,17 @@ HTMLFormElement::GetActionURL(nsIURI** a
 
     // let's log a message to the console that we are upgrading a request
     nsAutoCString scheme;
     rv = actionURL->GetScheme(scheme);
     NS_ENSURE_SUCCESS(rv, rv);
     NS_ConvertUTF8toUTF16 reportScheme(scheme);
 
     const char16_t* params[] = { reportSpec.get(), reportScheme.get() };
-    CSP_LogLocalizedStr(u"upgradeInsecureRequest",
+    CSP_LogLocalizedStr("upgradeInsecureRequest",
                         params, ArrayLength(params),
                         EmptyString(), // aSourceFile
                         EmptyString(), // aScriptSample
                         0, // aLineNumber
                         0, // aColumnNumber
                         nsIScriptError::warningFlag, "CSP",
                         document->InnerWindowID());
   }
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -7604,25 +7604,25 @@ HTMLInputElement::SetFilePickerFiltersFr
 
     int32_t filterMask = 0;
     nsString filterName;
     nsString extensionListStr;
 
     // First, check for image/audio/video filters...
     if (token.EqualsLiteral("image/*")) {
       filterMask = nsIFilePicker::filterImages;
-      filterBundle->GetStringFromName(u"imageFilter",
+      filterBundle->GetStringFromName("imageFilter",
                                       getter_Copies(extensionListStr));
     } else if (token.EqualsLiteral("audio/*")) {
       filterMask = nsIFilePicker::filterAudio;
-      filterBundle->GetStringFromName(u"audioFilter",
+      filterBundle->GetStringFromName("audioFilter",
                                       getter_Copies(extensionListStr));
     } else if (token.EqualsLiteral("video/*")) {
       filterMask = nsIFilePicker::filterVideo;
-      filterBundle->GetStringFromName(u"videoFilter",
+      filterBundle->GetStringFromName("videoFilter",
                                       getter_Copies(extensionListStr));
     } else if (token.First() == '.') {
       if (token.Contains(';') || token.Contains('*')) {
         // Ignore this filter as it contains reserved characters
         continue;
       }
       extensionListStr = NS_LITERAL_STRING("*") + token;
       filterName = extensionListStr;
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -587,17 +587,17 @@ ImageDocument::OnLoadComplete(imgIReques
 
   // mImageContent can be null if the document is already destroyed
   if (NS_FAILED(aStatus) && mStringBundle && mImageContent) {
     nsAutoCString src;
     mDocumentURI->GetSpec(src);
     NS_ConvertUTF8toUTF16 srcString(src);
     const char16_t* formatString[] = { srcString.get() };
     nsXPIDLString errorMsg;
-    mStringBundle->FormatStringFromName(u"InvalidImage", formatString, 1,
+    mStringBundle->FormatStringFromName("InvalidImage", formatString, 1,
                                         getter_Copies(errorMsg));
 
     mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, errorMsg, false);
   }
 
   return NS_OK;
 }
 
@@ -799,17 +799,17 @@ ImageDocument::UpdateTitleAndCharset()
   }
 
   nsXPIDLString status;
   if (mImageIsResized) {
     nsAutoString ratioStr;
     ratioStr.AppendInt(NSToCoordFloor(GetRatio() * 100));
 
     const char16_t* formatString[1] = { ratioStr.get() };
-    mStringBundle->FormatStringFromName(u"ScaledImage",
+    mStringBundle->FormatStringFromName("ScaledImage",
                                         formatString, 1,
                                         getter_Copies(status));
   }
 
   static const char* const formatNames[4] =
   {
     "ImageTitleWithNeitherDimensionsNorFile",
     "ImageTitleWithoutDimensions",
--- a/dom/html/MediaDocument.cpp
+++ b/dom/html/MediaDocument.cpp
@@ -378,55 +378,55 @@ MediaDocument::UpdateTitleAndCharset(con
       nsAutoString widthStr;
       nsAutoString heightStr;
       widthStr.AppendInt(aWidth);
       heightStr.AppendInt(aHeight);
       // If we got a filename, display it
       if (!fileStr.IsEmpty()) {
         const char16_t *formatStrings[4]  = {fileStr.get(), typeStr.get(),
           widthStr.get(), heightStr.get()};
-        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDimAndFile]);
-        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 4,
+        mStringBundle->FormatStringFromName(aFormatNames[eWithDimAndFile],
+                                            formatStrings, 4,
                                             getter_Copies(title));
       }
       else {
         const char16_t *formatStrings[3]  = {typeStr.get(), widthStr.get(),
           heightStr.get()};
-        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDim]);
-        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 3,
+        mStringBundle->FormatStringFromName(aFormatNames[eWithDim],
+                                            formatStrings, 3,
                                             getter_Copies(title));
       }
     }
     else {
     // If we got a filename, display it
       if (!fileStr.IsEmpty()) {
         const char16_t *formatStrings[2] = {fileStr.get(), typeStr.get()};
-        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithFile]);
-        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2,
+        mStringBundle->FormatStringFromName(aFormatNames[eWithFile],
+                                            formatStrings, 2,
                                             getter_Copies(title));
       }
       else {
         const char16_t *formatStrings[1] = {typeStr.get()};
-        NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithNoInfo]);
-        mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 1,
+        mStringBundle->FormatStringFromName(aFormatNames[eWithNoInfo],
+                                            formatStrings, 1,
                                             getter_Copies(title));
       }
     }
   }
 
   // set it on the document
   if (aStatus.IsEmpty()) {
     SetTitle(title);
   }
   else {
     nsXPIDLString titleWithStatus;
     const nsPromiseFlatString& status = PromiseFlatString(aStatus);
     const char16_t *formatStrings[2] = {title.get(), status.get()};
-    mStringBundle->FormatStringFromName(u"TitleWithStatus", formatStrings, 2,
-                                        getter_Copies(titleWithStatus));
+    mStringBundle->FormatStringFromName("TitleWithStatus", formatStrings,
+                                        2, getter_Copies(titleWithStatus));
     SetTitle(titleWithStatus);
   }
 }
 
 void
 MediaDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject)
 {
     nsHTMLDocument::SetScriptGlobalObject(aGlobalObject);
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -807,17 +807,17 @@ nsHTMLDocument::StartDocumentLoad(const 
     nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
     NS_ASSERTION(NS_SUCCEEDED(rv) && bundleService, "The bundle service could not be loaded");
     nsCOMPtr<nsIStringBundle> bundle;
     rv = bundleService->CreateBundle("chrome://global/locale/browser.properties",
                                      getter_AddRefs(bundle));
     NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/browser.properties could not be loaded");
     nsXPIDLString title;
     if (bundle) {
-      bundle->GetStringFromName(u"plainText.wordWrap", getter_Copies(title));
+      bundle->GetStringFromName("plainText.wordWrap", getter_Copies(title));
     }
     SetSelectedStyleSheetSet(title);
   }
 
   // parser the content of the URI
   mParser->Parse(uri, nullptr, (void *)this);
 
   return rv;
--- a/dom/media/CubebUtils.cpp
+++ b/dom/media/CubebUtils.cpp
@@ -310,17 +310,17 @@ void InitBrandName()
   nsXPIDLString brandName;
   nsCOMPtr<nsIStringBundleService> stringBundleService =
     mozilla::services::GetStringBundleService();
   if (stringBundleService) {
     nsCOMPtr<nsIStringBundle> brandBundle;
     nsresult rv = stringBundleService->CreateBundle(kBrandBundleURL,
                                            getter_AddRefs(brandBundle));
     if (NS_SUCCEEDED(rv)) {
-      rv = brandBundle->GetStringFromName(u"brandShortName",
+      rv = brandBundle->GetStringFromName("brandShortName",
                                           getter_Copies(brandName));
       NS_WARNING_ASSERTION(
         NS_SUCCEEDED(rv), "Could not get the program name for a cubeb stream.");
     }
   }
   NS_LossyConvertUTF16toASCII ascii(brandName);
   sBrandName = new char[ascii.Length() + 1];
   PodCopy(sBrandName.get(), ascii.get(), ascii.Length());
--- a/dom/security/FramingChecker.cpp
+++ b/dom/security/FramingChecker.cpp
@@ -178,17 +178,17 @@ ShouldIgnoreFrameOptions(nsIChannel* aCh
     return false;
   }
 
   // log warning to console that xfo is ignored because of CSP
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
   uint64_t innerWindowID = loadInfo ? loadInfo->GetInnerWindowID() : 0;
   const char16_t* params[] = { u"x-frame-options",
                                u"frame-ancestors" };
-  CSP_LogLocalizedStr(u"IgnoringSrcBecauseOfDirective",
+  CSP_LogLocalizedStr("IgnoringSrcBecauseOfDirective",
                       params, ArrayLength(params),
                       EmptyString(), // no sourcefile
                       EmptyString(), // no scriptsample
                       0,             // no linenumber
                       0,             // no columnnumber
                       nsIScriptError::warningFlag,
                       "CSP", innerWindowID);
 
--- a/dom/security/nsCSPContext.cpp
+++ b/dom/security/nsCSPContext.cpp
@@ -738,17 +738,17 @@ nsCSPContext::flushConsoleMessages()
     CSP_LogMessage(elem.mMsg, elem.mSourceName, elem.mSourceLine,
                    elem.mLineNumber, elem.mColumnNumber,
                    elem.mSeverityFlag, "CSP", mInnerWindowID);
   }
   mConsoleMsgQueue.Clear();
 }
 
 void
-nsCSPContext::logToConsole(const char16_t* aName,
+nsCSPContext::logToConsole(const char* aName,
                            const char16_t** aParams,
                            uint32_t aParamsLength,
                            const nsAString& aSourceName,
                            const nsAString& aSourceLine,
                            uint32_t aLineNumber,
                            uint32_t aColumnNumber,
                            uint32_t aSeverityFlag)
 {
@@ -939,17 +939,17 @@ nsCSPContext::SendReports(nsISupports* a
   for (uint32_t r = 0; r < reportURIs.Length(); r++) {
     nsAutoCString reportURICstring = NS_ConvertUTF16toUTF8(reportURIs[r]);
     // try to create a new uri from every report-uri string
     rv = NS_NewURI(getter_AddRefs(reportURI), reportURIs[r]);
     if (NS_FAILED(rv)) {
       const char16_t* params[] = { reportURIs[r].get() };
       CSPCONTEXTLOG(("Could not create nsIURI for report URI %s",
                      reportURICstring.get()));
-      logToConsole(u"triedToSendReport", params, ArrayLength(params),
+      logToConsole("triedToSendReport", params, ArrayLength(params),
                    aSourceFile, aScriptSample, aLineNum, 0, nsIScriptError::errorFlag);
       continue; // don't return yet, there may be more URIs
     }
 
     // try to create a new channel for every report-uri
     nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL | nsIChannel::LOAD_CLASSIFY_URI;
     if (doc) {
       rv = NS_NewChannel(getter_AddRefs(reportChannel),
@@ -980,17 +980,17 @@ nsCSPContext::SendReports(nsISupports* a
 
     // log a warning to console if scheme is not http or https
     bool isHttpScheme =
       (NS_SUCCEEDED(reportURI->SchemeIs("http", &isHttpScheme)) && isHttpScheme) ||
       (NS_SUCCEEDED(reportURI->SchemeIs("https", &isHttpScheme)) && isHttpScheme);
 
     if (!isHttpScheme) {
       const char16_t* params[] = { reportURIs[r].get() };
-      logToConsole(u"reportURInotHttpsOrHttp2", params, ArrayLength(params),
+      logToConsole("reportURInotHttpsOrHttp2", params, ArrayLength(params),
                    aSourceFile, aScriptSample, aLineNum, 0, nsIScriptError::errorFlag);
       continue;
     }
 
     // make sure this is an anonymous request (no cookies) so in case the
     // policy URI is injected, it can't be abused for CSRF.
     nsLoadFlags flags;
     rv = reportChannel->GetLoadFlags(&flags);
@@ -1045,17 +1045,17 @@ nsCSPContext::SendReports(nsISupports* a
     // AsyncOpen should not fail, but could if there's no load group (like if
     // SetRequestContext is not given a channel).  This should fail quietly and
     // not return an error since it's really ok if reports don't go out, but
     // it's good to log the error locally.
 
     if (NS_FAILED(rv)) {
       const char16_t* params[] = { reportURIs[r].get() };
       CSPCONTEXTLOG(("AsyncOpen failed for report URI %s", NS_ConvertUTF16toUTF8(params[0]).get()));
-      logToConsole(u"triedToSendReport", params, ArrayLength(params),
+      logToConsole("triedToSendReport", params, ArrayLength(params),
                    aSourceFile, aScriptSample, aLineNum, 0, nsIScriptError::errorFlag);
     } else {
       CSPCONTEXTLOG(("Sent violation report to URI %s", reportURICstring.get()));
     }
   }
   return NS_OK;
 }
 
@@ -1137,18 +1137,18 @@ class CSPReportSenderRunnable final : pu
       } else if (blockedString) {
         blockedString->GetData(blockedDataStr);
       }
 
       if (blockedDataStr.Length() > 0) {
         nsString blockedDataChar16 = NS_ConvertUTF8toUTF16(blockedDataStr);
         const char16_t* params[] = { mViolatedDirective.get(),
                                      blockedDataChar16.get() };
-        mCSPContext->logToConsole(mReportOnlyFlag ? u"CSPROViolationWithURI" :
-                                                    u"CSPViolationWithURI",
+        mCSPContext->logToConsole(mReportOnlyFlag ? "CSPROViolationWithURI" :
+                                                    "CSPViolationWithURI",
                                   params, ArrayLength(params), mSourceFile, mScriptSample,
                                   mLineNum, 0, nsIScriptError::errorFlag);
       }
       return NS_OK;
     }
 
   private:
     nsCOMPtr<nsISupports>   mBlockedContentSource;
@@ -1420,17 +1420,17 @@ nsCSPContext::GetCSPSandboxFlags(uint32_
       // continue the loop checking for an enforcement policy.
       nsAutoString policy;
       mPolicies[i]->toString(policy);
 
       CSPCONTEXTLOG(("nsCSPContext::GetCSPSandboxFlags, report only policy, ignoring sandbox in: %s",
                      NS_ConvertUTF16toUTF8(policy).get()));
 
       const char16_t* params[] = { policy.get() };
-      logToConsole(u"ignoringReportOnlyDirective", params, ArrayLength(params),
+      logToConsole("ignoringReportOnlyDirective", params, ArrayLength(params),
                    EmptyString(), EmptyString(), 0, 0, nsIScriptError::warningFlag);
     }
   }
 
   return NS_OK;
 }
 
 /* ========== CSPViolationReportListener implementation ========== */
--- a/dom/security/nsCSPContext.h
+++ b/dom/security/nsCSPContext.h
@@ -44,17 +44,17 @@ class nsCSPContext : public nsIContentSe
 
     /**
      * SetRequestContext() needs to be called before the innerWindowID
      * is initialized on the document. Use this function to call back to
      * flush queued up console messages and initalize the innerWindowID.
      */
     void flushConsoleMessages();
 
-    void logToConsole(const char16_t* aName,
+    void logToConsole(const char* aName,
                       const char16_t** aParams,
                       uint32_t aParamsLength,
                       const nsAString& aSourceName,
                       const nsAString& aSourceLine,
                       uint32_t aLineNumber,
                       uint32_t aColumnNumber,
                       uint32_t aSeverityFlag);
 
--- a/dom/security/nsCSPParser.cpp
+++ b/dom/security/nsCSPParser.cpp
@@ -279,17 +279,17 @@ void
 nsCSPParser::logWarningErrorToConsole(uint32_t aSeverityFlag,
                                       const char* aProperty,
                                       const char16_t* aParams[],
                                       uint32_t aParamsLength)
 {
   CSPPARSERLOG(("nsCSPParser::logWarningErrorToConsole: %s", aProperty));
   // send console messages off to the context and let the context
   // deal with it (potentially messages need to be queued up)
-  mCSPContext->logToConsole(NS_ConvertUTF8toUTF16(aProperty).get(),
+  mCSPContext->logToConsole(aProperty,
                             aParams,
                             aParamsLength,
                             EmptyString(), // aSourceName
                             EmptyString(), // aSourceLine
                             0,             // aLineNumber
                             0,             // aColumnNumber
                             aSeverityFlag); // aFlags
 }
--- a/dom/security/nsCSPUtils.cpp
+++ b/dom/security/nsCSPUtils.cpp
@@ -83,17 +83,17 @@ CSP_PercentDecodeStr(const nsAString& aE
     outDecStr.Append(decChar);
 
     // increment 'cur' to after the second hexDig
     cur = ++hexDig2;
   }
 }
 
 void
-CSP_GetLocalizedStr(const char16_t* aName,
+CSP_GetLocalizedStr(const char* aName,
                     const char16_t** aParams,
                     uint32_t aLength,
                     char16_t** outResult)
 {
   nsCOMPtr<nsIStringBundle> keyStringBundle;
   nsCOMPtr<nsIStringBundleService> stringBundleService =
     mozilla::services::GetStringBundleService();
 
@@ -101,17 +101,18 @@ CSP_GetLocalizedStr(const char16_t* aNam
   stringBundleService->CreateBundle("chrome://global/locale/security/csp.properties",
                                       getter_AddRefs(keyStringBundle));
 
   NS_ASSERTION(keyStringBundle, "Key string bundle must be available!");
 
   if (!keyStringBundle) {
     return;
   }
-  keyStringBundle->FormatStringFromName(aName, aParams, aLength, outResult);
+  keyStringBundle->FormatStringFromName(aName, aParams, aLength,
+                                        outResult);
 }
 
 void
 CSP_LogStrMessage(const nsAString& aMsg)
 {
   nsCOMPtr<nsIConsoleService> console(do_GetService("@mozilla.org/consoleservice;1"));
 
   if (!console) {
@@ -176,17 +177,17 @@ CSP_LogMessage(const nsAString& aMessage
   }
   console->LogMessage(error);
 }
 
 /**
  * Combines CSP_LogMessage and CSP_GetLocalizedStr into one call.
  */
 void
-CSP_LogLocalizedStr(const char16_t* aName,
+CSP_LogLocalizedStr(const char* aName,
                     const char16_t** aParams,
                     uint32_t aLength,
                     const nsAString& aSourceName,
                     const nsAString& aSourceLine,
                     uint32_t aLineNumber,
                     uint32_t aColumnNumber,
                     uint32_t aFlags,
                     const char* aCategory,
--- a/dom/security/nsCSPUtils.h
+++ b/dom/security/nsCSPUtils.h
@@ -19,28 +19,28 @@
 namespace mozilla {
 namespace dom {
   struct CSP;
 } // namespace dom
 } // namespace mozilla
 
 /* =============== Logging =================== */
 
-void CSP_LogLocalizedStr(const char16_t* aName,
+void CSP_LogLocalizedStr(const char* aName,
                          const char16_t** aParams,
                          uint32_t aLength,
                          const nsAString& aSourceName,
                          const nsAString& aSourceLine,
                          uint32_t aLineNumber,
                          uint32_t aColumnNumber,
                          uint32_t aFlags,
                          const char* aCategory,
                          uint64_t aInnerWindowID);
 
-void CSP_GetLocalizedStr(const char16_t* aName,
+void CSP_GetLocalizedStr(const char* aName,
                          const char16_t** aParams,
                          uint32_t aLength,
                          char16_t** outResult);
 
 void CSP_LogStrMessage(const nsAString& aMsg);
 
 void CSP_LogMessage(const nsAString& aMessage,
                     const nsAString& aSourceName,
--- a/dom/security/nsMixedContentBlocker.cpp
+++ b/dom/security/nsMixedContentBlocker.cpp
@@ -808,17 +808,17 @@ nsMixedContentBlocker::ShouldLoad(bool a
   if (document->GetBlockAllMixedContent(isPreload)) {
     // log a message to the console before returning.
     nsAutoCString spec;
     rv = aContentLocation->GetSpec(spec);
     NS_ENSURE_SUCCESS(rv, rv);
     NS_ConvertUTF8toUTF16 reportSpec(spec);
 
     const char16_t* params[] = { reportSpec.get()};
-    CSP_LogLocalizedStr(u"blockAllMixedContent",
+    CSP_LogLocalizedStr("blockAllMixedContent",
                         params, ArrayLength(params),
                         EmptyString(), // aSourceFile
                         EmptyString(), // aScriptSample
                         0, // aLineNumber
                         0, // aColumnNumber
                         nsIScriptError::errorFlag, "CSP",
                         document->InnerWindowID());
     *aDecision = REJECT_REQUEST;
--- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -1181,63 +1181,63 @@ nsresult nsWebBrowserPersist::SendErrorS
     else
     {
         nsAutoCString fileurl;
         rv = aURI->GetSpec(fileurl);
         NS_ENSURE_SUCCESS(rv, rv);
         AppendUTF8toUTF16(fileurl, path);
     }
 
-    nsAutoString msgId;
+    const char* msgId;
     switch(aResult)
     {
     case NS_ERROR_FILE_NAME_TOO_LONG:
         // File name too long.
-        msgId.AssignLiteral("fileNameTooLongError");
+        msgId = "fileNameTooLongError";
         break;
     case NS_ERROR_FILE_ALREADY_EXISTS:
         // File exists with same name as directory.
-        msgId.AssignLiteral("fileAlreadyExistsError");
+        msgId = "fileAlreadyExistsError";
         break;
     case NS_ERROR_FILE_DISK_FULL:
     case NS_ERROR_FILE_NO_DEVICE_SPACE:
         // Out of space on target volume.
-        msgId.AssignLiteral("diskFull");
+        msgId = "diskFull";
         break;
 
     case NS_ERROR_FILE_READ_ONLY:
         // Attempt to write to read/only file.
-        msgId.AssignLiteral("readOnly");
+        msgId = "readOnly";
         break;
 
     case NS_ERROR_FILE_ACCESS_DENIED:
         // Attempt to write without sufficient permissions.
-        msgId.AssignLiteral("accessError");
+        msgId = "accessError";
         break;
 
     default:
         // Generic read/write error message.
         if (aIsReadError)
-            msgId.AssignLiteral("readError");
+            msgId = "readError";
         else
-            msgId.AssignLiteral("writeError");
+            msgId = "writeError";
         break;
     }
     // Get properties file bundle and extract status string.
     nsCOMPtr<nsIStringBundleService> s = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
     NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && s, NS_ERROR_FAILURE);
 
     nsCOMPtr<nsIStringBundle> bundle;
     rv = s->CreateBundle(kWebBrowserPersistStringBundle, getter_AddRefs(bundle));
     NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && bundle, NS_ERROR_FAILURE);
 
     nsXPIDLString msgText;
     const char16_t *strings[1];
     strings[0] = path.get();
-    rv = bundle->FormatStringFromName(msgId.get(), strings, 1, getter_Copies(msgText));
+    rv = bundle->FormatStringFromName(msgId, strings, 1, getter_Copies(msgText));
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
     mProgressListener->OnStatusChange(nullptr, aRequest, aResult, msgText);
 
     return NS_OK;
 }
 
 nsresult nsWebBrowserPersist::GetValidURIFromObject(nsISupports *aObject, nsIURI **aURI) const
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -1083,22 +1083,22 @@ txMozillaXSLTProcessor::reportError(nsre
 
             nsXPIDLString errorMessage;
             nsCOMPtr<nsIStringBundle> bundle;
             sbs->CreateBundle(XSLT_MSGS_URL, getter_AddRefs(bundle));
 
             if (bundle) {
                 const char16_t* error[] = { errorText.get() };
                 if (mStylesheet) {
-                    bundle->FormatStringFromName(u"TransformError",
+                    bundle->FormatStringFromName("TransformError",
                                                  error, 1,
                                                  getter_Copies(errorMessage));
                 }
                 else {
-                    bundle->FormatStringFromName(u"LoadingError",
+                    bundle->FormatStringFromName("LoadingError",
                                                  error, 1,
                                                  getter_Copies(errorMessage));
                 }
             }
             mErrorText.Assign(errorMessage);
         }
     }
 
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp
@@ -505,21 +505,21 @@ nsresult nsAutoConfig::PromptForEMailAdd
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIStringBundle> bundle;
     rv = bundleService->CreateBundle("chrome://autoconfig/locale/autoconfig.properties",
                                 getter_AddRefs(bundle));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsXPIDLString title;
-    rv = bundle->GetStringFromName(u"emailPromptTitle", getter_Copies(title));
+    rv = bundle->GetStringFromName("emailPromptTitle", getter_Copies(title));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsXPIDLString err;
-    rv = bundle->GetStringFromName(u"emailPromptMsg", getter_Copies(err));
+    rv = bundle->GetStringFromName("emailPromptMsg", getter_Copies(err));
     NS_ENSURE_SUCCESS(rv, rv);
     bool check = false;
     nsXPIDLString emailResult;
     bool success;
     rv = promptService->Prompt(nullptr, title.get(), err.get(), getter_Copies(emailResult), nullptr, &check, &success);
     if (!success)
       return NS_ERROR_FAILURE;
     NS_ENSURE_SUCCESS(rv, rv);
--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp
@@ -50,22 +50,22 @@ static void DisplayError(void)
 
     nsCOMPtr<nsIStringBundle> bundle;
     bundleService->CreateBundle("chrome://autoconfig/locale/autoconfig.properties",
                                 getter_AddRefs(bundle));
     if (!bundle)
         return;
 
     nsXPIDLString title;
-    rv = bundle->GetStringFromName(u"readConfigTitle", getter_Copies(title));
+    rv = bundle->GetStringFromName("readConfigTitle", getter_Copies(title));
     if (NS_FAILED(rv))
         return;
 
     nsXPIDLString err;
-    rv = bundle->GetStringFromName(u"readConfigMsg", getter_Copies(err));
+    rv = bundle->GetStringFromName("readConfigMsg", getter_Copies(err));
     if (NS_FAILED(rv))
         return;
 
     promptService->Alert(nullptr, title.get(), err.get());
 }
 
 // nsISupports Implementation
 
--- a/intl/strres/nsIStringBundle.idl
+++ b/intl/strres/nsIStringBundle.idl
@@ -24,29 +24,50 @@
 %}
 
 native nsStrBundleLoadedFunc(nsStrBundleLoadedFunc);
 
 [scriptable, uuid(D85A17C2-AA7C-11d2-9B8C-00805F8A16D9)]
 interface nsIStringBundle : nsISupports
 {
   wstring GetStringFromID(in long aID);
-  wstring GetStringFromName(in wstring aName);
+
+  // This method is mostly used from JS, where AUTF8String is appropriate.
+  [binaryname(GetStringFromAUTF8Name)]
+  wstring GetStringFromName(in AUTF8String aName);
+
+  // This method is mostly used from C++, where |string| is appropriate because
+  // the names are most often 8-bit string literals (normally ASCII, though
+  // u8"foo" literals will also work).
+  [noscript, binaryname(GetStringFromName)]
+  wstring GetStringFromNameCpp(in string aName);
 
   // this is kind of like smprintf - except that you can
   // only pass it unicode strings, using the %S formatting character.
   // the id or name should refer to a string in the bundle that
   // uses %S.. do NOT try to use any other types.
   // this uses nsTextFormatter::smprintf to do the dirty work.
   wstring formatStringFromID(in long aID,
                              [array, size_is(length)] in wstring params,
                              in unsigned long length);
-  wstring formatStringFromName(in wstring aName,
+
+  // This method is mostly used from JS, where AUTF8String is appropriate.
+  [binaryname(FormatStringFromAUTF8Name)]
+  wstring formatStringFromName(in AUTF8String aName,
                                [array, size_is(length)] in wstring params,
                                in unsigned long length);
+
+  // This method is mostly used from C++, where |string| is appropriate because
+  // the names are most often 8-bit string literals (normally ASCII, though
+  // u8"foo" literals will also work).
+  [noscript, binaryname(FormatStringFromName)]
+  wstring formatStringFromNameCpp(in string aName,
+                                  [array, size_is(length)] in wstring params,
+                                  in unsigned long length);
+
   /*
   Implements nsISimpleEnumerator, replaces nsIEnumerator 
   */
   nsISimpleEnumerator getSimpleEnumeration();
 
 };
 
 [scriptable, uuid(D85A17C0-AA7C-11d2-9B8C-00805F8A16D9)]
--- a/intl/strres/nsStringBundle.cpp
+++ b/intl/strres/nsStringBundle.cpp
@@ -132,68 +132,77 @@ nsStringBundle::GetStringFromID(int32_t 
   }
 
   rv = mProps->GetStringProperty(name, aResult);
 
   return rv;
 }
 
 nsresult
-nsStringBundle::GetStringFromName(const nsAString& aName,
-                                  nsAString& aResult)
+nsStringBundle::GetStringFromName(const char* aName, nsAString& aResult)
 {
   nsresult rv;
 
   // try override first
   if (mOverrideStrings) {
     rv = mOverrideStrings->GetStringFromName(mPropertiesURL,
-                                             NS_ConvertUTF16toUTF8(aName),
+                                             nsDependentCString(aName),
                                              aResult);
     if (NS_SUCCEEDED(rv)) return rv;
   }
 
-  rv = mProps->GetStringProperty(NS_ConvertUTF16toUTF8(aName), aResult);
+  rv = mProps->GetStringProperty(nsDependentCString(aName), aResult);
   return rv;
 }
 
 NS_IMETHODIMP
 nsStringBundle::FormatStringFromID(int32_t aID,
                                    const char16_t **aParams,
                                    uint32_t aLength,
                                    char16_t ** aResult)
 {
-  nsAutoString idStr;
+  nsAutoCString idStr;
   idStr.AppendInt(aID, 10);
 
   return FormatStringFromName(idStr.get(), aParams, aLength, aResult);
 }
 
 // this function supports at most 10 parameters.. see below for why
 NS_IMETHODIMP
-nsStringBundle::FormatStringFromName(const char16_t *aName,
-                                     const char16_t **aParams,
+nsStringBundle::FormatStringFromAUTF8Name(const nsACString& aName,
+                                          const char16_t **aParams,
+                                          uint32_t aLength,
+                                          char16_t **aResult)
+{
+  return FormatStringFromName(PromiseFlatCString(aName).get(), aParams,
+                              aLength, aResult);
+}
+
+// this function supports at most 10 parameters.. see below for why
+NS_IMETHODIMP
+nsStringBundle::FormatStringFromName(const char* aName,
+                                     const char16_t** aParams,
                                      uint32_t aLength,
-                                     char16_t **aResult)
+                                     char16_t** aResult)
 {
   NS_ENSURE_ARG_POINTER(aName);
   NS_ASSERTION(aParams && aLength, "FormatStringFromName() without format parameters: use GetStringFromName() instead");
   NS_ENSURE_ARG_POINTER(aResult);
 
   nsresult rv;
   rv = LoadProperties();
   if (NS_FAILED(rv)) return rv;
 
   nsAutoString formatStr;
-  rv = GetStringFromName(nsDependentString(aName), formatStr);
+  rv = GetStringFromName(aName, formatStr);
   if (NS_FAILED(rv)) return rv;
 
   return FormatString(formatStr.get(), aParams, aLength, aResult);
 }
 
-
 NS_IMPL_ISUPPORTS(nsStringBundle, nsIStringBundle)
 
 NS_IMETHODIMP
 nsStringBundle::GetStringFromID(int32_t aID, char16_t **aResult)
 {
   nsresult rv;
   rv = LoadProperties();
   if (NS_FAILED(rv)) return rv;
@@ -206,39 +215,37 @@ nsStringBundle::GetStringFromID(int32_t 
 
   *aResult = ToNewUnicode(tmpstr);
   NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsStringBundle::GetStringFromName(const char16_t *aName, char16_t **aResult)
+nsStringBundle::GetStringFromAUTF8Name(const nsACString& aName,
+                                       char16_t **aResult)
+{
+  return GetStringFromName(PromiseFlatCString(aName).get(), aResult);
+}
+
+NS_IMETHODIMP
+nsStringBundle::GetStringFromName(const char* aName, char16_t** aResult)
 {
   NS_ENSURE_ARG_POINTER(aName);
   NS_ENSURE_ARG_POINTER(aResult);
 
   nsresult rv;
   rv = LoadProperties();
   if (NS_FAILED(rv)) return rv;
 
   ReentrantMonitorAutoEnter automon(mReentrantMonitor);
   *aResult = nullptr;
   nsAutoString tmpstr;
-  rv = GetStringFromName(nsDependentString(aName), tmpstr);
-  if (NS_FAILED(rv))
-  {
-#if 0
-    // it is not uncommon for apps to request a string name which may not exist
-    // so be quiet about it.
-    NS_WARNING("String missing from string bundle");
-    printf("  '%s' missing from bundle %s\n", NS_ConvertUTF16toUTF8(aName).get(), mPropertiesURL.get());
-#endif
-    return rv;
-  }
+  rv = GetStringFromName(aName, tmpstr);
+  if (NS_FAILED(rv)) return rv;
 
   *aResult = ToNewUnicode(tmpstr);
   NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
 
   return NS_OK;
 }
 
 nsresult
@@ -428,18 +435,24 @@ nsresult nsExtensibleStringBundle::GetSt
       if (NS_SUCCEEDED(rv))
         return NS_OK;
     }
   }
 
   return NS_ERROR_FAILURE;
 }
 
-nsresult nsExtensibleStringBundle::GetStringFromName(const char16_t *aName,
-                                                     char16_t ** aResult)
+nsresult nsExtensibleStringBundle::GetStringFromAUTF8Name(
+  const nsACString& aName, char16_t ** aResult)
+{
+  return GetStringFromName(PromiseFlatCString(aName).get(), aResult);
+}
+
+nsresult nsExtensibleStringBundle::GetStringFromName(const char* aName,
+                                                     char16_t** aResult)
 {
   nsresult rv;
   const uint32_t size = mBundles.Count();
   for (uint32_t i = 0; i < size; ++i) {
     nsIStringBundle* bundle = mBundles[i];
     if (bundle) {
       rv = bundle->GetStringFromName(aName, aResult);
       if (NS_SUCCEEDED(rv))
@@ -451,26 +464,36 @@ nsresult nsExtensibleStringBundle::GetSt
 }
 
 NS_IMETHODIMP
 nsExtensibleStringBundle::FormatStringFromID(int32_t aID,
                                              const char16_t ** aParams,
                                              uint32_t aLength,
                                              char16_t ** aResult)
 {
-  nsAutoString idStr;
+  nsAutoCString idStr;
   idStr.AppendInt(aID, 10);
   return FormatStringFromName(idStr.get(), aParams, aLength, aResult);
 }
 
 NS_IMETHODIMP
-nsExtensibleStringBundle::FormatStringFromName(const char16_t *aName,
-                                               const char16_t ** aParams,
+nsExtensibleStringBundle::FormatStringFromAUTF8Name(const nsACString& aName,
+                                                    const char16_t ** aParams,
+                                                    uint32_t aLength,
+                                                    char16_t ** aResult)
+{
+  return FormatStringFromName(PromiseFlatCString(aName).get(),
+                              aParams, aLength, aResult);
+}
+
+NS_IMETHODIMP
+nsExtensibleStringBundle::FormatStringFromName(const char* aName,
+                                               const char16_t** aParams,
                                                uint32_t aLength,
-                                               char16_t ** aResult)
+                                               char16_t** aResult)
 {
   nsXPIDLString formatStr;
   nsresult rv;
   rv = GetStringFromName(aName, getter_Copies(formatStr));
   if (NS_FAILED(rv))
     return rv;
 
   return nsStringBundle::FormatString(formatStr, aParams, aLength, aResult);
--- a/intl/strres/nsStringBundle.h
+++ b/intl/strres/nsStringBundle.h
@@ -25,21 +25,19 @@ public:
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISTRINGBUNDLE
 
     nsCOMPtr<nsIPersistentProperties> mProps;
 
 protected:
     virtual ~nsStringBundle();
 
-    //
-    // functional decomposition of the funitions repeatively called
-    //
+    // Functional decomposition of the functions repeatedly called.
     nsresult GetStringFromID(int32_t aID, nsAString& aResult);
-    nsresult GetStringFromName(const nsAString& aName, nsAString& aResult);
+    nsresult GetStringFromName(const char* aName, nsAString& aResult);
 
     nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
                                     nsISimpleEnumerator** aResult);
 private:
     nsCString              mPropertiesURL;
     nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
     mozilla::ReentrantMonitor    mReentrantMonitor;
     bool                         mAttemptedLoad;
--- a/intl/unicharutil/nsEntityConverter.cpp
+++ b/intl/unicharutil/nsEntityConverter.cpp
@@ -101,17 +101,17 @@ nsEntityConverter::ConvertUTF32ToEntity(
 
     nsIStringBundle* entities = GetVersionBundleInstance(entityVersion & mask);
     NS_ASSERTION(entities, "Cannot get the entity");
 
     if (!entities) {
       continue;
     }
 
-    nsAutoString key(NS_LITERAL_STRING("entity."));
+    nsAutoCString key("entity.");
     key.AppendInt(character,10);
 
     nsXPIDLString value;
     nsresult rv = entities->GetStringFromName(key.get(), getter_Copies(value));
     if (NS_SUCCEEDED(rv)) {
       *_retval = ToNewCString(value);
       return NS_OK;
     }
@@ -127,17 +127,17 @@ nsEntityConverter::ConvertToEntities(con
 
   *_retval = nullptr;
 
   nsString outString;
 
   // per character look for the entity
   uint32_t len = NS_strlen(inString);
   for (uint32_t i = 0; i < len; i++) {
-    nsAutoString key(NS_LITERAL_STRING("entity."));
+    nsAutoCString key("entity.");
     if (NS_IS_HIGH_SURROGATE(inString[i]) && i + 2 < len && NS_IS_LOW_SURROGATE(inString[i + 1])) {
       key.AppendInt(SURROGATE_TO_UCS4(inString[i], inString[i+1]), 10);
       ++i;
     } else {
       key.AppendInt(inString[i],10);
     }
 
     nsXPIDLString value;
@@ -149,17 +149,18 @@ nsEntityConverter::ConvertToEntities(con
       }
       nsIStringBundle* entities = GetVersionBundleInstance(entityVersion & mask);
       NS_ASSERTION(entities, "Cannot get the property file");
 
       if (!entities) {
         continue;
       }
 
-      nsresult rv = entities->GetStringFromName(key.get(), getter_Copies(value));
+      nsresult rv =
+        entities->GetStringFromName(key.get(), getter_Copies(value));
       if (NS_SUCCEEDED(rv)) {
         entity = value.get();
         break;
       }
     }
     if (entity) {
       outString.Append(entity);
     } else {
--- a/layout/printing/nsPrintData.cpp
+++ b/layout/printing/nsPrintData.cpp
@@ -44,17 +44,17 @@ nsPrintData::nsPrintData(ePrintDataType 
   , mBrandName(nullptr)
 {
   nsCOMPtr<nsIStringBundle> brandBundle;
   nsCOMPtr<nsIStringBundleService> svc =
     mozilla::services::GetStringBundleService();
   if (svc) {
     svc->CreateBundle( "chrome://branding/locale/brand.properties", getter_AddRefs( brandBundle ) );
     if (brandBundle) {
-      brandBundle->GetStringFromName(u"brandShortName", &mBrandName );
+      brandBundle->GetStringFromName("brandShortName", &mBrandName );
     }
   }
 
   if (!mBrandName) {
     mBrandName = ToNewUnicode(NS_LITERAL_STRING("Mozilla Document"));
   }
 
 }
--- a/layout/style/ErrorReporter.cpp
+++ b/layout/style/ErrorReporter.cpp
@@ -297,48 +297,47 @@ ErrorReporter::AddToError(const nsString
 }
 
 void
 ErrorReporter::ReportUnexpected(const char *aMessage)
 {
   if (!ShouldReportErrors()) return;
 
   nsAutoString str;
-  sStringBundle->GetStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(),
-                                   getter_Copies(str));
+  sStringBundle->GetStringFromName(aMessage, getter_Copies(str));
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpected(const char *aMessage,
                                 const nsString &aParam)
 {
   if (!ShouldReportErrors()) return;
 
   nsAutoString qparam;
   nsStyleUtil::AppendEscapedCSSIdent(aParam, qparam);
   const char16_t *params[1] = { qparam.get() };
 
   nsAutoString str;
-  sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(),
+  sStringBundle->FormatStringFromName(aMessage,
                                       params, ArrayLength(params),
                                       getter_Copies(str));
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpectedUnescaped(const char *aMessage,
                                          const nsAutoString& aParam)
 {
   if (!ShouldReportErrors()) return;
 
   const char16_t *params[1] = { aParam.get() };
 
   nsAutoString str;
-  sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(),
+  sStringBundle->FormatStringFromName(aMessage,
                                       params, ArrayLength(params),
                                       getter_Copies(str));
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpected(const char *aMessage,
                                 const nsCSSToken &aToken)
@@ -358,17 +357,17 @@ ErrorReporter::ReportUnexpected(const ch
   if (!ShouldReportErrors()) return;
 
   nsAutoString tokenString;
   aToken.AppendToString(tokenString);
   const char16_t charStr[2] = { aChar, 0 };
   const char16_t *params[2] = { tokenString.get(), charStr };
 
   nsAutoString str;
-  sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(),
+  sStringBundle->FormatStringFromName(aMessage,
                                       params, ArrayLength(params),
                                       getter_Copies(str));
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpected(const char *aMessage,
                                 const nsString &aParam,
@@ -376,51 +375,50 @@ ErrorReporter::ReportUnexpected(const ch
 {
   if (!ShouldReportErrors()) return;
 
   nsAutoString qparam;
   nsStyleUtil::AppendEscapedCSSIdent(aParam, qparam);
   const char16_t *params[2] = { qparam.get(), aValue.get() };
 
   nsAutoString str;
-  sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(),
+  sStringBundle->FormatStringFromName(aMessage,
                                       params, ArrayLength(params),
                                       getter_Copies(str));
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpectedEOF(const char *aMessage)
 {
   if (!ShouldReportErrors()) return;
 
   nsAutoString innerStr;
-  sStringBundle->GetStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(),
-                                   getter_Copies(innerStr));
+  sStringBundle->GetStringFromName(aMessage, getter_Copies(innerStr));
   const char16_t *params[1] = { innerStr.get() };
 
   nsAutoString str;
-  sStringBundle->FormatStringFromName(u"PEUnexpEOF2",
+  sStringBundle->FormatStringFromName("PEUnexpEOF2",
                                       params, ArrayLength(params),
                                       getter_Copies(str));
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpectedEOF(char16_t aExpected)
 {
   if (!ShouldReportErrors()) return;
 
   const char16_t expectedStr[] = {
     char16_t('\''), aExpected, char16_t('\''), char16_t(0)
   };
   const char16_t *params[1] = { expectedStr };
 
   nsAutoString str;
-  sStringBundle->FormatStringFromName(u"PEUnexpEOF2",
+  sStringBundle->FormatStringFromName("PEUnexpEOF2",
                                       params, ArrayLength(params),
                                       getter_Copies(str));
   AddToError(str);
 }
 
 } // namespace css
 } // namespace mozilla
 
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -1100,17 +1100,18 @@ nsMenuFrame::BuildAcceleratorText(bool a
         mozilla::services::GetStringBundleService();
       if (bundleService) {
         nsCOMPtr<nsIStringBundle> bundle;
         rv = bundleService->CreateBundle("chrome://global/locale/keys.properties",
                                          getter_AddRefs(bundle));
 
         if (NS_SUCCEEDED(rv) && bundle) {
           nsXPIDLString keyName;
-          rv = bundle->GetStringFromName(keyCode.get(), getter_Copies(keyName));
+          rv = bundle->GetStringFromName(NS_ConvertUTF16toUTF8(keyCode).get(),
+                                         getter_Copies(keyName));
           if (keyName)
             accelString = keyName;
         }
       }
 
       // nothing usable found, bail
       if (accelString.IsEmpty())
         return;
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.cpp
@@ -855,21 +855,17 @@ nsresult nsPrefBranch::GetDefaultFromPro
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(propertyFileURL,
                                    getter_AddRefs(bundle));
   if (NS_FAILED(rv))
     return rv;
 
-  // string names are in unicode
-  nsAutoString stringId;
-  stringId.AssignASCII(aPrefName);
-
-  return bundle->GetStringFromName(stringId.get(), return_buf);
+  return bundle->GetStringFromName(aPrefName, return_buf);
 }
 
 nsPrefBranch::PrefName
 nsPrefBranch::getPrefName(const char *aPrefName) const
 {
   NS_ASSERTION(aPrefName, "null pref name!");
 
   // for speed, avoid strcpy if we can:
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -2590,17 +2590,17 @@ NS_ShouldSecureUpgrade(nsIURI* aURI,
         aURI->GetScheme(scheme);
         // append the additional 's' for security to the scheme :-)
         scheme.AppendASCII("s");
         NS_ConvertUTF8toUTF16 reportSpec(aURI->GetSpecOrDefault());
         NS_ConvertUTF8toUTF16 reportScheme(scheme);
 
         const char16_t* params[] = { reportSpec.get(), reportScheme.get() };
         uint32_t innerWindowId = aLoadInfo->GetInnerWindowID();
-        CSP_LogLocalizedStr(u"upgradeInsecureRequest",
+        CSP_LogLocalizedStr("upgradeInsecureRequest",
                             params, ArrayLength(params),
                             EmptyString(), // aSourceFile
                             EmptyString(), // aScriptSample
                             0, // aLineNumber
                             0, // aColumnNumber
                             nsIScriptError::warningFlag, "CSP",
                             innerWindowId);
 
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -939,17 +939,18 @@ nsFtpState::R_syst() {
                                                       getter_AddRefs(bundle));
             if (NS_FAILED(rv))
                 return FTP_ERROR;
 
             char16_t* ucs2Response = ToNewUnicode(mResponseMsg);
             const char16_t *formatStrings[1] = { ucs2Response };
 
             nsXPIDLString formattedString;
-            rv = bundle->FormatStringFromName(u"UnsupportedFTPServer", formatStrings, 1,
+            rv = bundle->FormatStringFromName("UnsupportedFTPServer",
+                                              formatStrings, 1,
                                               getter_Copies(formattedString));
             free(ucs2Response);
             if (NS_FAILED(rv))
                 return FTP_ERROR;
 
             // TODO(darin): this code should not be dictating UI like this!
             nsCOMPtr<nsIPrompt> prompter;
             mChannel->GetCallback(prompter);
--- a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp
+++ b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp
@@ -822,27 +822,27 @@ mount_operation_ask_password (GMountOper
     return;
   }
   nsAutoString nsmessage;
 
   if (flags & G_ASK_PASSWORD_NEED_PASSWORD) {
     if (flags & G_ASK_PASSWORD_NEED_USERNAME) {
       if (!realm.IsEmpty()) {
         const char16_t *strings[] = { realm.get(), dispHost.get() };
-        bundle->FormatStringFromName(u"EnterLoginForRealm3",
+        bundle->FormatStringFromName("EnterLoginForRealm3",
                                      strings, 2, getter_Copies(nsmessage));
       } else {
         const char16_t *strings[] = { dispHost.get() };
-        bundle->FormatStringFromName(u"EnterUserPasswordFor2",
+        bundle->FormatStringFromName("EnterUserPasswordFor2",
                                      strings, 1, getter_Copies(nsmessage));
       }
     } else {
       NS_ConvertUTF8toUTF16 userName(default_user);
       const char16_t *strings[] = { userName.get(), dispHost.get() };
-      bundle->FormatStringFromName(u"EnterPasswordFor",
+      bundle->FormatStringFromName("EnterPasswordFor",
                                    strings, 2, getter_Copies(nsmessage));
     }
   } else {
     g_warning("Unknown mount operation request (flags: %x)", flags);
   }
 
   if (nsmessage.IsEmpty()) {
     g_mount_operation_reply(mount_op, G_MOUNT_OPERATION_ABORTED);
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2741,17 +2741,18 @@ nsHttpChannel::PromptTempRedirect()
             do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return rv;
 
     nsCOMPtr<nsIStringBundle> stringBundle;
     rv = bundleService->CreateBundle(NECKO_MSGS_URL, getter_AddRefs(stringBundle));
     if (NS_FAILED(rv)) return rv;
 
     nsXPIDLString messageString;
-    rv = stringBundle->GetStringFromName(u"RepostFormData", getter_Copies(messageString));
+    rv = stringBundle->GetStringFromName("RepostFormData",
+                                         getter_Copies(messageString));
     // GetStringFromName can return NS_OK and nullptr messageString.
     if (NS_SUCCEEDED(rv) && messageString) {
         bool repost = false;
 
         nsCOMPtr<nsIPrompt> prompt;
         GetCallback(prompt);
         if (!prompt)
             return NS_ERROR_NO_INTERFACE;
--- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
+++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
@@ -283,17 +283,17 @@ nsHttpChannelAuthProvider::CheckForSuper
 
     MOZ_ASSERT(mAuthChannel, "Channel not initialized");
 
     // we've been called because it has been determined that this channel is
     // getting loaded without taking the userpass from the URL.  if the URL
     // contained a userpass, then (provided some other conditions are true),
     // we'll give the user an opportunity to abort the channel as this might be
     // an attempt to spoof a different site (see bug 232567).
-    if (!ConfirmAuth(NS_LITERAL_STRING("SuperfluousAuth"), true)) {
+    if (!ConfirmAuth("SuperfluousAuth", true)) {
         // calling cancel here sets our mStatus and aborts the HTTP
         // transaction, which prevents OnDataAvailable events.
         Unused << mAuthChannel->Cancel(NS_ERROR_ABORT);
         return NS_ERROR_ABORT;
     }
     return NS_OK;
 }
 
@@ -924,17 +924,17 @@ nsHttpChannelAuthProvider::GetCredential
             if (NS_FAILED(rv)) return rv;
             identFromURI = false;
         }
     }
 
     if (identFromURI) {
         // Warn the user before automatically using the identity from the URL
         // to automatically log them into a site (see bug 232567).
-        if (!ConfirmAuth(NS_LITERAL_STRING("AutomaticAuth"), false)) {
+        if (!ConfirmAuth("AutomaticAuth", false)) {
             // calling cancel here sets our mStatus and aborts the HTTP
             // transaction, which prevents OnDataAvailable events.
             rv = mAuthChannel->Cancel(NS_ERROR_ABORT);
             MOZ_ASSERT(NS_SUCCEEDED(rv));
             // this return code alone is not equivalent to Cancel, since
             // it only instructs our caller that authentication failed.
             // without an explicit call to Cancel, our caller would just
             // load the page that accompanies the HTTP auth challenge.
@@ -1504,18 +1504,18 @@ nsHttpChannelAuthProvider::ContinueOnAut
     mRemainingChallenges.Truncate();
 
     Unused << mAuthChannel->OnAuthAvailable();
 
     return NS_OK;
 }
 
 bool
-nsHttpChannelAuthProvider::ConfirmAuth(const nsString &bundleKey,
-                                       bool            doYesNoPrompt)
+nsHttpChannelAuthProvider::ConfirmAuth(const char* bundleKey,
+                                       bool        doYesNoPrompt)
 {
     // skip prompting the user if
     //   1) we've already prompted the user
     //   2) we're not a toplevel channel
     //   3) the userpass length is less than the "phishy" threshold
 
     uint32_t loadFlags;
     nsresult rv = mAuthChannel->GetLoadFlags(&loadFlags);
@@ -1582,17 +1582,17 @@ nsHttpChannelAuthProvider::ConfirmAuth(c
       if (cutPoint > 0) {
         ucsHost.Replace(0, cutPoint, nsContentUtils::GetLocalizedEllipsis());
       }
     }
 
     const char16_t *strs[2] = { ucsHost.get(), ucsUser.get() };
 
     nsXPIDLString msg;
-    bundle->FormatStringFromName(bundleKey.get(), strs, 2, getter_Copies(msg));
+    bundle->FormatStringFromName(bundleKey, strs, 2, getter_Copies(msg));
     if (!msg)
         return true;
 
     nsCOMPtr<nsIInterfaceRequestor> callbacks;
     rv = mAuthChannel->GetNotificationCallbacks(getter_AddRefs(callbacks));
     if (NS_FAILED(rv))
         return true;
 
--- a/netwerk/protocol/http/nsHttpChannelAuthProvider.h
+++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.h
@@ -80,17 +80,17 @@ private:
                                bool proxyAuth, nsIHttpAuthenticator *auth,
                                nsCString& creds);
     MOZ_MUST_USE nsresult PromptForIdentity(uint32_t level, bool proxyAuth,
                                             const char *realm,
                                             const char *authType,
                                             uint32_t authFlags,
                                             nsHttpAuthIdentity &);
 
-    bool     ConfirmAuth(const nsString &bundleKey, bool doYesNoPrompt);
+    bool     ConfirmAuth(const char* bundleKey, bool doYesNoPrompt);
     void     SetAuthorizationHeader(nsHttpAuthCache *, nsHttpAtom header,
                                     const char *scheme, const char *host,
                                     int32_t port, const char *path,
                                     nsHttpAuthIdentity &ident);
     MOZ_MUST_USE nsresult GetCurrentPath(nsACString &);
     /**
      * Return all information needed to build authorization information,
      * all parameters except proxyAuth are out parameters. proxyAuth specifies
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -522,17 +522,17 @@ nsIndexedToHTML::DoOnStartRequest(nsIReq
     htmlEscSpec.Adopt(nsEscapeHTML2(unEscapeSpec.get(),
                                     unEscapeSpec.Length()));
 
     nsXPIDLString title;
     const char16_t* formatTitle[] = {
         htmlEscSpec.get()
     };
 
-    rv = mBundle->FormatStringFromName(u"DirTitle",
+    rv = mBundle->FormatStringFromName("DirTitle",
                                        formatTitle,
                                        sizeof(formatTitle)/sizeof(char16_t*),
                                        getter_Copies(title));
     if (NS_FAILED(rv)) return rv;
 
     // we want to convert string bundle to NCR
     // to ensure they're shown in any charsets
     AppendNonAsciiToNCR(title, buffer);
@@ -574,74 +574,74 @@ nsIndexedToHTML::DoOnStartRequest(nsIReq
     buffer.AppendLiteral("</head>\n<body dir=\"");
     buffer.Append(direction);
     buffer.AppendLiteral("\">\n<h1>");
 
     const char16_t* formatHeading[] = {
         htmlEscSpec.get()
     };
 
-    rv = mBundle->FormatStringFromName(u"DirTitle",
+    rv = mBundle->FormatStringFromName("DirTitle",
                                        formatHeading,
                                        sizeof(formatHeading)/sizeof(char16_t*),
                                        getter_Copies(title));
     if (NS_FAILED(rv)) return rv;
 
     AppendNonAsciiToNCR(title, buffer);
     buffer.AppendLiteral("</h1>\n");
 
     if (!parentStr.IsEmpty()) {
         nsXPIDLString parentText;
-        rv = mBundle->GetStringFromName(u"DirGoUp",
+        rv = mBundle->GetStringFromName("DirGoUp",
                                         getter_Copies(parentText));
         if (NS_FAILED(rv)) return rv;
 
         buffer.AppendLiteral("<p id=\"UI_goUp\"><a class=\"up\" href=\"");
 
         nsAdoptingCString htmlParentStr(nsEscapeHTML(parentStr.get()));
         buffer.Append(htmlParentStr);
         buffer.AppendLiteral("\">");
         AppendNonAsciiToNCR(parentText, buffer);
         buffer.AppendLiteral("</a></p>\n");
     }
 
     if (isSchemeFile) {
         nsXPIDLString showHiddenText;
-        rv = mBundle->GetStringFromName(u"ShowHidden",
+        rv = mBundle->GetStringFromName("ShowHidden",
                                         getter_Copies(showHiddenText));
         if (NS_FAILED(rv)) return rv;
 
         buffer.AppendLiteral("<p id=\"UI_showHidden\" style=\"display:none\"><label><input type=\"checkbox\" checked onchange=\"updateHidden()\">");
         AppendNonAsciiToNCR(showHiddenText, buffer);
         buffer.AppendLiteral("</label></p>\n");
     }
 
     buffer.AppendLiteral("<table>\n");
 
     nsXPIDLString columnText;
 
     buffer.AppendLiteral(" <thead>\n"
                          "  <tr>\n"
                          "   <th>");
 
-    rv = mBundle->GetStringFromName(u"DirColName",
+    rv = mBundle->GetStringFromName("DirColName",
                                     getter_Copies(columnText));
     if (NS_FAILED(rv)) return rv;
     AppendNonAsciiToNCR(columnText, buffer);
     buffer.AppendLiteral("</th>\n"
                          "   <th>");
 
-    rv = mBundle->GetStringFromName(u"DirColSize",
+    rv = mBundle->GetStringFromName("DirColSize",
                                     getter_Copies(columnText));
     if (NS_FAILED(rv)) return rv;
     AppendNonAsciiToNCR(columnText, buffer);
     buffer.AppendLiteral("</th>\n"
                          "   <th colspan=\"2\">");
 
-    rv = mBundle->GetStringFromName(u"DirColMTime",
+    rv = mBundle->GetStringFromName("DirColMTime",
                                     getter_Copies(columnText));
     if (NS_FAILED(rv)) return rv;
     AppendNonAsciiToNCR(columnText, buffer);
     buffer.AppendLiteral("</th>\n"
                          "  </tr>\n"
                          " </thead>\n");
     buffer.AppendLiteral(" <tbody>\n");
 
@@ -790,17 +790,17 @@ nsIndexedToHTML::OnIndexAvailable(nsIReq
             nsAdoptingCString htmlFileExt(nsEscapeHTML(locEscaped.get()));
             pushBuffer.Append(htmlFileExt);
         } else {
             pushBuffer.AppendLiteral("unknown");
         }
         pushBuffer.AppendLiteral("?size=16\" alt=\"");
 
         nsXPIDLString altText;
-        rv = mBundle->GetStringFromName(u"DirFileLabel",
+        rv = mBundle->GetStringFromName("DirFileLabel",
                                         getter_Copies(altText));
         if (NS_FAILED(rv)) return rv;
         AppendNonAsciiToNCR(altText, pushBuffer);
         pushBuffer.AppendLiteral("\">");
     }
 
     pushBuffer.Append(escaped);
     pushBuffer.AppendLiteral("</a></td></tr></tbody></table></td>\n <td");
--- a/parser/html/nsHtml5PlainTextUtils.cpp
+++ b/parser/html/nsHtml5PlainTextUtils.cpp
@@ -29,15 +29,15 @@ nsHtml5PlainTextUtils::NewLinkAttributes
   nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   NS_ASSERTION(NS_SUCCEEDED(rv) && bundleService, "The bundle service could not be loaded");
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle("chrome://global/locale/browser.properties",
                                    getter_AddRefs(bundle));
   NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/browser.properties could not be loaded");
   nsXPIDLString title;
   if (bundle) {
-    bundle->GetStringFromName(u"plainText.wordWrap", getter_Copies(title));
+    bundle->GetStringFromName("plainText.wordWrap", getter_Copies(title));
   }
 
   linkAttrs->addAttribute(
     nsHtml5AttributeName::ATTR_TITLE, nsHtml5String::FromString(title), -1);
   return linkAttrs;
 }
--- a/parser/htmlparser/nsParserMsgUtils.cpp
+++ b/parser/htmlparser/nsParserMsgUtils.cpp
@@ -31,21 +31,20 @@ nsParserMsgUtils::GetLocalizedStringByNa
   oVal.Truncate();
 
   NS_ENSURE_ARG_POINTER(aKey);
 
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv = GetBundle(aPropFileName,getter_AddRefs(bundle));
   if (NS_SUCCEEDED(rv) && bundle) {
     nsXPIDLString valUni;
-    nsAutoString key; key.AssignWithConversion(aKey);
-    rv = bundle->GetStringFromName(key.get(), getter_Copies(valUni));
+    rv = bundle->GetStringFromName(aKey, getter_Copies(valUni));
     if (NS_SUCCEEDED(rv) && valUni) {
       oVal.Assign(valUni);
-    }  
+    }
   }
 
   return rv;
 }
 
 nsresult
 nsParserMsgUtils::GetLocalizedStringByID(const char * aPropFileName, uint32_t aID, nsString& oVal)
 {
--- a/security/manager/pki/nsNSSDialogs.cpp
+++ b/security/manager/pki/nsNSSDialogs.cpp
@@ -315,17 +315,17 @@ nsNSSDialogs::GetPKCS12FilePassword(nsII
   nsCOMPtr<nsIPromptService> promptSvc(
     do_GetService(NS_PROMPTSERVICE_CONTRACTID));
   if (!promptSvc) {
     return NS_ERROR_FAILURE;
   }
 
   nsAutoString msg;
   nsresult rv = mPIPStringBundle->GetStringFromName(
-    u"getPKCS12FilePasswordMessage", getter_Copies(msg));
+    "getPKCS12FilePasswordMessage", getter_Copies(msg));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // Get the parent window for the dialog
   nsCOMPtr<mozIDOMWindowProxy> parent = do_GetInterface(ctx);
   bool ignored = false;
   char16_t* pwTemp = nullptr;
--- a/security/manager/ssl/NSSErrorsService.cpp
+++ b/security/manager/ssl/NSSErrorsService.cpp
@@ -188,19 +188,17 @@ NSSErrorsService::GetErrorMessage(nsresu
     theBundle = mNSSErrorsBundle;
   }
 
   if (!id_str || !theBundle) {
     return NS_ERROR_FAILURE;
   }
 
   nsAutoString msg;
-  nsresult rv =
-    theBundle->GetStringFromName(NS_ConvertASCIItoUTF16(id_str).get(),
-                                 getter_Copies(msg));
+  nsresult rv = theBundle->GetStringFromName(id_str, getter_Copies(msg));
   if (NS_SUCCEEDED(rv)) {
     aErrorMessage = msg;
   }
   return rv;
 }
 
 } // namespace psm
 } // namespace mozilla
--- a/security/manager/ssl/nsNSSCertHelper.cpp
+++ b/security/manager/ssl/nsNSSCertHelper.cpp
@@ -101,18 +101,18 @@ GetPIPNSSBundleString(const char* string
     return NS_ERROR_INVALID_ARG;
   }
   nsCOMPtr<nsIStringBundle> pipnssBundle;
   nsresult rv = GetPIPNSSBundle(getter_AddRefs(pipnssBundle));
   if (NS_FAILED(rv)) {
     return rv;
   }
   result.Truncate();
-  return pipnssBundle->GetStringFromName(
-    NS_ConvertASCIItoUTF16(stringName).get(), getter_Copies(result));
+  return pipnssBundle->GetStringFromName(stringName,
+                                         getter_Copies(result));
 }
 
 static nsresult
 PIPBundleFormatStringFromName(const char* stringName, const char16_t** params,
                               uint32_t numParams, nsAString& result)
 {
   MOZ_ASSERT(stringName);
   MOZ_ASSERT(params);
@@ -121,18 +121,17 @@ PIPBundleFormatStringFromName(const char
   }
   nsCOMPtr<nsIStringBundle> pipnssBundle;
   nsresult rv = GetPIPNSSBundle(getter_AddRefs(pipnssBundle));
   if (NS_FAILED(rv)) {
     return rv;
   }
   result.Truncate();
   return pipnssBundle->FormatStringFromName(
-    NS_ConvertASCIItoUTF16(stringName).get(), params, numParams,
-    getter_Copies(result));
+    stringName, params, numParams, getter_Copies(result));
 }
 
 static nsresult
 ProcessVersion(SECItem* versionItem, nsIASN1PrintableItem** retItem)
 {
   nsAutoString text;
   GetPIPNSSBundleString("CertDumpVersion", text);
   nsCOMPtr<nsIASN1PrintableItem> printableItem = new nsNSSASN1PrintableItem();
--- a/security/manager/ssl/nsNSSComponent.cpp
+++ b/security/manager/ssl/nsNSSComponent.cpp
@@ -233,17 +233,17 @@ nsNSSComponent::PIPBundleFormatStringFro
                                               uint32_t numParams,
                                               nsAString& outString)
 {
   MutexAutoLock lock(mMutex);
   nsresult rv = NS_ERROR_FAILURE;
 
   if (mPIPNSSBundle && name) {
     nsXPIDLString result;
-    rv = mPIPNSSBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(name).get(),
+    rv = mPIPNSSBundle->FormatStringFromName(name,
                                              params, numParams,
                                              getter_Copies(result));
     if (NS_SUCCEEDED(rv)) {
       outString = result;
     }
   }
   return rv;
 }
@@ -252,18 +252,17 @@ NS_IMETHODIMP
 nsNSSComponent::GetPIPNSSBundleString(const char* name, nsAString& outString)
 {
   MutexAutoLock lock(mMutex);
   nsresult rv = NS_ERROR_FAILURE;
 
   outString.SetLength(0);
   if (mPIPNSSBundle && name) {
     nsXPIDLString result;
-    rv = mPIPNSSBundle->GetStringFromName(NS_ConvertASCIItoUTF16(name).get(),
-                                          getter_Copies(result));
+    rv = mPIPNSSBundle->GetStringFromName(name, getter_Copies(result));
     if (NS_SUCCEEDED(rv)) {
       outString = result;
       rv = NS_OK;
     }
   }
 
   return rv;
 }
@@ -272,18 +271,17 @@ NS_IMETHODIMP
 nsNSSComponent::GetNSSBundleString(const char* name, nsAString& outString)
 {
   MutexAutoLock lock(mMutex);
   nsresult rv = NS_ERROR_FAILURE;
 
   outString.SetLength(0);
   if (mNSSErrorsBundle && name) {
     nsXPIDLString result;
-    rv = mNSSErrorsBundle->GetStringFromName(NS_ConvertASCIItoUTF16(name).get(),
-                                             getter_Copies(result));
+    rv = mNSSErrorsBundle->GetStringFromName(name, getter_Copies(result));
     if (NS_SUCCEEDED(rv)) {
       outString = result;
       rv = NS_OK;
     }
   }
 
   return rv;
 }
--- a/toolkit/components/downloads/nsDownloadManager.cpp
+++ b/toolkit/components/downloads/nsDownloadManager.cpp
@@ -113,18 +113,17 @@ nsDownloadManager::GetDefaultDownloadsDi
   // Vista:
   // Downloads
   // XP/2K:
   // My Documents/Downloads
   // Linux:
   // XDG user dir spec, with a fallback to Home/Downloads
 
   nsXPIDLString folderName;
-  mBundle->GetStringFromName(u"downloadsFolder",
-                             getter_Copies(folderName));
+  mBundle->GetStringFromName("downloadsFolder", getter_Copies(folderName));
 
 #if defined (XP_MACOSX)
   rv = dirService->Get(NS_OSX_DEFAULT_DOWNLOAD_DIR,
                        NS_GET_IID(nsIFile),
                        getter_AddRefs(downloadDir));
   NS_ENSURE_SUCCESS(rv, rv);
 #elif defined(XP_WIN)
   rv = dirService->Get(NS_WIN_DEFAULT_DOWNLOAD_DIR,
--- a/toolkit/components/places/Database.cpp
+++ b/toolkit/components/places/Database.cpp
@@ -1264,38 +1264,38 @@ Database::CreateBookmarkRoots()
 
   nsXPIDLString rootTitle;
   // The first root's title is an empty string.
   rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("places"),
                   NS_LITERAL_CSTRING("root________"), rootTitle);
   if (NS_FAILED(rv)) return rv;
 
   // Fetch the internationalized folder name from the string bundle.
-  rv = bundle->GetStringFromName(u"BookmarksMenuFolderTitle",
+  rv = bundle->GetStringFromName("BookmarksMenuFolderTitle",
                                  getter_Copies(rootTitle));
   if (NS_FAILED(rv)) return rv;
   rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("menu"),
                   NS_LITERAL_CSTRING("menu________"), rootTitle);
   if (NS_FAILED(rv)) return rv;
 
-  rv = bundle->GetStringFromName(u"BookmarksToolbarFolderTitle",
+  rv = bundle->GetStringFromName("BookmarksToolbarFolderTitle",
                                  getter_Copies(rootTitle));
   if (NS_FAILED(rv)) return rv;
   rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("toolbar"),
                   NS_LITERAL_CSTRING("toolbar_____"), rootTitle);
   if (NS_FAILED(rv)) return rv;
 
-  rv = bundle->GetStringFromName(u"TagsFolderTitle",
+  rv = bundle->GetStringFromName("TagsFolderTitle",
                                  getter_Copies(rootTitle));
   if (NS_FAILED(rv)) return rv;
   rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("tags"),
                   NS_LITERAL_CSTRING("tags________"), rootTitle);
   if (NS_FAILED(rv)) return rv;
 
-  rv = bundle->GetStringFromName(u"OtherBookmarksFolderTitle",
+  rv = bundle->GetStringFromName("OtherBookmarksFolderTitle",
                                  getter_Copies(rootTitle));
   if (NS_FAILED(rv)) return rv;
   rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("unfiled"),
                   NS_LITERAL_CSTRING("unfiled_____"), rootTitle);
   if (NS_FAILED(rv)) return rv;
 
   int64_t mobileRootId = CreateMobileRoot();
   if (mobileRootId <= 0) return NS_ERROR_FAILURE;
@@ -1439,17 +1439,17 @@ Database::UpdateBookmarkRootTitles()
                                  , "BookmarksToolbarFolderTitle"
                                  , "TagsFolderTitle"
                                  , "OtherBookmarksFolderTitle"
                                  , "MobileBookmarksFolderTitle"
                                  };
 
   for (uint32_t i = 0; i < ArrayLength(rootGuids); ++i) {
     nsXPIDLString title;
-    rv = bundle->GetStringFromName(NS_ConvertASCIItoUTF16(titleStringIDs[i]).get(),
+    rv = bundle->GetStringFromName(titleStringIDs[i],
                                    getter_Copies(title));
     if (NS_FAILED(rv)) return rv;
 
     nsCOMPtr<mozIStorageBindingParams> params;
     rv = paramsArray->NewBindingParams(getter_AddRefs(params));
     if (NS_FAILED(rv)) return rv;
     rv = params->BindUTF8StringByName(NS_LITERAL_CSTRING("guid"),
                                       nsDependentCString(rootGuids[i]));
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -1653,79 +1653,79 @@ PlacesSQLQueryBuilder::SelectAsDay()
     // a fixed timestamp.
     // These are used as limits for the inside containers.
     nsAutoCString sqlFragmentContainerBeginTime, sqlFragmentContainerEndTime;
     // These are used to query if the container should be visible.
     nsAutoCString sqlFragmentSearchBeginTime, sqlFragmentSearchEndTime;
     switch(i) {
        case 0:
         // Today
-         history->GetStringFromName(
-          u"finduri-AgeInDays-is-0", dateName);
+        history->GetStringFromName(
+          "finduri-AgeInDays-is-0", dateName);
         // From start of today
         sqlFragmentContainerBeginTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','utc')*1000000)");
         // To now (tomorrow)
         sqlFragmentContainerEndTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','+1 day','utc')*1000000)");
         // Search for the same timeframe.
         sqlFragmentSearchBeginTime = sqlFragmentContainerBeginTime;
         sqlFragmentSearchEndTime = sqlFragmentContainerEndTime;
          break;
        case 1:
         // Yesterday
-         history->GetStringFromName(
-          u"finduri-AgeInDays-is-1", dateName);
+        history->GetStringFromName(
+          "finduri-AgeInDays-is-1", dateName);
         // From start of yesterday
         sqlFragmentContainerBeginTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','-1 day','utc')*1000000)");
         // To start of today
         sqlFragmentContainerEndTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','utc')*1000000)");
         // Search for the same timeframe.
         sqlFragmentSearchBeginTime = sqlFragmentContainerBeginTime;
         sqlFragmentSearchEndTime = sqlFragmentContainerEndTime;
         break;
       case 2:
         // Last 7 days
         history->GetAgeInDaysString(7,
-          u"finduri-AgeInDays-last-is", dateName);
+          "finduri-AgeInDays-last-is", dateName);
         // From start of 7 days ago
         sqlFragmentContainerBeginTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','-7 days','utc')*1000000)");
         // To now (tomorrow)
         sqlFragmentContainerEndTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','+1 day','utc')*1000000)");
         // This is an overlapped container, but we show it only if there are
         // visits older than yesterday.
         sqlFragmentSearchBeginTime = sqlFragmentContainerBeginTime;
         sqlFragmentSearchEndTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','-2 days','utc')*1000000)");
         break;
       case 3:
         // This month
         history->GetStringFromName(
-          u"finduri-AgeInMonths-is-0", dateName);
+          "finduri-AgeInMonths-is-0", dateName);
         // From start of this month
         sqlFragmentContainerBeginTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of month','utc')*1000000)");
         // To now (tomorrow)
         sqlFragmentContainerEndTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','+1 day','utc')*1000000)");
         // This is an overlapped container, but we show it only if there are
         // visits older than 7 days ago.
         sqlFragmentSearchBeginTime = sqlFragmentContainerBeginTime;
         sqlFragmentSearchEndTime = NS_LITERAL_CSTRING(
           "(strftime('%s','now','localtime','start of day','-7 days','utc')*1000000)");
          break;
        default:
         if (i == HISTORY_ADDITIONAL_DATE_CONT_NUM + 6) {
           // Older than 6 months
           history->GetAgeInDaysString(6,
-            u"finduri-AgeInMonths-isgreater", dateName);
+            "finduri-AgeInMonths-isgreater", dateName);
           // From start of epoch
           sqlFragmentContainerBeginTime = NS_LITERAL_CSTRING(
             "(datetime(0, 'unixepoch')*1000000)");
           // To start of 6 months ago ( 5 months + this month).
           sqlFragmentContainerEndTime = NS_LITERAL_CSTRING(
             "(strftime('%s','now','localtime','start of month','-5 months','utc')*1000000)");
           // Search for the same timeframe.
           sqlFragmentSearchBeginTime = sqlFragmentContainerBeginTime;
@@ -1814,17 +1814,17 @@ PlacesSQLQueryBuilder::SelectAsDay()
 nsresult
 PlacesSQLQueryBuilder::SelectAsSite()
 {
   nsAutoCString localFiles;
 
   nsNavHistory *history = nsNavHistory::GetHistoryService();
   NS_ENSURE_STATE(history);
 
-  history->GetStringFromName(u"localhost", localFiles);
+  history->GetStringFromName("localhost", localFiles);
   mAddParams.Put(NS_LITERAL_CSTRING("localhost"), localFiles);
 
   // If there are additional conditions the query has to join on visits too.
   nsAutoCString visitsJoin;
   nsAutoCString additionalConditions;
   nsAutoCString timeConstraints;
   if (!mConditions.IsEmpty()) {
     visitsJoin.AssignLiteral("JOIN moz_historyvisits v ON v.place_id = h.id ");
@@ -4192,52 +4192,52 @@ void
 nsNavHistory::TitleForDomain(const nsCString& domain, nsACString& aTitle)
 {
   if (! domain.IsEmpty()) {
     aTitle = domain;
     return;
   }
 
   // use the localized one instead
-  GetStringFromName(u"localhost", aTitle);
+  GetStringFromName("localhost", aTitle);
 }
 
 void
-nsNavHistory::GetAgeInDaysString(int32_t aInt, const char16_t *aName,
+nsNavHistory::GetAgeInDaysString(int32_t aInt, const char* aName,
                                  nsACString& aResult)
 {
   nsIStringBundle *bundle = GetBundle();
   if (bundle) {
     nsAutoString intString;
     intString.AppendInt(aInt);
     const char16_t* strings[1] = { intString.get() };
     nsXPIDLString value;
     nsresult rv = bundle->FormatStringFromName(aName, strings,
                                                1, getter_Copies(value));
     if (NS_SUCCEEDED(rv)) {
       CopyUTF16toUTF8(value, aResult);
       return;
     }
   }
-  CopyUTF16toUTF8(nsDependentString(aName), aResult);
+  aResult.Assign(aName);
 }
 
 void
-nsNavHistory::GetStringFromName(const char16_t *aName, nsACString& aResult)
+nsNavHistory::GetStringFromName(const char* aName, nsACString& aResult)
 {
   nsIStringBundle *bundle = GetBundle();
   if (bundle) {
     nsXPIDLString value;
     nsresult rv = bundle->GetStringFromName(aName, getter_Copies(value));
     if (NS_SUCCEEDED(rv)) {
       CopyUTF16toUTF8(value, aResult);
       return;
     }
   }
-  CopyUTF16toUTF8(nsDependentString(aName), aResult);
+  aResult.Assign(aName);
 }
 
 // static
 void
 nsNavHistory::GetMonthName(const PRExplodedTime& aTime, nsACString& aResult)
 {
   nsAutoString month;
   nsresult rv = DateTimeFormat::FormatPRExplodedTime(kDateFormatMonthLong,
--- a/toolkit/components/places/nsNavHistory.h
+++ b/toolkit/components/places/nsNavHistory.h
@@ -204,19 +204,18 @@ public:
                                uint16_t aReason, uint32_t aTransitionType);
 
   /**
    * These functions return non-owning references to the locale-specific
    * objects for places components.
    */
   nsIStringBundle* GetBundle();
   nsICollation* GetCollation();
-  void GetStringFromName(const char16_t* aName, nsACString& aResult);
-  void GetAgeInDaysString(int32_t aInt, const char16_t *aName,
-                          nsACString& aResult);
+  void GetStringFromName(const char* aName, nsACString& aResult);
+  void GetAgeInDaysString(int32_t aInt, const char* aName, nsACString& aResult);
   static void GetMonthName(const PRExplodedTime& aTime, nsACString& aResult);
   static void GetMonthYear(const PRExplodedTime& aTime, nsACString& aResult);
 
   // Returns whether history is enabled or not.
   bool IsHistoryDisabled() {
     return !mHistoryEnabled;
   }
 
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -4665,17 +4665,17 @@ nsNavHistoryResult::OnVisit(nsIURI* aURI
       NS_ENSURE_SUCCESS(rv, rv);
       nsAutoCString title;
       rv = firstChild->GetTitle(title);
       NS_ENSURE_SUCCESS(rv, rv);
       nsNavHistory* history = nsNavHistory::GetHistoryService();
       NS_ENSURE_TRUE(history, NS_OK);
       nsAutoCString todayLabel;
       history->GetStringFromName(
-        u"finduri-AgeInDays-is-0", todayLabel);
+        "finduri-AgeInDays-is-0", todayLabel);
       todayIsMissing = !todayLabel.Equals(title);
     }
   }
 
   if (!added || todayIsMissing) {
     // None of registered query observers has accepted our URI.  This means,
     // that a matching query either was not expanded or it does not exist.
     uint32_t resultType = mRootNode->mOptions->ResultType();
--- a/toolkit/components/printingui/win/nsPrintDialogUtil.cpp
+++ b/toolkit/components/printingui/win/nsPrintDialogUtil.cpp
@@ -104,19 +104,17 @@ GetLocalizedBundle(const char * aPropFil
 static nsresult
 GetLocalizedString(nsIStringBundle* aStrBundle, const char* aKey, nsString& oVal)
 {
   NS_ENSURE_ARG_POINTER(aStrBundle);
   NS_ENSURE_ARG_POINTER(aKey);
 
   // Determine default label from string bundle
   nsXPIDLString valUni;
-  nsAutoString key;
-  key.AssignWithConversion(aKey);
-  nsresult rv = aStrBundle->GetStringFromName(key.get(), getter_Copies(valUni));
+  nsresult rv = aStrBundle->GetStringFromName(aKey, getter_Copies(valUni));
   if (NS_SUCCEEDED(rv) && valUni) {
     oVal.Assign(valUni);
   } else {
     oVal.Truncate();
   }
   return rv;
 }
 
--- a/toolkit/mozapps/extensions/AddonContentPolicy.cpp
+++ b/toolkit/mozapps/extensions/AddonContentPolicy.cpp
@@ -363,19 +363,17 @@ class CSPValidator final : public nsCSPS
 
     void FormatErrorParams(const char* aName, const char16_t** aParams, int32_t aLength)
     {
       nsresult rv = NS_ERROR_FAILURE;
 
       nsCOMPtr<nsIStringBundle> stringBundle = GetStringBundle();
 
       if (stringBundle) {
-        NS_ConvertASCIItoUTF16 name(aName);
-
-        rv = stringBundle->FormatStringFromName(name.get(), aParams, aLength,
+        rv = stringBundle->FormatStringFromName(aName, aParams, aLength,
                                                 getter_Copies(mError));
       }
 
       if (NS_WARN_IF(NS_FAILED(rv))) {
         mError.AssignLiteral("An unexpected error occurred");
       }
     };
 
--- a/toolkit/system/gnome/nsAlertsIconListener.cpp
+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp
@@ -251,17 +251,17 @@ nsAlertsIconListener::InitAlertAsync(nsI
     nsAutoCString appShortName;
     if (bundleService) {
       nsCOMPtr<nsIStringBundle> bundle;
       bundleService->CreateBundle("chrome://branding/locale/brand.properties",
                                   getter_AddRefs(bundle));
       nsAutoString appName;
 
       if (bundle) {
-        bundle->GetStringFromName(u"brandShortName",
+        bundle->GetStringFromName("brandShortName",
                                   getter_Copies(appName));
         appShortName = NS_ConvertUTF16toUTF8(appName);
       } else {
         NS_WARNING("brand.properties not present, using default application name");
         appShortName.AssignLiteral("Mozilla");
       }
     } else {
       appShortName.AssignLiteral("Mozilla");
--- a/toolkit/xre/ProfileReset.cpp
+++ b/toolkit/xre/ProfileReset.cpp
@@ -84,17 +84,17 @@ ProfileResetCleanup(nsIToolkitProfile* a
   rv = sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb));
   if (!sb) return NS_ERROR_FAILURE;
 
   NS_ConvertUTF8toUTF16 appName(gAppData->name);
   const char16_t* params[] = {appName.get(), appName.get()};
 
   nsXPIDLString resetBackupDirectoryName;
 
-  static const char16_t* kResetBackupDirectory = u"resetBackupDirectory";
+  static const char* kResetBackupDirectory = "resetBackupDirectory";
   rv = sb->FormatStringFromName(kResetBackupDirectory, params, 2,
                                 getter_Copies(resetBackupDirectoryName));
 
   // Get info to copy the old root profile dir to the desktop as a backup.
   nsCOMPtr<nsIFile> backupDest, containerDest, profileDest;
   rv = NS_GetSpecialDirectory(NS_OS_DESKTOP_DIR, getter_AddRefs(backupDest));
   if (NS_FAILED(rv)) {
     // Fall back to the home directory if the desktop is not available.
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -1956,27 +1956,27 @@ ProfileLockedDialog(nsIFile* aProfileDir
     sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb));
     NS_ENSURE_TRUE_LOG(sbs, NS_ERROR_FAILURE);
 
     NS_ConvertUTF8toUTF16 appName(gAppData->name);
     const char16_t* params[] = {appName.get(), appName.get()};
 
     nsXPIDLString killMessage;
 #ifndef XP_MACOSX
-    sb->FormatStringFromName(aUnlocker ? u"restartMessageUnlocker"
-                                       : u"restartMessageNoUnlocker",
+    sb->FormatStringFromName(aUnlocker ? "restartMessageUnlocker"
+                                       : "restartMessageNoUnlocker",
                              params, 2, getter_Copies(killMessage));
 #else
-    sb->FormatStringFromName(aUnlocker ? u"restartMessageUnlockerMac"
-                                       : u"restartMessageNoUnlockerMac",
+    sb->FormatStringFromName(aUnlocker ? "restartMessageUnlockerMac"
+                                       : "restartMessageNoUnlockerMac",
                              params, 2, getter_Copies(killMessage));
 #endif
 
     nsXPIDLString killTitle;
-    sb->FormatStringFromName(u"restartTitle",
+    sb->FormatStringFromName("restartTitle",
                              params, 1, getter_Copies(killTitle));
 
     if (!killMessage || !killTitle)
       return NS_ERROR_FAILURE;
 
     if (gfxPlatform::IsHeadless()) {
       // TODO: make a way to turn off all dialogs when headless.
       Output(true, "%s\n", NS_LossyConvertUTF16toASCII(killMessage).get());
@@ -2055,20 +2055,21 @@ ProfileMissingDialog(nsINativeAppSupport
     NS_ENSURE_TRUE_LOG(sbs, NS_ERROR_FAILURE);
 
     NS_ConvertUTF8toUTF16 appName(gAppData->name);
     const char16_t* params[] = {appName.get(), appName.get()};
 
     nsXPIDLString missingMessage;
 
     // profileMissing
-    sb->FormatStringFromName(u"profileMissing", params, 2, getter_Copies(missingMessage));
+    sb->FormatStringFromName("profileMissing",
+                             params, 2, getter_Copies(missingMessage));
 
     nsXPIDLString missingTitle;
-    sb->FormatStringFromName(u"profileMissingTitle",
+    sb->FormatStringFromName("profileMissingTitle",
                              params, 1, getter_Copies(missingTitle));
 
     if (missingMessage && missingTitle) {
       nsCOMPtr<nsIPromptService> ps
         (do_GetService(NS_PROMPTSERVICE_CONTRACTID));
       NS_ENSURE_TRUE(ps, NS_ERROR_FAILURE);
 
       ps->Alert(nullptr, missingTitle, missingMessage);
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1799,113 +1799,113 @@ NS_IMETHODIMP nsExternalAppHandler::OnSt
 
   return NS_OK;
 }
 
 // Convert error info into proper message text and send OnStatusChange
 // notification to the dialog progress listener or nsITransfer implementation.
 void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequest *aRequest, const nsString& path)
 {
-    nsAutoString msgId;
+    const char* msgId;
     switch (rv) {
     case NS_ERROR_OUT_OF_MEMORY:
         // No memory
-        msgId.AssignLiteral("noMemory");
+        msgId = "noMemory";
         break;
 
     case NS_ERROR_FILE_DISK_FULL:
     case NS_ERROR_FILE_NO_DEVICE_SPACE:
         // Out of space on target volume.
-        msgId.AssignLiteral("diskFull");
+        msgId = "diskFull";
         break;
 
     case NS_ERROR_FILE_READ_ONLY:
         // Attempt to write to read/only file.
-        msgId.AssignLiteral("readOnly");
+        msgId = "readOnly";
         break;
 
     case NS_ERROR_FILE_ACCESS_DENIED:
         if (type == kWriteError) {
           // Attempt to write without sufficient permissions.
 #if defined(ANDROID)
           // On Android (and Gonk), this means the SD card is present but
           // unavailable (read-only).
-          msgId.AssignLiteral("SDAccessErrorCardReadOnly");
+          msgId = "SDAccessErrorCardReadOnly";
 #else
-          msgId.AssignLiteral("accessError");
+          msgId = "accessError";
 #endif
         } else {
-          msgId.AssignLiteral("launchError");
+          msgId = "launchError";
         }
         break;
 
     case NS_ERROR_FILE_NOT_FOUND:
     case NS_ERROR_FILE_TARGET_DOES_NOT_EXIST:
     case NS_ERROR_FILE_UNRECOGNIZED_PATH:
         // Helper app not found, let's verify this happened on launch
         if (type == kLaunchError) {
-          msgId.AssignLiteral("helperAppNotFound");
+          msgId = "helperAppNotFound";
           break;
         }
 #if defined(ANDROID)
         else if (type == kWriteError) {
           // On Android (and Gonk), this means the SD card is missing (not in
           // SD slot).
-          msgId.AssignLiteral("SDAccessErrorCardMissing");
+          msgId = "SDAccessErrorCardMissing";
           break;
         }
 #endif
         MOZ_FALLTHROUGH;
 
     default:
         // Generic read/write/launch error message.
         switch (type) {
         case kReadError:
-          msgId.AssignLiteral("readError");
+          msgId = "readError";
           break;
         case kWriteError:
-          msgId.AssignLiteral("writeError");
+          msgId = "writeError";
           break;
         case kLaunchError:
-          msgId.AssignLiteral("launchError");
+          msgId = "launchError";
           break;
         }
         break;
     }
 
     MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Error,
         ("Error: %s, type=%i, listener=0x%p, transfer=0x%p, rv=0x%08" PRIX32 "\n",
-         NS_LossyConvertUTF16toASCII(msgId).get(), type, mDialogProgressListener.get(), mTransfer.get(),
+         msgId, type, mDialogProgressListener.get(), mTransfer.get(),
          static_cast<uint32_t>(rv)));
 
     MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Error,
         ("       path='%s'\n", NS_ConvertUTF16toUTF8(path).get()));
 
     // Get properties file bundle and extract status string.
     nsCOMPtr<nsIStringBundleService> stringService =
         mozilla::services::GetStringBundleService();
     if (stringService) {
         nsCOMPtr<nsIStringBundle> bundle;
         if (NS_SUCCEEDED(stringService->CreateBundle("chrome://global/locale/nsWebBrowserPersist.properties",
                          getter_AddRefs(bundle)))) {
             nsXPIDLString msgText;
             const char16_t *strings[] = { path.get() };
-            if (NS_SUCCEEDED(bundle->FormatStringFromName(msgId.get(), strings, 1,
+            if (NS_SUCCEEDED(bundle->FormatStringFromName(msgId, strings, 1,
                                                           getter_Copies(msgText)))) {
               if (mDialogProgressListener) {
                 // We have a listener, let it handle the error.
                 mDialogProgressListener->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText);
               } else if (mTransfer) {
                 mTransfer->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText);
               } else if (XRE_IsParentProcess()) {
                 // We don't have a listener.  Simply show the alert ourselves.
                 nsresult qiRv;
                 nsCOMPtr<nsIPrompt> prompter(do_GetInterface(GetDialogParent(), &qiRv));
                 nsXPIDLString title;
-                bundle->FormatStringFromName(u"title",
+                bundle->FormatStringFromName("title",
                                              strings,
                                              1,
                                              getter_Copies(title));
 
                 MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Debug,
                        ("mContentContext=0x%p, prompter=0x%p, qi rv=0x%08"
                         PRIX32 ", title='%s', msg='%s'",
                        mContentContext.get(),
--- a/widget/cocoa/OSXNotificationCenter.mm
+++ b/widget/cocoa/OSXNotificationCenter.mm
@@ -294,17 +294,17 @@ OSXNotificationCenter::ShowAlertWithIcon
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIStringBundle> bundle;
   nsCOMPtr<nsIStringBundleService> sbs = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
   sbs->CreateBundle("chrome://alerts/locale/alert.properties", getter_AddRefs(bundle));
 
   if (!hostPort.IsEmpty() && bundle) {
     const char16_t* formatStrings[] = { hostPort.get() };
     nsXPIDLString notificationSource;
-    bundle->FormatStringFromName(u"source.label",
+    bundle->FormatStringFromName("source.label",
                                  formatStrings,
                                  ArrayLength(formatStrings),
                                  getter_Copies(notificationSource));
     notification.subtitle = nsCocoaUtils::ToNSString(notificationSource);
   }
 
   nsAutoString text;
   rv = aAlert->GetText(text);
@@ -313,28 +313,28 @@ OSXNotificationCenter::ShowAlertWithIcon
 
   notification.soundName = NSUserNotificationDefaultSoundName;
   notification.hasActionButton = NO;
 
   // If this is not an application/extension alert, show additional actions dealing with permissions.
   bool isActionable;
   if (bundle && NS_SUCCEEDED(aAlert->GetActionable(&isActionable)) && isActionable) {
     nsXPIDLString closeButtonTitle, actionButtonTitle, disableButtonTitle, settingsButtonTitle;
-    bundle->GetStringFromName(u"closeButton.title",
+    bundle->GetStringFromName("closeButton.title",
                               getter_Copies(closeButtonTitle));
-    bundle->GetStringFromName(u"actionButton.label",
+    bundle->GetStringFromName("actionButton.label",
                               getter_Copies(actionButtonTitle));
     if (!hostPort.IsEmpty()) {
       const char16_t* formatStrings[] = { hostPort.get() };
-      bundle->FormatStringFromName(u"webActions.disableForOrigin.label",
+      bundle->FormatStringFromName("webActions.disableForOrigin.label",
                                    formatStrings,
                                    ArrayLength(formatStrings),
                                    getter_Copies(disableButtonTitle));
     }
-    bundle->GetStringFromName(u"webActions.settings.label",
+    bundle->GetStringFromName("webActions.settings.label",
                               getter_Copies(settingsButtonTitle));
 
     notification.otherButtonTitle = nsCocoaUtils::ToNSString(closeButtonTitle);
 
     // OS X 10.8 only shows action buttons if the "Alerts" style is set in
     // Notification Center preferences, and doesn't support the alternate
     // action menu.
     if ([notification respondsToSelector:@selector(set_showsButtons:)] &&
--- a/widget/cocoa/nsFilePicker.mm
+++ b/widget/cocoa/nsFilePicker.mm
@@ -115,17 +115,17 @@ NSView* nsFilePicker::GetAccessoryView()
   NSString* label = @"Format:";
 
   // Try to get the localized string.
   nsCOMPtr<nsIStringBundleService> sbs = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv = sbs->CreateBundle("chrome://global/locale/filepicker.properties", getter_AddRefs(bundle));
   if (NS_SUCCEEDED(rv)) {
     nsXPIDLString locaLabel;
-    bundle->GetStringFromName(u"formatLabel", getter_Copies(locaLabel));
+    bundle->GetStringFromName("formatLabel", getter_Copies(locaLabel));
     if (locaLabel) {
       label = [NSString stringWithCharacters:reinterpret_cast<const unichar*>(locaLabel.get())
                                       length:locaLabel.Length()];
     }
   }
 
   // set up label text field
   NSTextField* textField = [[[NSTextField alloc] init] autorelease];
--- a/widget/cocoa/nsMenuBarX.mm
+++ b/widget/cocoa/nsMenuBarX.mm
@@ -191,18 +191,18 @@ void nsMenuBarX::ConstructFallbackNative
 
   if (!stringBundle) {
     return;
   }
 
   nsXPIDLString labelUTF16;
   nsXPIDLString keyUTF16;
 
-  const char16_t* labelProp = u"quitMenuitem.label";
-  const char16_t* keyProp = u"quitMenuitem.key";
+  const char* labelProp = "quitMenuitem.label";
+  const char* keyProp = "quitMenuitem.key";
 
   stringBundle->GetStringFromName(labelProp, getter_Copies(labelUTF16));
   stringBundle->GetStringFromName(keyProp, getter_Copies(keyUTF16));
 
   NSString* labelStr = [NSString stringWithUTF8String:
                         NS_ConvertUTF16toUTF8(labelUTF16).get()];
   NSString* keyStr= [NSString stringWithUTF8String:
                      NS_ConvertUTF16toUTF8(keyUTF16).get()];
--- a/widget/cocoa/nsPrintDialogX.mm
+++ b/widget/cocoa/nsPrintDialogX.mm
@@ -303,17 +303,17 @@ static const char sHeaderFooterTags[][4]
 }
 
 - (NSString*)localizedString:(const char*)aKey
 {
   if (!mPrintBundle)
     return @"";
 
   nsXPIDLString intlString;
-  mPrintBundle->GetStringFromName(NS_ConvertUTF8toUTF16(aKey).get(), getter_Copies(intlString));
+  mPrintBundle->GetStringFromName(aKey, getter_Copies(intlString));
   NSMutableString* s = [NSMutableString stringWithUTF8String:NS_ConvertUTF16toUTF8(intlString).get()];
 
   // Remove all underscores (they're used in the GTK dialog for accesskeys).
   [s replaceOccurrencesOfString:@"_" withString:@"" options:0 range:NSMakeRange(0, [s length])];
   return s;
 }
 
 // Widget helpers
--- a/widget/gtk/nsPrintDialogGTK.cpp
+++ b/widget/gtk/nsPrintDialogGTK.cpp
@@ -50,33 +50,33 @@ ShowCustomDialog(GtkComboBox *changed_bo
   GtkWindow* printDialog = GTK_WINDOW(user_data);
   nsCOMPtr<nsIStringBundleService> bundleSvc =
        do_GetService(NS_STRINGBUNDLE_CONTRACTID);
 
   nsCOMPtr<nsIStringBundle> printBundle;
   bundleSvc->CreateBundle("chrome://global/locale/printdialog.properties", getter_AddRefs(printBundle));
   nsXPIDLString intlString;
 
-  printBundle->GetStringFromName(u"headerFooterCustom", getter_Copies(intlString));
+  printBundle->GetStringFromName("headerFooterCustom", getter_Copies(intlString));
   GtkWidget* prompt_dialog = gtk_dialog_new_with_buttons(NS_ConvertUTF16toUTF8(intlString).get(), printDialog,
 #if (MOZ_WIDGET_GTK == 2)
                                                          (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
 #else
                                                          (GtkDialogFlags)(GTK_DIALOG_MODAL),
 #endif
                                                          GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                          GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                          nullptr);
   gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog), GTK_RESPONSE_ACCEPT);
   gtk_dialog_set_alternative_button_order(GTK_DIALOG(prompt_dialog),
                                           GTK_RESPONSE_ACCEPT,
                                           GTK_RESPONSE_REJECT,
                                           -1);
 
-  printBundle->GetStringFromName(u"customHeaderFooterPrompt", getter_Copies(intlString));
+  printBundle->GetStringFromName("customHeaderFooterPrompt", getter_Copies(intlString));
   GtkWidget* custom_label = gtk_label_new(NS_ConvertUTF16toUTF8(intlString).get());
   GtkWidget* custom_entry = gtk_entry_new();
   GtkWidget* question_icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
 
   // To be convenient, prefill the textbox with the existing value, if any, and select it all so they can easily
   // both edit it and type in a new one.
   const char* current_text = (const char*) g_object_get_data(G_OBJECT(changed_box), "custom-text");
   if (current_text) {
@@ -323,17 +323,17 @@ nsPrintDialogWidgetGTK::nsPrintDialogWid
   gtk_print_unix_dialog_add_custom_tab(GTK_PRINT_UNIX_DIALOG(dialog), custom_options_tab, tab_label);
   gtk_widget_show_all(custom_options_tab);
 }
 
 NS_ConvertUTF16toUTF8
 nsPrintDialogWidgetGTK::GetUTF8FromBundle(const char *aKey)
 {
   nsXPIDLString intlString;
-  printBundle->GetStringFromName(NS_ConvertUTF8toUTF16(aKey).get(), getter_Copies(intlString));
+  printBundle->GetStringFromName(aKey, getter_Copies(intlString));
   return NS_ConvertUTF16toUTF8(intlString);  // Return the actual object so we don't lose reference
 }
 
 const char*
 nsPrintDialogWidgetGTK::OptionWidgetToString(GtkWidget *dropdown)
 {
   gint index = gtk_combo_box_get_active(GTK_COMBO_BOX(dropdown));
 
--- a/widget/gtk/nsSound.cpp
+++ b/widget/gtk/nsSound.cpp
@@ -128,17 +128,17 @@ ca_context_get_default()
     nsCOMPtr<nsIStringBundleService> bundleService =
         mozilla::services::GetStringBundleService();
     if (bundleService) {
         nsCOMPtr<nsIStringBundle> brandingBundle;
         bundleService->CreateBundle("chrome://branding/locale/brand.properties",
                                     getter_AddRefs(brandingBundle));
         if (brandingBundle) {
             nsAutoString wbrand;
-            brandingBundle->GetStringFromName(u"brandShortName",
+            brandingBundle->GetStringFromName("brandShortName",
                                               getter_Copies(wbrand));
             NS_ConvertUTF16toUTF8 brand(wbrand);
 
             ca_context_change_props(ctx, "application.name", brand.get(),
                                     nullptr);
         }
     }
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3485,17 +3485,17 @@ GetBrandName(nsXPIDLString& brandName)
     nsCOMPtr<nsIStringBundle> bundle;
     if (bundleService)
         bundleService->CreateBundle(
             "chrome://branding/locale/brand.properties",
             getter_AddRefs(bundle));
 
     if (bundle)
         bundle->GetStringFromName(
-            u"brandShortName",
+            "brandShortName",
             getter_Copies(brandName));
 
     if (brandName.IsEmpty())
         brandName.AssignLiteral(u"Mozilla");
 }
 
 static GdkWindow *
 CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
--- a/widget/nsBaseFilePicker.cpp
+++ b/widget/nsBaseFilePicker.cpp
@@ -210,57 +210,57 @@ nsBaseFilePicker::AppendFilters(int32_t 
   rv = stringService->CreateBundle(FILEPICKER_FILTERS, getter_AddRefs(filterBundle));
   if (NS_FAILED(rv))
     return NS_ERROR_FAILURE;
 
   nsXPIDLString title;
   nsXPIDLString filter;
 
   if (aFilterMask & filterAll) {
-    titleBundle->GetStringFromName(u"allTitle", getter_Copies(title));
-    filterBundle->GetStringFromName(u"allFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("allTitle", getter_Copies(title));
+    filterBundle->GetStringFromName("allFilter", getter_Copies(filter));
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterHTML) {
-    titleBundle->GetStringFromName(u"htmlTitle", getter_Copies(title));
-    filterBundle->GetStringFromName(u"htmlFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("htmlTitle", getter_Copies(title));
+    filterBundle->GetStringFromName("htmlFilter", getter_Copies(filter));
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterText) {
-    titleBundle->GetStringFromName(u"textTitle", getter_Copies(title));
-    filterBundle->GetStringFromName(u"textFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("textTitle", getter_Copies(title));
+    filterBundle->GetStringFromName("textFilter", getter_Copies(filter));
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterImages) {
-    titleBundle->GetStringFromName(u"imageTitle", getter_Copies(title));
-    filterBundle->GetStringFromName(u"imageFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("imageTitle", getter_Copies(title));
+    filterBundle->GetStringFromName("imageFilter", getter_Copies(filter));
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterAudio) {
-    titleBundle->GetStringFromName(u"audioTitle", getter_Copies(title));
-    filterBundle->GetStringFromName(u"audioFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("audioTitle", getter_Copies(title));
+    filterBundle->GetStringFromName("audioFilter", getter_Copies(filter));
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterVideo) {
-    titleBundle->GetStringFromName(u"videoTitle", getter_Copies(title));
-    filterBundle->GetStringFromName(u"videoFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("videoTitle", getter_Copies(title));
+    filterBundle->GetStringFromName("videoFilter", getter_Copies(filter));
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterXML) {
-    titleBundle->GetStringFromName(u"xmlTitle", getter_Copies(title));
-    filterBundle->GetStringFromName(u"xmlFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("xmlTitle", getter_Copies(title));
+    filterBundle->GetStringFromName("xmlFilter", getter_Copies(filter));
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterXUL) {
-    titleBundle->GetStringFromName(u"xulTitle", getter_Copies(title));
-    filterBundle->GetStringFromName(u"xulFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("xulTitle", getter_Copies(title));
+    filterBundle->GetStringFromName("xulFilter", getter_Copies(filter));
     AppendFilter(title, filter);
   }
   if (aFilterMask & filterApps) {
-    titleBundle->GetStringFromName(u"appsTitle", getter_Copies(title));
+    titleBundle->GetStringFromName("appsTitle", getter_Copies(title));
     // Pass the magic string "..apps" to the platform filepicker, which it
     // should recognize and do the correct platform behavior for.
     AppendFilter(title, NS_LITERAL_STRING("..apps"));
   }
   return NS_OK;
 }
 
 // Set the filter index
--- a/widget/windows/AudioSession.cpp
+++ b/widget/windows/AudioSession.cpp
@@ -204,17 +204,17 @@ AudioSession::Start()
     nsCOMPtr<nsIStringBundleService> bundleService =
       do_GetService(NS_STRINGBUNDLE_CONTRACTID);
     NS_ENSURE_TRUE(bundleService, NS_ERROR_FAILURE);
     nsCOMPtr<nsIStringBundle> bundle;
     bundleService->CreateBundle("chrome://branding/locale/brand.properties",
                                 getter_AddRefs(bundle));
     NS_ENSURE_TRUE(bundle, NS_ERROR_FAILURE);
 
-    bundle->GetStringFromName(u"brandFullName",
+    bundle->GetStringFromName("brandFullName",
                               getter_Copies(mDisplayName));
 
     wchar_t *buffer;
     mIconPath.GetMutableData(&buffer, MAX_PATH);
     ::GetModuleFileNameW(nullptr, buffer, MAX_PATH);
 
     nsCOMPtr<nsIUUIDGenerator> uuidgen =
       do_GetService("@mozilla.org/uuid-generator;1");
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -1074,17 +1074,17 @@ CreateFilenameFromTextW(nsString & aText
   wcscpy(&aFilename[0], aText.get());
   wcscpy(&aFilename[aText.Length()], aExtension);
   return true;
 }
 
 #define PAGEINFO_PROPERTIES "chrome://navigator/locale/pageInfo.properties"
 
 static bool
-GetLocalizedString(const char16_t * aName, nsXPIDLString & aString)
+GetLocalizedString(const char* aName, nsXPIDLString & aString)
 {
   nsCOMPtr<nsIStringBundleService> stringService =
     mozilla::services::GetStringBundleService();
   if (!stringService)
     return false;
 
   nsCOMPtr<nsIStringBundle> stringBundle;
   nsresult rv = stringService->CreateBundle(PAGEINFO_PROPERTIES,
@@ -1120,17 +1120,17 @@ nsDataObj :: GetFileDescriptorInternetSh
     return E_OUTOFMEMORY;
   }
 
   // get a valid filename in the following order: 1) from the page title, 
   // 2) localized string for an untitled page, 3) just use "Untitled.URL"
   if (!CreateFilenameFromTextA(title, ".URL", 
                                fileGroupDescA->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
     nsXPIDLString untitled;
-    if (!GetLocalizedString(u"noPageTitle", untitled) ||
+    if (!GetLocalizedString("noPageTitle", untitled) ||
         !CreateFilenameFromTextA(untitled, ".URL", 
                                  fileGroupDescA->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
       strcpy(fileGroupDescA->fgd[0].cFileName, "Untitled.URL");
     }
   }
 
   // one file in the file block
   fileGroupDescA->cItems = 1;
@@ -1161,17 +1161,17 @@ nsDataObj :: GetFileDescriptorInternetSh
     return E_OUTOFMEMORY;
   }
 
   // get a valid filename in the following order: 1) from the page title, 
   // 2) localized string for an untitled page, 3) just use "Untitled.URL"
   if (!CreateFilenameFromTextW(title, L".URL",
                                fileGroupDescW->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
     nsXPIDLString untitled;
-    if (!GetLocalizedString(u"noPageTitle", untitled) ||
+    if (!GetLocalizedString("noPageTitle", untitled) ||
         !CreateFilenameFromTextW(untitled, L".URL",
                                  fileGroupDescW->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
       wcscpy(fileGroupDescW->fgd[0].cFileName, L"Untitled.URL");
     }
   }
 
   // one file in the file block
   fileGroupDescW->cItems = 1;