diff --git a/netwerk/protocol/http/nsCORSListenerProxy.cpp b/netwerk/protocol/http/nsCORSListenerProxy.cpp index a5f5fab43b..a1e6089523 100644 --- a/netwerk/protocol/http/nsCORSListenerProxy.cpp +++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp @@ -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;