Bug 1384834 (part 2) - Remove remaining uses of nsAdoptingCString. r=erahm.

--HG--
extra : rebase_source : 70a385a0a06bc88e728d51459e7460a68f15f7fb
This commit is contained in:
Nicholas Nethercote 2017-07-28 11:21:47 +10:00
Родитель d18fdecf67
Коммит 73558eac3d
7 изменённых файлов: 20 добавлений и 25 удалений

Просмотреть файл

@ -19,7 +19,6 @@ class nsACString;
class nsAString;
class nsString;
class nsCString;
class nsAdoptingCString;
class nsXPIDLString;
template<class T> class nsReadingIterator;
#endif

Просмотреть файл

@ -197,7 +197,7 @@ std::string gfxPrefs::PrefGet(const char* aPref, std::string aDefault)
{
MOZ_ASSERT(IsPrefsServiceAvailable());
nsAdoptingCString result;
nsAutoCString result;
Preferences::GetCString(aPref, result);
if (result.IsEmpty()) {

Просмотреть файл

@ -547,9 +547,9 @@ nsDNSService::Init()
int proxyType = nsIProtocolProxyService::PROXYCONFIG_DIRECT;
bool notifyResolution = false;
nsAdoptingCString ipv4OnlyDomains;
nsAdoptingCString localDomains;
nsAdoptingCString forceResolve;
nsCString ipv4OnlyDomains;
nsCString localDomains;
nsCString forceResolve;
// read prefs
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
@ -618,7 +618,7 @@ nsDNSService::Init()
MutexAutoLock lock(mLock);
mResolver = res;
mIDN = idn;
mIPv4OnlyDomains = ipv4OnlyDomains; // exchanges buffer ownership
mIPv4OnlyDomains = ipv4OnlyDomains;
mOfflineLocalhost = offlineLocalhost;
mDisableIPv6 = disableIPv6;
mBlockDotOnion = blockDotOnion;
@ -629,7 +629,7 @@ nsDNSService::Init()
mDisablePrefetch = disablePrefetch || (proxyType == nsIProtocolProxyService::PROXYCONFIG_MANUAL);
mLocalDomains.Clear();
if (localDomains) {
if (!localDomains.IsVoid()) {
nsCCharSeparatedTokenizer tokenizer(localDomains, ',',
nsCCharSeparatedTokenizer::SEPARATOR_OPTIONAL);

Просмотреть файл

@ -59,8 +59,8 @@ private:
// mIPv4OnlyDomains is a comma-separated list of domains for which only
// IPv4 DNS lookups are performed. This allows the user to disable IPv6 on
// a per-domain basis and work around broken DNS servers. See bug 68796.
nsAdoptingCString mIPv4OnlyDomains;
nsAdoptingCString mForceResolve;
nsCString mIPv4OnlyDomains;
nsCString mForceResolve;
bool mDisableIPv6;
bool mDisablePrefetch;
bool mBlockDotOnion;

Просмотреть файл

@ -556,7 +556,8 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
// dealing with a resource URI.
if (!isResource) {
buffer.AppendLiteral("<base href=\"");
nsAdoptingCString htmlEscapedUri(nsEscapeHTML(baseUri.get()));
nsCString htmlEscapedUri;
htmlEscapedUri.Adopt(nsEscapeHTML(baseUri.get()));
buffer.Append(htmlEscapedUri);
buffer.AppendLiteral("\" />\n");
}
@ -596,7 +597,8 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
buffer.AppendLiteral("<p id=\"UI_goUp\"><a class=\"up\" href=\"");
nsAdoptingCString htmlParentStr(nsEscapeHTML(parentStr.get()));
nsCString htmlParentStr;
htmlParentStr.Adopt(nsEscapeHTML(parentStr.get()));
buffer.Append(htmlParentStr);
buffer.AppendLiteral("\">");
AppendNonAsciiToNCR(parentText, buffer);
@ -726,7 +728,8 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
pushBuffer.Append('2');
break;
}
nsAdoptingCString escaped(nsEscapeHTML(loc));
nsCString escaped;
escaped.Adopt(nsEscapeHTML(loc));
pushBuffer.Append(escaped);
pushBuffer.AppendLiteral("\"><table class=\"ellipsis\"><tbody><tr><td><a class=\"");
@ -777,7 +780,8 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
// contains semicolons we need to manually escape them.
// This replacement should be removed in bug #473280
locEscaped.ReplaceSubstring(";", "%3b");
nsAdoptingCString htmlEscapedURL(nsEscapeHTML(locEscaped.get()));
nsCString htmlEscapedURL;
htmlEscapedURL.Adopt(nsEscapeHTML(locEscaped.get()));
pushBuffer.Append(htmlEscapedURL);
pushBuffer.AppendLiteral("\">");
@ -787,7 +791,8 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
int32_t lastDot = locEscaped.RFindChar('.');
if (lastDot != kNotFound) {
locEscaped.Cut(0, lastDot);
nsAdoptingCString htmlFileExt(nsEscapeHTML(locEscaped.get()));
nsCString htmlFileExt;
htmlFileExt.Adopt(nsEscapeHTML(locEscaped.get()));
pushBuffer.Append(htmlFileExt);
} else {
pushBuffer.AppendLiteral("unknown");

Просмотреть файл

@ -52,15 +52,6 @@ static const char kBackgroundPageHTMLEnd[] = "\n\
<body>\n\
</html>";
class EscapeHTML final : public nsAdoptingCString
{
public:
explicit EscapeHTML(const nsACString& str)
: nsAdoptingCString(nsEscapeHTML(str.BeginReading()))
{}
};
static inline ExtensionPolicyService&
EPS()
{
@ -258,7 +249,8 @@ WebExtensionPolicy::BackgroundPageHTML() const
result.AppendLiteral(kBackgroundPageHTMLStart);
for (auto& script : mBackgroundScripts.Value()) {
EscapeHTML escaped{NS_ConvertUTF16toUTF8(script)};
nsCString escaped;
escaped.Adopt(nsEscapeHTML(NS_ConvertUTF16toUTF8(script).get()));
result.AppendPrintf(kBackgroundPageHTMLScript, escaped.get());
}

Просмотреть файл

@ -26,7 +26,6 @@ class nsACString;
class nsAString;
class nsString;
class nsCString;
class nsAdoptingCString;
class nsXPIDLString;
template<class T> class nsReadingIterator;
#endif