Bug 869836 - Part 1: Use EqualsLiteral instead of `== NS_LITERAL_STRING(...)`. r=ehsan

This commit is contained in:
Birunthan Mohanathas 2014-05-22 06:48:50 +03:00
Родитель d16b3320e8
Коммит a5ab25c973
8 изменённых файлов: 47 добавлений и 51 удалений

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

@ -58,11 +58,7 @@ struct ICONENTRY {
// Match stock icons with names
static SHSTOCKICONID GetStockIconIDForName(const nsACString &aStockName)
{
// UAC shield icon
if (aStockName == NS_LITERAL_CSTRING("uac-shield"))
return SIID_SHIELD;
return SIID_INVALID;
return aStockName.EqualsLiteral("uac-shield") ? SIID_SHIELD : SIID_INVALID;
}
// nsIconChannel methods

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

@ -170,7 +170,7 @@ nsPrintPreviewListener::HandleEvent(nsIDOMEvent* aEvent)
{
nsAutoString eventString;
aEvent->GetType(eventString);
if (eventString == NS_LITERAL_STRING("keydown")) {
if (eventString.EqualsLiteral("keydown")) {
// Handle tabbing explicitly here since we don't want focus ending up
// inside the content document, bug 244128.
nsIDocument* doc = content->GetCurrentDoc();

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

@ -160,7 +160,7 @@ nsAboutCacheEntry::OpenCacheEntry(nsIURI *uri)
if (!CacheObserver::UseNewCache() &&
mLoadInfo->IsPrivate() &&
mStorageName == NS_LITERAL_CSTRING("disk")) {
mStorageName.EqualsLiteral("disk")) {
// The cache v1 is storing all private entries in the memory-only
// cache, so it would not be found in the v1 disk cache.
mStorageName = NS_LITERAL_CSTRING("memory");
@ -277,7 +277,7 @@ nsAboutCacheEntry::OnCacheEntryAvailable(nsICacheEntry *entry,
rv = WriteCacheEntryDescription(entry);
} else if (!CacheObserver::UseNewCache() &&
!mLoadInfo->IsPrivate() &&
mStorageName == NS_LITERAL_CSTRING("memory")) {
mStorageName.EqualsLiteral("memory")) {
// If we were not able to find the entry in the memory storage
// try again in the disk storage.
// This is a workaround for cache v1: when an originally disk

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

@ -781,7 +781,7 @@ nsWyciwygChannel::ReadFromCache()
nsAutoCString tmpStr;
rv = mCacheEntry->GetMetaDataElement("inhibit-persistent-caching",
getter_Copies(tmpStr));
if (NS_SUCCEEDED(rv) && tmpStr == NS_LITERAL_CSTRING("1"))
if (NS_SUCCEEDED(rv) && tmpStr.EqualsLiteral("1"))
mLoadFlags |= INHIBIT_PERSISTENT_CACHING;
// Get a transport to the cached data...

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

@ -653,9 +653,9 @@ main(int32_t argc, char *argv[])
if (!cookie2) break;
nsAutoCString name;
cookie2->GetName(name);
if (name == NS_LITERAL_CSTRING("test2"))
if (name.EqualsLiteral("test2"))
expiredCookie = cookie2;
else if (name == NS_LITERAL_CSTRING("test3"))
else if (name.EqualsLiteral("test3"))
newDomainCookie = cookie2;
}
rv[5] = i == 3;

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

@ -662,7 +662,7 @@ DetermineHTMLParseMode(const nsString& aBuffer,
// Special hack for IBM's custom DOCTYPE.
if (!(resultFlags & PARSE_DTD_HAVE_INTERNAL_SUBSET) &&
sysIDUCS2 == NS_LITERAL_STRING(
sysIDUCS2.EqualsLiteral(
"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd")) {
aParseMode = eDTDMode_quirks;
aDocType = eHTML_Quirks;

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

@ -206,31 +206,31 @@ BlacklistNodeToTextValue(nsIDOMNode *aBlacklistNode, nsAString& aValue)
static OperatingSystem
BlacklistOSToOperatingSystem(const nsAString& os)
{
if (os == NS_LITERAL_STRING("WINNT 5.1"))
if (os.EqualsLiteral("WINNT 5.1"))
return DRIVER_OS_WINDOWS_XP;
else if (os == NS_LITERAL_STRING("WINNT 5.2"))
else if (os.EqualsLiteral("WINNT 5.2"))
return DRIVER_OS_WINDOWS_SERVER_2003;
else if (os == NS_LITERAL_STRING("WINNT 6.0"))
else if (os.EqualsLiteral("WINNT 6.0"))
return DRIVER_OS_WINDOWS_VISTA;
else if (os == NS_LITERAL_STRING("WINNT 6.1"))
else if (os.EqualsLiteral("WINNT 6.1"))
return DRIVER_OS_WINDOWS_7;
else if (os == NS_LITERAL_STRING("WINNT 6.2"))
else if (os.EqualsLiteral("WINNT 6.2"))
return DRIVER_OS_WINDOWS_8;
else if (os == NS_LITERAL_STRING("WINNT 6.3"))
else if (os.EqualsLiteral("WINNT 6.3"))
return DRIVER_OS_WINDOWS_8_1;
else if (os == NS_LITERAL_STRING("Linux"))
else if (os.EqualsLiteral("Linux"))
return DRIVER_OS_LINUX;
else if (os == NS_LITERAL_STRING("Darwin 9"))
else if (os.EqualsLiteral("Darwin 9"))
return DRIVER_OS_OS_X_10_5;
else if (os == NS_LITERAL_STRING("Darwin 10"))
else if (os.EqualsLiteral("Darwin 10"))
return DRIVER_OS_OS_X_10_6;
else if (os == NS_LITERAL_STRING("Darwin 11"))
else if (os.EqualsLiteral("Darwin 11"))
return DRIVER_OS_OS_X_10_7;
else if (os == NS_LITERAL_STRING("Darwin 12"))
else if (os.EqualsLiteral("Darwin 12"))
return DRIVER_OS_OS_X_10_8;
else if (os == NS_LITERAL_STRING("Android"))
else if (os.EqualsLiteral("Android"))
return DRIVER_OS_ANDROID;
else if (os == NS_LITERAL_STRING("All"))
else if (os.EqualsLiteral("All"))
return DRIVER_OS_ALL;
return DRIVER_OS_UNKNOWN;
@ -265,25 +265,25 @@ BlacklistDevicesToDeviceFamily(nsIDOMHTMLCollection* aDevices)
static int32_t
BlacklistFeatureToGfxFeature(const nsAString& aFeature)
{
if (aFeature == NS_LITERAL_STRING("DIRECT2D"))
if (aFeature.EqualsLiteral("DIRECT2D"))
return nsIGfxInfo::FEATURE_DIRECT2D;
else if (aFeature == NS_LITERAL_STRING("DIRECT3D_9_LAYERS"))
else if (aFeature.EqualsLiteral("DIRECT3D_9_LAYERS"))
return nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS;
else if (aFeature == NS_LITERAL_STRING("DIRECT3D_10_LAYERS"))
else if (aFeature.EqualsLiteral("DIRECT3D_10_LAYERS"))
return nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS;
else if (aFeature == NS_LITERAL_STRING("DIRECT3D_10_1_LAYERS"))
else if (aFeature.EqualsLiteral("DIRECT3D_10_1_LAYERS"))
return nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS;
else if (aFeature == NS_LITERAL_STRING("DIRECT3D_11_LAYERS"))
else if (aFeature.EqualsLiteral("DIRECT3D_11_LAYERS"))
return nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS;
else if (aFeature == NS_LITERAL_STRING("OPENGL_LAYERS"))
else if (aFeature.EqualsLiteral("OPENGL_LAYERS"))
return nsIGfxInfo::FEATURE_OPENGL_LAYERS;
else if (aFeature == NS_LITERAL_STRING("WEBGL_OPENGL"))
else if (aFeature.EqualsLiteral("WEBGL_OPENGL"))
return nsIGfxInfo::FEATURE_WEBGL_OPENGL;
else if (aFeature == NS_LITERAL_STRING("WEBGL_ANGLE"))
else if (aFeature.EqualsLiteral("WEBGL_ANGLE"))
return nsIGfxInfo::FEATURE_WEBGL_ANGLE;
else if (aFeature == NS_LITERAL_STRING("WEBGL_MSAA"))
else if (aFeature.EqualsLiteral("WEBGL_MSAA"))
return nsIGfxInfo::FEATURE_WEBGL_MSAA;
else if (aFeature == NS_LITERAL_STRING("STAGEFRIGHT"))
else if (aFeature.EqualsLiteral("STAGEFRIGHT"))
return nsIGfxInfo::FEATURE_STAGEFRIGHT;
return 0;
}
@ -291,15 +291,15 @@ BlacklistFeatureToGfxFeature(const nsAString& aFeature)
static int32_t
BlacklistFeatureStatusToGfxFeatureStatus(const nsAString& aStatus)
{
if (aStatus == NS_LITERAL_STRING("NO_INFO"))
if (aStatus.EqualsLiteral("NO_INFO"))
return nsIGfxInfo::FEATURE_NO_INFO;
else if (aStatus == NS_LITERAL_STRING("BLOCKED_DRIVER_VERSION"))
else if (aStatus.EqualsLiteral("BLOCKED_DRIVER_VERSION"))
return nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
else if (aStatus == NS_LITERAL_STRING("BLOCKED_DEVICE"))
else if (aStatus.EqualsLiteral("BLOCKED_DEVICE"))
return nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
else if (aStatus == NS_LITERAL_STRING("DISCOURAGED"))
else if (aStatus.EqualsLiteral("DISCOURAGED"))
return nsIGfxInfo::FEATURE_DISCOURAGED;
else if (aStatus == NS_LITERAL_STRING("BLOCKED_OS_VERSION"))
else if (aStatus.EqualsLiteral("BLOCKED_OS_VERSION"))
return nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
// Do not allow it to set STATUS_UNKNOWN.
@ -310,23 +310,23 @@ BlacklistFeatureStatusToGfxFeatureStatus(const nsAString& aStatus)
static VersionComparisonOp
BlacklistComparatorToComparisonOp(const nsAString& op)
{
if (op == NS_LITERAL_STRING("LESS_THAN"))
if (op.EqualsLiteral("LESS_THAN"))
return DRIVER_LESS_THAN;
else if (op == NS_LITERAL_STRING("LESS_THAN_OR_EQUAL"))
else if (op.EqualsLiteral("LESS_THAN_OR_EQUAL"))
return DRIVER_LESS_THAN_OR_EQUAL;
else if (op == NS_LITERAL_STRING("GREATER_THAN"))
else if (op.EqualsLiteral("GREATER_THAN"))
return DRIVER_GREATER_THAN;
else if (op == NS_LITERAL_STRING("GREATER_THAN_OR_EQUAL"))
else if (op.EqualsLiteral("GREATER_THAN_OR_EQUAL"))
return DRIVER_GREATER_THAN_OR_EQUAL;
else if (op == NS_LITERAL_STRING("EQUAL"))
else if (op.EqualsLiteral("EQUAL"))
return DRIVER_EQUAL;
else if (op == NS_LITERAL_STRING("NOT_EQUAL"))
else if (op.EqualsLiteral("NOT_EQUAL"))
return DRIVER_NOT_EQUAL;
else if (op == NS_LITERAL_STRING("BETWEEN_EXCLUSIVE"))
else if (op.EqualsLiteral("BETWEEN_EXCLUSIVE"))
return DRIVER_BETWEEN_EXCLUSIVE;
else if (op == NS_LITERAL_STRING("BETWEEN_INCLUSIVE"))
else if (op.EqualsLiteral("BETWEEN_INCLUSIVE"))
return DRIVER_BETWEEN_INCLUSIVE;
else if (op == NS_LITERAL_STRING("BETWEEN_INCLUSIVE_START"))
else if (op.EqualsLiteral("BETWEEN_INCLUSIVE_START"))
return DRIVER_BETWEEN_INCLUSIVE_START;
return DRIVER_COMPARISON_IGNORED;

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

@ -186,7 +186,7 @@ namespace {
void
doMemoryReport(const nsCString& aInputStr)
{
bool doMMUMemoryReport = aInputStr == NS_LITERAL_CSTRING("minimize memory report");
bool doMMUMemoryReport = aInputStr.EqualsLiteral("minimize memory report");
LOG("FifoWatcher(command:%s) dispatching memory report runnable.", aInputStr.get());
nsRefPtr<DumpMemoryInfoToTempDirRunnable> runnable =
new DumpMemoryInfoToTempDirRunnable(/* identifier = */ EmptyString(),
@ -197,7 +197,7 @@ doMemoryReport(const nsCString& aInputStr)
void
doGCCCDump(const nsCString& aInputStr)
{
bool doAllTracesGCCCDump = aInputStr == NS_LITERAL_CSTRING("gc log");
bool doAllTracesGCCCDump = aInputStr.EqualsLiteral("gc log");
LOG("FifoWatcher(command:%s) dispatching GC/CC log runnable.", aInputStr.get());
nsRefPtr<GCAndCCLogDumpRunnable> runnable =
new GCAndCCLogDumpRunnable(/* identifier = */ EmptyString(),