Bug 1384834 (part 1) - Remove remaining uses of nsAdoptingString. r=erahm.
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 28 Jul 2017 11:21:45 +1000
changeset 423269 dd41537bcdd1b492583c553ec0191d2fd70689c7
parent 423268 f0d243adabca0c6c9f303a30b903f0a53bf681fc
child 423270 d1f258975b80a9cef336962987cdf33113a8ddb2
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1384834
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384834 (part 1) - Remove remaining uses of nsAdoptingString. r=erahm.
dom/base/nsGlobalWindow.cpp
dom/security/test/gtest/TestCSPParser.cpp
intl/uconv/nsTextToSubURI.cpp
netwerk/streamconv/converters/nsIndexedToHTML.cpp
widget/tests/TestChromeMargin.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -7809,19 +7809,20 @@ nsGlobalWindow::PromptOuter(const nsAStr
   if (disallowDialog) {
     DisableDialogs();
   }
 
   if (aError.Failed()) {
     return;
   }
 
-  nsAdoptingString outValue(inoutValue);
-
-  if (ok && outValue) {
+  nsString outValue;
+  outValue.Adopt(inoutValue);
+
+  if (ok && inoutValue) {
     aReturn.Assign(outValue);
   }
 }
 
 void
 nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
                        nsAString& aReturn,
                        nsIPrincipal& aSubjectPrincipal,
--- a/dom/security/test/gtest/TestCSPParser.cpp
+++ b/dom/security/test/gtest/TestCSPParser.cpp
@@ -14,17 +14,16 @@
 #define nsAString_h___
 #define nsString_h___
 #define nsStringFwd_h___
 #define nsReadableUtils_h___
 class nsACString;
 class nsAString;
 class nsString;
 class nsCString;
-class nsAdoptingString;
 class nsAdoptingCString;
 class nsXPIDLString;
 template<class T> class nsReadingIterator;
 #endif
 
 #include "nsIContentSecurityPolicy.h"
 #include "nsNetUtil.h"
 #include "nsIScriptSecurityManager.h"
--- a/intl/uconv/nsTextToSubURI.cpp
+++ b/intl/uconv/nsTextToSubURI.cpp
@@ -147,17 +147,17 @@ NS_IMETHODIMP  nsTextToSubURI::UnEscapeU
                 PromiseFlatCString(aCharset), unescapedSpec, _retval)
       != NS_OK) {
     // assume UTF-8 instead of ASCII  because hostname (IDN) may be in UTF-8
     CopyUTF8toUTF16(aURIFragment, _retval);
   }
 
   // If there are any characters that are unsafe for URIs, reescape those.
   if (mUnsafeChars.IsEmpty()) {
-    nsAdoptingString blacklist;
+    nsAutoString blacklist;
     nsresult rv = mozilla::Preferences::GetString("network.IDN.blacklist_chars",
                                                   blacklist);
     if (NS_SUCCEEDED(rv)) {
       // we allow SPACE and IDEOGRAPHIC SPACE in this method
       blacklist.StripChars(u" \u3000");
       mUnsafeChars.AppendElements(static_cast<const char16_t*>(blacklist.Data()),
                                   blacklist.Length());
     } else {
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -853,19 +853,21 @@ nsIndexedToHTML::OnIndexAvailable(nsIReq
     return SendToListener(aRequest, aCtxt, pushBuffer);
 }
 
 NS_IMETHODIMP
 nsIndexedToHTML::OnInformationAvailable(nsIRequest *aRequest,
                                         nsISupports *aCtxt,
                                         const nsAString& aInfo) {
     nsAutoCString pushBuffer;
-    nsAdoptingString escaped(nsEscapeHTML2(PromiseFlatString(aInfo).get()));
-    if (!escaped)
+    char16_t* str = nsEscapeHTML2(PromiseFlatString(aInfo).get());
+    if (!str)
         return NS_ERROR_OUT_OF_MEMORY;
+    nsString escaped;
+    escaped.Adopt(str);
     pushBuffer.AppendLiteral("<tr>\n <td>");
     // escaped is provided in Unicode, so write hex NCRs as necessary
     // to prevent the HTML parser from applying a character set.
     AppendNonAsciiToNCR(escaped, pushBuffer);
     pushBuffer.AppendLiteral("</td>\n <td></td>\n <td></td>\n <td></td>\n</tr>\n");
 
     return SendToListener(aRequest, aCtxt, pushBuffer);
 }
--- a/widget/tests/TestChromeMargin.cpp
+++ b/widget/tests/TestChromeMargin.cpp
@@ -21,17 +21,16 @@
 #define nsAString_h___
 #define nsString_h___
 #define nsStringFwd_h___
 #define nsReadableUtils_h___
 class nsACString;
 class nsAString;
 class nsString;
 class nsCString;
-class nsAdoptingString;
 class nsAdoptingCString;
 class nsXPIDLString;
 template<class T> class nsReadingIterator;
 #endif
 
 #include "nscore.h"
 #include "nsContentUtils.h"