mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 16:58:38 +09:00
Issue #2703 - Part 3: Make cache entry request checking more readable.
This commit is contained in:
parent
7854198085
commit
fdfe81fe54
1 changed files with 15 additions and 14 deletions
|
|
@ -238,25 +238,26 @@ nsPreflightCache::CacheEntry::CheckRequest(const nsCString& aMethod,
|
|||
PurgeExpired(TimeStamp::NowLoRes());
|
||||
|
||||
if (!aMethod.EqualsLiteral("GET") && !aMethod.EqualsLiteral("POST")) {
|
||||
uint32_t i;
|
||||
for (i = 0; i < mMethods.Length(); ++i) {
|
||||
if (aMethod.Equals(mMethods[i].token))
|
||||
break;
|
||||
}
|
||||
if (i == mMethods.Length()) {
|
||||
struct CheckToken {
|
||||
bool Equals(const TokenTime& e, const nsCString& method) const {
|
||||
return e.token.Equals(method);
|
||||
}
|
||||
};
|
||||
|
||||
if (!mMethods.Contains(aMethod, CheckToken())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < aHeaders.Length(); ++i) {
|
||||
uint32_t j;
|
||||
const auto& comparator = nsCaseInsensitiveCStringComparator();
|
||||
for (j = 0; j < mHeaders.Length(); ++j) {
|
||||
if (aHeaders[i].Equals(mHeaders[j].token, comparator)) {
|
||||
break;
|
||||
}
|
||||
const struct CheckHeaderToken {
|
||||
bool Equals(const TokenTime& e, const nsCString& header) const {
|
||||
return e.token.Equals(header, comparator);
|
||||
}
|
||||
if (j == mHeaders.Length()) {
|
||||
|
||||
const nsCaseInsensitiveCStringComparator comparator;
|
||||
} checker;
|
||||
for (uint32_t i = 0; i < aHeaders.Length(); ++i) {
|
||||
if (!mHeaders.Contains(aHeaders[i], checker)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue