Skip to content

Commit

Permalink
Bug 869836 - Part 6: Use EqualsLiteral instead of Equals where possib…
Browse files Browse the repository at this point in the history
…le. r=ehsan
  • Loading branch information
poiru committed May 22, 2014
1 parent f65339b commit 5864180
Show file tree
Hide file tree
Showing 30 changed files with 99 additions and 99 deletions.
2 changes: 1 addition & 1 deletion accessible/src/atk/nsMaiInterfaceText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion browser/components/feeds/src/nsFeedSniffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion content/base/src/FeedWriterEnabled.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
};

Expand Down
2 changes: 1 addition & 1 deletion content/base/src/nsContentSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion content/base/src/nsCopySupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion content/html/document/src/MediaDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -11678,7 +11678,7 @@ nsDocShell::ChannelIsPost(nsIChannel* aChannel)

nsAutoCString method;
httpChannel->GetRequestMethod(method);
return method.Equals("POST");
return method.EqualsLiteral("POST");
}

void
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsContentPermissionHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion dom/system/gonk/Volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/LayerScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class LayerScopeWebSocketHandler : public nsIInputStreamCallback {
return false;
}

if (!(version.Equals("7") || version.Equals("8") || version.Equals("13"))) {
if (!(version.EqualsLiteral("7") || version.EqualsLiteral("8") || version.EqualsLiteral("13"))) {
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions image/encoders/bmp/nsBMPEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions image/encoders/ico/nsICOEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions layout/base/nsPresContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion layout/printing/nsPrintEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 12 additions & 12 deletions netwerk/protocol/http/Http2Compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

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

Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/Http2Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] == ' ')
Expand Down
14 changes: 7 additions & 7 deletions netwerk/protocol/http/SpdyStream3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions netwerk/protocol/http/SpdyStream31.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions parser/htmlparser/src/nsParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
36 changes: 18 additions & 18 deletions security/manager/ssl/src/nsNSSComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1638,47 +1638,47 @@ 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);
SSL_OptionSetDefault(SSL_ENABLE_RENEGOTIATION,
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);
Expand Down
Loading

0 comments on commit 5864180

Please sign in to comment.