From 58641805f110540cbcb152e9ec2dad9cbc27afb5 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 22 May 2014 06:48:51 +0300 Subject: [PATCH] Bug 869836 - Part 6: Use EqualsLiteral instead of Equals where possible. r=ehsan --- accessible/src/atk/nsMaiInterfaceText.cpp | 2 +- .../components/feeds/src/nsFeedSniffer.cpp | 2 +- content/base/src/FeedWriterEnabled.h | 2 +- content/base/src/nsContentSink.cpp | 2 +- content/base/src/nsCopySupport.cpp | 2 +- content/html/document/src/MediaDocument.cpp | 2 +- docshell/base/nsDocShell.cpp | 6 ++-- dom/base/nsContentPermissionHelper.cpp | 4 +-- dom/system/gonk/Volume.cpp | 2 +- gfx/layers/LayerScope.cpp | 2 +- image/encoders/bmp/nsBMPEncoder.cpp | 8 ++--- image/encoders/ico/nsICOEncoder.cpp | 4 +-- layout/base/nsPresContext.cpp | 10 +++--- layout/printing/nsPrintEngine.cpp | 2 +- netwerk/protocol/http/Http2Compression.cpp | 24 ++++++------- netwerk/protocol/http/Http2Stream.cpp | 2 +- netwerk/protocol/http/SpdyStream3.cpp | 14 ++++---- netwerk/protocol/http/SpdyStream31.cpp | 14 ++++---- parser/htmlparser/src/nsParser.cpp | 4 +-- security/manager/ssl/src/nsNSSComponent.cpp | 36 +++++++++---------- security/manager/ssl/src/nsNSSIOLayer.cpp | 10 +++--- toolkit/components/places/Database.cpp | 2 +- .../typeaheadfind/nsTypeAheadFind.cpp | 4 +-- .../unixproxy/nsUnixSystemProxySettings.cpp | 4 +-- .../exthandler/nsExternalHelperAppService.cpp | 2 +- widget/android/GfxInfo.cpp | 14 ++++---- widget/windows/nsDataObj.cpp | 2 +- xpcom/base/nsMemoryReporterManager.cpp | 2 +- xpcom/io/nsLocalFileUnix.cpp | 4 +-- xpcom/tests/external/TestMinStringAPI.cpp | 10 +++--- 30 files changed, 99 insertions(+), 99 deletions(-) diff --git a/accessible/src/atk/nsMaiInterfaceText.cpp b/accessible/src/atk/nsMaiInterfaceText.cpp index 912550b7055c..a8922d49e707 100644 --- a/accessible/src/atk/nsMaiInterfaceText.cpp +++ b/accessible/src/atk/nsMaiInterfaceText.cpp @@ -70,7 +70,7 @@ ConvertToAtkTextAttributeSet(nsIPersistentProperties* aAttributes) } else if (name.EqualsLiteral("font-family")) { atkValue = value; atkName = sAtkTextAttrNames[ATK_TEXT_ATTR_FAMILY_NAME]; - } else if (name.Equals("font-size")) { + } else if (name.EqualsLiteral("font-size")) { // ATK wants the number of pixels without px at the end. atkValue = StringHead(value, value.Length() - 2); atkName = sAtkTextAttrNames[ATK_TEXT_ATTR_SIZE]; diff --git a/browser/components/feeds/src/nsFeedSniffer.cpp b/browser/components/feeds/src/nsFeedSniffer.cpp index c9c6ea80f00d..61cc77bdd799 100644 --- a/browser/components/feeds/src/nsFeedSniffer.cpp +++ b/browser/components/feeds/src/nsFeedSniffer.cpp @@ -208,7 +208,7 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request, // Check that this is a GET request, since you can't subscribe to a POST... nsAutoCString method; channel->GetRequestMethod(method); - if (!method.Equals("GET")) { + if (!method.EqualsLiteral("GET")) { sniffedType.Truncate(); return NS_OK; } diff --git a/content/base/src/FeedWriterEnabled.h b/content/base/src/FeedWriterEnabled.h index e61824115db3..bfb4345148e6 100644 --- a/content/base/src/FeedWriterEnabled.h +++ b/content/base/src/FeedWriterEnabled.h @@ -40,7 +40,7 @@ struct FeedWriterEnabled { // Now check the spec itself nsAutoCString spec; uri->GetSpec(spec); - return spec.Equals("about:feeds"); + return spec.EqualsLiteral("about:feeds"); } }; diff --git a/content/base/src/nsContentSink.cpp b/content/base/src/nsContentSink.cpp index cdf270a5c5fa..9d940edce96d 100644 --- a/content/base/src/nsContentSink.cpp +++ b/content/base/src/nsContentSink.cpp @@ -1066,7 +1066,7 @@ nsContentSink::ProcessOfflineManifest(const nsAString& aManifestSpec) nsAutoCString method; rv = httpChannel->GetRequestMethod(method); if (NS_SUCCEEDED(rv)) - fetchedWithHTTPGetOrEquiv = method.Equals("GET"); + fetchedWithHTTPGetOrEquiv = method.EqualsLiteral("GET"); } rv = SelectDocAppCache(applicationCache, manifestURI, diff --git a/content/base/src/nsCopySupport.cpp b/content/base/src/nsCopySupport.cpp index 1b76b7eb7c4b..cfa9d1dbbfa2 100644 --- a/content/base/src/nsCopySupport.cpp +++ b/content/base/src/nsCopySupport.cpp @@ -369,7 +369,7 @@ nsCopySupport::GetContents(const nsACString& aMimeType, uint32_t aFlags, nsISele uint32_t flags = aFlags | nsIDocumentEncoder::SkipInvisibleContent; - if (aMimeType.Equals("text/plain")) + if (aMimeType.EqualsLiteral("text/plain")) flags |= nsIDocumentEncoder::OutputPreformatted; NS_ConvertASCIItoUTF16 unicodeMimeType(aMimeType); diff --git a/content/html/document/src/MediaDocument.cpp b/content/html/document/src/MediaDocument.cpp index 0933c0c04d51..9ac5c27a011e 100644 --- a/content/html/document/src/MediaDocument.cpp +++ b/content/html/document/src/MediaDocument.cpp @@ -170,7 +170,7 @@ MediaDocument::StartDocumentLoad(const char* aCommand, docShell->GetParentCharset(charset, &source, getter_AddRefs(principal)); if (!charset.IsEmpty() && - !charset.Equals("UTF-8") && + !charset.EqualsLiteral("UTF-8") && NodePrincipal()->Equals(principal)) { SetDocumentCharacterSetSource(source); SetDocumentCharacterSet(charset); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index d9638dc3e0ef..8ccc8f959b2c 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -10931,12 +10931,12 @@ nsDocShell::ShouldAddToSessionHistory(nsIURI * aURI) if (NS_FAILED(rv)) return false; - if (buf.Equals("about")) { + if (buf.EqualsLiteral("about")) { rv = aURI->GetPath(buf); if (NS_FAILED(rv)) return false; - if (buf.Equals("blank")) { + if (buf.EqualsLiteral("blank")) { return false; } } @@ -11678,7 +11678,7 @@ nsDocShell::ChannelIsPost(nsIChannel* aChannel) nsAutoCString method; httpChannel->GetRequestMethod(method); - return method.Equals("POST"); + return method.EqualsLiteral("POST"); } void diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissionHelper.cpp index f47cc24e30f7..90bd23f7ce27 100644 --- a/dom/base/nsContentPermissionHelper.cpp +++ b/dom/base/nsContentPermissionHelper.cpp @@ -309,12 +309,12 @@ nsContentPermissionRequestProxy::Allow(JS::HandleValue aChoices) #ifdef MOZ_WIDGET_GONK uint32_t len = mPermissionRequests.Length(); for (uint32_t i = 0; i < len; i++) { - if (mPermissionRequests[i].type().Equals("audio-capture")) { + if (mPermissionRequests[i].type().EqualsLiteral("audio-capture")) { GonkPermissionService::GetInstance()->addGrantInfo( "android.permission.RECORD_AUDIO", static_cast(mParent->Manager())->Manager()->Pid()); } - if (mPermissionRequests[i].type().Equals("video-capture")) { + if (mPermissionRequests[i].type().EqualsLiteral("video-capture")) { GonkPermissionService::GetInstance()->addGrantInfo( "android.permission.CAMERA", static_cast(mParent->Manager())->Manager()->Pid()); diff --git a/dom/system/gonk/Volume.cpp b/dom/system/gonk/Volume.cpp index 574db0ce923d..083a8a79b3ca 100644 --- a/dom/system/gonk/Volume.cpp +++ b/dom/system/gonk/Volume.cpp @@ -379,7 +379,7 @@ Volume::HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer& aTokenizer // So we parse out the state after the string " to " while (aTokenizer.hasMoreTokens()) { nsAutoCString token(aTokenizer.nextToken()); - if (token.Equals("to")) { + if (token.EqualsLiteral("to")) { nsresult errCode; token = aTokenizer.nextToken(); SetState((STATE)token.ToInteger(&errCode)); diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp index 9899978cfc14..f43bef66c153 100644 --- a/gfx/layers/LayerScope.cpp +++ b/gfx/layers/LayerScope.cpp @@ -223,7 +223,7 @@ private: return false; } - if (!(version.Equals("7") || version.Equals("8") || version.Equals("13"))) { + if (!(version.EqualsLiteral("7") || version.EqualsLiteral("8") || version.EqualsLiteral("13"))) { return false; } diff --git a/image/encoders/bmp/nsBMPEncoder.cpp b/image/encoders/bmp/nsBMPEncoder.cpp index 2c3536d314e2..f1502f1bc5e4 100644 --- a/image/encoders/bmp/nsBMPEncoder.cpp +++ b/image/encoders/bmp/nsBMPEncoder.cpp @@ -283,9 +283,9 @@ nsBMPEncoder::ParseOptions(const nsAString& aOptions, Version* version, // name=value if (nameValuePair[0].Equals("version", nsCaseInsensitiveCStringComparator())) { - if (nameValuePair[1].Equals("3")) { + if (nameValuePair[1].EqualsLiteral("3")) { *version = VERSION_3; - } else if (nameValuePair[1].Equals("5")) { + } else if (nameValuePair[1].EqualsLiteral("5")) { *version = VERSION_5; } else { return NS_ERROR_INVALID_ARG; @@ -294,9 +294,9 @@ nsBMPEncoder::ParseOptions(const nsAString& aOptions, Version* version, // Parse the bpp portion of the string name=value;bpp=;name=value if (nameValuePair[0].Equals("bpp", nsCaseInsensitiveCStringComparator())) { - if (nameValuePair[1].Equals("24")) { + if (nameValuePair[1].EqualsLiteral("24")) { *bpp = 24; - } else if (nameValuePair[1].Equals("32")) { + } else if (nameValuePair[1].EqualsLiteral("32")) { *bpp = 32; } else { return NS_ERROR_INVALID_ARG; diff --git a/image/encoders/ico/nsICOEncoder.cpp b/image/encoders/ico/nsICOEncoder.cpp index da0056171afc..1390fa9fb574 100644 --- a/image/encoders/ico/nsICOEncoder.cpp +++ b/image/encoders/ico/nsICOEncoder.cpp @@ -305,10 +305,10 @@ nsICOEncoder::ParseOptions(const nsAString& aOptions, uint32_t* bpp, // Parse the bpp portion of the string format=;bpp= if (nameValuePair[0].Equals("bpp", nsCaseInsensitiveCStringComparator())) { - if (nameValuePair[1].Equals("24")) { + if (nameValuePair[1].EqualsLiteral("24")) { *bpp = 24; } - else if (nameValuePair[1].Equals("32")) { + else if (nameValuePair[1].EqualsLiteral("32")) { *bpp = 32; } else { diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 665bf1029dfa..cc607135038a 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -496,10 +496,10 @@ nsPresContext::GetFontPrefsForLang(nsIAtom *aLanguage) const Preferences::GetCString("font.size.unit"); if (!cvalue.IsEmpty()) { - if (cvalue.Equals("px")) { + if (cvalue.EqualsLiteral("px")) { unit = eUnit_px; } - else if (cvalue.Equals("pt")) { + else if (cvalue.EqualsLiteral("pt")) { unit = eUnit_pt; } else { @@ -768,11 +768,11 @@ nsPresContext::GetUserPreferences() // * image animation const nsAdoptingCString& animatePref = Preferences::GetCString("image.animation_mode"); - if (animatePref.Equals("normal")) + if (animatePref.EqualsLiteral("normal")) mImageAnimationModePref = imgIContainer::kNormalAnimMode; - else if (animatePref.Equals("none")) + else if (animatePref.EqualsLiteral("none")) mImageAnimationModePref = imgIContainer::kDontAnimMode; - else if (animatePref.Equals("once")) + else if (animatePref.EqualsLiteral("once")) mImageAnimationModePref = imgIContainer::kLoopOnceAnimMode; else // dynamic change to invalid value should act like it does initially mImageAnimationModePref = imgIContainer::kNormalAnimMode; diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index b6887ce629c9..91d89cf1d4b5 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -1911,7 +1911,7 @@ nsPrintEngine::OnStateChange(nsIWebProgress* aWebProgress, { nsAutoCString name; aRequest->GetName(name); - if (name.Equals("about:document-onload-blocker")) { + if (name.EqualsLiteral("about:document-onload-blocker")) { return NS_OK; } if (aStateFlags & STATE_START) { diff --git a/netwerk/protocol/http/Http2Compression.cpp b/netwerk/protocol/http/Http2Compression.cpp index ef7382900bca..fdc44bbc2551 100644 --- a/netwerk/protocol/http/Http2Compression.cpp +++ b/netwerk/protocol/http/Http2Compression.cpp @@ -950,14 +950,14 @@ Http2Compressor::EncodeHeaderBlock(const nsCString &nvInput, ToLowerCase(name); // exclusions - if (name.Equals("connection") || - name.Equals("host") || - name.Equals("keep-alive") || - name.Equals("proxy-connection") || - name.Equals("te") || - name.Equals("transfer-encoding") || - name.Equals("upgrade") || - name.Equals("accept-encoding")) { + if (name.EqualsLiteral("connection") || + name.EqualsLiteral("host") || + name.EqualsLiteral("keep-alive") || + name.EqualsLiteral("proxy-connection") || + name.EqualsLiteral("te") || + name.EqualsLiteral("transfer-encoding") || + name.EqualsLiteral("upgrade") || + name.EqualsLiteral("accept-encoding")) { continue; } @@ -972,7 +972,7 @@ Http2Compressor::EncodeHeaderBlock(const nsCString &nvInput, // if we have Expect: *100-continue,*" redact the 100-continue // as we don't have a good mechanism for clients to make use of it // anyhow - if (name.Equals("expect")) { + if (name.EqualsLiteral("expect")) { const char *continueHeader = nsHttp::FindToken(beginBuffer + valueIndex, "100-continue", HTTP_HEADER_VALUE_SEPS); @@ -995,14 +995,14 @@ Http2Compressor::EncodeHeaderBlock(const nsCString &nvInput, nsDependentCSubstring value = Substring(beginBuffer + valueIndex, beginBuffer + crlfIndex); - if (name.Equals("content-length")) { + if (name.EqualsLiteral("content-length")) { int64_t len; nsCString tmp(value); if (nsHttp::ParseInt64(tmp.get(), nullptr, &len)) mParsedContentLength = len; } - if (name.Equals("cookie")) { + if (name.EqualsLiteral("cookie")) { // cookie crumbling bool haveMoreCookies = true; int32_t nextCookie = valueIndex; @@ -1019,7 +1019,7 @@ Http2Compressor::EncodeHeaderBlock(const nsCString &nvInput, nextCookie = semiSpaceIndex + 2; } } else { - ProcessHeader(nvPair(name, value), name.Equals("authorization") ? true : false); + ProcessHeader(nvPair(name, value), name.EqualsLiteral("authorization") ? true : false); } } diff --git a/netwerk/protocol/http/Http2Stream.cpp b/netwerk/protocol/http/Http2Stream.cpp index 005ee3de9a62..2f9b8364ba39 100644 --- a/netwerk/protocol/http/Http2Stream.cpp +++ b/netwerk/protocol/http/Http2Stream.cpp @@ -520,7 +520,7 @@ Http2Stream::ParseHttpRequestHeaders(const char *buf, // all header names are lower case in spdy ToLowerCase(name); - if (name.Equals("content-length")) { + if (name.EqualsLiteral("content-length")) { nsCString *val = new nsCString(); int32_t valueIndex = colonIndex + 1; while (valueIndex < crlfIndex && beginBuffer[valueIndex] == ' ') diff --git a/netwerk/protocol/http/SpdyStream3.cpp b/netwerk/protocol/http/SpdyStream3.cpp index 291273f39b4e..be9c5abb59c2 100644 --- a/netwerk/protocol/http/SpdyStream3.cpp +++ b/netwerk/protocol/http/SpdyStream3.cpp @@ -425,12 +425,12 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, ToLowerCase(name); // exclusions.. mostly from 3.2.1 - if (name.Equals("connection") || - name.Equals("keep-alive") || - name.Equals("host") || - name.Equals("accept-encoding") || - name.Equals("te") || - name.Equals("transfer-encoding")) + if (name.EqualsLiteral("connection") || + name.EqualsLiteral("keep-alive") || + name.EqualsLiteral("host") || + name.EqualsLiteral("accept-encoding") || + name.EqualsLiteral("te") || + name.EqualsLiteral("transfer-encoding")) continue; nsCString *val = hdrHash.Get(name); @@ -449,7 +449,7 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf, val->Append(static_cast(0)); val->Append(v); - if (name.Equals("content-length")) { + if (name.EqualsLiteral("content-length")) { int64_t len; if (nsHttp::ParseInt64(val->get(), nullptr, &len)) mRequestBodyLenRemaining = len; diff --git a/netwerk/protocol/http/SpdyStream31.cpp b/netwerk/protocol/http/SpdyStream31.cpp index 62ddd558dcae..c1a3601f4dab 100644 --- a/netwerk/protocol/http/SpdyStream31.cpp +++ b/netwerk/protocol/http/SpdyStream31.cpp @@ -431,12 +431,12 @@ SpdyStream31::ParseHttpRequestHeaders(const char *buf, ToLowerCase(name); // exclusions.. mostly from 3.2.1 - if (name.Equals("connection") || - name.Equals("keep-alive") || - name.Equals("host") || - name.Equals("accept-encoding") || - name.Equals("te") || - name.Equals("transfer-encoding")) + if (name.EqualsLiteral("connection") || + name.EqualsLiteral("keep-alive") || + name.EqualsLiteral("host") || + name.EqualsLiteral("accept-encoding") || + name.EqualsLiteral("te") || + name.EqualsLiteral("transfer-encoding")) continue; nsCString *val = hdrHash.Get(name); @@ -455,7 +455,7 @@ SpdyStream31::ParseHttpRequestHeaders(const char *buf, val->Append(static_cast(0)); val->Append(v); - if (name.Equals("content-length")) { + if (name.EqualsLiteral("content-length")) { int64_t len; if (nsHttp::ParseInt64(val->get(), nullptr, &len)) mRequestBodyLenRemaining = len; diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp index 442a8aa501ad..d0b162f7dcda 100644 --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -259,9 +259,9 @@ NS_IMETHODIMP_(void) nsParser::SetCommand(const char* aCommand) { mCommandStr.Assign(aCommand); - if (mCommandStr.Equals("view-source")) { + if (mCommandStr.EqualsLiteral("view-source")) { mCommand = eViewSource; - } else if (mCommandStr.Equals("view-fragment")) { + } else if (mCommandStr.EqualsLiteral("view-fragment")) { mCommand = eViewFragment; } else { mCommand = eViewNormal; diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp index 47a7f05ffcb1..9a987a210df9 100644 --- a/security/manager/ssl/src/nsNSSComponent.cpp +++ b/security/manager/ssl/src/nsNSSComponent.cpp @@ -1638,15 +1638,15 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic, bool clearSessionCache = true; NS_ConvertUTF16toUTF8 prefName(someData); - if (prefName.Equals("security.tls.version.min") || - prefName.Equals("security.tls.version.max")) { + if (prefName.EqualsLiteral("security.tls.version.min") || + prefName.EqualsLiteral("security.tls.version.max")) { (void) setEnabledTLSVersions(); - } else if (prefName.Equals("security.ssl.require_safe_negotiation")) { + } else if (prefName.EqualsLiteral("security.ssl.require_safe_negotiation")) { bool requireSafeNegotiation = Preferences::GetBool("security.ssl.require_safe_negotiation", REQUIRE_SAFE_NEGOTIATION_DEFAULT); SSL_OptionSetDefault(SSL_REQUIRE_SAFE_NEGOTIATION, requireSafeNegotiation); - } else if (prefName.Equals("security.ssl.allow_unrestricted_renego_everywhere__temporarily_available_pref")) { + } else if (prefName.EqualsLiteral("security.ssl.allow_unrestricted_renego_everywhere__temporarily_available_pref")) { bool allowUnrestrictedRenego = Preferences::GetBool("security.ssl.allow_unrestricted_renego_everywhere__temporarily_available_pref", ALLOW_UNRESTRICTED_RENEGO_DEFAULT); @@ -1654,31 +1654,31 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic, allowUnrestrictedRenego ? SSL_RENEGOTIATE_UNRESTRICTED : SSL_RENEGOTIATE_REQUIRES_XTN); - } else if (prefName.Equals("security.ssl.enable_false_start")) { + } else if (prefName.EqualsLiteral("security.ssl.enable_false_start")) { SSL_OptionSetDefault(SSL_ENABLE_FALSE_START, Preferences::GetBool("security.ssl.enable_false_start", FALSE_START_ENABLED_DEFAULT)); - } else if (prefName.Equals("security.ssl.enable_npn")) { + } else if (prefName.EqualsLiteral("security.ssl.enable_npn")) { SSL_OptionSetDefault(SSL_ENABLE_NPN, Preferences::GetBool("security.ssl.enable_npn", NPN_ENABLED_DEFAULT)); - } else if (prefName.Equals("security.ssl.enable_alpn")) { + } else if (prefName.EqualsLiteral("security.ssl.enable_alpn")) { SSL_OptionSetDefault(SSL_ENABLE_ALPN, Preferences::GetBool("security.ssl.enable_alpn", ALPN_ENABLED_DEFAULT)); - } else if (prefName.Equals("security.OCSP.enabled") - || prefName.Equals("security.CRL_download.enabled") - || prefName.Equals("security.fresh_revocation_info.require") - || prefName.Equals("security.missing_cert_download.enabled") - || prefName.Equals("security.OCSP.require") - || prefName.Equals("security.OCSP.GET.enabled") - || prefName.Equals("security.ssl.enable_ocsp_stapling") - || prefName.Equals("security.use_mozillapkix_verification") - || prefName.Equals("security.use_libpkix_verification") - || prefName.Equals("security.cert_pinning.enforcement_level")) { + } else if (prefName.EqualsLiteral("security.OCSP.enabled") || + prefName.EqualsLiteral("security.CRL_download.enabled") || + prefName.EqualsLiteral("security.fresh_revocation_info.require") || + prefName.EqualsLiteral("security.missing_cert_download.enabled") || + prefName.EqualsLiteral("security.OCSP.require") || + prefName.EqualsLiteral("security.OCSP.GET.enabled") || + prefName.EqualsLiteral("security.ssl.enable_ocsp_stapling") || + prefName.EqualsLiteral("security.use_mozillapkix_verification") || + prefName.EqualsLiteral("security.use_libpkix_verification") || + prefName.EqualsLiteral("security.cert_pinning.enforcement_level")) { MutexAutoLock lock(mutex); setValidationOptions(false, lock); - } else if (prefName.Equals("network.ntlm.send-lm-response")) { + } else if (prefName.EqualsLiteral("network.ntlm.send-lm-response")) { bool sendLM = Preferences::GetBool("network.ntlm.send-lm-response", SEND_LM_DEFAULT); nsNTLMAuthModule::SetSendLM(sendLM); diff --git a/security/manager/ssl/src/nsNSSIOLayer.cpp b/security/manager/ssl/src/nsNSSIOLayer.cpp index 39e2a317ddf5..dcbb6584a552 100644 --- a/security/manager/ssl/src/nsNSSIOLayer.cpp +++ b/security/manager/ssl/src/nsNSSIOLayer.cpp @@ -1391,25 +1391,25 @@ PrefObserver::Observe(nsISupports* aSubject, const char* aTopic, if (nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0) { NS_ConvertUTF16toUTF8 prefName(someData); - if (prefName.Equals("security.ssl.renego_unrestricted_hosts")) { + if (prefName.EqualsLiteral("security.ssl.renego_unrestricted_hosts")) { nsCString unrestricted_hosts; Preferences::GetCString("security.ssl.renego_unrestricted_hosts", &unrestricted_hosts); if (!unrestricted_hosts.IsEmpty()) { mOwner->setRenegoUnrestrictedSites(unrestricted_hosts); } - } else if (prefName.Equals("security.ssl.treat_unsafe_negotiation_as_broken")) { + } else if (prefName.EqualsLiteral("security.ssl.treat_unsafe_negotiation_as_broken")) { bool enabled; Preferences::GetBool("security.ssl.treat_unsafe_negotiation_as_broken", &enabled); mOwner->setTreatUnsafeNegotiationAsBroken(enabled); - } else if (prefName.Equals("security.ssl.warn_missing_rfc5746")) { + } else if (prefName.EqualsLiteral("security.ssl.warn_missing_rfc5746")) { int32_t warnLevel = 1; Preferences::GetInt("security.ssl.warn_missing_rfc5746", &warnLevel); mOwner->setWarnLevelMissingRFC5746(warnLevel); - } else if (prefName.Equals("security.ssl.false_start.require-npn")) { + } else if (prefName.EqualsLiteral("security.ssl.false_start.require-npn")) { mOwner->mFalseStartRequireNPN = Preferences::GetBool("security.ssl.false_start.require-npn", FALSE_START_REQUIRE_NPN_DEFAULT); - } else if (prefName.Equals("security.ssl.false_start.require-forward-secrecy")) { + } else if (prefName.EqualsLiteral("security.ssl.false_start.require-forward-secrecy")) { mOwner->mFalseStartRequireForwardSecrecy = Preferences::GetBool("security.ssl.false_start.require-forward-secrecy", FALSE_START_REQUIRE_FORWARD_SECRECY_DEFAULT); diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index a960bfc7b930..fa57af179018 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -314,7 +314,7 @@ CreateRoot(nsCOMPtr& aDBConn, // The 'places' root is a folder containing the other roots. // The first bookmark in a folder has position 0. - if (!aRootName.Equals("places")) + if (!aRootName.EqualsLiteral("places")) ++itemPosition; return NS_OK; diff --git a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp index a7ed3a617b4e..359c5a3cc94d 100644 --- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp +++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp @@ -269,13 +269,13 @@ nsTypeAheadFind::PlayNotFoundSound() if (mSoundInterface) { mIsSoundInitialized = true; - if (mNotFoundSoundURL.Equals("beep")) { + if (mNotFoundSoundURL.EqualsLiteral("beep")) { mSoundInterface->Beep(); return; } nsCOMPtr soundURI; - if (mNotFoundSoundURL.Equals("default")) + if (mNotFoundSoundURL.EqualsLiteral("default")) NS_NewURI(getter_AddRefs(soundURI), NS_LITERAL_CSTRING(TYPEAHEADFIND_NOTFOUND_WAV_URL)); else NS_NewURI(getter_AddRefs(soundURI), mNotFoundSoundURL); diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp index 5bbd9a98edce..60d857bf5bd0 100644 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp @@ -85,7 +85,7 @@ nsUnixSystemProxySettings::GetPACURI(nsACString& aResult) nsCString proxyMode; // Check if mode is auto nsresult rv = mProxySettings->GetString(NS_LITERAL_CSTRING("mode"), proxyMode); - if (rv == NS_OK && proxyMode.Equals("auto")) { + if (rv == NS_OK && proxyMode.EqualsLiteral("auto")) { return mProxySettings->GetString(NS_LITERAL_CSTRING("autoconfig-url"), aResult); } /* The org.gnome.system.proxy schema has been found, but auto mode is not set. @@ -451,7 +451,7 @@ nsUnixSystemProxySettings::GetProxyFromGSettings(const nsACString& aScheme, NS_ENSURE_SUCCESS(rv, rv); // return NS_ERROR_FAILURE when no proxy is set - if (!proxyMode.Equals("manual")) { + if (!proxyMode.EqualsLiteral("manual")) { return NS_ERROR_FAILURE; } diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index c715e7eaa426..90972486eefb 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -694,7 +694,7 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte if (httpChan) { nsAutoCString requestMethod; httpChan->GetRequestMethod(requestMethod); - allowURLExt = !requestMethod.Equals("POST"); + allowURLExt = !requestMethod.EqualsLiteral("POST"); } // Check if we had a query string - we don't want to check the URL diff --git a/widget/android/GfxInfo.cpp b/widget/android/GfxInfo.cpp index dc4563324115..fb4e26ceb483 100644 --- a/widget/android/GfxInfo.cpp +++ b/widget/android/GfxInfo.cpp @@ -409,12 +409,12 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, NS_LossyConvertUTF16toASCII cModel(mModel); NS_LossyConvertUTF16toASCII cHardware(mHardware); - if (cHardware.Equals("antares") || - cHardware.Equals("harmony") || - cHardware.Equals("picasso") || - cHardware.Equals("picasso_e") || - cHardware.Equals("ventana") || - cHardware.Equals("rk30board")) + if (cHardware.EqualsLiteral("antares") || + cHardware.EqualsLiteral("harmony") || + cHardware.EqualsLiteral("picasso") || + cHardware.EqualsLiteral("picasso_e") || + cHardware.EqualsLiteral("ventana") || + cHardware.EqualsLiteral("rk30board")) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; @@ -555,7 +555,7 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature, NS_LossyConvertUTF16toASCII cModel(mModel); NS_LossyConvertUTF16toASCII cHardware(mHardware); - if (cHardware.Equals("hammerhead") && + if (cHardware.EqualsLiteral("hammerhead") && CompareVersions(mOSVersion.get(), "4.4.2") >= 0 && cManufacturer.Equals("lge", nsCaseInsensitiveCStringComparator()) && cModel.Equals("nexus 5", nsCaseInsensitiveCStringComparator())) { diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp index 5d9416ed950f..4f24329907aa 100644 --- a/widget/windows/nsDataObj.cpp +++ b/widget/windows/nsDataObj.cpp @@ -1240,7 +1240,7 @@ HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGME // if someone asks for text/plain, look up text/unicode instead in the transferable. const char* flavorStr; const nsPromiseFlatCString& flat = PromiseFlatCString(aDataFlavor); - if ( aDataFlavor.Equals("text/plain") ) + if ( aDataFlavor.EqualsLiteral("text/plain") ) flavorStr = kUnicodeMime; else flavorStr = flat.get(); diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index c4e330336a1a..f12b350b6569 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1426,7 +1426,7 @@ public: // create artificial (i.e. deterministic) reporters -- which allows us // to precisely test nsMemoryReporterManager.explicit -- but we can't // do that for distinguished amounts. - if (aPath.Equals("heap-allocated") || + if (aPath.EqualsLiteral("heap-allocated") || (aKind == nsIMemoryReporter::KIND_NONHEAP && PromiseFlatCString(aPath).Find("explicit") == 0)) { Int64Wrapper* wrappedInt64 = static_cast(aWrappedExplicit); diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 70cab7c02490..7d50c7f431af 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -288,7 +288,7 @@ nsLocalFile::Clone(nsIFile** aFile) NS_IMETHODIMP nsLocalFile::InitWithNativePath(const nsACString& aFilePath) { - if (aFilePath.Equals("~") || + if (aFilePath.EqualsLiteral("~") || Substring(aFilePath, 0, 2).EqualsLiteral("~/")) { nsCOMPtr homeDir; nsAutoCString homePath; @@ -1445,7 +1445,7 @@ nsLocalFile::GetParent(nsIFile** aParent) *aParent = nullptr; // if '/' we are at the top of the volume, return null - if (mPath.Equals("/")) { + if (mPath.EqualsLiteral("/")) { return NS_OK; } diff --git a/xpcom/tests/external/TestMinStringAPI.cpp b/xpcom/tests/external/TestMinStringAPI.cpp index 215109dd1474..95d9acac1ecb 100644 --- a/xpcom/tests/external/TestMinStringAPI.cpp +++ b/xpcom/tests/external/TestMinStringAPI.cpp @@ -480,12 +480,12 @@ static bool test_stripchars() { nsCString test(kAsciiData); test.StripChars("ld"); - if (!test.Equals("Heo Wor")) + if (!test.EqualsLiteral("Heo Wor")) return false; test.Assign(kAsciiData); test.StripWhitespace(); - if (!test.Equals("HelloWorld")) + if (!test.EqualsLiteral("HelloWorld")) return false; return true; @@ -504,13 +504,13 @@ static bool test_trim() test2.Trim(kWS, true, false); test3.Trim(kWS, false, true); - if (!test1.Equals("Testing...")) + if (!test1.EqualsLiteral("Testing...")) return false; - if (!test2.Equals("Testing...\n\r")) + if (!test2.EqualsLiteral("Testing...\n\r")) return false; - if (!test3.Equals(" \n\tTesting...")) + if (!test3.EqualsLiteral(" \n\tTesting...")) return false; return true;