Bug 1387381 - Remove nsXPIDLString local variables. r=erahm.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 08 Aug 2017 16:07:55 +1000
changeset 373385 3984a9f49bcf7b7cb073988f1570e975601ef4ea
parent 373357 49af461825cb9c4c510be20ff5633851e30181a9
child 373386 1c9560f99aa0669b6a650b49af359de346b4a430
push id32302
push userkwierso@gmail.com
push dateTue, 08 Aug 2017 22:14:39 +0000
treeherdermozilla-central@1d042bcb2632 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1387381
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 1387381 - Remove nsXPIDLString local variables. r=erahm. nsXPIDLStrings are marked as VOIDED upon initialization. Most of these local nsXPIDLString variables are immediately set via getter_Copies(), which will either assign a string value (using Adopt()) or do SetIsVoid(). These can be trivially converted to nsString, which will get the same treatment. The patch suitably converts the remaining nsXPIDLString local variable as well.
docshell/base/nsDocShell.cpp
docshell/base/nsDocShellTreeOwner.cpp
docshell/shistory/nsSHistory.cpp
dom/html/MediaDocument.cpp
dom/ipc/ContentChild.cpp
dom/webbrowserpersist/nsWebBrowserPersist.cpp
editor/libeditor/HTMLEditorDataTransfer.cpp
extensions/pref/autoconfig/src/nsAutoConfig.cpp
extensions/spellcheck/src/mozSpellChecker.cpp
js/xpconnect/src/XPCConvert.cpp
layout/generic/nsPageFrame.cpp
layout/printing/nsPrintEngine.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
modules/libpref/nsPrefBranch.cpp
rdf/base/nsInMemoryDataSource.cpp
security/manager/ssl/LocalCertService.cpp
security/manager/ssl/nsNSSCallbacks.cpp
security/manager/ssl/nsNSSCertHelper.cpp
security/manager/ssl/nsNSSCertificateDB.cpp
security/manager/ssl/nsNSSIOLayer.cpp
toolkit/components/printingui/ipc/PrintingParent.cpp
toolkit/components/printingui/win/nsPrintDialogUtil.cpp
toolkit/xre/nsConsoleWriter.cpp
toolkit/xre/nsNativeAppSupportWin.cpp
widget/android/nsDeviceContextAndroid.cpp
widget/cocoa/nsPrintDialogX.mm
widget/gtk/nsDeviceContextSpecG.cpp
widget/gtk/nsPrintDialogGTK.cpp
widget/gtk/nsPrintSettingsGTK.cpp
widget/nsPrintOptionsImpl.cpp
widget/windows/nsDeviceContextSpecWin.cpp
xpfe/components/directory/nsDirectoryViewer.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -1300,17 +1300,17 @@ nsDocShell::LoadURI(nsIURI* aURI,
   nsCOMPtr<nsIInputStream> headersStream;
   nsCOMPtr<nsIPrincipal> triggeringPrincipal;
   bool inheritPrincipal = false;
   bool principalIsExplicit = false;
   bool sendReferrer = true;
   uint32_t referrerPolicy = mozilla::net::RP_Unset;
   bool isSrcdoc = false;
   nsCOMPtr<nsISHEntry> shEntry;
-  nsXPIDLString target;
+  nsString target;
   nsAutoString srcdoc;
   nsCOMPtr<nsIDocShell> sourceDocShell;
   nsCOMPtr<nsIURI> baseURI;
 
   uint32_t loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
 
   NS_ENSURE_ARG(aURI);
 
@@ -4283,17 +4283,16 @@ nsDocShell::FindChildWithName(const nsAS
 
   // if we don't find one, we return NS_OK and a null result
   *aResult = nullptr;
 
   if (aName.IsEmpty()) {
     return NS_OK;
   }
 
-  nsXPIDLString childName;
   nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
   while (iter.HasMore()) {
     nsCOMPtr<nsIDocShellTreeItem> child = do_QueryObject(iter.GetNext());
     NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
     int32_t childType = child->ItemType();
 
     if (aSameType && (childType != mItemType)) {
       continue;
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -1377,39 +1377,36 @@ ChromeTooltipListener::sTooltipCallback(
       // release tooltip target if there is one, NO MATTER WHAT
       self->mPossibleTooltipNode = nullptr;
       return;
     }
 
     // if there is text associated with the node, show the tip and fire
     // off a timer to auto-hide it.
 
-    nsXPIDLString tooltipText;
-    nsXPIDLString directionText;
     if (self->mTooltipTextProvider) {
+      nsString tooltipText;
+      nsString directionText;
       bool textFound = false;
-
       self->mTooltipTextProvider->GetNodeText(
         self->mPossibleTooltipNode, getter_Copies(tooltipText),
         getter_Copies(directionText), &textFound);
 
       if (textFound) {
-        nsString tipText(tooltipText);
-        nsString dirText(directionText);
         LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset();
         double scaleFactor = 1.0;
         if (shell->GetPresContext()) {
           nsDeviceContext* dc = shell->GetPresContext()->DeviceContext();
           scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel()) /
                         dc->AppUnitsPerDevPixelAtUnitFullZoom();
         }
         // ShowTooltip expects widget-relative position.
         self->ShowTooltip(self->mMouseScreenX - screenDot.x / scaleFactor,
                           self->mMouseScreenY - screenDot.y / scaleFactor,
-                          tipText, dirText);
+                          tooltipText, directionText);
       }
     }
 
     // release tooltip target if there is one, NO MATTER WHAT
     self->mPossibleTooltipNode = nullptr;
   }
 }
 
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -699,17 +699,17 @@ nsSHistory::PrintHistory()
     nsCOMPtr<nsISHEntry> entry;
     rv = txn->GetSHEntry(getter_AddRefs(entry));
     if (NS_FAILED(rv) && !entry) {
       return NS_ERROR_FAILURE;
     }
 
     nsCOMPtr<nsILayoutHistoryState> layoutHistoryState;
     nsCOMPtr<nsIURI> uri;
-    nsXPIDLString title;
+    nsString title;
 
     entry->GetLayoutHistoryState(getter_AddRefs(layoutHistoryState));
     entry->GetURI(getter_AddRefs(uri));
     entry->GetTitle(getter_Copies(title));
 
 #if 0
     nsAutoCString url;
     if (uri) {
--- a/dom/html/MediaDocument.cpp
+++ b/dom/html/MediaDocument.cpp
@@ -356,17 +356,17 @@ MediaDocument::LinkScript(const nsAStrin
 
 void
 MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
                                      nsIChannel* aChannel,
                                      const char* const* aFormatNames,
                                      int32_t aWidth, int32_t aHeight,
                                      const nsAString& aStatus)
 {
-  nsXPIDLString fileStr;
+  nsAutoString fileStr;
   GetFileName(fileStr, aChannel);
 
   NS_ConvertASCIItoUTF16 typeStr(aTypeStr);
   nsAutoString title;
 
   if (mStringBundle) {
     // if we got a valid size (not all media have a size)
     if (aWidth != 0 && aHeight != 0) {
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -444,17 +444,17 @@ ConsoleListener::Observe(nsIConsoleMessa
     rv = scriptError->GetFlags(&flags);
     NS_ENSURE_SUCCESS(rv, rv);
 
     mChild->SendScriptError(msg, sourceName, sourceLine,
                             lineNum, colNum, flags, category);
     return NS_OK;
   }
 
-  nsXPIDLString msg;
+  nsString msg;
   nsresult rv = aMessage->GetMessageMoz(getter_Copies(msg));
   NS_ENSURE_SUCCESS(rv, rv);
   mChild->SendConsoleMessage(msg);
   return NS_OK;
 }
 
 class BackgroundChildPrimer final :
   public nsIIPCBackgroundChildCreateCallback
--- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -2621,17 +2621,17 @@ nsWebBrowserPersist::SaveSubframeContent
 {
     NS_ENSURE_ARG_POINTER(aData);
 
     // Extract the content type for the frame's contents.
     nsAutoCString contentType;
     nsresult rv = aFrameContent->GetContentType(contentType);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    nsXPIDLString ext;
+    nsString ext;
     GetExtensionForContentType(NS_ConvertASCIItoUTF16(contentType).get(),
                                getter_Copies(ext));
 
     // We must always have an extension so we will try to re-assign
     // the original extension if GetExtensionForContentType fails.
     if (ext.IsEmpty()) {
         nsCOMPtr<nsIURI> docURI;
         rv = NS_NewURI(getter_AddRefs(docURI), aURISpec, mCurrentCharset.get());
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -1166,17 +1166,17 @@ HTMLEditor::InsertFromTransferable(nsITr
                         aSourceDoc, aDestinationNode, aDestOffset, aDoDeleteSelection);
     } else if (bestFlavor.EqualsLiteral(kNativeHTMLMime)) {
       // note cf_html uses utf8, hence use length = len, not len/2 as in flavors below
       nsCOMPtr<nsISupportsCString> textDataObj = do_QueryInterface(genericDataObj);
       if (textDataObj && len > 0) {
         nsAutoCString cfhtml;
         textDataObj->GetData(cfhtml);
         NS_ASSERTION(cfhtml.Length() <= (len), "Invalid length!");
-        nsXPIDLString cfcontext, cffragment, cfselection; // cfselection left emtpy for now
+        nsString cfcontext, cffragment, cfselection; // cfselection left emtpy for now
 
         rv = ParseCFHTML(cfhtml, getter_Copies(cffragment), getter_Copies(cfcontext));
         if (NS_SUCCEEDED(rv) && !cffragment.IsEmpty()) {
           AutoEditBatch beginBatching(this);
           // If we have our private HTML flavor, we will only use the fragment
           // from the CF_HTML. The rest comes from the clipboard.
           if (havePrivateHTMLFlavor) {
             rv = DoInsertHTMLWithContext(cffragment,
@@ -1300,17 +1300,17 @@ HTMLEditor::InsertFromDataTransfer(DataT
                               aSourceDoc, aDestinationNode, aDestOffset, aDoDeleteSelection);
         }
       } else if (type.EqualsLiteral(kNativeHTMLMime)) {
         // Windows only clipboard parsing.
         nsAutoString text;
         GetStringFromDataTransfer(aDataTransfer, type, aIndex, text);
         NS_ConvertUTF16toUTF8 cfhtml(text);
 
-        nsXPIDLString cfcontext, cffragment, cfselection; // cfselection left emtpy for now
+        nsString cfcontext, cffragment, cfselection; // cfselection left emtpy for now
 
         nsresult rv = ParseCFHTML(cfhtml, getter_Copies(cffragment), getter_Copies(cfcontext));
         if (NS_SUCCEEDED(rv) && !cffragment.IsEmpty()) {
           AutoEditBatch beginBatching(this);
 
           if (hasPrivateHTMLFlavor) {
             // If we have our private HTML flavor, we will only use the fragment
             // from the CF_HTML. The rest comes from the clipboard.
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp
@@ -521,17 +521,17 @@ nsresult nsAutoConfig::PromptForEMailAdd
     nsAutoString title;
     rv = bundle->GetStringFromName("emailPromptTitle", title);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsAutoString err;
     rv = bundle->GetStringFromName("emailPromptMsg", err);
     NS_ENSURE_SUCCESS(rv, rv);
     bool check = false;
-    nsXPIDLString emailResult;
+    nsString 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);
     LossyCopyUTF16toASCII(emailResult, emailAddress);
     return NS_OK;
 }
--- a/extensions/spellcheck/src/mozSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozSpellChecker.cpp
@@ -363,17 +363,17 @@ mozSpellChecker::GetCurrentDictionary(ns
     return NS_OK;
   }
 
   if (!mSpellCheckingEngine) {
     aDictionary.Truncate();
     return NS_OK;
   }
 
-  nsXPIDLString dictname;
+  nsAutoString dictname;
   mSpellCheckingEngine->GetDictionary(getter_Copies(dictname));
   aDictionary = dictname;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 mozSpellChecker::SetCurrentDictionary(const nsAString &aDictionary)
 {
@@ -411,20 +411,19 @@ mozSpellChecker::SetCurrentDictionary(co
     mSpellCheckingEngine = spellCheckingEngines[i];
 
     rv = mSpellCheckingEngine->SetDictionary(PromiseFlatString(aDictionary).get());
 
     if (NS_SUCCEEDED(rv)) {
       nsCOMPtr<mozIPersonalDictionary> personalDictionary = do_GetService("@mozilla.org/spellchecker/personaldictionary;1");
       mSpellCheckingEngine->SetPersonalDictionary(personalDictionary.get());
 
-      nsXPIDLString language;
       nsCOMPtr<mozISpellI18NManager> serv(do_GetService("@mozilla.org/spellchecker/i18nmanager;1", &rv));
       NS_ENSURE_SUCCESS(rv, rv);
-      return serv->GetUtil(language.get(),getter_AddRefs(mConverter));
+      return serv->GetUtil(nullptr, getter_AddRefs(mConverter));
     }
   }
 
   mSpellCheckingEngine = nullptr;
 
   // We could not find any engine with the requested dictionary
   return NS_ERROR_NOT_AVAILABLE;
 }
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -1001,21 +1001,21 @@ XPCConvert::ConstructException(nsresult 
                                nsIException** exceptn,
                                JSContext* cx,
                                Value* jsExceptionPtr)
 {
     MOZ_ASSERT(!cx == !jsExceptionPtr, "Expected cx and jsExceptionPtr to cooccur.");
 
     static const char format[] = "\'%s\' when calling method: [%s::%s]";
     const char * msg = message;
-    nsXPIDLString xmsg;
-    nsAutoCString sxmsg;
+    nsAutoCString sxmsg;    // must have the same lifetime as msg
 
     nsCOMPtr<nsIScriptError> errorObject = do_QueryInterface(data);
     if (errorObject) {
+        nsString xmsg;
         if (NS_SUCCEEDED(errorObject->GetMessageMoz(getter_Copies(xmsg)))) {
             CopyUTF16toUTF8(xmsg, sxmsg);
             msg = sxmsg.get();
         }
     }
     if (!msg)
         if (!nsXPCException::NameAndFormatForNSResult(rv, nullptr, &msg) || ! msg)
             msg = "<error>";
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -634,25 +634,25 @@ nsPageFrame::PaintHeaderFooter(gfxContex
   nscoord ascent = 0;
   nscoord visibleHeight = 0;
   if (fontMet) {
     visibleHeight = fontMet->MaxHeight();
     ascent = fontMet->MaxAscent();
   }
 
   // print document headers and footers
-  nsXPIDLString headerLeft, headerCenter, headerRight;
+  nsString headerLeft, headerCenter, headerRight;
   mPD->mPrintSettings->GetHeaderStrLeft(getter_Copies(headerLeft));
   mPD->mPrintSettings->GetHeaderStrCenter(getter_Copies(headerCenter));
   mPD->mPrintSettings->GetHeaderStrRight(getter_Copies(headerRight));
   DrawHeaderFooter(aRenderingContext, *fontMet, eHeader,
                    headerLeft, headerCenter, headerRight,
                    rect, ascent, visibleHeight);
 
-  nsXPIDLString footerLeft, footerCenter, footerRight;
+  nsString footerLeft, footerCenter, footerRight;
   mPD->mPrintSettings->GetFooterStrLeft(getter_Copies(footerLeft));
   mPD->mPrintSettings->GetFooterStrCenter(getter_Copies(footerCenter));
   mPD->mPrintSettings->GetFooterStrRight(getter_Copies(footerRight));
   DrawHeaderFooter(aRenderingContext, *fontMet, eFooter,
                    footerLeft, footerCenter, footerRight,
                    rect, ascent, visibleHeight);
 }
 
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -1021,17 +1021,17 @@ nsPrintEngine::CheckForPrinters(nsIPrint
   // Unless we are in the parent, we ignore this function
   if (!XRE_IsParentProcess()) {
     return NS_OK;
   }
 #endif
   NS_ENSURE_ARG_POINTER(aPrintSettings);
 
   // See if aPrintSettings already has a printer
-  nsXPIDLString printerName;
+  nsString printerName;
   nsresult rv = aPrintSettings->GetPrinterName(getter_Copies(printerName));
   if (NS_SUCCEEDED(rv) && !printerName.IsEmpty()) {
     return NS_OK;
   }
 
   // aPrintSettings doesn't have a printer set. Try to fetch the default.
   nsCOMPtr<nsIPrintSettingsService> printSettingsService =
     do_GetService(sPrintSettingsServiceContractID, &rv);
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -356,21 +356,20 @@ nsTreeBodyFrame::EnsureView()
       return;
     }
     nsCOMPtr<nsIBoxObject> box = do_QueryInterface(mTreeBoxObject);
     if (box) {
       AutoWeakFrame weakFrame(this);
       nsCOMPtr<nsITreeView> treeView;
       mTreeBoxObject->GetView(getter_AddRefs(treeView));
       if (treeView && weakFrame.IsAlive()) {
-        nsXPIDLString rowStr;
+        nsString rowStr;
         box->GetProperty(u"topRow", getter_Copies(rowStr));
-        nsAutoString rowStr2(rowStr);
         nsresult error;
-        int32_t rowIndex = rowStr2.ToInteger(&error);
+        int32_t rowIndex = rowStr.ToInteger(&error);
 
         // Set our view.
         SetView(treeView);
         ENSURE_TRUE(weakFrame.IsAlive());
 
         // Scroll to the given row.
         // XXX is this optimal if we haven't laid out yet?
         ScrollToRow(rowIndex);
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.cpp
@@ -561,18 +561,17 @@ NS_IMETHODIMP nsPrefBranch::SetComplexVa
     }
     return rv;
   }
 
   if (aType.Equals(NS_GET_IID(nsIPrefLocalizedString))) {
     nsCOMPtr<nsIPrefLocalizedString> theString = do_QueryInterface(aValue);
 
     if (theString) {
-      nsXPIDLString wideString;
-
+      nsString wideString;
       rv = theString->GetData(getter_Copies(wideString));
       if (NS_SUCCEEDED(rv)) {
         // Check sanity of string length before any lengthy conversion
         rv = CheckSanityOfStringLength(aPrefName, wideString);
         if (NS_FAILED(rv)) {
           return rv;
         }
         rv = SetCharPrefInternal(aPrefName, NS_ConvertUTF16toUTF8(wideString).get());
--- a/rdf/base/nsInMemoryDataSource.cpp
+++ b/rdf/base/nsInMemoryDataSource.cpp
@@ -822,25 +822,20 @@ InMemoryDataSource::LogOperation(const c
     nsCOMPtr<nsIRDFLiteral> literal;
 
     if ((resource = do_QueryInterface(aTarget)) != nullptr) {
         resource->GetValue(getter_Copies(uri));
         MOZ_LOG(gLog, LogLevel::Debug,
            ("  -->[(%p)%s]", aTarget, (const char*) uri));
     }
     else if ((literal = do_QueryInterface(aTarget)) != nullptr) {
-        nsXPIDLString value;
+        nsString value;
         literal->GetValue(getter_Copies(value));
-        nsAutoString valueStr(value);
-        char* valueCStr = ToNewCString(valueStr);
-
         MOZ_LOG(gLog, LogLevel::Debug,
-           ("  -->(\"%s\")\n", valueCStr));
-
-        free(valueCStr);
+           ("  -->(\"%s\")\n", NS_ConvertUTF16toUTF8(value).get()));
     }
     else {
         MOZ_LOG(gLog, LogLevel::Debug,
            ("  -->(unknown-type)\n"));
     }
 }
 
 
--- a/security/manager/ssl/LocalCertService.cpp
+++ b/security/manager/ssl/LocalCertService.cpp
@@ -298,18 +298,18 @@ private:
     if (NS_FAILED(rv)) {
       return rv;
     }
     if (!selfSigned) {
       return NS_ERROR_FAILURE;
     }
 
     // Check that subject and issuer match nickname
-    nsXPIDLString subjectName;
-    nsXPIDLString issuerName;
+    nsAutoString subjectName;
+    nsAutoString issuerName;
     mCert->GetSubjectName(subjectName);
     mCert->GetIssuerName(issuerName);
     if (!subjectName.Equals(issuerName)) {
       return NS_ERROR_FAILURE;
     }
     NS_NAMED_LITERAL_STRING(commonNamePrefix, "CN=");
     nsAutoString subjectNameFromNickname(
       commonNamePrefix + NS_ConvertASCIItoUTF16(mNickname));
--- a/security/manager/ssl/nsNSSCallbacks.cpp
+++ b/security/manager/ssl/nsNSSCallbacks.cpp
@@ -796,17 +796,17 @@ PK11PasswordPromptRunnable::RunOnTargetT
   rv = nssComponent->PIPBundleFormatStringFromName("CertPassPrompt",
                                                    formatStrings,
                                                    ArrayLength(formatStrings),
                                                    promptString);
   if (NS_FAILED(rv)) {
     return;
   }
 
-  nsXPIDLString password;
+  nsString password;
   // |checkState| is unused because |checkMsg| (the argument just before it) is
   // null, but XPConnect requires it to point to a valid bool nonetheless.
   bool checkState = false;
   bool userClickedOK = false;
   rv = prompt->PromptPassword(nullptr, promptString.get(),
                               getter_Copies(password), nullptr, &checkState,
                               &userClickedOK);
   if (NS_FAILED(rv) || !userClickedOK) {
--- a/security/manager/ssl/nsNSSCertHelper.cpp
+++ b/security/manager/ssl/nsNSSCertHelper.cpp
@@ -964,17 +964,17 @@ ProcessBMPString(SECItem* extData, nsASt
 
 static nsresult
 ProcessGeneralName(const UniquePLArenaPool& arena, CERTGeneralName* current,
                    nsAString& text)
 {
   NS_ENSURE_ARG_POINTER(current);
 
   nsAutoString key;
-  nsXPIDLString value;
+  nsAutoString value;
   nsresult rv = NS_OK;
 
   switch (current->type) {
     case certOtherName: {
       SECOidTag oidTag = SECOID_FindOIDTag(&current->name.OthName.oid);
       if (oidTag == SEC_OID(MS_NT_PRINCIPAL_NAME)) {
         /* The type of this name is apparently nowhere explicitly
          documented. However, in the generated templates, it is always
@@ -1880,17 +1880,17 @@ nsNSSCertificate::CreateTBSCertificateAS
   rv = ProcessSECAlgorithmID(&mCert->signature, getter_AddRefs(algID));
   if (NS_FAILED(rv))
     return rv;
 
   GetPIPNSSBundleString("CertDumpSigAlg", text);
   algID->SetDisplayName(text);
   asn1Objects->AppendElement(algID, false);
 
-  nsXPIDLString value;
+  nsString value;
   ProcessName(&mCert->issuer, getter_Copies(value));
 
   printableItem = new nsNSSASN1PrintableItem();
 
   printableItem->SetDisplayValue(value);
   GetPIPNSSBundleString("CertDumpIssuer", text);
   printableItem->SetDisplayName(text);
   asn1Objects->AppendElement(printableItem, false);
--- a/security/manager/ssl/nsNSSCertificateDB.cpp
+++ b/security/manager/ssl/nsNSSCertificateDB.cpp
@@ -298,20 +298,20 @@ nsNSSCertificateDB::handleCACertDownload
     nsCOMPtr<nsIX509Cert> certn_2;  // second to last cert
     nsCOMPtr<nsIX509Cert> certn_1;  // last cert
 
     cert0 = do_QueryElementAt(x509Certs, 0);
     cert1 = do_QueryElementAt(x509Certs, 1);
     certn_2 = do_QueryElementAt(x509Certs, numCerts-2);
     certn_1 = do_QueryElementAt(x509Certs, numCerts-1);
 
-    nsXPIDLString cert0SubjectName;
-    nsXPIDLString cert1IssuerName;
-    nsXPIDLString certn_2IssuerName;
-    nsXPIDLString certn_1SubjectName;
+    nsAutoString cert0SubjectName;
+    nsAutoString cert1IssuerName;
+    nsAutoString certn_2IssuerName;
+    nsAutoString certn_1SubjectName;
 
     cert0->GetSubjectName(cert0SubjectName);
     cert1->GetIssuerName(cert1IssuerName);
     certn_2->GetIssuerName(certn_2IssuerName);
     certn_1->GetSubjectName(certn_1SubjectName);
 
     if (cert1IssuerName.Equals(cert0SubjectName)) {
       // In this case, the first cert in the list signed the second,
--- a/security/manager/ssl/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/nsNSSIOLayer.cpp
@@ -675,17 +675,17 @@ nsHandleSSLError(nsNSSSocketInfo* socket
   if (socketInfo->GetErrorCode()) {
     // If the socket has been flagged as canceled,
     // the code who did was responsible for setting the error code.
     return;
   }
 
   // We must cancel first, which sets the error code.
   socketInfo->SetCanceled(err, SSLErrorMessageType::Plain);
-  nsXPIDLString errorString;
+  nsAutoString errorString;
   socketInfo->GetErrorLogMessage(err, errtype, errorString);
 
   if (!errorString.IsEmpty()) {
     nsContentUtils::LogSimpleConsoleError(errorString, "SSL");
   }
 }
 
 namespace {
--- a/toolkit/components/printingui/ipc/PrintingParent.cpp
+++ b/toolkit/components/printingui/ipc/PrintingParent.cpp
@@ -131,36 +131,37 @@ PrintingParent::ShowPrintDialog(PBrowser
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mPrintSettingsSvc->DeserializeToPrintSettings(aData, settings);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = settings->SetPrintSilent(printSilently);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsXPIDLString printerName;
+  nsString printerName;
   settings->GetPrinterName(getter_Copies(printerName));
 #ifdef MOZ_X11
   // Requesting the default printer name on Linux has been removed in the child,
   // because it was causing a sandbox violation (see Bug 1329216).
   // If no printer name is set at this point, use the print settings service
   // to get the default printer name.
   if (printerName.IsEmpty()) {
     mPrintSettingsSvc->GetDefaultPrinterName(getter_Copies(printerName));
-    settings->SetPrinterName(printerName);
+    settings->SetPrinterName(printerName.get());
   }
-  mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName, settings);
+  mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName.get(), settings);
 #endif
 
   // If this is for print preview or we are printing silently then we just need
   // to initialize the print settings with anything specific from the printer.
   if (isPrintPreview || printSilently ||
       Preferences::GetBool("print.always_print_silent", printSilently)) {
     settings->SetIsInitializedFromPrinter(false);
-    mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName, settings);
+    mPrintSettingsSvc->InitPrintSettingsFromPrinter(printerName.get(),
+                                                    settings);
   } else {
     rv = pps->ShowPrintDialog(parentWin, wbp, settings);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (isPrintPreview) {
     // For print preview we don't want a RemotePrintJob just the settings.
     rv = mPrintSettingsSvc->SerializeToPrintData(settings, nullptr, aResult);
--- a/toolkit/components/printingui/win/nsPrintDialogUtil.cpp
+++ b/toolkit/components/printingui/win/nsPrintDialogUtil.cpp
@@ -459,18 +459,17 @@ static UINT CALLBACK PrintHookProc(HWND 
 // Returns a Global Moveable Memory Handle to a DevMode
 // from the Printer by the name of aPrintName
 //
 // NOTE:
 //   This function assumes that aPrintName has already been converted from
 //   unicode
 //
 static nsReturnRef<nsHGLOBAL>
-CreateGlobalDevModeAndInit(const nsXPIDLString& aPrintName,
-                           nsIPrintSettings* aPS)
+CreateGlobalDevModeAndInit(const nsString& aPrintName, nsIPrintSettings* aPS)
 {
   nsHPRINTER hPrinter = nullptr;
   // const cast kludge for silly Win32 api's
   LPWSTR printName = const_cast<wchar_t*>(static_cast<const wchar_t*>(aPrintName.get()));
   BOOL status = ::OpenPrinterW(printName, &hPrinter, nullptr);
   if (!status) {
     return nsReturnRef<nsHGLOBAL>();
   }
@@ -527,17 +526,17 @@ CreateGlobalDevModeAndInit(const nsXPIDL
 
   ::GlobalUnlock(hDevMode);
 
   return globalDevMode.out();
 }
 
 //------------------------------------------------------------------
 // helper
-static void GetDefaultPrinterNameFromGlobalPrinters(nsXPIDLString &printerName)
+static void GetDefaultPrinterNameFromGlobalPrinters(nsAString &printerName)
 {
   nsCOMPtr<nsIPrinterEnumerator> prtEnum = do_GetService("@mozilla.org/gfx/printerenumerator;1");
   if (prtEnum) {
     prtEnum->GetDefaultPrinterName(getter_Copies(printerName));
   }
 }
 
 // Determine whether we have a completely native dialog
@@ -565,17 +564,17 @@ ShowNativePrintDialog(HWND              
                       nsIPrintSettings* aPrintSettings)
 {
   //NS_ENSURE_ARG_POINTER(aHWnd);
   NS_ENSURE_ARG_POINTER(aPrintSettings);
 
   gDialogWasExtended  = false;
 
   // Get the Print Name to be used
-  nsXPIDLString printerName;
+  nsString printerName;
   aPrintSettings->GetPrinterName(getter_Copies(printerName));
 
   // If there is no name then use the default printer
   if (printerName.IsEmpty()) {
     GetDefaultPrinterNameFromGlobalPrinters(printerName);
   } else {
     HANDLE hPrinter = nullptr;
     if(!::OpenPrinterW(const_cast<wchar_t*>(static_cast<const wchar_t*>(printerName.get())),
@@ -601,17 +600,17 @@ ShowNativePrintDialog(HWND              
   if (!pDevNames) {
     return NS_ERROR_FAILURE;
   }
   pDevNames->wDriverOffset = sizeof(DEVNAMES)/sizeof(wchar_t);
   pDevNames->wDeviceOffset = sizeof(DEVNAMES)/sizeof(wchar_t);
   pDevNames->wOutputOffset = sizeof(DEVNAMES)/sizeof(wchar_t)+len;
   pDevNames->wDefault      = 0;
 
-  memcpy(pDevNames+1, printerName, (len + 1) * sizeof(wchar_t));
+  memcpy(pDevNames+1, printerName.get(), (len + 1) * sizeof(wchar_t));
   ::GlobalUnlock(hDevNames);
 
   // Create a Moveable Memory Object that holds a new DevMode
   // from the Printer Name
   // The PRINTDLG.hDevMode requires that it be a moveable memory object
   // NOTE: autoDevMode is automatically freed when any error occurred
   nsAutoGlobalMem autoDevMode(CreateGlobalDevModeAndInit(printerName, aPrintSettings));
 
--- a/toolkit/xre/nsConsoleWriter.cpp
+++ b/toolkit/xre/nsConsoleWriter.cpp
@@ -73,17 +73,17 @@ WriteConsoleLog()
     PR_fprintf(file, NS_LINEBREAK
                      "*** Console log: %s ***" NS_LINEBREAK,
                datetime);
   }
 
   // From this point on, we have to release all the messages, and free
   // the memory allocated for the messages array. XPCOM arrays suck.
 
-  nsXPIDLString msg;
+  nsString msg;
   nsAutoCString nativemsg;
 
   for (uint32_t i = 0; i < mcount; ++i) {
     rv = messages[i]->GetMessageMoz(getter_Copies(msg));
     if (NS_SUCCEEDED(rv)) {
       NS_CopyUnicodeToNative(msg, nativemsg);
       PR_fprintf(file, "%s" NS_LINEBREAK, nativemsg.get());
     }
--- a/toolkit/xre/nsNativeAppSupportWin.cpp
+++ b/toolkit/xre/nsNativeAppSupportWin.cpp
@@ -984,17 +984,17 @@ nsNativeAppSupportWin::HandleDDENotifica
 
                         // Get the base window from the doc shell...
                         nsCOMPtr<nsIBaseWindow> baseWindow =
                           do_QueryInterface( internalContent->GetDocShell() );
                         if ( !baseWindow ) {
                             break;
                         }
                         // And from the base window we can get the title.
-                        nsXPIDLString title;
+                        nsString title;
                         if(!baseWindow) {
                             break;
                         }
                         baseWindow->GetTitle(getter_Copies(title));
                         // Escape any double-quotes in the title.
                         escapeQuotes( title );
 
                         // Use a string buffer for the output data, first
--- a/widget/android/nsDeviceContextAndroid.cpp
+++ b/widget/android/nsDeviceContextAndroid.cpp
@@ -55,17 +55,17 @@ nsDeviceContextSpecAndroid::BeginDocumen
                                           int32_t aEndPage)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDeviceContextSpecAndroid::EndDocument()
 {
-  nsXPIDLString targetPath;
+  nsString targetPath;
   nsCOMPtr<nsIFile> destFile;
   mPrintSettings->GetToFileName(getter_Copies(targetPath));
 
   nsresult rv = NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoString destLeafName;
   rv = destFile->GetLeafName(destLeafName);
--- a/widget/cocoa/nsPrintDialogX.mm
+++ b/widget/cocoa/nsPrintDialogX.mm
@@ -230,17 +230,17 @@ nsPrintDialogServiceX::ShowPageSetup(nsP
 
 - (void)addLabel:(const char*)aLabel withFrame:(NSRect)aRect;
 
 - (void)addCenteredLabel:(const char*)aLabel withFrame:(NSRect)aRect;
 
 - (NSButton*)checkboxWithLabel:(const char*)aLabel andFrame:(NSRect)aRect;
 
 - (NSPopUpButton*)headerFooterItemListWithFrame:(NSRect)aRect
-                                   selectedItem:(const char16_t*)aCurrentString;
+                                   selectedItem:(const nsAString&)aCurrentString;
 
 - (void)addOptionsSection;
 
 - (void)addAppearanceSection;
 
 - (void)addFramesSection;
 
 - (void)addHeaderFooterSection;
@@ -359,17 +359,17 @@ static const char sHeaderFooterTags[][4]
   [checkbox setButtonType:NSSwitchButton];
   [checkbox setTitle:[self localizedString:aLabel]];
   [checkbox setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
   [checkbox sizeToFit];
   return checkbox;
 }
 
 - (NSPopUpButton*)headerFooterItemListWithFrame:(NSRect)aRect
-                                   selectedItem:(const char16_t*)aCurrentString
+                                   selectedItem:(const nsAString&)aCurrentString
 {
   NSPopUpButton* list = [[[NSPopUpButton alloc] initWithFrame:aRect pullsDown:NO] autorelease];
   [list setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
   [[list cell] setControlSize:NSSmallControlSize];
   NSArray* items =
     [NSArray arrayWithObjects:[self localizedString:"headerFooterBlank"],
                               [self localizedString:"headerFooterTitle"],
                               [self localizedString:"headerFooterURL"],
@@ -508,17 +508,17 @@ static const char sHeaderFooterTags[][4]
   // Labels
   [self addLabel:"pageHeadersTitleMac" withFrame:NSMakeRect(0, 44, 151, 22)];
   [self addLabel:"pageFootersTitleMac" withFrame:NSMakeRect(0, 0, 151, 22)];
   [self addCenteredLabel:"left" withFrame:NSMakeRect(156, 22, 100, 22)];
   [self addCenteredLabel:"center" withFrame:NSMakeRect(256, 22, 100, 22)];
   [self addCenteredLabel:"right" withFrame:NSMakeRect(356, 22, 100, 22)];
 
   // Lists
-  nsXPIDLString sel;
+  nsString sel;
 
   mSettings->GetHeaderStrLeft(getter_Copies(sel));
   mHeaderLeftList = [self headerFooterItemListWithFrame:NSMakeRect(156, 44, 100, 22)
                                            selectedItem:sel];
   [self addSubview:mHeaderLeftList];
 
   mSettings->GetHeaderStrCenter(getter_Copies(sel));
   mHeaderCenterList = [self headerFooterItemListWithFrame:NSMakeRect(256, 44, 100, 22)
--- a/widget/gtk/nsDeviceContextSpecG.cpp
+++ b/widget/gtk/nsDeviceContextSpecG.cpp
@@ -239,20 +239,20 @@ ns_release_macro(gpointer aData) {
 }
 
 /* static */
 gboolean nsDeviceContextSpecGTK::PrinterEnumerator(GtkPrinter *aPrinter,
                                                    gpointer aData) {
   nsDeviceContextSpecGTK *spec = (nsDeviceContextSpecGTK*)aData;
 
   // Find the printer whose name matches the one inside the settings.
-  nsXPIDLString printerName;
+  nsString printerName;
   nsresult rv =
     spec->mPrintSettings->GetPrinterName(getter_Copies(printerName));
-  if (NS_SUCCEEDED(rv) && printerName) {
+  if (NS_SUCCEEDED(rv) && !printerName.IsVoid()) {
     NS_ConvertUTF16toUTF8 requestedName(printerName);
     const char* currentName = gtk_printer_get_name(aPrinter);
     if (requestedName.Equals(currentName)) {
       spec->mPrintSettings->SetGtkPrinter(aPrinter);
 
       // Bug 1145916 - attempting to kick off a print job for this printer
       // during this tick of the event loop will result in the printer backend
       // misunderstanding what the capabilities of the printer are due to a
@@ -321,17 +321,17 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::En
       // one with a matching name.
       NS_DispatchToCurrentThread(
         NewRunnableMethod("nsDeviceContextSpecGTK::EnumeratePrinters",
                           this,
                           &nsDeviceContextSpecGTK::EnumeratePrinters));
     }
   } else {
     // Handle print-to-file ourselves for the benefit of embedders
-    nsXPIDLString targetPath;
+    nsString targetPath;
     nsCOMPtr<nsIFile> destFile;
     mPrintSettings->GetToFileName(getter_Copies(targetPath));
 
     nsresult rv = NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsAutoString destLeafName;
     rv = destFile->GetLeafName(destLeafName);
--- a/widget/gtk/nsPrintDialogGTK.cpp
+++ b/widget/gtk/nsPrintDialogGTK.cpp
@@ -270,17 +270,17 @@ nsPrintDialogWidgetGTK::nsPrintDialogWid
   gtk_misc_set_alignment(GTK_MISC(header_footer_label), 0, 0);
 
   GtkWidget* header_footer_container = gtk_alignment_new(0, 0, 0, 0);
   gtk_alignment_set_padding(GTK_ALIGNMENT(header_footer_container), 8, 0, 12, 0);
 
 
   // --- Table for making the header and footer options ---
   GtkWidget* header_footer_table = gtk_table_new(3, 3, FALSE); // 3x3 table
-  nsXPIDLString header_footer_str[3];
+  nsString header_footer_str[3];
 
   aSettings->GetHeaderStrLeft(getter_Copies(header_footer_str[0]));
   aSettings->GetHeaderStrCenter(getter_Copies(header_footer_str[1]));
   aSettings->GetHeaderStrRight(getter_Copies(header_footer_str[2]));
 
   for (unsigned int i = 0; i < ArrayLength(header_dropdown); i++) {
     header_dropdown[i] = ConstructHeaderFooterDropdown(header_footer_str[i].get());
     // Those 4 magic numbers in the middle provide the position in the table.
@@ -577,19 +577,19 @@ nsPrintDialogServiceGTK::ShowPageSetup(n
 
   nsCOMPtr<nsPrintSettingsGTK> aNSSettingsGTK(do_QueryInterface(aNSSettings));
   if (!aNSSettingsGTK)
     return NS_ERROR_FAILURE;
 
   // We need to init the prefs here because aNSSettings in its current form is a dummy in both uses of the word
   nsCOMPtr<nsIPrintSettingsService> psService = do_GetService("@mozilla.org/gfx/printsettings-service;1");
   if (psService) {
-    nsXPIDLString printName;
+    nsString printName;
     aNSSettings->GetPrinterName(getter_Copies(printName));
-    if (!printName) {
+    if (printName.IsVoid()) {
       psService->GetDefaultPrinterName(getter_Copies(printName));
       aNSSettings->SetPrinterName(printName.get());
     }
     psService->InitPrintSettingsFromPrefs(aNSSettings, true, nsIPrintSettings::kInitSaveAll);
   }
 
   GtkPrintSettings* gtkSettings = aNSSettingsGTK->GetGtkPrintSettings();
   GtkPageSetup* oldPageSetup = aNSSettingsGTK->GetGtkPageSetup();
--- a/widget/gtk/nsPrintSettingsGTK.cpp
+++ b/widget/gtk/nsPrintSettingsGTK.cpp
@@ -470,17 +470,17 @@ NS_IMETHODIMP
 nsPrintSettingsGTK::GetPrinterName(char16_t * *aPrinter)
 {
   const char* gtkPrintName = gtk_print_settings_get_printer(mPrintSettings);
   if (!gtkPrintName) {
     if (GTK_IS_PRINTER(mGTKPrinter)) {
       gtkPrintName = gtk_printer_get_name(mGTKPrinter);
     } else {
       // This mimics what nsPrintSettingsImpl does when we try to Get before we Set
-      nsXPIDLString nullPrintName;
+      nsString nullPrintName;
       *aPrinter = ToNewUnicode(nullPrintName);
       return NS_OK;
     }
   }
   *aPrinter = UTF8ToNewUnicode(nsDependentCString(gtkPrintName));
   return NS_OK;
 }
 
--- a/widget/nsPrintOptionsImpl.cpp
+++ b/widget/nsPrintOptionsImpl.cpp
@@ -134,80 +134,80 @@ nsPrintOptions::SerializeToPrintData(nsI
 
   aSettings->GetScaling(&data->scaling());
 
   aSettings->GetPrintBGColors(&data->printBGColors());
   aSettings->GetPrintBGImages(&data->printBGImages());
   aSettings->GetPrintRange(&data->printRange());
 
   // I have no idea if I'm doing this string copying correctly...
-  nsXPIDLString title;
+  nsString title;
   aSettings->GetTitle(getter_Copies(title));
   data->title() = title;
 
-  nsXPIDLString docURL;
+  nsString docURL;
   aSettings->GetDocURL(getter_Copies(docURL));
   data->docURL() = docURL;
 
   // Header strings...
-  nsXPIDLString headerStrLeft;
+  nsString headerStrLeft;
   aSettings->GetHeaderStrLeft(getter_Copies(headerStrLeft));
   data->headerStrLeft() = headerStrLeft;
 
-  nsXPIDLString headerStrCenter;
+  nsString headerStrCenter;
   aSettings->GetHeaderStrCenter(getter_Copies(headerStrCenter));
   data->headerStrCenter() = headerStrCenter;
 
-  nsXPIDLString headerStrRight;
+  nsString headerStrRight;
   aSettings->GetHeaderStrRight(getter_Copies(headerStrRight));
   data->headerStrRight() = headerStrRight;
 
   // Footer strings...
-  nsXPIDLString footerStrLeft;
+  nsString footerStrLeft;
   aSettings->GetFooterStrLeft(getter_Copies(footerStrLeft));
   data->footerStrLeft() = footerStrLeft;
 
-  nsXPIDLString footerStrCenter;
+  nsString footerStrCenter;
   aSettings->GetFooterStrCenter(getter_Copies(footerStrCenter));
   data->footerStrCenter() = footerStrCenter;
 
-  nsXPIDLString footerStrRight;
+  nsString footerStrRight;
   aSettings->GetFooterStrRight(getter_Copies(footerStrRight));
   data->footerStrRight() = footerStrRight;
 
   aSettings->GetHowToEnableFrameUI(&data->howToEnableFrameUI());
   aSettings->GetIsCancelled(&data->isCancelled());
   aSettings->GetPrintFrameTypeUsage(&data->printFrameTypeUsage());
   aSettings->GetPrintFrameType(&data->printFrameType());
   aSettings->GetPrintSilent(&data->printSilent());
   aSettings->GetShrinkToFit(&data->shrinkToFit());
   aSettings->GetShowPrintProgress(&data->showPrintProgress());
 
-  nsXPIDLString paperName;
+  nsString paperName;
   aSettings->GetPaperName(getter_Copies(paperName));
   data->paperName() = paperName;
 
   aSettings->GetPaperData(&data->paperData());
   aSettings->GetPaperWidth(&data->paperWidth());
   aSettings->GetPaperHeight(&data->paperHeight());
   aSettings->GetPaperSizeUnit(&data->paperSizeUnit());
 
   aSettings->GetPrintReversed(&data->printReversed());
   aSettings->GetPrintInColor(&data->printInColor());
   aSettings->GetOrientation(&data->orientation());
 
   aSettings->GetNumCopies(&data->numCopies());
 
-  nsXPIDLString printerName;
+  nsString printerName;
   aSettings->GetPrinterName(getter_Copies(printerName));
   data->printerName() = printerName;
 
   aSettings->GetPrintToFile(&data->printToFile());
 
-  nsXPIDLString toFileName;
+  nsString toFileName;
   aSettings->GetToFileName(getter_Copies(toFileName));
   data->toFileName() = toFileName;
 
   aSettings->GetOutputFormat(&data->outputFormat());
   aSettings->GetPrintPageDelay(&data->printPageDelay());
   aSettings->GetResolution(&data->resolution());
   aSettings->GetDuplex(&data->duplex());
   aSettings->GetIsInitializedFromPrinter(&data->isInitializedFromPrinter());
@@ -979,17 +979,17 @@ nsPrintOptions::WritePrefs(nsIPrintSetti
 nsresult nsPrintOptions::_CreatePrintSettings(nsIPrintSettings **_retval)
 {
   // does not initially ref count
   nsPrintSettings * printSettings = new nsPrintSettings();
   NS_ENSURE_TRUE(printSettings, NS_ERROR_OUT_OF_MEMORY);
 
   NS_ADDREF(*_retval = printSettings); // ref count
 
-  nsXPIDLString printerName;
+  nsString printerName;
   nsresult rv = GetDefaultPrinterName(getter_Copies(printerName));
   NS_ENSURE_SUCCESS(rv, rv);
   (*_retval)->SetPrinterName(printerName.get());
 
   (void)InitPrintSettingsFromPrefs(*_retval, false,
                                    nsIPrintSettings::kInitSaveAll);
 
   return NS_OK;
@@ -1060,17 +1060,17 @@ nsPrintOptions::InitPrintSettingsFromPri
   if (XRE_IsContentProcess() && Preferences::GetBool("print.print_via_parent")) {
     return NS_OK;
   }
 
   NS_ENSURE_ARG_POINTER(aPrintSettings);
   NS_ENSURE_ARG_POINTER(aPrinterName);
 
 #ifdef DEBUG
-  nsXPIDLString printerName;
+  nsString printerName;
   aPrintSettings->GetPrinterName(getter_Copies(printerName));
   if (!printerName.Equals(aPrinterName)) {
     NS_WARNING("Printer names should match!");
   }
 #endif
 
   bool isInitialized;
   aPrintSettings->GetIsInitializedFromPrinter(&isInitialized);
--- a/widget/windows/nsDeviceContextSpecWin.cpp
+++ b/widget/windows/nsDeviceContextSpecWin.cpp
@@ -260,17 +260,17 @@ already_AddRefed<PrintTarget> nsDeviceCo
     }
 
     // convert twips to points
     width  /= TWIPS_PER_POINT_FLOAT;
     height /= TWIPS_PER_POINT_FLOAT;
     IntSize size = IntSize::Truncate(width, height);
 
     if (mOutputFormat == nsIPrintSettings::kOutputFormatPDF) {
-      nsXPIDLString filename;
+      nsString filename;
       mPrintSettings->GetToFileName(getter_Copies(filename));
 
       nsAutoCString printFile(NS_ConvertUTF16toUTF8(filename).get());
       auto skStream = MakeUnique<SkFILEWStream>(printFile.get());
       return PrintTargetSkPDF::CreateOrNull(Move(skStream), size);
     }
 
     if (mDevMode) {
@@ -305,17 +305,17 @@ already_AddRefed<PrintTarget> nsDeviceCo
       mPDFTempFile->GetNativePath(filePath);
       auto skStream = MakeUnique<SkFILEWStream>(filePath.get());
       return PrintTargetSkPDF::CreateOrNull(Move(skStream), size);
     }
   }
 #endif
 
   if (mOutputFormat == nsIPrintSettings::kOutputFormatPDF) {
-    nsXPIDLString filename;
+    nsString filename;
     mPrintSettings->GetToFileName(getter_Copies(filename));
 
     double width, height;
     mPrintSettings->GetEffectivePageSize(&width, &height);
     if (width <= 0 || height <= 0) {
       return nullptr;
     }
 
--- a/xpfe/components/directory/nsDirectoryViewer.cpp
+++ b/xpfe/components/directory/nsDirectoryViewer.cpp
@@ -410,17 +410,17 @@ nsHTTPIndex::OnIndexAvailable(nsIRequest
     CopyASCIItoUTF16(entryuriC, str);
 
     rv = mDirRDF->GetLiteral(str.get(), getter_AddRefs(lit));
 
     if (NS_SUCCEEDED(rv)) {
       rv = Assert(entry, kNC_URL, lit, true);
       if (NS_FAILED(rv)) return rv;
 
-      nsXPIDLString xpstr;
+      nsString xpstr;
 
       // description
       rv = aIndex->GetDescription(getter_Copies(xpstr));
       if (NS_FAILED(rv)) return rv;
       if (xpstr.Last() == '/')
         xpstr.Truncate(xpstr.Length() - 1);
 
       rv = mDirRDF->GetLiteral(xpstr.get(), getter_AddRefs(lit));