mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Issue #2703 - Part 2: Don't repeatedly construct comparators when checking cache entries.
nsCaseInsensitiveCStringComparator ought to be cheap to construct, but the object actually has a vtable to install and whatnot. So it's beneficial to pull the construction of it outside of the headers loop.
This commit is contained in:
parent
d678f508de
commit
7854198085
1 changed files with 4 additions and 4 deletions
|
|
@ -250,9 +250,9 @@ nsPreflightCache::CacheEntry::CheckRequest(const nsCString& aMethod,
|
|||
|
||||
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,
|
||||
nsCaseInsensitiveCStringComparator())) {
|
||||
if (aHeaders[i].Equals(mHeaders[j].token, comparator)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1385,8 +1385,8 @@ nsCORSPreflightListener::CheckPreflightRequestApproved(nsIRequest* aRequest)
|
|||
) {
|
||||
continue;
|
||||
}
|
||||
if (!headers.Contains(mPreflightHeaders[i],
|
||||
nsCaseInsensitiveCStringArrayComparator())) {
|
||||
const auto& comparator = nsCaseInsensitiveCStringArrayComparator();
|
||||
if (!headers.Contains(mPreflightHeaders[i], comparator)) {
|
||||
LogBlockedRequest(aRequest, "CORSMissingAllowHeaderFromPreflight",
|
||||
NS_ConvertUTF8toUTF16(mPreflightHeaders[i]).get());
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue