Bug 1386600 - Change nsIStringBundle methods to return |AString| instead of |wstring|. r=emk,sr=dbaron.
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 04 Aug 2017 14:40:52 +1000
changeset 425127 e26e9804c545afcb33549da0f7fd693cc3fc671f
parent 425126 00f3b3a9ec28b44ef143e122b70dfe6977f8cbba
child 425128 a15bf52ecde10da99ceee3d96e2fcf6925fa7e5d
push id1567
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 12:36:05 +0000
treeherdermozilla-release@e512c14a0406 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk, dbaron
bugs1386600
milestone57.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 1386600 - Change nsIStringBundle methods to return |AString| instead of |wstring|. r=emk,sr=dbaron. This removes about 2/3 of the occurrences of nsXPIDLString in the tree. The places where nsXPIDLStrings are null-checked are replaced with |rv| checks. The patch also removes a couple of unused declarations from nsIStringBundle.idl. Note that nsStringBundle::GetStringFromNameHelper() was merged into GetStringFromName(), because they both would have had the same signature.
accessible/generic/Accessible.cpp
accessible/generic/ApplicationAccessible.cpp
browser/components/shell/nsGNOMEShellService.cpp
browser/components/shell/nsWindowsShellService.cpp
caps/nsScriptSecurityManager.cpp
docshell/base/nsDocShell.cpp
dom/animation/AnimationPerformanceWarning.cpp
dom/animation/AnimationPerformanceWarning.h
dom/animation/KeyframeEffectReadOnly.cpp
dom/base/EventSource.cpp
dom/base/WebSocket.cpp
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/base/nsGlobalWindow.cpp
dom/console/ConsoleReportCollector.cpp
dom/events/DataTransferItem.cpp
dom/html/HTMLFormElement.cpp
dom/html/HTMLFormSubmission.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLSelectElement.cpp
dom/html/HTMLTextAreaElement.cpp
dom/html/ImageDocument.cpp
dom/html/MediaDocument.cpp
dom/html/input/CheckableInputTypes.cpp
dom/html/input/CheckableInputTypes.h
dom/html/input/DateTimeInputTypes.cpp
dom/html/input/DateTimeInputTypes.h
dom/html/input/FileInputType.cpp
dom/html/input/FileInputType.h
dom/html/input/InputType.cpp
dom/html/input/InputType.h
dom/html/input/NumericInputTypes.cpp
dom/html/input/NumericInputTypes.h
dom/html/input/SingleLineTextInputTypes.cpp
dom/html/input/SingleLineTextInputTypes.h
dom/html/nsHTMLDocument.cpp
dom/indexedDB/ScriptErrorHelper.cpp
dom/media/CubebUtils.cpp
dom/media/webaudio/WebAudioUtils.cpp
dom/plugins/ipc/PluginHangUIParent.cpp
dom/security/nsCSPContext.cpp
dom/security/nsCSPUtils.cpp
dom/security/nsCSPUtils.h
dom/webbrowserpersist/nsWebBrowserPersist.cpp
dom/workers/ServiceWorkerManager.cpp
dom/workers/ServiceWorkerUpdateJob.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/strres/nsStringBundleService.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/base/nsDocumentViewer.cpp
layout/forms/nsFileControlFrame.cpp
layout/generic/DetailsFrame.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsSimplePageSequenceFrame.cpp
layout/printing/nsPrintData.cpp
layout/printing/nsPrintData.h
layout/printing/nsPrintEngine.cpp
layout/style/ErrorReporter.cpp
layout/xul/nsMenuFrame.cpp
modules/libpref/nsPrefBranch.cpp
modules/libpref/nsPrefBranch.h
netwerk/protocol/ftp/nsFtpConnectionThread.cpp
netwerk/protocol/gio/nsGIOProtocolHandler.cpp
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/protocol/http/nsCORSListenerProxy.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
netwerk/streamconv/converters/nsIndexedToHTML.cpp
parser/html/nsHtml5PlainTextUtils.cpp
parser/html/nsHtml5TreeOperation.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/printingui/win/nsPrintDialogUtil.cpp
toolkit/mozapps/extensions/AddonContentPolicy.cpp
toolkit/system/gnome/nsAlertsIconListener.cpp
toolkit/xre/ProfileReset.cpp
toolkit/xre/nsAppRunner.cpp
uriloader/base/nsDocLoader.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
@@ -312,20 +312,19 @@ Accessible::TranslateString(const nsStri
 
   nsCOMPtr<nsIStringBundle> stringBundle;
   stringBundleService->CreateBundle(
     "chrome://global-platform/locale/accessible.properties",
     getter_AddRefs(stringBundle));
   if (!stringBundle)
     return;
 
-  nsXPIDLString xsValue;
+  nsAutoString xsValue;
   nsresult rv =
-    stringBundle->GetStringFromName(NS_ConvertUTF16toUTF8(aKey).get(),
-                                    getter_Copies(xsValue));
+    stringBundle->GetStringFromName(NS_ConvertUTF16toUTF8(aKey).get(), xsValue);
   if (NS_SUCCEEDED(rv))
     aStringOut.Assign(xsValue);
 }
 
 uint64_t
 Accessible::VisibilityState()
 {
   nsIFrame* frame = GetFrame();
@@ -2830,47 +2829,42 @@ KeyBinding::ToPlatformFormat(nsAString& 
     stringBundleService->CreateBundle(
       "chrome://global-platform/locale/platformKeys.properties",
       getter_AddRefs(keyStringBundle));
 
   if (!keyStringBundle)
     return;
 
   nsAutoString separator;
-  keyStringBundle->GetStringFromName("MODIFIER_SEPARATOR",
-                                     getter_Copies(separator));
+  keyStringBundle->GetStringFromName("MODIFIER_SEPARATOR", separator);
 
   nsAutoString modifierName;
   if (mModifierMask & kControl) {
-    keyStringBundle->GetStringFromName("VK_CONTROL",
-                                       getter_Copies(modifierName));
+    keyStringBundle->GetStringFromName("VK_CONTROL", modifierName);
 
     aValue.Append(modifierName);
     aValue.Append(separator);
   }
 
   if (mModifierMask & kAlt) {
-    keyStringBundle->GetStringFromName("VK_ALT",
-                                       getter_Copies(modifierName));
+    keyStringBundle->GetStringFromName("VK_ALT", modifierName);
 
     aValue.Append(modifierName);
     aValue.Append(separator);
   }
 
   if (mModifierMask & kShift) {
-    keyStringBundle->GetStringFromName("VK_SHIFT",
-                                       getter_Copies(modifierName));
+    keyStringBundle->GetStringFromName("VK_SHIFT", modifierName);
 
     aValue.Append(modifierName);
     aValue.Append(separator);
   }
 
   if (mModifierMask & kMeta) {
-    keyStringBundle->GetStringFromName("VK_META",
-                                       getter_Copies(modifierName));
+    keyStringBundle->GetStringFromName("VK_META", modifierName);
 
     aValue.Append(modifierName);
     aValue.Append(separator);
   }
 
   aValue.Append(mKey);
 }
 
--- a/accessible/generic/ApplicationAccessible.cpp
+++ b/accessible/generic/ApplicationAccessible.cpp
@@ -48,18 +48,18 @@ ApplicationAccessible::Name(nsString& aN
     return eNameOK;
 
   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("brandShortName", getter_Copies(appName));
+  nsAutoString appName;
+  rv = bundle->GetStringFromName("brandShortName", 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
@@ -283,19 +283,18 @@ nsGNOMEShellService::SetDefaultBrowser(b
     nsCOMPtr<nsIStringBundleService> bundleService =
       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("brandShortName",
-                                   getter_Copies(brandShortName));
+    nsAutoString brandShortName;
+    brandBundle->GetStringFromName("brandShortName", brandShortName);
 
     // use brandShortName as the application id.
     NS_ConvertUTF16toUTF8 id(brandShortName);
     nsCOMPtr<nsIGIOMimeApp> appInfo;
     rv = giovfs->CreateAppFromCommand(mAppPath,
                                       id,
                                       getter_AddRefs(appInfo));
     NS_ENSURE_SUCCESS(rv, rv);
@@ -394,26 +393,25 @@ nsGNOMEShellService::SetDesktopBackgroun
     options.AssignLiteral("scaled");
   else
     options.AssignLiteral("centered");
 
   // Write the background file to the home directory.
   nsAutoCString filePath(PR_GetEnv("HOME"));
 
   // get the product brand name from localized strings
-  nsString brandName;
+  nsAutoString 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("brandShortName",
-                                          getter_Copies(brandName));
+      rv = brandBundle->GetStringFromName("brandShortName", brandName);
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
   // build the file name
   filePath.Append('/');
   filePath.Append(NS_ConvertUTF16toUTF8(brandName));
   filePath.AppendLiteral("_wallpaper.png");
--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -609,20 +609,19 @@ nsWindowsShellService::SetDesktopBackgro
   NS_ENSURE_SUCCESS(rv, rv);
 
   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
-                      ("desktopBackgroundLeafNameWin",
-                       getter_Copies(fileLeafName));
+  nsAutoString fileLeafName;
+  rv = shellBundle->GetStringFromName("desktopBackgroundLeafNameWin",
+                                      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/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -998,24 +998,24 @@ nsScriptSecurityManager::CheckLoadURIFla
     // and none of the rest of the nested chain of URIs for aTargetURI
     // prohibits the load, so avoid warning in that case:
     bool hasSubsumersFlag = false;
     rv = NS_URIChainHasFlags(aTargetBaseURI,
                              nsIProtocolHandler::URI_LOADABLE_BY_SUBSUMERS,
                              &hasSubsumersFlag);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!hasFlags && !hasSubsumersFlag) {
-        nsXPIDLString message;
+        nsAutoString message;
         NS_ConvertASCIItoUTF16 ucsTargetScheme(targetScheme);
         const char16_t* formatStrings[] = { ucsTargetScheme.get() };
         rv = sStrBundle->
             FormatStringFromName("ProtocolFlagError",
                                  formatStrings,
                                  ArrayLength(formatStrings),
-                                 getter_Copies(message));
+                                 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());
         }
     }
@@ -1036,24 +1036,24 @@ nsScriptSecurityManager::ReportError(JSC
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Get the target URL spec
     nsAutoCString targetSpec;
     rv = aTarget->GetAsciiSpec(targetSpec);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Localize the error message
-    nsXPIDLString message;
+    nsAutoString message;
     NS_ConvertASCIItoUTF16 ucsSourceSpec(sourceSpec);
     NS_ConvertASCIItoUTF16 ucsTargetSpec(targetSpec);
     const char16_t *formatStrings[] = { ucsSourceSpec.get(), ucsTargetSpec.get() };
     rv = sStrBundle->FormatStringFromName(aMessageTag,
                                           formatStrings,
                                           ArrayLength(formatStrings),
-                                          getter_Copies(message));
+                                          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
     if (cx)
     {
         SetPendingException(cx, message.get());
@@ -1280,30 +1280,30 @@ nsScriptSecurityManager::CanCreateWrappe
 
     //-- Access denied, report an error
     nsAutoCString origin;
     nsIPrincipal* subjectPrincipal = nsContentUtils::SubjectPrincipal();
     GetPrincipalDomainOrigin(subjectPrincipal, origin);
     NS_ConvertUTF8toUTF16 originUnicode(origin);
     NS_ConvertUTF8toUTF16 classInfoName(objClassInfo.GetName());
     nsresult rv;
-    nsXPIDLString errorMsg;
+    nsAutoString errorMsg;
     if (originUnicode.IsEmpty()) {
         const char16_t* formatStrings[] = { classInfoName.get() };
         rv = sStrBundle->FormatStringFromName("CreateWrapperDenied",
                                               formatStrings,
                                               1,
-                                              getter_Copies(errorMsg));
+                                              errorMsg);
     } else {
         const char16_t* formatStrings[] = { classInfoName.get(),
                                             originUnicode.get() };
         rv = sStrBundle->FormatStringFromName("CreateWrapperDeniedForOrigin",
                                               formatStrings,
                                               2,
-                                              getter_Copies(errorMsg));
+                                              errorMsg);
     }
     NS_ENSURE_SUCCESS(rv, rv);
 
     SetPendingException(cx, errorMsg.get());
     return NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED;
 }
 
 NS_IMETHODIMP
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5300,19 +5300,18 @@ 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, strs, formatStrCount,
-                                            getter_Copies(str));
+    nsAutoString str;
+    rv = stringBundle->FormatStringFromName(error, strs, formatStrCount, 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) {
@@ -13367,40 +13366,37 @@ nsDocShell::ConfirmRepost(bool* aRepost)
   nsCOMPtr<nsIStringBundle> brandBundle;
   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("brandShortName",
-                                      getter_Copies(brandName));
-
-  nsXPIDLString msgString, button0Title;
+  nsAutoString brandName;
+  rv = brandBundle->GetStringFromName("brandShortName", brandName);
+
+  nsAutoString msgString, button0Title;
   if (NS_FAILED(rv)) { // No brand, use the generic version.
-    rv = appBundle->GetStringFromName("confirmRepostPrompt",
-                                      getter_Copies(msgString));
+    rv = appBundle->GetStringFromName("confirmRepostPrompt", 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("confirmRepostPrompt",
                                          formatStrings,
                                          ArrayLength(formatStrings),
-                                         getter_Copies(msgString));
+                                         msgString);
   }
   if (NS_FAILED(rv)) {
     return rv;
   }
 
-  rv = appBundle->GetStringFromName("resendButton.label",
-                                    getter_Copies(button0Title));
+  rv = appBundle->GetStringFromName("resendButton.label", 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.
   bool checkState = false;
--- a/dom/animation/AnimationPerformanceWarning.cpp
+++ b/dom/animation/AnimationPerformanceWarning.cpp
@@ -7,33 +7,33 @@
 #include "AnimationPerformanceWarning.h"
 
 #include "nsContentUtils.h"
 
 namespace mozilla {
 
 template<uint32_t N> nsresult
 AnimationPerformanceWarning::ToLocalizedStringWithIntParams(
-  const char* aKey, nsXPIDLString& aLocalizedString) const
+  const char* aKey, nsAString& aLocalizedString) const
 {
   nsAutoString strings[N];
   const char16_t* charParams[N];
 
   for (size_t i = 0, n = mParams->Length(); i < n; i++) {
     strings[i].AppendInt((*mParams)[i]);
     charParams[i] = strings[i].get();
   }
 
   return nsContentUtils::FormatLocalizedString(
       nsContentUtils::eLAYOUT_PROPERTIES, aKey, charParams, aLocalizedString);
 }
 
 bool
 AnimationPerformanceWarning::ToLocalizedString(
-  nsXPIDLString& aLocalizedString) const
+  nsAString& aLocalizedString) const
 {
   const char* key = nullptr;
 
   switch (mType) {
     case Type::ContentTooLarge:
       MOZ_ASSERT(mParams && mParams->Length() == 6,
                  "Parameter's length should be 6 for ContentTooLarge2");
 
--- a/dom/animation/AnimationPerformanceWarning.h
+++ b/dom/animation/AnimationPerformanceWarning.h
@@ -7,17 +7,17 @@
 #ifndef mozilla_dom_AnimationPerformanceWarning_h
 #define mozilla_dom_AnimationPerformanceWarning_h
 
 #include <initializer_list>
 
 #include "mozilla/Maybe.h"
 #include "nsTArray.h"
 
-class nsXPIDLString;
+class nsAString;
 
 namespace mozilla {
 
 // Represents the reason why we can't run the CSS property on the compositor.
 struct AnimationPerformanceWarning
 {
   enum class Type : uint8_t {
     ContentTooLarge,
@@ -57,20 +57,20 @@ struct AnimationPerformanceWarning
   static constexpr uint8_t kMaxParamsForLocalization = 10;
 
   // Indicates why this property could not be animated on the compositor.
   Type mType;
 
   // Optional parameters that may be used for localization.
   Maybe<nsTArray<int32_t>> mParams;
 
-  bool ToLocalizedString(nsXPIDLString& aLocalizedString) const;
+  bool ToLocalizedString(nsAString& aLocalizedString) const;
   template<uint32_t N>
   nsresult ToLocalizedStringWithIntParams(
-    const char* aKey, nsXPIDLString& aLocalizedString) const;
+    const char* aKey, nsAString& aLocalizedString) const;
 
   bool operator==(const AnimationPerformanceWarning& aOther) const
   {
     return mType == aOther.mType &&
            mParams == aOther.mParams;
   }
   bool operator!=(const AnimationPerformanceWarning& aOther) const
   {
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -1134,17 +1134,17 @@ KeyframeEffectReadOnly::GetProperties(
     ErrorResult& aRv) const
 {
   for (const AnimationProperty& property : mProperties) {
     AnimationPropertyDetails propertyDetails;
     propertyDetails.mProperty =
       NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(property.mProperty));
     propertyDetails.mRunningOnCompositor = property.mIsRunningOnCompositor;
 
-    nsXPIDLString localizedString;
+    nsAutoString localizedString;
     if (property.mPerformanceWarning &&
         property.mPerformanceWarning->ToLocalizedString(localizedString)) {
       propertyDetails.mWarning.Construct(localizedString);
     }
 
     if (!propertyDetails.mValues.SetCapacity(property.mSegments.Length(),
                                              mozilla::fallible)) {
       aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
@@ -1616,17 +1616,17 @@ KeyframeEffectReadOnly::SetPerformanceWa
   }
 
   for (AnimationProperty& property : mProperties) {
     if (property.mProperty == aProperty &&
         (!property.mPerformanceWarning ||
          *property.mPerformanceWarning != aWarning)) {
       property.mPerformanceWarning = Some(aWarning);
 
-      nsXPIDLString localizedString;
+      nsAutoString localizedString;
       if (nsLayoutUtils::IsAnimationLoggingEnabled() &&
           property.mPerformanceWarning->ToLocalizedString(localizedString)) {
         nsAutoCString logMessage = NS_ConvertUTF16toUTF8(localizedString);
         AnimationUtils::LogAsyncAnimationFailure(logMessage, mTarget->mElement);
       }
       return;
     }
   }
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -1238,23 +1238,22 @@ EventSourceImpl::PrintErrorOnConsole(con
     do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIScriptError> errObj(
     do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Localize the error message
-  nsXPIDLString message;
+  nsAutoString message;
   if (aFormatStrings) {
     rv = strBundle->FormatStringFromName(aError, aFormatStrings,
-                                         aFormatStringsLen,
-                                         getter_Copies(message));
+                                         aFormatStringsLen, message);
   } else {
-    rv = strBundle->GetStringFromName(aError, getter_Copies(message));
+    rv = strBundle->GetStringFromName(aError, message);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = errObj->InitWithWindowID(message,
                                 mScriptFile,
                                 EmptyString(),
                                 mScriptLine, mScriptColumn,
                                 nsIScriptError::errorFlag,
--- a/dom/base/WebSocket.cpp
+++ b/dom/base/WebSocket.cpp
@@ -366,23 +366,22 @@ WebSocketImpl::PrintErrorOnConsole(const
     do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS_VOID(rv);
 
   nsCOMPtr<nsIScriptError> errorObject(
     do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS_VOID(rv);
 
   // Localize the error message
-  nsXPIDLString message;
+  nsAutoString message;
   if (aFormatStrings) {
     rv = strBundle->FormatStringFromName(aError, aFormatStrings,
-                                         aFormatStringsLen,
-                                         getter_Copies(message));
+                                         aFormatStringsLen, message);
   } else {
-    rv = strBundle->GetStringFromName(aError, getter_Copies(message));
+    rv = strBundle->GetStringFromName(aError, message);
   }
   NS_ENSURE_SUCCESS_VOID(rv);
 
   if (mInnerWindowID) {
     rv = errorObject->InitWithWindowID(message,
                                        NS_ConvertUTF8toUTF16(mScriptFile),
                                        EmptyString(), mScriptLine,
                                        mScriptColumn,
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -859,30 +859,30 @@ nsContentUtils::InitializeModifierString
   nsCOMPtr<nsIStringBundle> bundle;
   DebugOnly<nsresult> rv = NS_OK;
   if (bundleService) {
     rv = bundleService->CreateBundle( "chrome://global-platform/locale/platformKeys.properties",
                                       getter_AddRefs(bundle));
   }
 
   NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/platformKeys.properties could not be loaded");
-  nsXPIDLString shiftModifier;
-  nsXPIDLString metaModifier;
-  nsXPIDLString osModifier;
-  nsXPIDLString altModifier;
-  nsXPIDLString controlModifier;
-  nsXPIDLString modifierSeparator;
+  nsAutoString shiftModifier;
+  nsAutoString metaModifier;
+  nsAutoString osModifier;
+  nsAutoString altModifier;
+  nsAutoString controlModifier;
+  nsAutoString modifierSeparator;
   if (bundle) {
     //macs use symbols for each modifier key, so fetch each from the bundle, which also covers i18n
-    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));
+    bundle->GetStringFromName("VK_SHIFT", shiftModifier);
+    bundle->GetStringFromName("VK_META", metaModifier);
+    bundle->GetStringFromName("VK_WIN", osModifier);
+    bundle->GetStringFromName("VK_ALT", altModifier);
+    bundle->GetStringFromName("VK_CONTROL", controlModifier);
+    bundle->GetStringFromName("MODIFIER_SEPARATOR", 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);
@@ -3952,51 +3952,48 @@ nsContentUtils::EnsureStringBundle(Prope
     sStringBundles[aFile] = bundle; // transfer ownership
   }
   return NS_OK;
 }
 
 /* static */
 nsresult nsContentUtils::GetLocalizedString(PropertiesFile aFile,
                                             const char* aKey,
-                                            nsXPIDLString& aResult)
+                                            nsAString& aResult)
 {
   nsresult rv = EnsureStringBundle(aFile);
   NS_ENSURE_SUCCESS(rv, rv);
   nsIStringBundle *bundle = sStringBundles[aFile];
-
-  return bundle->GetStringFromName(aKey, getter_Copies(aResult));
+  return bundle->GetStringFromName(aKey, aResult);
 }
 
 /* static */
 nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile,
                                                const char* aKey,
                                                const char16_t **aParams,
                                                uint32_t aParamsLength,
-                                               nsXPIDLString& aResult)
+                                               nsAString& aResult)
 {
   nsresult rv = EnsureStringBundle(aFile);
   NS_ENSURE_SUCCESS(rv, rv);
   nsIStringBundle *bundle = sStringBundles[aFile];
 
   if (!aParams || !aParamsLength) {
-    return bundle->GetStringFromName(aKey, getter_Copies(aResult));
-  }
-
-  return bundle->FormatStringFromName(aKey,
-                                      aParams, aParamsLength,
-                                      getter_Copies(aResult));
+    return bundle->GetStringFromName(aKey, aResult);
+  }
+
+  return bundle->FormatStringFromName(aKey, aParams, aParamsLength, aResult);
 }
 
 /* static */
 nsresult nsContentUtils::FormatLocalizedString(
                                           PropertiesFile aFile,
                                           const char* aKey,
                                           const nsTArray<nsString>& aParamArray,
-                                          nsXPIDLString& aResult)
+                                          nsAString& aResult)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   UniquePtr<const char16_t*[]> params;
   uint32_t paramsLength = aParamArray.Length();
   if (paramsLength > 0) {
     params = MakeUnique<const char16_t*[]>(paramsLength);
     for (uint32_t i = 0; i < paramsLength; ++i) {
@@ -4039,17 +4036,17 @@ nsContentUtils::ReportToConsole(uint32_t
                                 uint32_t aLineNumber,
                                 uint32_t aColumnNumber)
 {
   NS_ASSERTION((aParams && aParamsLength) || (!aParams && !aParamsLength),
                "Supply either both parameters and their number or no"
                "parameters and 0.");
 
   nsresult rv;
-  nsXPIDLString errorText;
+  nsAutoString errorText;
   if (aParams) {
     rv = FormatLocalizedString(aFile, aMessageName, aParams, aParamsLength,
                                errorText);
   }
   else {
     rv = GetLocalizedString(aFile, aMessageName, errorText);
   }
   NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1035,17 +1035,17 @@ public:
 
   static void LogMessageToConsole(const char* aMsg);
 
   /**
    * Get the localized string named |aKey| in properties file |aFile|.
    */
   static nsresult GetLocalizedString(PropertiesFile aFile,
                                      const char* aKey,
-                                     nsXPIDLString& aResult);
+                                     nsAString& aResult);
 
   /**
    * A helper function that parses a sandbox attribute (of an <iframe> or a CSP
    * directive) and converts it to the set of flags used internally.
    *
    * @param aSandboxAttr  the sandbox attribute
    * @return              the set of flags (SANDBOXED_NONE if aSandboxAttr is
    *                      null)
@@ -1081,38 +1081,38 @@ public:
    * Fill (with the parameters given) the localized string named |aKey| in
    * properties file |aFile|.
    */
 private:
   static nsresult FormatLocalizedString(PropertiesFile aFile,
                                         const char* aKey,
                                         const char16_t** aParams,
                                         uint32_t aParamsLength,
-                                        nsXPIDLString& aResult);
+                                        nsAString& aResult);
 
 public:
   template<uint32_t N>
   static nsresult FormatLocalizedString(PropertiesFile aFile,
                                         const char* aKey,
                                         const char16_t* (&aParams)[N],
-                                        nsXPIDLString& aResult)
+                                        nsAString& aResult)
   {
     return FormatLocalizedString(aFile, aKey, aParams, N, aResult);
   }
 
   /**
    * Fill (with the parameters given) the localized string named |aKey| in
    * properties file |aFile| consuming an nsTArray of nsString parameters rather
    * than a char16_t** for the sake of avoiding use-after-free errors involving
    * temporaries.
    */
   static nsresult FormatLocalizedString(PropertiesFile aFile,
                                         const char* aKey,
                                         const nsTArray<nsString>& aParamArray,
-                                        nsXPIDLString& aResult);
+                                        nsAString& aResult);
 
   /**
    * Returns true if aDocument is a chrome document
    */
   static bool IsChromeDoc(nsIDocument *aDocument);
 
   /**
    * Returns true if aDocument is in a docshell whose parent is the same type
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -3889,17 +3889,17 @@ nsGlobalWindow::ConfirmDialogIfNeeded()
   }
 
   // Reset popup state while opening a modal dialog, and firing events
   // about the dialog, to prevent the current state from being active
   // the whole time a modal dialog is open.
   nsAutoPopupStatePusher popupStatePusher(openAbused, true);
 
   bool disableDialog = false;
-  nsXPIDLString label, title;
+  nsAutoString label, title;
   nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
                                      "ScriptDialogLabel", label);
   nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
                                      "ScriptDialogPreventTitle", title);
   promptSvc->Confirm(AsOuter(), title.get(), label.get(), &disableDialog);
   if (disableDialog) {
     DisableDialogs();
     return false;
@@ -7503,34 +7503,30 @@ nsGlobalWindow::MakeScriptDialogTitle(ns
           // schemes (e.g. file:) we fall back to the localized
           // generic string
 
           nsAutoCString prepath;
           fixedURI->GetPrePath(prepath);
 
           NS_ConvertUTF8toUTF16 ucsPrePath(prepath);
           const char16_t *formatStrings[] = { ucsPrePath.get() };
-          nsXPIDLString tempString;
           nsContentUtils::FormatLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
                                                 "ScriptDlgHeading",
                                                 formatStrings,
-                                                tempString);
-          aOutTitle = tempString;
+                                                aOutTitle);
         }
       }
     }
   }
 
   if (aOutTitle.IsEmpty()) {
     // We didn't find a host so use the generic heading
-    nsXPIDLString tempString;
     nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
                                        "ScriptDlgGenericHeading",
-                                       tempString);
-    aOutTitle = tempString;
+                                       aOutTitle);
   }
 
   // Just in case
   if (aOutTitle.IsEmpty()) {
     NS_WARNING("could not get ScriptDlgGenericHeading string from string bundle");
     aOutTitle.AssignLiteral("[Script]");
   }
 }
@@ -7644,17 +7640,17 @@ nsGlobalWindow::AlertOrConfirm(bool aAle
   if (nsCOMPtr<nsIWritablePropertyBag2> promptBag = do_QueryInterface(prompt)) {
     promptBag->SetPropertyAsBool(NS_LITERAL_STRING("allowTabModal"), true);
   }
 
   bool result = false;
   nsAutoSyncOperation sync(mDoc);
   if (ShouldPromptToBlockDialogs()) {
     bool disallowDialog = false;
-    nsXPIDLString label;
+    nsAutoString label;
     nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
                                        "ScriptDialogLabel", label);
 
     aError = aAlert ?
                prompt->AlertCheck(title.get(), final.get(), label.get(),
                                   &disallowDialog) :
                prompt->ConfirmCheck(title.get(), final.get(), label.get(),
                                     &disallowDialog, &result);
@@ -7779,26 +7775,28 @@ nsGlobalWindow::PromptOuter(const nsAStr
   if (nsCOMPtr<nsIWritablePropertyBag2> promptBag = do_QueryInterface(prompt)) {
     promptBag->SetPropertyAsBool(NS_LITERAL_STRING("allowTabModal"), true);
   }
 
   // Pass in the default value, if any.
   char16_t *inoutValue = ToNewUnicode(fixedInitial);
   bool disallowDialog = false;
 
-  nsXPIDLString label;
+  nsAutoString label;
+  label.SetIsVoid(true);
   if (ShouldPromptToBlockDialogs()) {
     nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
                                        "ScriptDialogLabel", label);
   }
 
   nsAutoSyncOperation sync(mDoc);
   bool ok;
-  aError = prompt->Prompt(title.get(), fixedMessage.get(),
-                          &inoutValue, label.get(), &disallowDialog, &ok);
+  aError = prompt->Prompt(title.get(), fixedMessage.get(), &inoutValue,
+                          label.IsVoid() ? nullptr : label.get(),
+                          &disallowDialog, &ok);
 
   if (disallowDialog) {
     DisableDialogs();
   }
 
   if (aError.Failed()) {
     return;
   }
@@ -8139,35 +8137,36 @@ nsGlobalWindow::PrintOuter(ErrorResult& 
     nsCOMPtr<nsIPrintSettings> printSettings;
     if (printSettingsService) {
       bool printSettingsAreGlobal =
         Preferences::GetBool("print.use_global_printsettings", false);
 
       if (printSettingsAreGlobal) {
         printSettingsService->GetGlobalPrintSettings(getter_AddRefs(printSettings));
 
-        nsXPIDLString printerName;
+        nsAutoString printerName;
         printSettings->GetPrinterName(getter_Copies(printerName));
 
         bool shouldGetDefaultPrinterName = printerName.IsEmpty();
 #ifdef MOZ_X11
         // In Linux, GTK backend does not support per printer settings.
         // Calling GetDefaultPrinterName causes a sandbox violation (see Bug 1329216).
         // The printer name is not needed anywhere else on Linux before it gets to the parent.
         // In the parent, we will then query the default printer name if no name is set.
         // Unless we are in the parent, we will skip this part.
         if (!XRE_IsParentProcess()) {
           shouldGetDefaultPrinterName = false;
         }
 #endif
         if (shouldGetDefaultPrinterName) {
           printSettingsService->GetDefaultPrinterName(getter_Copies(printerName));
-          printSettings->SetPrinterName(printerName);
+          printSettings->SetPrinterName(printerName.get());
         }
-        printSettingsService->InitPrintSettingsFromPrinter(printerName, printSettings);
+        printSettingsService->InitPrintSettingsFromPrinter(printerName.get(),
+                                                           printSettings);
         printSettingsService->InitPrintSettingsFromPrefs(printSettings,
                                                          true,
                                                          nsIPrintSettings::kInitSaveAll);
       } else {
         printSettingsService->GetNewPrintSettings(getter_AddRefs(printSettings));
       }
 
       EnterModalState();
@@ -11951,17 +11950,17 @@ nsGlobalWindow::ShowSlowScriptDialog()
     if (NS_SUCCEEDED(rv)) {
       debugService->GetActivationHandler(getter_AddRefs(debugCallback));
     }
   }
 
   bool showDebugButton = !!debugCallback;
 
   // Get localizable strings
-  nsXPIDLString title, msg, stopButton, waitButton, debugButton, neverShowDlg;
+  nsAutoString title, msg, stopButton, waitButton, debugButton, neverShowDlg;
 
   rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                           "KillScriptTitle",
                                           title);
 
   nsresult tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                            "StopScriptButton",
                                            stopButton);
@@ -11978,17 +11977,16 @@ nsGlobalWindow::ShowSlowScriptDialog()
 
   tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                            "DontAskAgain",
                                            neverShowDlg);
   if (NS_FAILED(tmp)) {
     rv = tmp;
   }
 
-
   if (showDebugButton) {
     tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                              "DebugScriptButton",
                                              debugButton);
     if (NS_FAILED(tmp)) {
       rv = tmp;
     }
 
@@ -12003,26 +12001,24 @@ nsGlobalWindow::ShowSlowScriptDialog()
     tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                              "KillScriptMessage",
                                              msg);
     if (NS_FAILED(tmp)) {
       rv = tmp;
     }
   }
 
-  // GetStringFromName can return NS_OK and still give nullptr string
-  if (NS_FAILED(rv) || !title || !msg || !stopButton || !waitButton ||
-      (!debugButton && showDebugButton) || !neverShowDlg) {
+  if (NS_FAILED(rv)) {
     NS_ERROR("Failed to get localized strings.");
     return ContinueSlowScript;
   }
 
   // Append file and line number information, if available
   if (filename.get()) {
-    nsXPIDLString scriptLocation;
+    nsAutoString scriptLocation;
     // We want to drop the middle part of too-long locations.  We'll
     // define "too-long" as longer than 60 UTF-16 code units.  Just
     // have to be a bit careful about unpaired surrogates.
     NS_ConvertUTF8toUTF16 filenameUTF16(filename.get());
     if (filenameUTF16.Length() > 60) {
       // XXXbz Do we need to insert any bidi overrides here?
       size_t cutStart = 30;
       size_t cutLength = filenameUTF16.Length() - 60;
@@ -12045,17 +12041,17 @@ nsGlobalWindow::ShowSlowScriptDialog()
       filenameUTF16.Replace(cutStart, cutLength, NS_LITERAL_STRING(u"\x2026"));
     }
     const char16_t *formatParams[] = { filenameUTF16.get() };
     rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                "KillScriptLocation",
                                                formatParams,
                                                scriptLocation);
 
-    if (NS_SUCCEEDED(rv) && scriptLocation) {
+    if (NS_SUCCEEDED(rv)) {
       msg.AppendLiteral("\n\n");
       msg.Append(scriptLocation);
       msg.Append(':');
       msg.AppendInt(lineno);
     }
   }
 
   int32_t buttonPressed = 0; // In case the user exits dialog by clicking X.
@@ -12067,19 +12063,20 @@ nsGlobalWindow::ShowSlowScriptDialog()
   // Add a third button if necessary.
   if (showDebugButton)
     buttonFlags += nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_2;
 
   {
     // Null out the operation callback while we're re-entering JS here.
     AutoDisableJSInterruptCallback disabler(cx);
     // Open the dialog.
-    rv = prompt->ConfirmEx(title, msg, buttonFlags, waitButton, stopButton,
-                          debugButton, neverShowDlg, &neverShowDlgChk,
-                          &buttonPressed);
+    rv = prompt->ConfirmEx(title.get(), msg.get(), buttonFlags,
+                           waitButton.get(), stopButton.get(),
+                           debugButton.get(), neverShowDlg.get(),
+                           &neverShowDlgChk, &buttonPressed);
   }
 
   if (NS_SUCCEEDED(rv) && (buttonPressed == 0)) {
     return neverShowDlgChk ? AlwaysContinueSlowScript : ContinueSlowScript;
   }
   if (buttonPressed == 2) {
     if (debugCallback) {
       rv = debugCallback->HandleSlowScriptDebug(this);
--- a/dom/console/ConsoleReportCollector.cpp
+++ b/dom/console/ConsoleReportCollector.cpp
@@ -51,17 +51,17 @@ ConsoleReportCollector::FlushReportsToCo
     } else {
       reports = mPendingReports;
     }
   }
 
   for (uint32_t i = 0; i < reports.Length(); ++i) {
     PendingReport& report = reports[i];
 
-    nsXPIDLString errorText;
+    nsAutoString errorText;
     nsresult rv;
     if (!report.mStringParams.IsEmpty()) {
       rv = nsContentUtils::FormatLocalizedString(report.mPropertiesFile,
                                                  report.mMessageName.get(),
                                                  report.mStringParams,
                                                  errorText);
     } else {
       rv = nsContentUtils::GetLocalizedString(report.mPropertiesFile,
--- a/dom/events/DataTransferItem.cpp
+++ b/dom/events/DataTransferItem.cpp
@@ -383,17 +383,17 @@ DataTransferItem::CreateFileFromInputStr
       break;
     }
   }
   if (!key) {
     MOZ_ASSERT_UNREACHABLE("Unsupported mime type");
     key = "GenericFileName";
   }
 
-  nsXPIDLString fileName;
+  nsAutoString fileName;
   nsresult rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                    key, fileName);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return nullptr;
   }
 
   uint64_t available;
   rv = aStream->Available(&available);
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -914,21 +914,21 @@ HTMLFormElement::DoSecureToInsecureSubmi
     getter_AddRefs(stringBundle));
   if (NS_FAILED(rv)) {
     return rv;
   }
   nsAutoString title;
   nsAutoString message;
   nsAutoString cont;
   stringBundle->GetStringFromName(
-    "formPostSecureToInsecureWarning.title", getter_Copies(title));
+    "formPostSecureToInsecureWarning.title", title);
   stringBundle->GetStringFromName(
-    "formPostSecureToInsecureWarning.message", getter_Copies(message));
+    "formPostSecureToInsecureWarning.message", message);
   stringBundle->GetStringFromName(
-    "formPostSecureToInsecureWarning.continue", getter_Copies(cont));
+    "formPostSecureToInsecureWarning.continue", 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,
--- a/dom/html/HTMLFormSubmission.cpp
+++ b/dom/html/HTMLFormSubmission.cpp
@@ -233,24 +233,24 @@ HandleMailtoSubject(nsCString& aPath)
   if (!hasSubject) {
     if (hasParams) {
       aPath.Append('&');
     } else {
       aPath.Append('?');
     }
 
     // Get the default subject
-    nsXPIDLString brandName;
+    nsAutoString brandName;
     nsresult rv =
       nsContentUtils::GetLocalizedString(nsContentUtils::eBRAND_PROPERTIES,
                                          "brandShortName", brandName);
     if (NS_FAILED(rv))
       return;
     const char16_t *formatStrings[] = { brandName.get() };
-    nsXPIDLString subjectStr;
+    nsAutoString subjectStr;
     rv = nsContentUtils::FormatLocalizedString(
                                            nsContentUtils::eFORMS_PROPERTIES,
                                            "DefaultFormSubject",
                                            formatStrings,
                                            subjectStr);
     if (NS_FAILED(rv))
       return;
     aPath.AppendLiteral("subject=");
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -849,17 +849,17 @@ HTMLInputElement::InitColorPicker()
   }
 
   if (IsPopupBlocked()) {
     win->FirePopupBlockedEvent(doc, nullptr, EmptyString(), EmptyString());
     return NS_OK;
   }
 
   // Get Loc title
-  nsXPIDLString title;
+  nsAutoString title;
   nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                      "ColorPicker", title);
 
   nsCOMPtr<nsIColorPicker> colorPicker = do_CreateInstance("@mozilla.org/colorpicker;1");
   if (!colorPicker) {
     return NS_ERROR_FAILURE;
   }
 
@@ -896,18 +896,18 @@ HTMLInputElement::InitFilePicker(FilePic
   }
 
   if (IsPopupBlocked()) {
     win->FirePopupBlockedEvent(doc, nullptr, EmptyString(), EmptyString());
     return NS_OK;
   }
 
   // Get Loc title
-  nsXPIDLString title;
-  nsXPIDLString okButtonLabel;
+  nsAutoString title;
+  nsAutoString okButtonLabel;
   if (aType == FILE_PICKER_DIRECTORY) {
     nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                        "DirectoryUpload", title);
 
     nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                        "DirectoryPickerOkButtonLabel",
                                        okButtonLabel);
   } else {
@@ -2764,17 +2764,17 @@ HTMLInputElement::GetDisplayFileName(nsA
     return;
   }
 
   if (mFileData->mFilesOrDirectories.Length() == 1) {
     GetDOMFileOrDirectoryName(mFileData->mFilesOrDirectories[0], aValue);
     return;
   }
 
-  nsXPIDLString value;
+  nsAutoString value;
 
   if (mFileData->mFilesOrDirectories.IsEmpty()) {
     if ((IsDirPickerEnabled() && Allowdirs()) ||
         (IsWebkitDirPickerEnabled() &&
          HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
       nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                          "NoDirSelected", value);
     } else if (HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
@@ -6410,17 +6410,17 @@ HTMLInputElement::SubmitNamesValues(HTML
 
   // Get the value
   nsAutoString value;
   GetValue(value, CallerType::System);
 
   if (mType == NS_FORM_INPUT_SUBMIT && value.IsEmpty() &&
       !HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
     // Get our default value, which is the same as our default label
-    nsXPIDLString defaultValue;
+    nsAutoString defaultValue;
     nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                        "Submit", defaultValue);
     value = defaultValue;
   }
 
   return aFormSubmission->AddNameValuePair(name, value);
 }
 
@@ -7565,25 +7565,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("imageFilter",
-                                      getter_Copies(extensionListStr));
+                                      extensionListStr);
     } else if (token.EqualsLiteral("audio/*")) {
       filterMask = nsIFilePicker::filterAudio;
       filterBundle->GetStringFromName("audioFilter",
-                                      getter_Copies(extensionListStr));
+                                      extensionListStr);
     } else if (token.EqualsLiteral("video/*")) {
       filterMask = nsIFilePicker::filterVideo;
       filterBundle->GetStringFromName("videoFilter",
-                                      getter_Copies(extensionListStr));
+                                      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;
       atLeastOneFileExtensionFilter = true;
@@ -7676,17 +7676,17 @@ HTMLInputElement::SetFilePickerFiltersFr
         // extension list): remove this one
         filters.RemoveElement(filterToCheck);
       }
     }
   }
 
   // Add "All Supported Types" filter
   if (filters.Length() > 1) {
-    nsXPIDLString title;
+    nsAutoString title;
     nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                        "AllSupportedTypes", title);
     filePicker->AppendFilter(title, allExtensionsList);
   }
 
   // Add each filter
   for (uint32_t i = 0; i < filters.Length(); ++i) {
     const nsFilePickerFilter& filter = filters[i];
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -1820,17 +1820,17 @@ HTMLSelectElement::UpdateValueMissingVal
 }
 
 nsresult
 HTMLSelectElement::GetValidationMessage(nsAString& aValidationMessage,
                                         ValidityStateType aType)
 {
   switch (aType) {
     case VALIDITY_STATE_VALUE_MISSING: {
-      nsXPIDLString message;
+      nsAutoString message;
       nsresult rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                        "FormValidationSelectMissing",
                                                        message);
       aValidationMessage = message;
       return rv;
     }
     default: {
       return nsIConstraintValidation::GetValidationMessage(aValidationMessage, aType);
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -1257,17 +1257,17 @@ HTMLTextAreaElement::GetValidationMessag
                                           ValidityStateType aType)
 {
   nsresult rv = NS_OK;
 
   switch (aType)
   {
     case VALIDITY_STATE_TOO_LONG:
       {
-        nsXPIDLString message;
+        nsAutoString message;
         int32_t maxLength = -1;
         int32_t textLength = -1;
         nsAutoString strMaxLength;
         nsAutoString strTextLength;
 
         GetMaxLength(&maxLength);
         GetTextLength(&textLength);
 
@@ -1278,17 +1278,17 @@ HTMLTextAreaElement::GetValidationMessag
         rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                    "FormValidationTextTooLong",
                                                    params, message);
         aValidationMessage = message;
       }
       break;
     case VALIDITY_STATE_TOO_SHORT:
       {
-        nsXPIDLString message;
+        nsAutoString message;
         int32_t minLength = -1;
         int32_t textLength = -1;
         nsAutoString strMinLength;
         nsAutoString strTextLength;
 
         GetMinLength(&minLength);
         GetTextLength(&textLength);
 
@@ -1299,17 +1299,17 @@ HTMLTextAreaElement::GetValidationMessag
         rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                    "FormValidationTextTooShort",
                                                    params, message);
         aValidationMessage = message;
       }
       break;
     case VALIDITY_STATE_VALUE_MISSING:
       {
-        nsXPIDLString message;
+        nsAutoString message;
         rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                 "FormValidationValueMissing",
                                                 message);
         aValidationMessage = message;
       }
       break;
     default:
       rv = nsIConstraintValidation::GetValidationMessage(aValidationMessage, aType);
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -594,19 +594,19 @@ ImageDocument::OnLoadComplete(imgIReques
   UpdateTitleAndCharset();
 
   // 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;
+    nsAutoString errorMsg;
     mStringBundle->FormatStringFromName("InvalidImage", formatString, 1,
-                                        getter_Copies(errorMsg));
+                                        errorMsg);
 
     mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, errorMsg, false);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -800,25 +800,23 @@ ImageDocument::UpdateTitleAndCharset()
         }
       }
       typeStr = Substring(iter, end);
     } else {
       typeStr = mimeType;
     }
   }
 
-  nsXPIDLString status;
+  nsAutoString status;
   if (mImageIsResized) {
     nsAutoString ratioStr;
     ratioStr.AppendInt(NSToCoordFloor(GetRatio() * 100));
 
     const char16_t* formatString[1] = { ratioStr.get() };
-    mStringBundle->FormatStringFromName("ScaledImage",
-                                        formatString, 1,
-                                        getter_Copies(status));
+    mStringBundle->FormatStringFromName("ScaledImage", formatString, 1, status);
   }
 
   static const char* const formatNames[4] =
   {
     "ImageTitleWithNeitherDimensionsNorFile",
     "ImageTitleWithoutDimensions",
     "ImageTitleWithDimensions2",
     "ImageTitleWithDimensions2AndFile",
--- a/dom/html/MediaDocument.cpp
+++ b/dom/html/MediaDocument.cpp
@@ -360,68 +360,64 @@ MediaDocument::UpdateTitleAndCharset(con
                                      const char* const* aFormatNames,
                                      int32_t aWidth, int32_t aHeight,
                                      const nsAString& aStatus)
 {
   nsXPIDLString fileStr;
   GetFileName(fileStr, aChannel);
 
   NS_ConvertASCIItoUTF16 typeStr(aTypeStr);
-  nsXPIDLString title;
+  nsAutoString title;
 
   if (mStringBundle) {
     // if we got a valid size (not all media have a size)
     if (aWidth != 0 && aHeight != 0) {
       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()};
         mStringBundle->FormatStringFromName(aFormatNames[eWithDimAndFile],
-                                            formatStrings, 4,
-                                            getter_Copies(title));
+                                            formatStrings, 4, title);
       }
       else {
         const char16_t *formatStrings[3]  = {typeStr.get(), widthStr.get(),
           heightStr.get()};
         mStringBundle->FormatStringFromName(aFormatNames[eWithDim],
-                                            formatStrings, 3,
-                                            getter_Copies(title));
+                                            formatStrings, 3, title);
       }
     }
     else {
     // If we got a filename, display it
       if (!fileStr.IsEmpty()) {
         const char16_t *formatStrings[2] = {fileStr.get(), typeStr.get()};
         mStringBundle->FormatStringFromName(aFormatNames[eWithFile],
-                                            formatStrings, 2,
-                                            getter_Copies(title));
+                                            formatStrings, 2, title);
       }
       else {
         const char16_t *formatStrings[1] = {typeStr.get()};
         mStringBundle->FormatStringFromName(aFormatNames[eWithNoInfo],
-                                            formatStrings, 1,
-                                            getter_Copies(title));
+                                            formatStrings, 1, title);
       }
     }
   }
 
   // set it on the document
   if (aStatus.IsEmpty()) {
     SetTitle(title);
   }
   else {
-    nsXPIDLString titleWithStatus;
+    nsAutoString titleWithStatus;
     const nsPromiseFlatString& status = PromiseFlatString(aStatus);
     const char16_t *formatStrings[2] = {title.get(), status.get()};
     mStringBundle->FormatStringFromName("TitleWithStatus", formatStrings,
-                                        2, getter_Copies(titleWithStatus));
+                                        2, titleWithStatus);
     SetTitle(titleWithStatus);
   }
 }
 
 void
 MediaDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject)
 {
     nsHTMLDocument::SetScriptGlobalObject(aGlobalObject);
--- a/dom/html/input/CheckableInputTypes.cpp
+++ b/dom/html/input/CheckableInputTypes.cpp
@@ -20,24 +20,24 @@ CheckboxInputType::IsValueMissing() cons
   if (!IsMutable()) {
     return false;
   }
 
   return !mInputElement->Checked();
 }
 
 nsresult
-CheckboxInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
+CheckboxInputType::GetValueMissingMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                             "FormValidationCheckboxMissing",
                                             aMessage);
 }
 
 /* input type=radio */
 
 nsresult
-RadioInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
+RadioInputType::GetValueMissingMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                             "FormValidationRadioMissing",
                                             aMessage);
 }
--- a/dom/html/input/CheckableInputTypes.h
+++ b/dom/html/input/CheckableInputTypes.h
@@ -27,17 +27,17 @@ public:
   static InputType*
   Create(mozilla::dom::HTMLInputElement* aInputElement, void* aMemory)
   {
     return new (aMemory) CheckboxInputType(aInputElement);
   }
 
   bool IsValueMissing() const override;
 
-  nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
+  nsresult GetValueMissingMessage(nsAString& aMessage) override;
 
 private:
   explicit CheckboxInputType(mozilla::dom::HTMLInputElement* aInputElement)
     : CheckableInputTypeBase(aInputElement)
   {}
 };
 
 // input type=radio
@@ -45,17 +45,17 @@ class RadioInputType : public CheckableI
 {
 public:
   static InputType*
   Create(mozilla::dom::HTMLInputElement* aInputElement, void* aMemory)
   {
     return new (aMemory) RadioInputType(aInputElement);
   }
 
-  nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
+  nsresult GetValueMissingMessage(nsAString& aMessage) override;
 
 private:
   explicit RadioInputType(mozilla::dom::HTMLInputElement* aInputElement)
     : CheckableInputTypeBase(aInputElement)
   {}
 };
 
 #endif /* CheckableInputTypes_h__ */
--- a/dom/html/input/DateTimeInputTypes.cpp
+++ b/dom/html/input/DateTimeInputTypes.cpp
@@ -113,28 +113,28 @@ DateTimeInputTypeBase::HasBadInput() con
   if (!frame) {
     return false;
   }
 
   return frame->HasBadInput();;
 }
 
 nsresult
-DateTimeInputTypeBase::GetRangeOverflowMessage(nsXPIDLString& aMessage)
+DateTimeInputTypeBase::GetRangeOverflowMessage(nsAString& aMessage)
 {
   nsAutoString maxStr;
   mInputElement->GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
 
   const char16_t* params[] = { maxStr.get() };
   return nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
     "FormValidationDateTimeRangeOverflow", params, aMessage);
 }
 
 nsresult
-DateTimeInputTypeBase::GetRangeUnderflowMessage(nsXPIDLString& aMessage)
+DateTimeInputTypeBase::GetRangeUnderflowMessage(nsAString& aMessage)
 {
   nsAutoString minStr;
   mInputElement->GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
 
   const char16_t* params[] = { minStr.get() };
   return nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
     "FormValidationDateTimeRangeUnderflow", params, aMessage);
 }
@@ -171,17 +171,17 @@ DateTimeInputTypeBase::GetTimeFromMs(dou
   *aHours = value;
 
   return true;
 }
 
 // input type=date
 
 nsresult
-DateInputType::GetBadInputMessage(nsXPIDLString& aMessage)
+DateInputType::GetBadInputMessage(nsAString& aMessage)
 {
   if (!IsInputDateTimeEnabled()) {
     return NS_ERROR_UNEXPECTED;
   }
 
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
     "FormValidationInvalidDate", aMessage);
 }
--- a/dom/html/input/DateTimeInputTypes.h
+++ b/dom/html/input/DateTimeInputTypes.h
@@ -15,18 +15,18 @@ public:
   ~DateTimeInputTypeBase() override {}
 
   bool IsValueMissing() const override;
   bool IsRangeOverflow() const override;
   bool IsRangeUnderflow() const override;
   bool HasStepMismatch(bool aUseZeroIfValueNaN) const override;
   bool HasBadInput() const override;
 
-  nsresult GetRangeOverflowMessage(nsXPIDLString& aMessage) override;
-  nsresult GetRangeUnderflowMessage(nsXPIDLString& aMessage) override;
+  nsresult GetRangeOverflowMessage(nsAString& aMessage) override;
+  nsresult GetRangeUnderflowMessage(nsAString& aMessage) override;
 
   nsresult MinMaxStepAttrChanged() override;
 
 protected:
   explicit DateTimeInputTypeBase(mozilla::dom::HTMLInputElement* aInputElement)
     : InputType(aInputElement)
   {}
 
@@ -66,17 +66,17 @@ public:
   {
     return new (aMemory) DateInputType(aInputElement);
   }
 
   // Currently, for input date and time, only date can have an invalid value, as
   // we forbid or autocorrect values that are not in the valid range for time.
   // For example, in 12hr format, if user enters '2' in the hour field, it will
   // be treated as '02' and automatically advance to the next field.
-  nsresult GetBadInputMessage(nsXPIDLString& aMessage) override;
+  nsresult GetBadInputMessage(nsAString& aMessage) override;
 
   bool ConvertStringToNumber(nsAString& aValue,
                              mozilla::Decimal& aResultValue) const override;
   bool ConvertNumberToString(mozilla::Decimal aValue,
                              nsAString& aResultString) const override;
 
 private:
   explicit DateInputType(mozilla::dom::HTMLInputElement* aInputElement)
--- a/dom/html/input/FileInputType.cpp
+++ b/dom/html/input/FileInputType.cpp
@@ -18,14 +18,14 @@ FileInputType::IsValueMissing() const
   if (!IsMutable()) {
     return false;
   }
 
   return mInputElement->GetFilesOrDirectoriesInternal().IsEmpty();
 }
 
 nsresult
-FileInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
+FileInputType::GetValueMissingMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                             "FormValidationFileMissing",
                                             aMessage);
 }
--- a/dom/html/input/FileInputType.h
+++ b/dom/html/input/FileInputType.h
@@ -16,17 +16,17 @@ public:
   static InputType*
   Create(mozilla::dom::HTMLInputElement* aInputElement, void* aMemory)
   {
     return new (aMemory) FileInputType(aInputElement);
   }
 
   bool IsValueMissing() const override;
 
-  nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
+  nsresult GetValueMissingMessage(nsAString& aMessage) override;
 
 private:
   explicit FileInputType(mozilla::dom::HTMLInputElement* aInputElement)
     : InputType(aInputElement)
   {}
 };
 
 #endif /* FileInputType_h__ */
--- a/dom/html/input/InputType.cpp
+++ b/dom/html/input/InputType.cpp
@@ -207,17 +207,17 @@ InputType::GetValidationMessage(nsAStrin
                                 nsIConstraintValidation::ValidityStateType aType)
 {
   nsresult rv = NS_OK;
 
   switch (aType)
   {
     case nsIConstraintValidation::VALIDITY_STATE_TOO_LONG:
     {
-      nsXPIDLString message;
+      nsAutoString message;
       int32_t maxLength = mInputElement->MaxLength();
       int32_t textLength =
         mInputElement->InputTextLength(mozilla::dom::CallerType::System);
       nsAutoString strMaxLength;
       nsAutoString strTextLength;
 
       strMaxLength.AppendInt(maxLength);
       strTextLength.AppendInt(textLength);
@@ -226,17 +226,17 @@ InputType::GetValidationMessage(nsAStrin
       rv = nsContentUtils::FormatLocalizedString(
         nsContentUtils::eDOM_PROPERTIES, "FormValidationTextTooLong",
         params, message);
       aValidationMessage = message;
       break;
     }
     case nsIConstraintValidation::VALIDITY_STATE_TOO_SHORT:
     {
-      nsXPIDLString message;
+      nsAutoString message;
       int32_t minLength = mInputElement->MinLength();
       int32_t textLength =
         mInputElement->InputTextLength(mozilla::dom::CallerType::System);
       nsAutoString strMinLength;
       nsAutoString strTextLength;
 
       strMinLength.AppendInt(minLength);
       strTextLength.AppendInt(textLength);
@@ -246,39 +246,39 @@ InputType::GetValidationMessage(nsAStrin
         nsContentUtils::eDOM_PROPERTIES, "FormValidationTextTooShort",
         params, message);
 
       aValidationMessage = message;
       break;
     }
     case nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING:
     {
-      nsXPIDLString message;
+      nsAutoString message;
       rv = GetValueMissingMessage(message);
       if (NS_FAILED(rv)) {
         return rv;
       }
 
       aValidationMessage = message;
       break;
     }
     case nsIConstraintValidation::VALIDITY_STATE_TYPE_MISMATCH:
     {
-      nsXPIDLString message;
+      nsAutoString message;
       rv = GetTypeMismatchMessage(message);
       if (NS_FAILED(rv)) {
         return rv;
       }
 
       aValidationMessage = message;
       break;
     }
     case nsIConstraintValidation::VALIDITY_STATE_PATTERN_MISMATCH:
     {
-      nsXPIDLString message;
+      nsAutoString message;
       nsAutoString title;
       mInputElement->GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
       if (title.IsEmpty()) {
         rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
           "FormValidationPatternMismatch", message);
       } else {
         if (title.Length() >
             nsIConstraintValidation::sContentSpecifiedMaxLengthMessage) {
@@ -290,39 +290,39 @@ InputType::GetValidationMessage(nsAStrin
           nsContentUtils::eDOM_PROPERTIES,
           "FormValidationPatternMismatchWithTitle", params, message);
       }
       aValidationMessage = message;
       break;
     }
     case nsIConstraintValidation::VALIDITY_STATE_RANGE_OVERFLOW:
     {
-      nsXPIDLString message;
+      nsAutoString message;
       rv = GetRangeOverflowMessage(message);
       if (NS_FAILED(rv)) {
         return rv;
       }
 
       aValidationMessage = message;
       break;
     }
     case nsIConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW:
     {
-      nsXPIDLString message;
+      nsAutoString message;
       rv = GetRangeUnderflowMessage(message);
       if (NS_FAILED(rv)) {
         return rv;
       }
 
       aValidationMessage = message;
       break;
     }
     case nsIConstraintValidation::VALIDITY_STATE_STEP_MISMATCH:
     {
-      nsXPIDLString message;
+      nsAutoString message;
 
       mozilla::Decimal value = mInputElement->GetValueAsDecimal();
       MOZ_ASSERT(!value.isNaN());
 
       mozilla::Decimal step = mInputElement->GetStep();
       MOZ_ASSERT(step != kStepAny && step > mozilla::Decimal(0));
 
       mozilla::Decimal stepBase = mInputElement->GetStepBase();
@@ -360,59 +360,59 @@ InputType::GetValidationMessage(nsAStrin
           "FormValidationStepMismatchOneValue", params, message);
       }
 
       aValidationMessage = message;
       break;
     }
     case nsIConstraintValidation::VALIDITY_STATE_BAD_INPUT:
     {
-      nsXPIDLString message;
+      nsAutoString message;
       rv = GetBadInputMessage(message);
       if (NS_FAILED(rv)) {
         return rv;
       }
 
       aValidationMessage = message;
       break;
     }
     default:
       return NS_ERROR_UNEXPECTED;
   }
 
   return rv;
 }
 
 nsresult
-InputType::GetValueMissingMessage(nsXPIDLString& aMessage)
+InputType::GetValueMissingMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
     "FormValidationValueMissing", aMessage);
 }
 
 nsresult
-InputType::GetTypeMismatchMessage(nsXPIDLString& aMessage)
+InputType::GetTypeMismatchMessage(nsAString& aMessage)
 {
   return NS_ERROR_UNEXPECTED;
 }
 
 nsresult
-InputType::GetRangeOverflowMessage(nsXPIDLString& aMessage)
+InputType::GetRangeOverflowMessage(nsAString& aMessage)
 {
   return NS_ERROR_UNEXPECTED;
 }
 
 nsresult
-InputType::GetRangeUnderflowMessage(nsXPIDLString& aMessage)
+InputType::GetRangeUnderflowMessage(nsAString& aMessage)
 {
   return NS_ERROR_UNEXPECTED;
 }
 
 nsresult
-InputType::GetBadInputMessage(nsXPIDLString& aMessage)
+InputType::GetBadInputMessage(nsAString& aMessage)
 {
   return NS_ERROR_UNEXPECTED;
 }
 
 nsresult
 InputType::MinMaxStepAttrChanged()
 {
   return NS_OK;
--- a/dom/html/input/InputType.h
+++ b/dom/html/input/InputType.h
@@ -58,21 +58,21 @@ public:
   virtual bool HasPatternMismatch() const;
   virtual bool IsRangeOverflow() const;
   virtual bool IsRangeUnderflow() const;
   virtual bool HasStepMismatch(bool aUseZeroIfValueNaN) const;
   virtual bool HasBadInput() const;
 
   nsresult GetValidationMessage(nsAString& aValidationMessage,
                                 nsIConstraintValidation::ValidityStateType aType);
-  virtual nsresult GetValueMissingMessage(nsXPIDLString& aMessage);
-  virtual nsresult GetTypeMismatchMessage(nsXPIDLString& aMessage);
-  virtual nsresult GetRangeOverflowMessage(nsXPIDLString& aMessage);
-  virtual nsresult GetRangeUnderflowMessage(nsXPIDLString& aMessage);
-  virtual nsresult GetBadInputMessage(nsXPIDLString& aMessage);
+  virtual nsresult GetValueMissingMessage(nsAString& aMessage);
+  virtual nsresult GetTypeMismatchMessage(nsAString& aMessage);
+  virtual nsresult GetRangeOverflowMessage(nsAString& aMessage);
+  virtual nsresult GetRangeUnderflowMessage(nsAString& aMessage);
+  virtual nsresult GetBadInputMessage(nsAString& aMessage);
 
   virtual nsresult MinMaxStepAttrChanged();
 
   /**
    * Convert a string to a Decimal number in a type specific way,
    * http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#concept-input-value-string-number
    * ie parse a date string to a timestamp if type=date,
    * or parse a number string to its value if type=number.
--- a/dom/html/input/NumericInputTypes.cpp
+++ b/dom/html/input/NumericInputTypes.cpp
@@ -60,17 +60,17 @@ NumericInputTypeBase::HasStepMismatch(bo
     return false;
   }
 
   // Value has to be an integral multiple of step.
   return NS_floorModulo(value - GetStepBase(), step) != mozilla::Decimal(0);
 }
 
 nsresult
-NumericInputTypeBase::GetRangeOverflowMessage(nsXPIDLString& aMessage)
+NumericInputTypeBase::GetRangeOverflowMessage(nsAString& aMessage)
 {
   // We want to show the value as parsed when it's a number
   mozilla::Decimal maximum = mInputElement->GetMaximum();
   MOZ_ASSERT(!maximum.isNaN());
 
   nsAutoString maxStr;
   char buf[32];
   mozilla::DebugOnly<bool> ok = maximum.toString(buf,
@@ -79,17 +79,17 @@ NumericInputTypeBase::GetRangeOverflowMe
   MOZ_ASSERT(ok, "buf not big enough");
 
   const char16_t* params[] = { maxStr.get() };
   return nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
     "FormValidationNumberRangeOverflow", params, aMessage);
 }
 
 nsresult
-NumericInputTypeBase::GetRangeUnderflowMessage(nsXPIDLString& aMessage)
+NumericInputTypeBase::GetRangeUnderflowMessage(nsAString& aMessage)
 {
   mozilla::Decimal minimum = mInputElement->GetMinimum();
   MOZ_ASSERT(!minimum.isNaN());
 
   nsAutoString minStr;
   char buf[32];
   mozilla::DebugOnly<bool> ok = minimum.toString(buf,
                                                  mozilla::ArrayLength(buf));
@@ -162,24 +162,24 @@ NumberInputType::HasBadInput() const
       !numberControlFrame->AnonTextControlIsEmpty()) {
     // The input the user entered failed to parse as a number.
     return true;
   }
   return false;
 }
 
 nsresult
-NumberInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
+NumberInputType::GetValueMissingMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
     "FormValidationBadInputNumber", aMessage);
 }
 
 nsresult
-NumberInputType::GetBadInputMessage(nsXPIDLString& aMessage)
+NumberInputType::GetBadInputMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
     "FormValidationBadInputNumber", aMessage);
 }
 
 bool
 NumberInputType::IsMutable() const
 {
--- a/dom/html/input/NumericInputTypes.h
+++ b/dom/html/input/NumericInputTypes.h
@@ -13,18 +13,18 @@ class NumericInputTypeBase : public ::In
 {
 public:
   ~NumericInputTypeBase() override {}
 
   bool IsRangeOverflow() const override;
   bool IsRangeUnderflow() const override;
   bool HasStepMismatch(bool aUseZeroIfValueNaN) const override;
 
-  nsresult GetRangeOverflowMessage(nsXPIDLString& aMessage) override;
-  nsresult GetRangeUnderflowMessage(nsXPIDLString& aMessage) override;
+  nsresult GetRangeOverflowMessage(nsAString& aMessage) override;
+  nsresult GetRangeUnderflowMessage(nsAString& aMessage) override;
 
   bool ConvertStringToNumber(nsAString& aValue,
                              mozilla::Decimal& aResultValue) const override;
   bool ConvertNumberToString(mozilla::Decimal aValue,
                              nsAString& aResultString) const override;
 
 protected:
   explicit NumericInputTypeBase(mozilla::dom::HTMLInputElement* aInputElement)
@@ -40,18 +40,18 @@ public:
   Create(mozilla::dom::HTMLInputElement* aInputElement, void* aMemory)
   {
     return new (aMemory) NumberInputType(aInputElement);
   }
 
   bool IsValueMissing() const override;
   bool HasBadInput() const override;
 
-  nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
-  nsresult GetBadInputMessage(nsXPIDLString& aMessage) override;
+  nsresult GetValueMissingMessage(nsAString& aMessage) override;
+  nsresult GetBadInputMessage(nsAString& aMessage) override;
 
 protected:
   bool IsMutable() const override;
 
 private:
   explicit NumberInputType(mozilla::dom::HTMLInputElement* aInputElement)
     : NumericInputTypeBase(aInputElement)
   {}
--- a/dom/html/input/SingleLineTextInputTypes.cpp
+++ b/dom/html/input/SingleLineTextInputTypes.cpp
@@ -116,17 +116,17 @@ URLInputType::HasTypeMismatch() const
   nsCOMPtr<nsIURI> uri;
 
   return !NS_SUCCEEDED(ioService->NewURI(NS_ConvertUTF16toUTF8(value), nullptr,
                                          nullptr, getter_AddRefs(uri)));
 
 }
 
 nsresult
-URLInputType::GetTypeMismatchMessage(nsXPIDLString& aMessage)
+URLInputType::GetTypeMismatchMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                             "FormValidationInvalidURL",
                                             aMessage);
 }
 
 /* input type=email */
 
@@ -160,25 +160,25 @@ EmailInputType::HasBadInput() const
     if (!PunycodeEncodeEmailAddress(tokenizer.nextToken(), unused, &unused2)) {
       return true;
     }
   }
   return false;
 }
 
 nsresult
-EmailInputType::GetTypeMismatchMessage(nsXPIDLString& aMessage)
+EmailInputType::GetTypeMismatchMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                             "FormValidationInvalidEmail",
                                             aMessage);
 }
 
 nsresult
-EmailInputType::GetBadInputMessage(nsXPIDLString& aMessage)
+EmailInputType::GetBadInputMessage(nsAString& aMessage)
 {
   return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                             "FormValidationInvalidEmail",
                                             aMessage);
 }
 
 /* static */ bool
 EmailInputType::IsValidEmailAddressList(const nsAString& aValue)
--- a/dom/html/input/SingleLineTextInputTypes.h
+++ b/dom/html/input/SingleLineTextInputTypes.h
@@ -83,17 +83,17 @@ public:
   static InputType*
   Create(mozilla::dom::HTMLInputElement* aInputElement, void* aMemory)
   {
     return new (aMemory) URLInputType(aInputElement);
   }
 
   bool HasTypeMismatch() const override;
 
-  nsresult GetTypeMismatchMessage(nsXPIDLString& aMessage) override;
+  nsresult GetTypeMismatchMessage(nsAString& aMessage) override;
 
 private:
   explicit URLInputType(mozilla::dom::HTMLInputElement* aInputElement)
     : SingleLineTextInputTypeBase(aInputElement)
   {}
 };
 
 // input type=email
@@ -104,18 +104,18 @@ public:
   Create(mozilla::dom::HTMLInputElement* aInputElement, void* aMemory)
   {
     return new (aMemory) EmailInputType(aInputElement);
   }
 
   bool HasTypeMismatch() const override;
   bool HasBadInput() const override;
 
-  nsresult GetTypeMismatchMessage(nsXPIDLString& aMessage) override;
-  nsresult GetBadInputMessage(nsXPIDLString& aMessage) override;
+  nsresult GetTypeMismatchMessage(nsAString& aMessage) override;
+  nsresult GetBadInputMessage(nsAString& aMessage) override;
 
 private:
   explicit EmailInputType(mozilla::dom::HTMLInputElement* aInputElement)
     : SingleLineTextInputTypeBase(aInputElement)
   {}
 
   /**
    * This helper method returns true if aValue is a valid email address.
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -803,19 +803,19 @@ nsHTMLDocument::StartDocumentLoad(const 
   if (plainText && !nsContentUtils::IsChildOfSameType(this) &&
       Preferences::GetBool("plain_text.wrap_long_lines")) {
     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;
+    nsAutoString title;
     if (bundle) {
-      bundle->GetStringFromName("plainText.wordWrap", getter_Copies(title));
+      bundle->GetStringFromName("plainText.wordWrap", title);
     }
     SetSelectedStyleSheetSet(title);
   }
 
   // parser the content of the URI
   mParser->Parse(uri, nullptr, (void *)this);
 
   return rv;
--- a/dom/indexedDB/ScriptErrorHelper.cpp
+++ b/dom/indexedDB/ScriptErrorHelper.cpp
@@ -76,17 +76,17 @@ public:
                        uint32_t aColumnNumber,
                        uint32_t aSeverityFlag,
                        bool aIsChrome,
                        uint64_t aInnerWindowID)
   {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(!aMessageName.IsEmpty());
 
-    nsXPIDLString localizedMessage;
+    nsAutoString localizedMessage;
     if (NS_WARN_IF(NS_FAILED(
       nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                          aMessageName.BeginReading(),
                                          localizedMessage)))) {
       return;
     }
 
     Dump(localizedMessage,
--- a/dom/media/CubebUtils.cpp
+++ b/dom/media/CubebUtils.cpp
@@ -302,26 +302,25 @@ uint32_t PreferredChannelMap(uint32_t aC
   return kLayoutInfos[sPreferredChannelLayout].mask;
 }
 
 void InitBrandName()
 {
   if (sBrandName) {
     return;
   }
-  nsXPIDLString brandName;
+  nsAutoString 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("brandShortName",
-                                          getter_Copies(brandName));
+      rv = brandBundle->GetStringFromName("brandShortName", 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());
   sBrandName[ascii.Length()] = 0;
--- a/dom/media/webaudio/WebAudioUtils.cpp
+++ b/dom/media/webaudio/WebAudioUtils.cpp
@@ -125,17 +125,17 @@ WebAudioUtils::LogToDeveloperConsole(uin
   nsresult rv;
   nsCOMPtr<nsIScriptError> errorObject =
       do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
   if (!errorObject) {
     NS_WARNING("Failed to log message to console.");
     return;
   }
 
-  nsXPIDLString result;
+  nsAutoString result;
   rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                           aKey, result);
 
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to log message to console.");
     return;
   }
 
--- a/dom/plugins/ipc/PluginHangUIParent.cpp
+++ b/dom/plugins/ipc/PluginHangUIParent.cpp
@@ -150,17 +150,17 @@ PluginHangUIParent::Init(const nsString&
   }
   nsAutoString path;
   greDir->GetPath(path);
 
   FilePath exePath(path.get());
   exePath = exePath.AppendASCII(MOZ_HANGUI_PROCESS_NAME);
   CommandLine commandLine(exePath.value());
 
-  nsXPIDLString localizedStr;
+  nsAutoString localizedStr;
   const char16_t* formatParams[] = { aPluginName.get() };
   rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                              "PluginHangUIMessage",
                                              formatParams,
                                              localizedStr);
   if (NS_FAILED(rv)) {
     return false;
   }
--- a/dom/security/nsCSPContext.cpp
+++ b/dom/security/nsCSPContext.cpp
@@ -774,18 +774,18 @@ nsCSPContext::logToConsole(const char* a
                            const nsAString& aSourceName,
                            const nsAString& aSourceLine,
                            uint32_t aLineNumber,
                            uint32_t aColumnNumber,
                            uint32_t aSeverityFlag)
 {
   // let's check if we have to queue up console messages
   if (mQueueUpMessages) {
-    nsXPIDLString msg;
-    CSP_GetLocalizedStr(aName, aParams, aParamsLength, getter_Copies(msg));
+    nsAutoString msg;
+    CSP_GetLocalizedStr(aName, aParams, aParamsLength, msg);
     ConsoleMsgQueueElem &elem = *mConsoleMsgQueue.AppendElement();
     elem.mMsg = msg;
     elem.mSourceName = PromiseFlatString(aSourceName);
     elem.mSourceLine = PromiseFlatString(aSourceLine);
     elem.mLineNumber = aLineNumber;
     elem.mColumnNumber = aColumnNumber;
     elem.mSeverityFlag = aSeverityFlag;
     return;
--- a/dom/security/nsCSPUtils.cpp
+++ b/dom/security/nsCSPUtils.cpp
@@ -86,17 +86,17 @@ CSP_PercentDecodeStr(const nsAString& aE
     cur = ++hexDig2;
   }
 }
 
 void
 CSP_GetLocalizedStr(const char* aName,
                     const char16_t** aParams,
                     uint32_t aLength,
-                    char16_t** outResult)
+                    nsAString& outResult)
 {
   nsCOMPtr<nsIStringBundle> keyStringBundle;
   nsCOMPtr<nsIStringBundleService> stringBundleService =
     mozilla::services::GetStringBundleService();
 
   NS_ASSERTION(stringBundleService, "String bundle service must be present!");
   stringBundleService->CreateBundle("chrome://global/locale/security/csp.properties",
                                       getter_AddRefs(keyStringBundle));
@@ -188,18 +188,18 @@ CSP_LogLocalizedStr(const char* aName,
                     const nsAString& aSourceName,
                     const nsAString& aSourceLine,
                     uint32_t aLineNumber,
                     uint32_t aColumnNumber,
                     uint32_t aFlags,
                     const char* aCategory,
                     uint64_t aInnerWindowID)
 {
-  nsXPIDLString logMsg;
-  CSP_GetLocalizedStr(aName, aParams, aLength, getter_Copies(logMsg));
+  nsAutoString logMsg;
+  CSP_GetLocalizedStr(aName, aParams, aLength, logMsg);
   CSP_LogMessage(logMsg, aSourceName, aSourceLine,
                  aLineNumber, aColumnNumber, aFlags,
                  aCategory, aInnerWindowID);
 }
 
 /* ===== Helpers ============================ */
 CSPDirective
 CSP_ContentTypeToDirective(nsContentPolicyType aType)
--- a/dom/security/nsCSPUtils.h
+++ b/dom/security/nsCSPUtils.h
@@ -33,17 +33,17 @@ void CSP_LogLocalizedStr(const char* aNa
                          uint32_t aColumnNumber,
                          uint32_t aFlags,
                          const char* aCategory,
                          uint64_t aInnerWindowID);
 
 void CSP_GetLocalizedStr(const char* aName,
                          const char16_t** aParams,
                          uint32_t aLength,
-                         char16_t** outResult);
+                         nsAString& outResult);
 
 void CSP_LogStrMessage(const nsAString& aMsg);
 
 void CSP_LogMessage(const nsAString& aMessage,
                     const nsAString& aSourceName,
                     const nsAString& aSourceLine,
                     uint32_t aLineNumber,
                     uint32_t aColumnNumber,
--- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -1223,23 +1223,24 @@ nsresult nsWebBrowserPersist::SendErrorS
     // 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;
+    nsAutoString msgText;
     const char16_t *strings[1];
     strings[0] = path.get();
-    rv = bundle->FormatStringFromName(msgId, strings, 1, getter_Copies(msgText));
+    rv = bundle->FormatStringFromName(msgId, strings, 1, msgText);
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
-    mProgressListener->OnStatusChange(nullptr, aRequest, aResult, msgText);
+    mProgressListener->OnStatusChange(nullptr, aRequest, aResult,
+                                      msgText.get());
 
     return NS_OK;
 }
 
 nsresult nsWebBrowserPersist::GetValidURIFromObject(nsISupports *aObject, nsIURI **aURI) const
 {
     NS_ENSURE_ARG_POINTER(aObject);
     NS_ENSURE_ARG_POINTER(aURI);
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -1879,17 +1879,17 @@ ServiceWorkerManager::LocalizeAndReportT
                                           uint32_t aColumnNumber)
 {
   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
   if (!swm) {
     return;
   }
 
   nsresult rv;
-  nsXPIDLString message;
+  nsAutoString message;
   rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                              aStringKey, aParamArray, message);
   if (NS_SUCCEEDED(rv)) {
     swm->ReportToAllClients(aScope, message,
                             aFilename, aLine, aLineNumber, aColumnNumber,
                             aFlags);
   } else {
     NS_WARNING("Failed to format and therefore report localized error.");
--- a/dom/workers/ServiceWorkerUpdateJob.cpp
+++ b/dom/workers/ServiceWorkerUpdateJob.cpp
@@ -396,17 +396,17 @@ ServiceWorkerUpdateJob::ComparisonResult
     rv = GetRequiredScopeStringPrefix(maxScopeURI, maxPrefix, eUsePath);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       FailUpdateJob(NS_ERROR_DOM_SECURITY_ERR);
       return;
     }
   }
 
   if (!StringBeginsWith(mRegistration->mScope, maxPrefix)) {
-    nsXPIDLString message;
+    nsAutoString message;
     NS_ConvertUTF8toUTF16 reportScope(mRegistration->mScope);
     NS_ConvertUTF8toUTF16 reportMaxPrefix(maxPrefix);
     const char16_t* params[] = { reportScope.get(), reportMaxPrefix.get() };
 
     rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                "ServiceWorkerScopePathMismatch",
                                                params, message);
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to format localized string");
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -1072,35 +1072,32 @@ txMozillaXSLTProcessor::reportError(nsre
 
     if (aErrorText) {
         mErrorText.Assign(aErrorText);
     }
     else {
         nsCOMPtr<nsIStringBundleService> sbs =
             mozilla::services::GetStringBundleService();
         if (sbs) {
-            nsXPIDLString errorText;
-            sbs->FormatStatusMessage(aResult, EmptyString().get(),
-                                     getter_Copies(errorText));
+            nsAutoString errorText;
+            sbs->FormatStatusMessage(aResult, EmptyString().get(), errorText);
 
-            nsXPIDLString errorMessage;
+            nsAutoString errorMessage;
             nsCOMPtr<nsIStringBundle> bundle;
             sbs->CreateBundle(XSLT_MSGS_URL, getter_AddRefs(bundle));
 
             if (bundle) {
                 const char16_t* error[] = { errorText.get() };
                 if (mStylesheet) {
                     bundle->FormatStringFromName("TransformError",
-                                                 error, 1,
-                                                 getter_Copies(errorMessage));
+                                                 error, 1, errorMessage);
                 }
                 else {
                     bundle->FormatStringFromName("LoadingError",
-                                                 error, 1,
-                                                 getter_Copies(errorMessage));
+                                                 error, 1, errorMessage);
                 }
             }
             mErrorText.Assign(errorMessage);
         }
     }
 
     if (aSourceText) {
         mSourceText.Assign(aSourceText);
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp
@@ -513,22 +513,22 @@ nsresult nsAutoConfig::PromptForEMailAdd
     nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
     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("emailPromptTitle", getter_Copies(title));
+    nsAutoString title;
+    rv = bundle->GetStringFromName("emailPromptTitle", title);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    nsXPIDLString err;
-    rv = bundle->GetStringFromName("emailPromptMsg", getter_Copies(err));
+    nsAutoString err;
+    rv = bundle->GetStringFromName("emailPromptMsg", 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
@@ -49,23 +49,23 @@ static void DisplayError(void)
         return;
 
     nsCOMPtr<nsIStringBundle> bundle;
     bundleService->CreateBundle("chrome://autoconfig/locale/autoconfig.properties",
                                 getter_AddRefs(bundle));
     if (!bundle)
         return;
 
-    nsXPIDLString title;
-    rv = bundle->GetStringFromName("readConfigTitle", getter_Copies(title));
+    nsAutoString title;
+    rv = bundle->GetStringFromName("readConfigTitle", title);
     if (NS_FAILED(rv))
         return;
 
-    nsXPIDLString err;
-    rv = bundle->GetStringFromName("readConfigMsg", getter_Copies(err));
+    nsAutoString err;
+    rv = bundle->GetStringFromName("readConfigMsg", 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
@@ -11,85 +11,77 @@
 // Define Contractid and CID
 // {D85A17C1-AA7C-11d2-9B8C-00805F8A16D9}
 #define NS_STRINGBUNDLESERVICE_CID \
 { 0xd85a17c1, 0xaa7c, 0x11d2, \
   { 0x9b, 0x8c, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } }
 
 #define NS_STRINGBUNDLE_CONTRACTID "@mozilla.org/intl/stringbundle;1"
 
-/** 
- * observer needs to check if the bundle handle matches
- */
-#define NS_STRBUNDLE_LOADED_TOPIC "strbundle-loaded"
-
 %}
 
-native nsStrBundleLoadedFunc(nsStrBundleLoadedFunc);
-
 [scriptable, uuid(D85A17C2-AA7C-11d2-9B8C-00805F8A16D9)]
 interface nsIStringBundle : nsISupports
 {
-  wstring GetStringFromID(in long aID);
+  AString GetStringFromID(in long aID);
 
   // This method is mostly used from JS, where AUTF8String is appropriate.
   [binaryname(GetStringFromAUTF8Name)]
-  wstring GetStringFromName(in AUTF8String aName);
+  AString 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);
+  AString 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,
+  AString formatStringFromID(in long aID,
                              [array, size_is(length)] in wstring params,
                              in unsigned long length);
 
   // This method is mostly used from JS, where AUTF8String is appropriate.
   [binaryname(FormatStringFromAUTF8Name)]
-  wstring formatStringFromName(in AUTF8String aName,
+  AString 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,
+  AString 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)]
 interface nsIStringBundleService : nsISupports
 {
   nsIStringBundle createBundle(in string aURLSpec);
   nsIStringBundle createExtensibleBundle(in string aRegistryKey);
 
   /**
    * Formats a message string from a status code and status arguments.
    * @param aStatus - The status code. This is mapped into a string ID and
    *            and used in the string lookup process (see nsIErrorService).
    * @param aStatusArg - The status message argument(s). Multiple arguments
    *            can be separated by newline ('\n') characters.
    * @return the formatted message
    */
-  wstring formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
+  AString formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
 
   /**
    * flushes the string bundle cache - useful when the locale changes or
    * when we need to get some extra memory back
    * 
    * at some point, we might want to make this flush all the bundles,
    * because any bundles that are floating around when the locale changes
    * will suddenly contain bad data
--- a/intl/strres/nsStringBundle.cpp
+++ b/intl/strres/nsStringBundle.cpp
@@ -110,106 +110,85 @@ nsStringBundle::LoadProperties()
   mAttemptedLoad = mLoaded = true;
   rv = mProps->Load(in);
 
   mLoaded = NS_SUCCEEDED(rv);
 
   return rv;
 }
 
-nsresult
-nsStringBundle::GetStringFromNameHelper(const char* aName, nsAString& aResult)
+NS_IMETHODIMP
+nsStringBundle::GetStringFromID(int32_t aID, nsAString& aResult)
+{
+  nsAutoCString idStr;
+  idStr.AppendInt(aID, 10);
+  return GetStringFromName(idStr.get(), aResult);
+}
+
+NS_IMETHODIMP
+nsStringBundle::GetStringFromAUTF8Name(const nsACString& aName,
+                                       nsAString& aResult)
+{
+  return GetStringFromName(PromiseFlatCString(aName).get(), aResult);
+}
+
+NS_IMETHODIMP
+nsStringBundle::GetStringFromName(const char* aName, nsAString& aResult)
 {
   NS_ENSURE_ARG_POINTER(aName);
 
   nsresult rv = LoadProperties();
   if (NS_FAILED(rv)) return rv;
 
   ReentrantMonitorAutoEnter automon(mReentrantMonitor);
 
   // try override first
   if (mOverrideStrings) {
     rv = mOverrideStrings->GetStringFromName(mPropertiesURL,
                                              nsDependentCString(aName),
                                              aResult);
     if (NS_SUCCEEDED(rv)) return rv;
   }
 
-  rv = mProps->GetStringProperty(nsDependentCString(aName), aResult);
-  return rv;
-}
-
-NS_IMETHODIMP
-nsStringBundle::GetStringFromID(int32_t aID, char16_t **aResult)
-{
-  nsAutoCString idStr;
-  idStr.AppendInt(aID, 10);
-  return GetStringFromName(idStr.get(), aResult);
-}
-
-NS_IMETHODIMP
-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(aResult);
-
-  *aResult = nullptr;
-
-  nsAutoString tmpstr;
-  nsresult rv = GetStringFromNameHelper(aName, tmpstr);
-  if (NS_FAILED(rv)) return rv;
-
-  *aResult = ToNewUnicode(tmpstr);
-  NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
-
-  return NS_OK;
+  return mProps->GetStringProperty(nsDependentCString(aName), aResult);
 }
 
 NS_IMETHODIMP
 nsStringBundle::FormatStringFromID(int32_t aID,
                                    const char16_t **aParams,
                                    uint32_t aLength,
-                                   char16_t ** aResult)
+                                   nsAString& aResult)
 {
   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::FormatStringFromAUTF8Name(const nsACString& aName,
                                           const char16_t **aParams,
                                           uint32_t aLength,
-                                          char16_t **aResult)
+                                          nsAString& 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)
+                                     nsAString& aResult)
 {
-  NS_ENSURE_ARG_POINTER(aResult);
   NS_ASSERTION(aParams && aLength, "FormatStringFromName() without format parameters: use GetStringFromName() instead");
 
-  *aResult = nullptr;
-
   nsAutoString formatStr;
-  nsresult rv = GetStringFromNameHelper(aName, formatStr);
+  nsresult rv = GetStringFromName(aName, formatStr);
   if (NS_FAILED(rv)) return rv;
 
   return FormatString(formatStr.get(), aParams, aLength, aResult);
 }
 
 nsresult
 nsStringBundle::GetCombinedEnumeration(nsIStringBundleOverride* aOverrideStrings,
                                        nsISimpleEnumerator** aResult)
@@ -289,41 +268,39 @@ nsStringBundle::GetSimpleEnumeration(nsI
       return GetCombinedEnumeration(mOverrideStrings, elements);
 
   return mProps->Enumerate(elements);
 }
 
 nsresult
 nsStringBundle::FormatString(const char16_t *aFormatStr,
                              const char16_t **aParams, uint32_t aLength,
-                             char16_t **aResult)
+                             nsAString& aResult)
 {
-  NS_ENSURE_ARG_POINTER(aResult);
   NS_ENSURE_ARG(aLength <= 10); // enforce 10-parameter limit
 
   // implementation note: you would think you could use vsmprintf
   // to build up an arbitrary length array.. except that there
   // is no way to build up a va_list at runtime!
   // Don't believe me? See:
   //   http://www.eskimo.com/~scs/C-faq/q15.13.html
   // -alecf
-  *aResult =
-    nsTextFormatter::smprintf(aFormatStr,
-                              aLength >= 1 ? aParams[0] : nullptr,
-                              aLength >= 2 ? aParams[1] : nullptr,
-                              aLength >= 3 ? aParams[2] : nullptr,
-                              aLength >= 4 ? aParams[3] : nullptr,
-                              aLength >= 5 ? aParams[4] : nullptr,
-                              aLength >= 6 ? aParams[5] : nullptr,
-                              aLength >= 7 ? aParams[6] : nullptr,
-                              aLength >= 8 ? aParams[7] : nullptr,
-                              aLength >= 9 ? aParams[8] : nullptr,
-                              aLength >= 10 ? aParams[9] : nullptr);
+  nsTextFormatter::ssprintf(aResult, aFormatStr,
+                            aLength >= 1 ? aParams[0] : nullptr,
+                            aLength >= 2 ? aParams[1] : nullptr,
+                            aLength >= 3 ? aParams[2] : nullptr,
+                            aLength >= 4 ? aParams[3] : nullptr,
+                            aLength >= 5 ? aParams[4] : nullptr,
+                            aLength >= 6 ? aParams[5] : nullptr,
+                            aLength >= 7 ? aParams[6] : nullptr,
+                            aLength >= 8 ? aParams[7] : nullptr,
+                            aLength >= 9 ? aParams[8] : nullptr,
+                            aLength >= 10 ? aParams[9] : nullptr);
 
-  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(nsExtensibleStringBundle, nsIStringBundle)
 
 nsExtensibleStringBundle::nsExtensibleStringBundle()
 {
   mLoaded = false;
 }
@@ -368,31 +345,34 @@ nsExtensibleStringBundle::Init(const cha
 
   return rv;
 }
 
 nsExtensibleStringBundle::~nsExtensibleStringBundle()
 {
 }
 
-nsresult nsExtensibleStringBundle::GetStringFromID(int32_t aID, char16_t ** aResult)
+nsresult
+nsExtensibleStringBundle::GetStringFromID(int32_t aID, nsAString& aResult)
 {
   nsAutoCString idStr;
   idStr.AppendInt(aID, 10);
   return GetStringFromName(idStr.get(), aResult);
 }
 
-nsresult nsExtensibleStringBundle::GetStringFromAUTF8Name(
-  const nsACString& aName, char16_t ** aResult)
+nsresult
+nsExtensibleStringBundle::GetStringFromAUTF8Name(const nsACString& aName,
+                                                 nsAString& aResult)
 {
   return GetStringFromName(PromiseFlatCString(aName).get(), aResult);
 }
 
-nsresult nsExtensibleStringBundle::GetStringFromName(const char* aName,
-                                                     char16_t** aResult)
+nsresult
+nsExtensibleStringBundle::GetStringFromName(const char* aName,
+                                            nsAString& 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))
@@ -402,46 +382,47 @@ nsresult nsExtensibleStringBundle::GetSt
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsExtensibleStringBundle::FormatStringFromID(int32_t aID,
                                              const char16_t ** aParams,
                                              uint32_t aLength,
-                                             char16_t ** aResult)
+                                             nsAString& aResult)
 {
   nsAutoCString idStr;
   idStr.AppendInt(aID, 10);
   return FormatStringFromName(idStr.get(), aParams, aLength, aResult);
 }
 
 NS_IMETHODIMP
 nsExtensibleStringBundle::FormatStringFromAUTF8Name(const nsACString& aName,
                                                     const char16_t ** aParams,
                                                     uint32_t aLength,
-                                                    char16_t ** aResult)
+                                                    nsAString& 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)
+                                               nsAString& aResult)
 {
-  nsXPIDLString formatStr;
+  nsAutoString formatStr;
   nsresult rv;
-  rv = GetStringFromName(aName, getter_Copies(formatStr));
+  rv = GetStringFromName(aName, formatStr);
   if (NS_FAILED(rv))
     return rv;
 
-  return nsStringBundle::FormatString(formatStr, aParams, aLength, aResult);
+  return nsStringBundle::FormatString(formatStr.get(), aParams, aLength,
+                                      aResult);
 }
 
 nsresult nsExtensibleStringBundle::GetSimpleEnumeration(nsISimpleEnumerator ** aResult)
 {
   // XXX write me
   *aResult = nullptr;
   return NS_ERROR_NOT_IMPLEMENTED;
 }
@@ -630,17 +611,17 @@ nsStringBundleService::CreateExtensibleB
   return NS_OK;
 }
 
 #define GLOBAL_PROPERTIES "chrome://global/locale/global-strres.properties"
 
 nsresult
 nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
                                         uint32_t argCount, char16_t** argArray,
-                                        char16_t* *result)
+                                        nsAString& result)
 {
   nsresult rv;
   nsXPIDLCString key;
 
   // try looking up the error message with the int key:
   uint16_t code = NS_ERROR_GET_CODE(aStatus);
   rv = bundle->FormatStringFromID(code, (const char16_t**)argArray, argCount, result);
 
@@ -656,27 +637,26 @@ nsStringBundleService::FormatWithBundle(
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsStringBundleService::FormatStatusMessage(nsresult aStatus,
                                            const char16_t* aStatusArg,
-                                           char16_t* *result)
+                                           nsAString& result)
 {
   nsresult rv;
   uint32_t i, argCount = 0;
   nsCOMPtr<nsIStringBundle> bundle;
   nsXPIDLCString stringBundleURL;
 
   // XXX hack for mailnews who has already formatted their messages:
   if (aStatus == NS_OK && aStatusArg) {
-    *result = NS_strdup(aStatusArg);
-    NS_ENSURE_TRUE(*result, NS_ERROR_OUT_OF_MEMORY);
+    result.Assign(aStatusArg);
     return NS_OK;
   }
 
   if (aStatus == NS_OK) {
     return NS_ERROR_FAILURE;       // no message to format
   }
 
   // format the arguments:
--- a/intl/strres/nsStringBundle.h
+++ b/intl/strres/nsStringBundle.h
@@ -25,31 +25,29 @@ public:
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSISTRINGBUNDLE
 
     nsCOMPtr<nsIPersistentProperties> mProps;
 
 protected:
     virtual ~nsStringBundle();
 
-    nsresult GetStringFromNameHelper(const char* aName, nsAString& aResult);
-
     nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
                                     nsISimpleEnumerator** aResult);
 private:
     nsCString              mPropertiesURL;
     nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
     mozilla::ReentrantMonitor    mReentrantMonitor;
     bool                         mAttemptedLoad;
     bool                         mLoaded;
 
 public:
     static nsresult FormatString(const char16_t *formatStr,
                                  const char16_t **aParams, uint32_t aLength,
-                                 char16_t **aResult);
+                                 nsAString& aResult);
 };
 
 class nsExtensibleStringBundle;
 
 /**
  * An extensible implementation of the StringBundle interface.
  *
  * @created         28/Dec/1999
--- a/intl/strres/nsStringBundleService.h
+++ b/intl/strres/nsStringBundleService.h
@@ -34,17 +34,17 @@ public:
   NS_DECL_NSIOBSERVER
 
 private:
   virtual ~nsStringBundleService();
 
   void getStringBundle(const char *aUrl, nsIStringBundle** aResult);
   nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
                             uint32_t argCount, char16_t** argArray,
-                            char16_t* *result);
+                            nsAString& result);
 
   void flushBundleCache();
 
   bundleCacheEntry_t *insertIntoCache(already_AddRefed<nsIStringBundle> aBundle,
                                       nsCString &aHashKey);
 
   nsDataHashtable<nsCStringHashKey, bundleCacheEntry_t*> mBundleMap;
   mozilla::LinkedList<bundleCacheEntry_t> mBundleCache;
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1832,17 +1832,17 @@ nsCSSFrameConstructor::CreateGeneratedCo
           aParentContent->NodeInfo()->Equals(nsGkAtoms::input)) {
         if (aParentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
           nsCOMPtr<nsIContent> content;
           NS_NewAttributeContent(mDocument->NodeInfoManager(),
                                  kNameSpaceID_None, nsGkAtoms::value, getter_AddRefs(content));
           return content.forget();
         }
 
-        nsXPIDLString temp;
+        nsAutoString temp;
         nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                            "Submit", temp);
         return CreateGenConTextNode(aState, temp, nullptr, nullptr);
       }
 
       break;
     }
 
@@ -9124,19 +9124,19 @@ nsCSSFrameConstructor::WillDestroyFrameT
   nsFrameManager::Destroy();
 }
 
 //STATIC
 
 // XXXbz I'd really like this method to go away. Once we have inline-block and
 // I can just use that for sized broken images, that can happen, maybe.
 void
-nsCSSFrameConstructor::GetAlternateTextFor(nsIContent*    aContent,
-                                           nsIAtom*       aTag,
-                                           nsXPIDLString& aAltText)
+nsCSSFrameConstructor::GetAlternateTextFor(nsIContent* aContent,
+                                           nsIAtom* aTag,
+                                           nsAString& aAltText)
 {
   // The "alt" attribute specifies alternate text that is rendered
   // when the image can not be displayed.
   if (aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aAltText)) {
     return;
   }
 
   if (nsGkAtoms::input == aTag) {
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -60,19 +60,19 @@ public:
   friend class mozilla::ServoRestyleManager;
 
   nsCSSFrameConstructor(nsIDocument* aDocument, nsIPresShell* aPresShell);
   ~nsCSSFrameConstructor() {
     MOZ_ASSERT(mUpdateCount == 0, "Dying in the middle of our own update?");
   }
 
   // get the alternate text for a content node
-  static void GetAlternateTextFor(nsIContent*    aContent,
-                                  nsIAtom*       aTag,  // content object's tag
-                                  nsXPIDLString& aAltText);
+  static void GetAlternateTextFor(nsIContent* aContent,
+                                  nsIAtom* aTag,  // content object's tag
+                                  nsAString& aAltText);
 
 private:
   nsCSSFrameConstructor(const nsCSSFrameConstructor& aCopy) = delete;
   nsCSSFrameConstructor& operator=(const nsCSSFrameConstructor& aCopy) = delete;
 
 public:
   mozilla::RestyleManager* RestyleManager() const
     { return mPresShell->GetPresContext()->RestyleManager(); }
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1263,17 +1263,17 @@ nsDocumentViewer::PermitUnloadInternal(b
       nsCOMPtr<nsIWritablePropertyBag2> promptBag = do_QueryInterface(prompt);
       if (promptBag) {
         bool isTabModalPromptAllowed;
         GetIsTabModalPromptAllowed(&isTabModalPromptAllowed);
         promptBag->SetPropertyAsBool(NS_LITERAL_STRING("allowTabModal"),
                                      isTabModalPromptAllowed);
       }
 
-      nsXPIDLString title, message, stayLabel, leaveLabel;
+      nsAutoString title, message, stayLabel, leaveLabel;
       rv  = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                "OnBeforeUnloadTitle",
                                                title);
       nsresult tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                "OnBeforeUnloadMessage",
                                                message);
       if (NS_FAILED(tmp)) {
         rv = tmp;
@@ -1286,35 +1286,35 @@ nsDocumentViewer::PermitUnloadInternal(b
       }
       tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                                "OnBeforeUnloadStayButton",
                                                stayLabel);
       if (NS_FAILED(tmp)) {
         rv = tmp;
       }
 
-      if (NS_FAILED(rv) || !title || !message || !stayLabel || !leaveLabel) {
+      if (NS_FAILED(rv)) {
         NS_ERROR("Failed to get strings from dom.properties!");
         return NS_OK;
       }
 
       // Although the exact value is ignored, we must not pass invalid
       // bool values through XPConnect.
       bool dummy = false;
       int32_t buttonPressed = 0;
       uint32_t buttonFlags = (nsIPrompt::BUTTON_POS_0_DEFAULT |
                              (nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_0) |
                              (nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_1));
 
       nsAutoSyncOperation sync(mDocument);
       mInPermitUnloadPrompt = true;
       mozilla::Telemetry::Accumulate(mozilla::Telemetry::ONBEFOREUNLOAD_PROMPT_COUNT, 1);
-      rv = prompt->ConfirmEx(title, message, buttonFlags,
-                             leaveLabel, stayLabel, nullptr, nullptr,
-                             &dummy, &buttonPressed);
+      rv = prompt->ConfirmEx(title.get(), message.get(), buttonFlags,
+                             leaveLabel.get(), stayLabel.get(),
+                             nullptr, nullptr, &dummy, &buttonPressed);
       mInPermitUnloadPrompt = false;
 
       // If the prompt aborted, we tell our consumer that it is not allowed
       // to unload the page. One reason that prompts abort is that the user
       // performed some action that caused the page to unload while our prompt
       // was active. In those cases we don't want our consumer to also unload
       // the page.
       //
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -83,17 +83,17 @@ MakeAnonButton(nsIDocument* aDoc, const 
   RefPtr<Element> button = aDoc->CreateHTMLElement(nsGkAtoms::button);
   // NOTE: SetIsNativeAnonymousRoot() has to be called before setting any
   // attribute.
   button->SetIsNativeAnonymousRoot();
   button->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                   NS_LITERAL_STRING("button"), false);
 
   // Set the file picking button text depending on the current locale.
-  nsXPIDLString buttonTxt;
+  nsAutoString buttonTxt;
   nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                      labelKey, buttonTxt);
 
   // Set the browse button text. It's a bit of a pain to do because we want to
   // make sure we are not notifying.
   RefPtr<nsTextNode> textContent =
     new nsTextNode(button->NodeInfo()->NodeInfoManager());
 
--- a/layout/generic/DetailsFrame.cpp
+++ b/layout/generic/DetailsFrame.cpp
@@ -100,17 +100,17 @@ DetailsFrame::CreateAnonymousContent(nsT
   nsNodeInfoManager* nodeInfoManager =
     GetContent()->NodeInfo()->NodeInfoManager();
 
   already_AddRefed<NodeInfo> nodeInfo =
     nodeInfoManager->GetNodeInfo(nsGkAtoms::summary, nullptr, kNameSpaceID_XHTML,
                                  nsIDOMNode::ELEMENT_NODE);
   mDefaultSummary = new HTMLSummaryElement(nodeInfo);
 
-  nsXPIDLString defaultSummaryText;
+  nsAutoString defaultSummaryText;
   nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                      "DefaultSummary", defaultSummaryText);
   RefPtr<nsTextNode> description = new nsTextNode(nodeInfoManager);
   description->SetText(defaultSummaryText, false);
   mDefaultSummary->AppendChildTo(description, false);
 
   aElements.AppendElement(mDefaultSummary);
 
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1493,17 +1493,17 @@ nsImageFrame::DisplayAltFeedback(gfxCont
       inner.width -= paddedIconSize;
     }
   }
 
   // If there's still room, display the alt-text
   if (!inner.IsEmpty()) {
     nsIContent* content = GetContent();
     if (content) {
-      nsXPIDLString altText;
+      nsAutoString altText;
       nsCSSFrameConstructor::GetAlternateTextFor(content,
                                                  content->NodeInfo()->NameAtom(),
                                                  altText);
       DisplayAltText(PresContext(), aRenderingContext, altText, inner);
     }
   }
 
   aRenderingContext.Restore();
--- a/layout/generic/nsSimplePageSequenceFrame.cpp
+++ b/layout/generic/nsSimplePageSequenceFrame.cpp
@@ -388,17 +388,17 @@ nsSimplePageSequenceFrame::GetPrintRange
   return NS_OK;
 }
 
 // Helper Function
 void
 nsSimplePageSequenceFrame::SetPageNumberFormat(const char* aPropName, const char* aDefPropVal, bool aPageNumOnly)
 {
   // Doing this here so we only have to go get these formats once
-  nsXPIDLString pageNumberFormat;
+  nsAutoString pageNumberFormat;
   // Now go get the Localized Page Formating String
   nsresult rv =
     nsContentUtils::GetLocalizedString(nsContentUtils::ePRINTING_PROPERTIES,
                                        aPropName, pageNumberFormat);
   if (NS_FAILED(rv)) { // back stop formatting
     pageNumberFormat.AssignASCII(aDefPropVal);
   }
 
--- a/layout/printing/nsPrintData.cpp
+++ b/layout/printing/nsPrintData.cpp
@@ -36,32 +36,30 @@ nsPrintData::nsPrintData(ePrintDataType 
   , mDocWasToBeDestroyed(false)
   , mShrinkToFit(false)
   , mPrintFrameType(nsIPrintSettings::kFramesAsIs)
   , mNumPrintablePages(0)
   , mNumPagesPrinted(0)
   , mShrinkRatio(1.0)
   , mOrigDCScale(1.0)
   , mPPEventListeners(nullptr)
-  , 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("brandShortName", &mBrandName );
+      brandBundle->GetStringFromName("brandShortName", mBrandName);
     }
   }
 
-  if (!mBrandName) {
-    mBrandName = ToNewUnicode(NS_LITERAL_STRING("Mozilla Document"));
+  if (mBrandName.IsEmpty()) {
+    mBrandName.AssignLiteral(u"Mozilla Document");
   }
-
 }
 
 nsPrintData::~nsPrintData()
 {
   // remove the event listeners
   if (mPPEventListeners) {
     mPPEventListeners->RemoveListeners();
     NS_RELEASE(mPPEventListeners);
@@ -86,20 +84,16 @@ nsPrintData::~nsPrintData()
       } else {
         rv = mPrintDC->AbortDocument();
       }
       if (NS_FAILED(rv)) {
         // XXX nsPrintData::ShowPrintErrorDialog(rv);
       }
     }
   }
-
-  if (mBrandName) {
-    free(mBrandName);
-  }
 }
 
 void nsPrintData::OnStartPrinting()
 {
   if (!mOnStartSent) {
     DoOnProgressChange(0, 0, true, nsIWebProgressListener::STATE_START|nsIWebProgressListener::STATE_IS_DOCUMENT|nsIWebProgressListener::STATE_IS_NETWORK);
     mOnStartSent = true;
   }
--- a/layout/printing/nsPrintData.h
+++ b/layout/printing/nsPrintData.h
@@ -82,17 +82,17 @@ public:
   int32_t                     mNumPrintablePages;
   int32_t                     mNumPagesPrinted;
   float                       mShrinkRatio;
   float                       mOrigDCScale;
 
   nsCOMPtr<nsIPrintSettings>  mPrintSettings;
   nsPrintPreviewListener*     mPPEventListeners;
 
-  char16_t*            mBrandName; //  needed as a substitute name for a document
+  nsString                    mBrandName; //  needed as a substitute name for a document
 
 private:
   nsPrintData() = delete;
   nsPrintData& operator=(const nsPrintData& aOther) = delete;
 
   ~nsPrintData(); // non-virtual
 };
 
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -1503,17 +1503,17 @@ nsPrintEngine::GetDisplayTitleAndURL(con
 
   if (aTitle.IsEmpty()) {
     if (!docTitle.IsEmpty()) {
       aTitle = docTitle;
     } else {
       if (aDefType == eDocTitleDefURLDoc) {
         if (!aURLStr.IsEmpty()) {
           aTitle = aURLStr;
-        } else if (mPrt->mBrandName) {
+        } else if (!mPrt->mBrandName.IsEmpty()) {
           aTitle = mPrt->mBrandName;
         }
       }
     }
   }
 }
 
 //---------------------------------------------------------------------
--- a/layout/style/ErrorReporter.cpp
+++ b/layout/style/ErrorReporter.cpp
@@ -310,49 +310,47 @@ ErrorReporter::AddToError(const nsString
 }
 
 void
 ErrorReporter::ReportUnexpected(const char *aMessage)
 {
   if (!ShouldReportErrors()) return;
 
   nsAutoString str;
-  sStringBundle->GetStringFromName(aMessage, getter_Copies(str));
+  sStringBundle->GetStringFromName(aMessage, 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(aMessage,
-                                      params, ArrayLength(params),
-                                      getter_Copies(str));
+  sStringBundle->FormatStringFromName(aMessage, params, ArrayLength(params),
+                                      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(aMessage,
-                                      params, ArrayLength(params),
-                                      getter_Copies(str));
+  sStringBundle->FormatStringFromName(aMessage, params, ArrayLength(params),
+                                      str);
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpected(const char *aMessage,
                                 const nsCSSToken &aToken)
 {
   if (!ShouldReportErrors()) return;
@@ -370,70 +368,66 @@ 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(aMessage,
-                                      params, ArrayLength(params),
-                                      getter_Copies(str));
+  sStringBundle->FormatStringFromName(aMessage, params, ArrayLength(params),
+                                      str);
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpected(const char *aMessage,
                                 const nsString &aParam,
                                 const nsString &aValue)
 {
   if (!ShouldReportErrors()) return;
 
   nsAutoString qparam;
   nsStyleUtil::AppendEscapedCSSIdent(aParam, qparam);
   const char16_t *params[2] = { qparam.get(), aValue.get() };
 
   nsAutoString str;
-  sStringBundle->FormatStringFromName(aMessage,
-                                      params, ArrayLength(params),
-                                      getter_Copies(str));
+  sStringBundle->FormatStringFromName(aMessage, params, ArrayLength(params),
+                                      str);
   AddToError(str);
 }
 
 void
 ErrorReporter::ReportUnexpectedEOF(const char *aMessage)
 {
   if (!ShouldReportErrors()) return;
 
   nsAutoString innerStr;
-  sStringBundle->GetStringFromName(aMessage, getter_Copies(innerStr));
+  sStringBundle->GetStringFromName(aMessage, innerStr);
   const char16_t *params[1] = { innerStr.get() };
 
   nsAutoString str;
-  sStringBundle->FormatStringFromName("PEUnexpEOF2",
-                                      params, ArrayLength(params),
-                                      getter_Copies(str));
+  sStringBundle->FormatStringFromName("PEUnexpEOF2", params,
+                                      ArrayLength(params), 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("PEUnexpEOF2",
-                                      params, ArrayLength(params),
-                                      getter_Copies(str));
+  sStringBundle->FormatStringFromName("PEUnexpEOF2", params,
+                                      ArrayLength(params), str);
   AddToError(str);
 }
 
 bool
 ErrorReporter::IsServo() const
 {
   return !mScanner;
 }
--- a/layout/xul/nsMenuFrame.cpp
+++ b/layout/xul/nsMenuFrame.cpp
@@ -1097,21 +1097,22 @@ nsMenuFrame::BuildAcceleratorText(bool a
       nsCOMPtr<nsIStringBundleService> bundleService =
         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;
+          nsAutoString keyName;
           rv = bundle->GetStringFromName(NS_ConvertUTF16toUTF8(keyCode).get(),
-                                         getter_Copies(keyName));
-          if (keyName)
+                                         keyName);
+          if (NS_SUCCEEDED(rv)) {
             accelString = keyName;
+          }
         }
       }
 
       // nothing usable found, bail
       if (accelString.IsEmpty())
         return;
     }
   }
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.cpp
@@ -320,18 +320,18 @@ NS_IMETHODIMP nsPrefBranch::GetComplexVa
       if (!PREF_HasUserPref(pref.get()) && !PREF_PrefIsLocked(pref.get())) {
         bNeedDefault = true;
       }
     }
 
     // if we need to fetch the default value, do that instead, otherwise use the
     // value we pulled in at the top of this function
     if (bNeedDefault) {
-      nsXPIDLString utf16String;
-      rv = GetDefaultFromPropertiesFile(pref.get(), getter_Copies(utf16String));
+      nsAutoString utf16String;
+      rv = GetDefaultFromPropertiesFile(pref.get(), utf16String);
       if (NS_SUCCEEDED(rv)) {
         theString->SetData(utf16String.get());
       }
     } else {
       rv = GetCharPref(aPrefName, getter_Copies(utf8String));
       if (NS_SUCCEEDED(rv)) {
         theString->SetData(NS_ConvertUTF8toUTF16(utf8String).get());
       }
@@ -831,17 +831,19 @@ void nsPrefBranch::freeObserverList(void
 
 void
 nsPrefBranch::RemoveExpiredCallback(PrefCallback *aCallback)
 {
   NS_PRECONDITION(aCallback->IsExpired(), "Callback should be expired.");
   mObservers.Remove(aCallback);
 }
 
-nsresult nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName, char16_t **return_buf)
+nsresult
+nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName,
+                                           nsAString& aReturn)
 {
   nsresult rv;
 
   // the default value contains a URL to a .properties file
 
   nsXPIDLCString propertyFileURL;
   rv = PREF_CopyCharPref(aPrefName, getter_Copies(propertyFileURL), true);
   if (NS_FAILED(rv))
@@ -853,17 +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;
 
-  return bundle->GetStringFromName(aPrefName, return_buf);
+  return bundle->GetStringFromName(aPrefName, aReturn);
 }
 
 nsPrefBranch::PrefName
 nsPrefBranch::getPrefName(const char *aPrefName) const
 {
   NS_ASSERTION(aPrefName, "null pref name!");
 
   // for speed, avoid strcpy if we can:
--- a/modules/libpref/nsPrefBranch.h
+++ b/modules/libpref/nsPrefBranch.h
@@ -237,17 +237,17 @@ protected:
     size_t Length() const {
       static LenMatcher m;
       return match(m);
     }
   };
 
   virtual ~nsPrefBranch();
 
-  nsresult   GetDefaultFromPropertiesFile(const char *aPrefName, char16_t **return_buf);
+  nsresult   GetDefaultFromPropertiesFile(const char *aPrefName, nsAString& aReturn);
   // As SetCharPref, but without any check on the length of |aValue|
   nsresult   SetCharPrefInternal(const char *aPrefName, const char *aValue);
   // Reject strings that are more than 1Mb, warn if strings are more than 16kb
   nsresult   CheckSanityOfStringLength(const char* aPrefName, const nsAString& aValue);
   nsresult   CheckSanityOfStringLength(const char* aPrefName, const nsACString& aValue);
   nsresult   CheckSanityOfStringLength(const char* aPrefName, const char* aValue);
   nsresult   CheckSanityOfStringLength(const char* aPrefName, const uint32_t aLength);
   void RemoveExpiredCallback(PrefCallback *aCallback);
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -938,20 +938,20 @@ nsFtpState::R_syst() {
             nsresult rv = bundleService->CreateBundle(NECKO_MSGS_URL,
                                                       getter_AddRefs(bundle));
             if (NS_FAILED(rv))
                 return FTP_ERROR;
 
             char16_t* ucs2Response = ToNewUnicode(mResponseMsg);
             const char16_t *formatStrings[1] = { ucs2Response };
 
-            nsXPIDLString formattedString;
+            nsAutoString formattedString;
             rv = bundle->FormatStringFromName("UnsupportedFTPServer",
                                               formatStrings, 1,
-                                              getter_Copies(formattedString));
+                                              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);
             if (prompter)
--- a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp
+++ b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp
@@ -823,27 +823,27 @@ mount_operation_ask_password (GMountOper
   }
   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("EnterLoginForRealm3",
-                                     strings, 2, getter_Copies(nsmessage));
+                                     strings, 2, nsmessage);
       } else {
         const char16_t *strings[] = { dispHost.get() };
         bundle->FormatStringFromName("EnterUserPasswordFor2",
-                                     strings, 1, getter_Copies(nsmessage));
+                                     strings, 1, nsmessage);
       }
     } else {
       NS_ConvertUTF8toUTF16 userName(default_user);
       const char16_t *strings[] = { userName.get(), dispHost.get() };
       bundle->FormatStringFromName("EnterPasswordFor",
-                                   strings, 2, getter_Copies(nsmessage));
+                                   strings, 2, nsmessage);
     }
   } else {
     g_warning("Unknown mount operation request (flags: %x)", flags);
   }
 
   if (nsmessage.IsEmpty()) {
     g_mount_operation_reply(mount_op, G_MOUNT_OPERATION_ABORTED);
     return;
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -2482,17 +2482,17 @@ HttpBaseChannel::AddSecurityMessage(cons
   nsCOMPtr<nsILoadInfo> loadInfo;
   GetLoadInfo(getter_AddRefs(loadInfo));
   if (!loadInfo) {
     return NS_ERROR_FAILURE;
   }
 
   auto innerWindowID = loadInfo->GetInnerWindowID();
 
-  nsXPIDLString errorText;
+  nsAutoString errorText;
   rv = nsContentUtils::GetLocalizedString(
           nsContentUtils::eSECURITY_PROPERTIES,
           NS_ConvertUTF16toUTF8(aMessageTag).get(),
           errorText);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString spec;
   if (mURI) {
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -67,17 +67,17 @@ LogBlockedRequest(nsIRequest* aRequest,
   nsCOMPtr<nsIURI> aUri;
   channel->GetURI(getter_AddRefs(aUri));
   nsAutoCString spec;
   if (aUri) {
     spec = aUri->GetSpecOrDefault();
   }
 
   // Generate the error message
-  nsXPIDLString blockedMessage;
+  nsAutoString blockedMessage;
   NS_ConvertUTF8toUTF16 specUTF16(spec);
   const char16_t* params[] = { specUTF16.get(), aParam };
   rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eSECURITY_PROPERTIES,
                                              aProperty,
                                              params,
                                              blockedMessage);
 
   if (NS_FAILED(rv)) {
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2804,29 +2804,27 @@ nsHttpChannel::PromptTempRedirect()
     nsCOMPtr<nsIStringBundleService> bundleService =
             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("RepostFormData",
-                                         getter_Copies(messageString));
-    // GetStringFromName can return NS_OK and nullptr messageString.
-    if (NS_SUCCEEDED(rv) && messageString) {
+    nsAutoString messageString;
+    rv = stringBundle->GetStringFromName("RepostFormData", messageString);
+    if (NS_SUCCEEDED(rv)) {
         bool repost = false;
 
         nsCOMPtr<nsIPrompt> prompt;
         GetCallback(prompt);
         if (!prompt)
             return NS_ERROR_NO_INTERFACE;
 
-        prompt->Confirm(nullptr, messageString, &repost);
+        prompt->Confirm(nullptr, messageString.get(), &repost);
         if (!repost)
             return NS_ERROR_FAILURE;
     }
 
     return rv;
 }
 
 nsresult
--- a/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
+++ b/netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
@@ -1581,19 +1581,19 @@ nsHttpChannelAuthProvider::ConfirmAuth(c
       // if we're actually removing anything.
       if (cutPoint > 0) {
         ucsHost.Replace(0, cutPoint, nsContentUtils::GetLocalizedEllipsis());
       }
     }
 
     const char16_t *strs[2] = { ucsHost.get(), ucsUser.get() };
 
-    nsXPIDLString msg;
-    bundle->FormatStringFromName(bundleKey, strs, 2, getter_Copies(msg));
-    if (!msg)
+    nsAutoString msg;
+    rv = bundle->FormatStringFromName(bundleKey, strs, 2, msg);
+    if (NS_FAILED(rv))
         return true;
 
     nsCOMPtr<nsIInterfaceRequestor> callbacks;
     rv = mAuthChannel->GetNotificationCallbacks(getter_AddRefs(callbacks));
     if (NS_FAILED(rv))
         return true;
 
     nsCOMPtr<nsILoadGroup> loadGroup;
@@ -1609,28 +1609,28 @@ nsHttpChannelAuthProvider::ConfirmAuth(c
 
     // do not prompt again
     mSuppressDefensiveAuth = true;
 
     bool confirmed;
     if (doYesNoPrompt) {
         int32_t choice;
         bool checkState = false;
-        rv = prompt->ConfirmEx(nullptr, msg,
+        rv = prompt->ConfirmEx(nullptr, msg.get(),
                                nsIPrompt::BUTTON_POS_1_DEFAULT +
                                nsIPrompt::STD_YES_NO_BUTTONS,
                                nullptr, nullptr, nullptr, nullptr,
                                &checkState, &choice);
         if (NS_FAILED(rv))
             return true;
 
         confirmed = choice == 0;
     }
     else {
-        rv = prompt->Confirm(nullptr, msg, &confirmed);
+        rv = prompt->Confirm(nullptr, msg.get(), &confirmed);
         if (NS_FAILED(rv))
             return true;
     }
 
     return confirmed;
 }
 
 void
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -510,25 +510,25 @@ nsIndexedToHTML::DoOnStartRequest(nsIReq
         rv = mTextToSubURI->UnEscapeAndConvert(charset, titleUri, unEscapeSpec);
     }
     if (NS_FAILED(rv)) return rv;
 
     nsXPIDLString htmlEscSpec;
     htmlEscSpec.Adopt(nsEscapeHTML2(unEscapeSpec.get(),
                                     unEscapeSpec.Length()));
 
-    nsXPIDLString title;
+    nsAutoString title;
     const char16_t* formatTitle[] = {
         htmlEscSpec.get()
     };
 
     rv = mBundle->FormatStringFromName("DirTitle",
                                        formatTitle,
                                        sizeof(formatTitle)/sizeof(char16_t*),
-                                       getter_Copies(title));
+                                       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);
 
     buffer.AppendLiteral("</title>\n");
 
@@ -571,73 +571,66 @@ nsIndexedToHTML::DoOnStartRequest(nsIReq
 
     const char16_t* formatHeading[] = {
         htmlEscSpec.get()
     };
 
     rv = mBundle->FormatStringFromName("DirTitle",
                                        formatHeading,
                                        sizeof(formatHeading)/sizeof(char16_t*),
-                                       getter_Copies(title));
+                                       title);
     if (NS_FAILED(rv)) return rv;
 
     AppendNonAsciiToNCR(title, buffer);
     buffer.AppendLiteral("</h1>\n");
 
     if (!parentStr.IsEmpty()) {
-        nsXPIDLString parentText;
-        rv = mBundle->GetStringFromName("DirGoUp",
-                                        getter_Copies(parentText));
+        nsAutoString parentText;
+        rv = mBundle->GetStringFromName("DirGoUp", parentText);
         if (NS_FAILED(rv)) return rv;
 
         buffer.AppendLiteral("<p id=\"UI_goUp\"><a class=\"up\" href=\"");
 
         nsCString htmlParentStr;
         htmlParentStr.Adopt(nsEscapeHTML(parentStr.get()));
         buffer.Append(htmlParentStr);
         buffer.AppendLiteral("\">");
         AppendNonAsciiToNCR(parentText, buffer);
         buffer.AppendLiteral("</a></p>\n");
     }
 
     if (isSchemeFile) {
-        nsXPIDLString showHiddenText;
-        rv = mBundle->GetStringFromName("ShowHidden",
-                                        getter_Copies(showHiddenText));
+        nsAutoString showHiddenText;
+        rv = mBundle->GetStringFromName("ShowHidden", 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"
+    buffer.AppendLiteral("<table>\n"
+                         " <thead>\n"
                          "  <tr>\n"
                          "   <th>");
 
-    rv = mBundle->GetStringFromName("DirColName",
-                                    getter_Copies(columnText));
+    nsAutoString columnText;
+    rv = mBundle->GetStringFromName("DirColName", columnText);
     if (NS_FAILED(rv)) return rv;
     AppendNonAsciiToNCR(columnText, buffer);
     buffer.AppendLiteral("</th>\n"
                          "   <th>");
 
-    rv = mBundle->GetStringFromName("DirColSize",
-                                    getter_Copies(columnText));
+    rv = mBundle->GetStringFromName("DirColSize", columnText);
     if (NS_FAILED(rv)) return rv;
     AppendNonAsciiToNCR(columnText, buffer);
     buffer.AppendLiteral("</th>\n"
                          "   <th colspan=\"2\">");
 
-    rv = mBundle->GetStringFromName("DirColMTime",
-                                    getter_Copies(columnText));
+    rv = mBundle->GetStringFromName("DirColMTime", columnText);
     if (NS_FAILED(rv)) return rv;
     AppendNonAsciiToNCR(columnText, buffer);
     buffer.AppendLiteral("</th>\n"
                          "  </tr>\n"
                          " </thead>\n");
     buffer.AppendLiteral(" <tbody>\n");
 
     aBuffer = buffer;
@@ -787,19 +780,18 @@ nsIndexedToHTML::OnIndexAvailable(nsIReq
             nsCString htmlFileExt;
             htmlFileExt.Adopt(nsEscapeHTML(locEscaped.get()));
             pushBuffer.Append(htmlFileExt);
         } else {
             pushBuffer.AppendLiteral("unknown");
         }
         pushBuffer.AppendLiteral("?size=16\" alt=\"");
 
-        nsXPIDLString altText;
-        rv = mBundle->GetStringFromName("DirFileLabel",
-                                        getter_Copies(altText));
+        nsAutoString altText;
+        rv = mBundle->GetStringFromName("DirFileLabel", 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
@@ -27,17 +27,17 @@ nsHtml5PlainTextUtils::NewLinkAttributes
 
   nsresult rv;
   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;
+  nsAutoString title;
   if (bundle) {
-    bundle->GetStringFromName("plainText.wordWrap", getter_Copies(title));
+    bundle->GetStringFromName("plainText.wordWrap", title);
   }
 
   linkAttrs->addAttribute(
     nsHtml5AttributeName::ATTR_TITLE, nsHtml5String::FromString(title), -1);
   return linkAttrs;
 }
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -927,17 +927,17 @@ nsHtml5TreeOperation::Perform(nsHtml5Tre
       } else {
         node->SetAttr(kNameSpaceID_None,
                       nsGkAtoms::_class,
                       NS_LITERAL_STRING("error"),
                       true);
       }
 
       nsresult rv;
-      nsXPIDLString message;
+      nsAutoString message;
       if (otherAtom) {
         const char16_t* params[] = { atom->GetUTF16String(),
                                       otherAtom->GetUTF16String() };
         rv = nsContentUtils::FormatLocalizedString(
           nsContentUtils::eHTMLPARSER_PROPERTIES, msgId, params, message);
         NS_ENSURE_SUCCESS(rv, NS_OK);
       } else if (atom) {
         const char16_t* params[] = { atom->GetUTF16String() };
--- a/parser/htmlparser/nsParserMsgUtils.cpp
+++ b/parser/htmlparser/nsParserMsgUtils.cpp
@@ -30,35 +30,35 @@ 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;
-    rv = bundle->GetStringFromName(aKey, getter_Copies(valUni));
-    if (NS_SUCCEEDED(rv) && valUni) {
+    nsAutoString valUni;
+    rv = bundle->GetStringFromName(aKey, valUni);
+    if (NS_SUCCEEDED(rv)) {
       oVal.Assign(valUni);
     }
   }
 
   return rv;
 }
 
 nsresult
 nsParserMsgUtils::GetLocalizedStringByID(const char * aPropFileName, uint32_t aID, nsString& oVal)
 {
   oVal.Truncate();
 
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv = GetBundle(aPropFileName,getter_AddRefs(bundle));
   if (NS_SUCCEEDED(rv) && bundle) {
-    nsXPIDLString valUni;
-    rv = bundle->GetStringFromID(aID, getter_Copies(valUni));
-    if (NS_SUCCEEDED(rv) && valUni) {
+    nsAutoString valUni;
+    rv = bundle->GetStringFromID(aID, valUni);
+    if (NS_SUCCEEDED(rv)) {
       oVal.Assign(valUni);
-    }  
+    }
   }
 
   return rv;
 }
--- 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(
-    "getPKCS12FilePasswordMessage", getter_Copies(msg));
+    "getPKCS12FilePasswordMessage", 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,17 +188,17 @@ NSSErrorsService::GetErrorMessage(nsresu
     theBundle = mNSSErrorsBundle;
   }
 
   if (!id_str || !theBundle) {
     return NS_ERROR_FAILURE;
   }
 
   nsAutoString msg;
-  nsresult rv = theBundle->GetStringFromName(id_str, getter_Copies(msg));
+  nsresult rv = theBundle->GetStringFromName(id_str, 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,17 @@ 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(stringName,
-                                         getter_Copies(result));
+  return pipnssBundle->GetStringFromName(stringName, result);
 }
 
 static nsresult
 PIPBundleFormatStringFromName(const char* stringName, const char16_t** params,
                               uint32_t numParams, nsAString& result)
 {
   MOZ_ASSERT(stringName);
   MOZ_ASSERT(params);
@@ -121,17 +120,17 @@ PIPBundleFormatStringFromName(const char
   }
   nsCOMPtr<nsIStringBundle> pipnssBundle;
   nsresult rv = GetPIPNSSBundle(getter_AddRefs(pipnssBundle));
   if (NS_FAILED(rv)) {
     return rv;
   }
   result.Truncate();
   return pipnssBundle->FormatStringFromName(
-    stringName, params, numParams, getter_Copies(result));
+    stringName, params, numParams, 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,37 +233,35 @@ nsNSSComponent::PIPBundleFormatStringFro
                                               const char16_t** params,
                                               uint32_t numParams,
                                               nsAString& outString)
 {
   MutexAutoLock lock(mMutex);
   nsresult rv = NS_ERROR_FAILURE;
 
   if (mPIPNSSBundle && name) {
-    nsXPIDLString result;
-    rv = mPIPNSSBundle->FormatStringFromName(name,
-                                             params, numParams,
-                                             getter_Copies(result));
+    nsAutoString result;
+    rv = mPIPNSSBundle->FormatStringFromName(name, params, numParams, result);
     if (NS_SUCCEEDED(rv)) {
       outString = result;
     }
   }
   return rv;
 }
 
 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(name, getter_Copies(result));
+    nsAutoString result;
+    rv = mPIPNSSBundle->GetStringFromName(name, result);
     if (NS_SUCCEEDED(rv)) {
       outString = result;
       rv = NS_OK;
     }
   }
 
   return rv;
 }
@@ -271,18 +269,18 @@ nsNSSComponent::GetPIPNSSBundleString(co
 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(name, getter_Copies(result));
+    nsAutoString result;
+    rv = mNSSErrorsBundle->GetStringFromName(name, result);
     if (NS_SUCCEEDED(rv)) {
       outString = result;
       rv = NS_OK;
     }
   }
 
   return rv;
 }
--- a/toolkit/components/downloads/nsDownloadManager.cpp
+++ b/toolkit/components/downloads/nsDownloadManager.cpp
@@ -112,18 +112,18 @@ nsDownloadManager::GetDefaultDownloadsDi
   // User download directory
   // Vista:
   // Downloads
   // XP/2K:
   // My Documents/Downloads
   // Linux:
   // XDG user dir spec, with a fallback to Home/Downloads
 
-  nsXPIDLString folderName;
-  mBundle->GetStringFromName("downloadsFolder", getter_Copies(folderName));
+  nsAutoString folderName;
+  mBundle->GetStringFromName("downloadsFolder", 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
@@ -217,17 +217,17 @@ SetJournalMode(nsCOMPtr<mozIStorageConne
   }
 
   return JOURNAL_DELETE;
 }
 
 nsresult
 CreateRoot(nsCOMPtr<mozIStorageConnection>& aDBConn,
            const nsCString& aRootName, const nsCString& aGuid,
-           const nsXPIDLString& titleString)
+           const nsAString& titleString)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   // The position of the new item in its folder.
   static int32_t itemPosition = 0;
 
   // A single creation timestamp for all roots so that the root folder's
   // last modification time isn't earlier than its childrens' creation time.
@@ -1215,46 +1215,42 @@ Database::CreateBookmarkRoots()
 
   nsCOMPtr<nsIStringBundleService> bundleService =
     services::GetStringBundleService();
   NS_ENSURE_STATE(bundleService);
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv = bundleService->CreateBundle(PLACES_BUNDLE, getter_AddRefs(bundle));
   if (NS_FAILED(rv)) return rv;
 
-  nsXPIDLString rootTitle;
+  nsAutoString 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("BookmarksMenuFolderTitle",
-                                 getter_Copies(rootTitle));
+  rv = bundle->GetStringFromName("BookmarksMenuFolderTitle", 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("BookmarksToolbarFolderTitle",
-                                 getter_Copies(rootTitle));
+  rv = bundle->GetStringFromName("BookmarksToolbarFolderTitle", 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("TagsFolderTitle",
-                                 getter_Copies(rootTitle));
+  rv = bundle->GetStringFromName("TagsFolderTitle", 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("OtherBookmarksFolderTitle",
-                                 getter_Copies(rootTitle));
+  rv = bundle->GetStringFromName("OtherBookmarksFolderTitle", 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;
   {
@@ -1396,19 +1392,18 @@ Database::UpdateBookmarkRootTitles()
   const char *titleStringIDs[] = { "BookmarksMenuFolderTitle"
                                  , "BookmarksToolbarFolderTitle"
                                  , "TagsFolderTitle"
                                  , "OtherBookmarksFolderTitle"
                                  , "MobileBookmarksFolderTitle"
                                  };
 
   for (uint32_t i = 0; i < ArrayLength(rootGuids); ++i) {
-    nsXPIDLString title;
-    rv = bundle->GetStringFromName(titleStringIDs[i],
-                                   getter_Copies(title));
+    nsAutoString title;
+    rv = bundle->GetStringFromName(titleStringIDs[i], 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]));
     if (NS_FAILED(rv)) return rv;
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -4216,34 +4216,33 @@ void
 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));
+    nsAutoString value;
+    nsresult rv = bundle->FormatStringFromName(aName, strings, 1, value);
     if (NS_SUCCEEDED(rv)) {
       CopyUTF16toUTF8(value, aResult);
       return;
     }
   }
   aResult.Assign(aName);
 }
 
 void
 nsNavHistory::GetStringFromName(const char* aName, nsACString& aResult)
 {
   nsIStringBundle *bundle = GetBundle();
   if (bundle) {
-    nsXPIDLString value;
-    nsresult rv = bundle->GetStringFromName(aName, getter_Copies(value));
+    nsAutoString value;
+    nsresult rv = bundle->GetStringFromName(aName, value);
     if (NS_SUCCEEDED(rv)) {
       CopyUTF16toUTF8(value, aResult);
       return;
     }
   }
   aResult.Assign(aName);
 }
 
--- a/toolkit/components/printingui/win/nsPrintDialogUtil.cpp
+++ b/toolkit/components/printingui/win/nsPrintDialogUtil.cpp
@@ -103,19 +103,19 @@ GetLocalizedBundle(const char * aPropFil
 // Return localized string
 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;
-  nsresult rv = aStrBundle->GetStringFromName(aKey, getter_Copies(valUni));
-  if (NS_SUCCEEDED(rv) && valUni) {
+  nsAutoString valUni;
+  nsresult rv = aStrBundle->GetStringFromName(aKey, valUni);
+  if (NS_SUCCEEDED(rv)) {
     oVal.Assign(valUni);
   } else {
     oVal.Truncate();
   }
   return rv;
 }
 
 //--------------------------------------------------------
--- a/toolkit/mozapps/extensions/AddonContentPolicy.cpp
+++ b/toolkit/mozapps/extensions/AddonContentPolicy.cpp
@@ -193,16 +193,17 @@ class CSPValidator final : public nsCSPS
   public:
     CSPValidator(nsAString& aURL, CSPDirective aDirective, bool aDirectiveRequired = true) :
       mURL(aURL),
       mDirective(CSP_CSPDirectiveToString(aDirective)),
       mFoundSelf(false)
     {
       // Start with the default error message for a missing directive, since no
       // visitors will be called if the directive isn't present.
+      mError.SetIsVoid(true);
       if (aDirectiveRequired) {
         FormatError("csp.error.missing-directive");
       }
     }
 
     // Visitors
 
     bool visitSchemeSrc(const nsCSPSchemeSrc& src) override
@@ -363,31 +364,31 @@ 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) {
-        rv = stringBundle->FormatStringFromName(aName, aParams, aLength,
-                                                getter_Copies(mError));
+        rv =
+          stringBundle->FormatStringFromName(aName, aParams, aLength, mError);
       }
 
       if (NS_WARN_IF(NS_FAILED(rv))) {
         mError.AssignLiteral("An unexpected error occurred");
       }
     };
 
 
     // Data members
 
     nsAutoString mURL;
     NS_ConvertASCIItoUTF16 mDirective;
-    nsXPIDLString mError;
+    nsString mError;
 
     bool mFoundSelf;
 };
 
 /**
  * Validates a custom content security policy string for use by an add-on.
  * In particular, ensures that:
  *
--- a/toolkit/system/gnome/nsAlertsIconListener.cpp
+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp
@@ -251,18 +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("brandShortName",
-                                  getter_Copies(appName));
+        bundle->GetStringFromName("brandShortName", 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
@@ -82,21 +82,21 @@ ProfileResetCleanup(nsIToolkitProfile* a
 
   nsCOMPtr<nsIStringBundle> sb;
   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;
+  nsAutoString resetBackupDirectoryName;
 
   static const char* kResetBackupDirectory = "resetBackupDirectory";
   rv = sb->FormatStringFromName(kResetBackupDirectory, params, 2,
-                                getter_Copies(resetBackupDirectoryName));
+                                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.
     rv = NS_GetSpecialDirectory(NS_OS_HOME_DIR, getter_AddRefs(backupDest));
     if (NS_FAILED(rv)) return rv;
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -1952,33 +1952,31 @@ ProfileLockedDialog(nsIFile* aProfileDir
 
     nsCOMPtr<nsIStringBundle> sb;
     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;
+    nsAutoString killMessage;
 #ifndef XP_MACOSX
-    sb->FormatStringFromName(aUnlocker ? "restartMessageUnlocker"
-                                       : "restartMessageNoUnlocker",
-                             params, 2, getter_Copies(killMessage));
+    rv = sb->FormatStringFromName(aUnlocker ? "restartMessageUnlocker"
+                                            : "restartMessageNoUnlocker",
+                                  params, 2, killMessage);
 #else
-    sb->FormatStringFromName(aUnlocker ? "restartMessageUnlockerMac"
-                                       : "restartMessageNoUnlockerMac",
-                             params, 2, getter_Copies(killMessage));
+    rv = sb->FormatStringFromName(aUnlocker ? "restartMessageUnlockerMac"
+                                            : "restartMessageNoUnlockerMac",
+                                  params, 2, killMessage);
 #endif
-
-    nsXPIDLString killTitle;
-    sb->FormatStringFromName("restartTitle",
-                             params, 1, getter_Copies(killTitle));
-
-    if (!killMessage || !killTitle)
-      return NS_ERROR_FAILURE;
+    NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+
+    nsAutoString killTitle;
+    rv = sb->FormatStringFromName("restartTitle", params, 1, killTitle);
+    NS_ENSURE_SUCCESS(rv, 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());
       return NS_ERROR_FAILURE;
     }
 
     nsCOMPtr<nsIPromptService> ps
@@ -1993,18 +1991,18 @@ ProfileLockedDialog(nsIFile* aProfileDir
 #else
       const uint32_t flags =
         (nsIPromptService::BUTTON_TITLE_IS_STRING *
          nsIPromptService::BUTTON_POS_0) +
         (nsIPromptService::BUTTON_TITLE_CANCEL *
          nsIPromptService::BUTTON_POS_1);
 
       bool checkState = false;
-      rv = ps->ConfirmEx(nullptr, killTitle, killMessage, flags,
-                         killTitle, nullptr, nullptr, nullptr,
+      rv = ps->ConfirmEx(nullptr, killTitle.get(), killMessage.get(), flags,
+                         killTitle.get(), nullptr, nullptr, nullptr,
                          &checkState, &button);
       NS_ENSURE_SUCCESS_LOG(rv, rv);
 #endif
 
       if (button == 0) {
         rv = aUnlocker->Unlock(nsIProfileUnlocker::FORCE_QUIT);
         if (NS_FAILED(rv)) {
           return rv;
@@ -2017,17 +2015,17 @@ ProfileLockedDialog(nsIFile* aProfileDir
       }
     } else {
 #ifdef MOZ_WIDGET_ANDROID
       if (java::GeckoAppShell::UnlockProfile()) {
         return NS_LockProfilePath(aProfileDir, aProfileLocalDir,
                                   nullptr, aResult);
       }
 #else
-      rv = ps->Alert(nullptr, killTitle, killMessage);
+      rv = ps->Alert(nullptr, killTitle.get(), killMessage.get());
       NS_ENSURE_SUCCESS_LOG(rv, rv);
 #endif
     }
 
     return NS_ERROR_ABORT;
   }
 }
 
@@ -2050,33 +2048,29 @@ ProfileMissingDialog(nsINativeAppSupport
 
     nsCOMPtr<nsIStringBundle> sb;
     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 missingMessage;
-
     // profileMissing
-    sb->FormatStringFromName("profileMissing",
-                             params, 2, getter_Copies(missingMessage));
-
-    nsXPIDLString missingTitle;
-    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);
-    }
+    nsAutoString missingMessage;
+    rv = sb->FormatStringFromName("profileMissing", params, 2, missingMessage);
+    NS_ENSURE_SUCCESS(rv, NS_ERROR_ABORT);
+
+    nsAutoString missingTitle;
+    rv = sb->FormatStringFromName("profileMissingTitle", params, 1, missingTitle);
+    NS_ENSURE_SUCCESS(rv, NS_ERROR_ABORT);
+
+    nsCOMPtr<nsIPromptService> ps(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
+    NS_ENSURE_TRUE(ps, NS_ERROR_FAILURE);
+
+    ps->Alert(nullptr, missingTitle.get(), missingMessage.get());
 
     return NS_ERROR_ABORT;
   }
 }
 
 static nsresult
 ProfileLockedDialog(nsIToolkitProfile* aProfile, nsIProfileUnlocker* aUnlocker,
                     nsINativeAppSupport* aNative, nsIProfileLock* *aResult)
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -1157,19 +1157,18 @@ NS_IMETHODIMP nsDocLoader::OnStatus(nsIR
         info->mMaxProgress = 0;
       }
     }
 
     nsCOMPtr<nsIStringBundleService> sbs =
       mozilla::services::GetStringBundleService();
     if (!sbs)
       return NS_ERROR_FAILURE;
-    nsXPIDLString msg;
-    nsresult rv = sbs->FormatStatusMessage(aStatus, aStatusArg,
-                                           getter_Copies(msg));
+    nsAutoString msg;
+    nsresult rv = sbs->FormatStatusMessage(aStatus, aStatusArg, msg);
     if (NS_FAILED(rv))
       return rv;
 
     // Keep around the message. In case a request finishes, we need to make sure
     // to send the status message of another request to our user to that we
     // don't display, for example, "Transferring" messages for requests that are
     // already done.
     if (info) {
@@ -1180,17 +1179,17 @@ NS_IMETHODIMP nsDocLoader::OnStatus(nsIR
         // it from wherever it is now.
         info->mLastStatus->remove();
       }
       info->mLastStatus->mStatusMessage = msg;
       info->mLastStatus->mStatusCode = aStatus;
       // Put the info at the front of the list
       mStatusInfoList.insertFront(info->mLastStatus);
     }
-    FireOnStatusChange(this, aRequest, aStatus, msg);
+    FireOnStatusChange(this, aRequest, aStatus, msg.get());
   }
   return NS_OK;
 }
 
 void nsDocLoader::ClearInternalProgress()
 {
   ClearRequestInfoHash();
 
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1859,34 +1859,34 @@ void nsExternalAppHandler::SendStatusCha
 
     // 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;
+            nsAutoString msgText;
             const char16_t *strings[] = { path.get() };
             if (NS_SUCCEEDED(bundle->FormatStringFromName(msgId, strings, 1,
-                                                          getter_Copies(msgText)))) {
+                                                          msgText))) {
               if (mDialogProgressListener) {
                 // We have a listener, let it handle the error.
-                mDialogProgressListener->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText);
+                mDialogProgressListener->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText.get());
               } else if (mTransfer) {
-                mTransfer->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText);
+                mTransfer->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText.get());
               } 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;
+                nsAutoString title;
                 bundle->FormatStringFromName("title",
                                              strings,
                                              1,
-                                             getter_Copies(title));
+                                             title);
 
                 MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Debug,
                        ("mContentContext=0x%p, prompter=0x%p, qi rv=0x%08"
                         PRIX32 ", title='%s', msg='%s'",
                        mContentContext.get(),
                        prompter.get(),
                         static_cast<uint32_t>(qiRv),
                        NS_ConvertUTF16toUTF8(title).get(),
@@ -1916,17 +1916,17 @@ void nsExternalAppHandler::SendStatusCha
                   if (!prompter) {
                     MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Error,
                            ("No prompter from DocShell, no way to alert user"));
                     return;
                   }
                 }
 
                 // We should always have a prompter at this point.
-                prompter->Alert(title, msgText);
+                prompter->Alert(title.get(), msgText.get());
               }
             }
         }
     }
 }
 
 NS_IMETHODIMP
 nsExternalAppHandler::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
--- a/widget/cocoa/OSXNotificationCenter.mm
+++ b/widget/cocoa/OSXNotificationCenter.mm
@@ -293,49 +293,46 @@ OSXNotificationCenter::ShowAlertWithIcon
   rv = aAlert->GetSource(hostPort);
   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;
+    nsAutoString notificationSource;
     bundle->FormatStringFromName("source.label",
                                  formatStrings,
                                  ArrayLength(formatStrings),
-                                 getter_Copies(notificationSource));
+                                 notificationSource);
     notification.subtitle = nsCocoaUtils::ToNSString(notificationSource);
   }
 
   nsAutoString text;
   rv = aAlert->GetText(text);
   NS_ENSURE_SUCCESS(rv, rv);
   notification.informativeText = nsCocoaUtils::ToNSString(text);
 
   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("closeButton.title",
-                              getter_Copies(closeButtonTitle));
-    bundle->GetStringFromName("actionButton.label",
-                              getter_Copies(actionButtonTitle));
+    nsAutoString closeButtonTitle, actionButtonTitle, disableButtonTitle, settingsButtonTitle;
+    bundle->GetStringFromName("closeButton.title", closeButtonTitle);
+    bundle->GetStringFromName("actionButton.label", actionButtonTitle);
     if (!hostPort.IsEmpty()) {
       const char16_t* formatStrings[] = { hostPort.get() };
       bundle->FormatStringFromName("webActions.disableForOrigin.label",
                                    formatStrings,
                                    ArrayLength(formatStrings),
-                                   getter_Copies(disableButtonTitle));
+                                   disableButtonTitle);
     }
-    bundle->GetStringFromName("webActions.settings.label",
-                              getter_Copies(settingsButtonTitle));
+    bundle->GetStringFromName("webActions.settings.label", 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:)] &&
         [notification respondsToSelector:@selector(set_alwaysShowAlternateActionMenu:)] &&
--- a/widget/cocoa/nsFilePicker.mm
+++ b/widget/cocoa/nsFilePicker.mm
@@ -114,19 +114,19 @@ NSView* nsFilePicker::GetAccessoryView()
   // Set a label's default value.
   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("formatLabel", getter_Copies(locaLabel));
-    if (locaLabel) {
+    nsAutoString locaLabel;
+    rv = bundle->GetStringFromName("formatLabel", locaLabel);
+    if (NS_SUCCEEDED(rv)) {
       label = [NSString stringWithCharacters:reinterpret_cast<const unichar*>(locaLabel.get())
                                       length:locaLabel.Length()];
     }
   }
 
   // set up label text field
   NSTextField* textField = [[[NSTextField alloc] init] autorelease];
   [textField setEditable:NO];
--- a/widget/cocoa/nsMenuBarX.mm
+++ b/widget/cocoa/nsMenuBarX.mm
@@ -188,24 +188,24 @@ void nsMenuBarX::ConstructFallbackNative
 
   nsCOMPtr<nsIStringBundleService> bundleSvc = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
   bundleSvc->CreateBundle("chrome://global/locale/fallbackMenubar.properties", getter_AddRefs(stringBundle));
 
   if (!stringBundle) {
     return;
   }
 
-  nsXPIDLString labelUTF16;
-  nsXPIDLString keyUTF16;
+  nsAutoString labelUTF16;
+  nsAutoString keyUTF16;
 
   const char* labelProp = "quitMenuitem.label";
   const char* keyProp = "quitMenuitem.key";
 
-  stringBundle->GetStringFromName(labelProp, getter_Copies(labelUTF16));
-  stringBundle->GetStringFromName(keyProp, getter_Copies(keyUTF16));
+  stringBundle->GetStringFromName(labelProp, labelUTF16);
+  stringBundle->GetStringFromName(keyProp, keyUTF16);
 
   NSString* labelStr = [NSString stringWithUTF8String:
                         NS_ConvertUTF16toUTF8(labelUTF16).get()];
   NSString* keyStr= [NSString stringWithUTF8String:
                      NS_ConvertUTF16toUTF8(keyUTF16).get()];
 
   if (!nsMenuBarX::sNativeEventTarget) {
     nsMenuBarX::sNativeEventTarget = [[NativeMenuItemTarget alloc] init];
--- a/widget/cocoa/nsPrintDialogX.mm
+++ b/widget/cocoa/nsPrintDialogX.mm
@@ -302,18 +302,18 @@ static const char sHeaderFooterTags[][4]
   bundleSvc->CreateBundle("chrome://global/locale/printdialog.properties", &mPrintBundle);
 }
 
 - (NSString*)localizedString:(const char*)aKey
 {
   if (!mPrintBundle)
     return @"";
 
-  nsXPIDLString intlString;
-  mPrintBundle->GetStringFromName(aKey, getter_Copies(intlString));
+  nsAutoString intlString;
+  mPrintBundle->GetStringFromName(aKey, 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
@@ -48,35 +48,35 @@ 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;
+  nsAutoString intlString;
 
-  printBundle->GetStringFromName("headerFooterCustom", getter_Copies(intlString));
+  printBundle->GetStringFromName("headerFooterCustom", 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("customHeaderFooterPrompt", getter_Copies(intlString));
+  printBundle->GetStringFromName("customHeaderFooterPrompt", 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) {
@@ -322,18 +322,18 @@ 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(aKey, getter_Copies(intlString));
+  nsAutoString intlString;
+  printBundle->GetStringFromName(aKey, 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,18 +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("brandShortName",
-                                              getter_Copies(wbrand));
+            brandingBundle->GetStringFromName("brandShortName", wbrand);
             NS_ConvertUTF16toUTF8 brand(wbrand);
 
             ca_context_change_props(ctx, "application.name", brand.get(),
                                     nullptr);
         }
     }
 
     nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -170,17 +170,17 @@ static GdkCursor *get_gtk_cursor(nsCurso
 
 static GdkWindow *get_inner_gdk_window (GdkWindow *aWindow,
                                         gint x, gint y,
                                         gint *retx, gint *rety);
 
 static int    is_parent_ungrab_enter(GdkEventCrossing *aEvent);
 static int    is_parent_grab_leave(GdkEventCrossing *aEvent);
 
-static void GetBrandName(nsXPIDLString& brandName);
+static void GetBrandName(nsAString& brandName);
 
 /* callbacks from widgets */
 #if (MOZ_WIDGET_GTK == 2)
 static gboolean expose_event_cb           (GtkWidget *widget,
                                            GdkEventExpose *event);
 #else
 static gboolean expose_event_cb           (GtkWidget *widget,
                                            cairo_t *rect);
@@ -1759,17 +1759,17 @@ void
 nsWindow::SetIcon(const nsAString& aIconSpec)
 {
     if (!mShell)
         return;
 
     nsAutoCString iconName;
 
     if (aIconSpec.EqualsLiteral("default")) {
-        nsXPIDLString brandName;
+        nsAutoString brandName;
         GetBrandName(brandName);
         AppendUTF16toUTF8(brandName, iconName);
         ToLowerCase(iconName);
     } else {
         AppendUTF16toUTF8(aIconSpec, iconName);
     }
 
     nsCOMPtr<nsIFile> iconFile;
@@ -3491,34 +3491,32 @@ nsWindow::OnTouchEvent(GdkEventTouch* aE
     }
 
     DispatchInputEvent(&event);
     return TRUE;
 }
 #endif
 
 static void
-GetBrandName(nsXPIDLString& brandName)
+GetBrandName(nsAString& aBrandName)
 {
     nsCOMPtr<nsIStringBundleService> bundleService =
         do_GetService(NS_STRINGBUNDLE_CONTRACTID);
 
     nsCOMPtr<nsIStringBundle> bundle;
     if (bundleService)
         bundleService->CreateBundle(
             "chrome://branding/locale/brand.properties",
             getter_AddRefs(bundle));
 
     if (bundle)
-        bundle->GetStringFromName(
-            "brandShortName",
-            getter_Copies(brandName));
-
-    if (brandName.IsEmpty())
-        brandName.AssignLiteral(u"Mozilla");
+        bundle->GetStringFromName("brandShortName", aBrandName);
+
+    if (aBrandName.IsEmpty())
+        aBrandName.AssignLiteral(u"Mozilla");
 }
 
 static GdkWindow *
 CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
 {
     GdkWindowAttr attributes;
     gint          attributes_mask = GDK_WA_VISUAL;
 
--- a/widget/nsBaseFilePicker.cpp
+++ b/widget/nsBaseFilePicker.cpp
@@ -206,61 +206,61 @@ nsBaseFilePicker::AppendFilters(int32_t 
                                             getter_AddRefs(titleBundle));
   if (NS_FAILED(rv))
     return NS_ERROR_FAILURE;
 
   rv = stringService->CreateBundle(FILEPICKER_FILTERS, getter_AddRefs(filterBundle));
   if (NS_FAILED(rv))
     return NS_ERROR_FAILURE;
 
-  nsXPIDLString title;
-  nsXPIDLString filter;
+  nsAutoString title;
+  nsAutoString filter;
 
   if (aFilterMask & filterAll) {
-    titleBundle->GetStringFromName("allTitle", getter_Copies(title));
-    filterBundle->GetStringFromName("allFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("allTitle", title);
+    filterBundle->GetStringFromName("allFilter", filter);
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterHTML) {
-    titleBundle->GetStringFromName("htmlTitle", getter_Copies(title));
-    filterBundle->GetStringFromName("htmlFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("htmlTitle", title);
+    filterBundle->GetStringFromName("htmlFilter", filter);
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterText) {
-    titleBundle->GetStringFromName("textTitle", getter_Copies(title));
-    filterBundle->GetStringFromName("textFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("textTitle", title);
+    filterBundle->GetStringFromName("textFilter", filter);
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterImages) {
-    titleBundle->GetStringFromName("imageTitle", getter_Copies(title));
-    filterBundle->GetStringFromName("imageFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("imageTitle", title);
+    filterBundle->GetStringFromName("imageFilter", filter);
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterAudio) {
-    titleBundle->GetStringFromName("audioTitle", getter_Copies(title));
-    filterBundle->GetStringFromName("audioFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("audioTitle", title);
+    filterBundle->GetStringFromName("audioFilter", filter);
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterVideo) {
-    titleBundle->GetStringFromName("videoTitle", getter_Copies(title));
-    filterBundle->GetStringFromName("videoFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("videoTitle", title);
+    filterBundle->GetStringFromName("videoFilter", filter);
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterXML) {
-    titleBundle->GetStringFromName("xmlTitle", getter_Copies(title));
-    filterBundle->GetStringFromName("xmlFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("xmlTitle", title);
+    filterBundle->GetStringFromName("xmlFilter", filter);
     AppendFilter(title,filter);
   }
   if (aFilterMask & filterXUL) {
-    titleBundle->GetStringFromName("xulTitle", getter_Copies(title));
-    filterBundle->GetStringFromName("xulFilter", getter_Copies(filter));
+    titleBundle->GetStringFromName("xulTitle", title);
+    filterBundle->GetStringFromName("xulFilter", filter);
     AppendFilter(title, filter);
   }
   if (aFilterMask & filterApps) {
-    titleBundle->GetStringFromName("appsTitle", getter_Copies(title));
+    titleBundle->GetStringFromName("appsTitle", 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,18 +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("brandFullName",
-                              getter_Copies(mDisplayName));
+    bundle->GetStringFromName("brandFullName", mDisplayName);
 
     wchar_t *buffer;
     mIconPath.GetMutableData(&buffer, MAX_PATH);
     ::GetModuleFileNameW(nullptr, buffer, MAX_PATH);
 
     nsCOMPtr<nsIUUIDGenerator> uuidgen =
       do_GetService("@mozilla.org/uuid-generator;1");
     NS_ENSURE_TRUE(uuidgen, NS_ERROR_FAILURE);
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -1074,30 +1074,30 @@ 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 char* aName, nsXPIDLString & aString)
+GetLocalizedString(const char* aName, nsAString& aString)
 {
   nsCOMPtr<nsIStringBundleService> stringService =
     mozilla::services::GetStringBundleService();
   if (!stringService)
     return false;
 
   nsCOMPtr<nsIStringBundle> stringBundle;
   nsresult rv = stringService->CreateBundle(PAGEINFO_PROPERTIES,
                                             getter_AddRefs(stringBundle));
   if (NS_FAILED(rv))
     return false;
 
-  rv = stringBundle->GetStringFromName(aName, getter_Copies(aString));
+  rv = stringBundle->GetStringFromName(aName, aString);
   return NS_SUCCEEDED(rv);
 }
 
 //
 // GetFileDescriptorInternetShortcut
 //
 // Create the special format for an internet shortcut and build up the data
 // structures the shell is expecting.
@@ -1119,17 +1119,17 @@ nsDataObj :: GetFileDescriptorInternetSh
     ::GlobalFree(fileGroupDescHandle);
     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;
+    nsAutoString 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
@@ -1160,17 +1160,17 @@ nsDataObj :: GetFileDescriptorInternetSh
     ::GlobalFree(fileGroupDescHandle);
     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;
+    nsAutoString 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