Bug 869836 - Part 6: Use EqualsLiteral instead of Equals where possible. r=ehsan

This commit is contained in:
Birunthan Mohanathas 2014-05-22 06:48:51 +03:00
parent e2a009d822
commit c4568a7085
30 changed files with 99 additions and 99 deletions

View File

@ -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];

View File

@ -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;
}

View File

@ -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");
}
};

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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<TabParent*>(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<TabParent*>(mParent->Manager())->Manager()->Pid());

View File

@ -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));

View File

@ -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;
}

View File

@ -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=<bpp_value>;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;

View File

@ -305,10 +305,10 @@ nsICOEncoder::ParseOptions(const nsAString& aOptions, uint32_t* bpp,
// Parse the bpp portion of the string format=<png|bmp>;bpp=<bpp_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 {

View File

@ -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;

View File

@ -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) {

View File

@ -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);
}
}

View File

@ -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] == ' ')

View File

@ -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<char>(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;

View File

@ -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<char>(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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -314,7 +314,7 @@ CreateRoot(nsCOMPtr<mozIStorageConnection>& 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;

View File

@ -269,13 +269,13 @@ nsTypeAheadFind::PlayNotFoundSound()
if (mSoundInterface) {
mIsSoundInitialized = true;
if (mNotFoundSoundURL.Equals("beep")) {
if (mNotFoundSoundURL.EqualsLiteral("beep")) {
mSoundInterface->Beep();
return;
}
nsCOMPtr<nsIURI> 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);

View File

@ -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;
}

View File

@ -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

View File

@ -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())) {

View File

@ -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();

View File

@ -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<Int64Wrapper*>(aWrappedExplicit);

View File

@ -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<nsIFile> 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;
}

View File

@ -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;