Bug 1339081 - Part 22: Rename "schema" to "scheme" where appropriate; r=asuth

This commit is contained in:
Jan Varga 2017-03-06 18:40:33 +01:00
Родитель b7172cf3d7
Коммит 8ba58bb018
1 изменённых файлов: 33 добавлений и 33 удалений

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

@ -1527,16 +1527,16 @@ private:
typedef nsCCharSeparatedTokenizerTemplate<IgnoreWhitespace> Tokenizer;
enum SchemaType {
enum SchemeType {
eNone,
eFile,
eAbout
};
enum State {
eExpectingAppIdOrSchema,
eExpectingAppIdOrScheme,
eExpectingInMozBrowser,
eExpectingSchema,
eExpectingScheme,
eExpectingEmptyToken1,
eExpectingEmptyToken2,
eExpectingEmptyToken3,
@ -1553,13 +1553,13 @@ private:
Tokenizer mTokenizer;
uint32_t mAppId;
nsCString mSchema;
nsCString mScheme;
nsCString mHost;
Nullable<uint32_t> mPort;
nsTArray<nsCString> mPathnameComponents;
nsCString mHandledTokens;
SchemaType mSchemaType;
SchemeType mSchemeType;
State mState;
bool mInIsolatedMozBrowser;
bool mMaybeDriveLetter;
@ -1573,8 +1573,8 @@ public:
, mTokenizer(aOrigin, '+')
, mAppId(kNoAppId)
, mPort()
, mSchemaType(eNone)
, mState(eExpectingAppIdOrSchema)
, mSchemeType(eNone)
, mState(eExpectingAppIdOrScheme)
, mInIsolatedMozBrowser(false)
, mMaybeDriveLetter(false)
, mError(false)
@ -1590,10 +1590,10 @@ public:
private:
void
HandleSchema(const nsDependentCSubstring& aSchema);
HandleScheme(const nsDependentCSubstring& aToken);
void
HandlePathnameComponent(const nsDependentCSubstring& aSchema);
HandlePathnameComponent(const nsDependentCSubstring& aToken);
void
HandleToken(const nsDependentCSubstring& aToken);
@ -7267,9 +7267,9 @@ OriginParser::Parse(nsACString& aSpec, OriginAttributes* aAttrs) -> ResultType
*aAttrs = OriginAttributes(mAppId, mInIsolatedMozBrowser);
}
nsAutoCString spec(mSchema);
nsAutoCString spec(mScheme);
if (mSchemaType == eFile) {
if (mSchemeType == eFile) {
spec.AppendLiteral("://");
for (uint32_t count = mPathnameComponents.Length(), index = 0;
@ -7284,7 +7284,7 @@ OriginParser::Parse(nsACString& aSpec, OriginAttributes* aAttrs) -> ResultType
return ValidOrigin;
}
if (mSchemaType == eAbout) {
if (mSchemeType == eAbout) {
spec.Append(':');
} else {
spec.AppendLiteral("://");
@ -7299,14 +7299,14 @@ OriginParser::Parse(nsACString& aSpec, OriginAttributes* aAttrs) -> ResultType
aSpec = spec;
return mSchema.EqualsLiteral("app") ? ObsoleteOrigin : ValidOrigin;
return mScheme.EqualsLiteral("app") ? ObsoleteOrigin : ValidOrigin;
}
void
OriginParser::HandleSchema(const nsDependentCSubstring& aToken)
OriginParser::HandleScheme(const nsDependentCSubstring& aToken)
{
MOZ_ASSERT(!aToken.IsEmpty());
MOZ_ASSERT(mState == eExpectingAppIdOrSchema || mState == eExpectingSchema);
MOZ_ASSERT(mState == eExpectingAppIdOrScheme || mState == eExpectingScheme);
bool isAbout = false;
bool isFile = false;
@ -7319,14 +7319,14 @@ OriginParser::HandleSchema(const nsDependentCSubstring& aToken)
aToken.EqualsLiteral("app") ||
aToken.EqualsLiteral("resource") ||
aToken.EqualsLiteral("moz-extension")) {
mSchema = aToken;
mScheme = aToken;
if (isAbout) {
mSchemaType = eAbout;
mSchemeType = eAbout;
mState = eExpectingHost;
} else {
if (isFile) {
mSchemaType = eFile;
mSchemeType = eFile;
}
mState = eExpectingEmptyToken1;
}
@ -7334,7 +7334,7 @@ OriginParser::HandleSchema(const nsDependentCSubstring& aToken)
return;
}
QM_WARNING("'%s' is not a valid schema!", nsCString(aToken).get());
QM_WARNING("'%s' is not a valid scheme!", nsCString(aToken).get());
mError = true;
}
@ -7345,7 +7345,7 @@ OriginParser::HandlePathnameComponent(const nsDependentCSubstring& aToken)
MOZ_ASSERT(!aToken.IsEmpty());
MOZ_ASSERT(mState == eExpectingEmptyTokenOrDriveLetterOrPathnameComponent ||
mState == eExpectingEmptyTokenOrPathnameComponent);
MOZ_ASSERT(mSchemaType == eFile);
MOZ_ASSERT(mSchemeType == eFile);
mPathnameComponents.AppendElement(aToken);
@ -7357,9 +7357,9 @@ void
OriginParser::HandleToken(const nsDependentCSubstring& aToken)
{
switch (mState) {
case eExpectingAppIdOrSchema: {
case eExpectingAppIdOrScheme: {
if (aToken.IsEmpty()) {
QM_WARNING("Expected an app id or schema (not an empty string)!");
QM_WARNING("Expected an app id or scheme (not an empty string)!");
mError = true;
return;
@ -7378,7 +7378,7 @@ OriginParser::HandleToken(const nsDependentCSubstring& aToken)
}
}
HandleSchema(aToken);
HandleScheme(aToken);
return;
}
@ -7404,20 +7404,20 @@ OriginParser::HandleToken(const nsDependentCSubstring& aToken)
return;
}
mState = eExpectingSchema;
mState = eExpectingScheme;
return;
}
case eExpectingSchema: {
case eExpectingScheme: {
if (aToken.IsEmpty()) {
QM_WARNING("Expected a schema (not an empty string)!");
QM_WARNING("Expected a scheme (not an empty string)!");
mError = true;
return;
}
HandleSchema(aToken);
HandleScheme(aToken);
return;
}
@ -7443,7 +7443,7 @@ OriginParser::HandleToken(const nsDependentCSubstring& aToken)
return;
}
if (mSchemaType == eFile) {
if (mSchemeType == eFile) {
mState = eExpectingEmptyToken3;
} else {
mState = eExpectingHost;
@ -7453,7 +7453,7 @@ OriginParser::HandleToken(const nsDependentCSubstring& aToken)
}
case eExpectingEmptyToken3: {
MOZ_ASSERT(mSchemaType == eFile);
MOZ_ASSERT(mSchemeType == eFile);
if (!aToken.IsEmpty()) {
QM_WARNING("Expected the third empty token!");
@ -7485,7 +7485,7 @@ OriginParser::HandleToken(const nsDependentCSubstring& aToken)
}
case eExpectingPort: {
MOZ_ASSERT(mSchemaType == eNone);
MOZ_ASSERT(mSchemeType == eNone);
if (aToken.IsEmpty()) {
QM_WARNING("Expected a port (not an empty string)!");
@ -7514,7 +7514,7 @@ OriginParser::HandleToken(const nsDependentCSubstring& aToken)
}
case eExpectingEmptyTokenOrDriveLetterOrPathnameComponent: {
MOZ_ASSERT(mSchemaType == eFile);
MOZ_ASSERT(mSchemeType == eFile);
if (aToken.IsEmpty()) {
mPathnameComponents.AppendElement(EmptyCString());
@ -7544,7 +7544,7 @@ OriginParser::HandleToken(const nsDependentCSubstring& aToken)
}
case eExpectingEmptyTokenOrPathnameComponent: {
MOZ_ASSERT(mSchemaType == eFile);
MOZ_ASSERT(mSchemeType == eFile);
if (aToken.IsEmpty()) {
if (mMaybeDriveLetter) {
@ -7579,7 +7579,7 @@ void
OriginParser::HandleTrailingSeparator()
{
MOZ_ASSERT(mState == eComplete);
MOZ_ASSERT(mSchemaType == eFile);
MOZ_ASSERT(mSchemeType == eFile);
mPathnameComponents.AppendElement(EmptyCString());