зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1669780 - Backed out changeset 29d1be2b96f9 (Bug 1569715) for causing us to skip CORS preflight cache for POST requests r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D93746
This commit is contained in:
Родитель
179a0134a9
Коммит
b5dcdc80bb
|
@ -1399,27 +1399,10 @@ nsresult nsCORSListenerProxy::StartCORSPreflight(
|
|||
bool withCredentials =
|
||||
originalLoadInfo->GetCookiePolicy() == nsILoadInfo::SEC_COOKIES_INCLUDE;
|
||||
|
||||
nsPreflightCache::CacheEntry* entry = nullptr;
|
||||
|
||||
nsLoadFlags loadFlags;
|
||||
rv = httpChannel->GetLoadFlags(&loadFlags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (sPreflightCache) {
|
||||
nsCOMPtr<nsICacheInfoChannel> cacheInfoChannel =
|
||||
do_QueryInterface(httpChannel);
|
||||
bool preferCacheLoadOverBypass = false;
|
||||
rv = cacheInfoChannel->GetPreferCacheLoadOverBypass(
|
||||
&preferCacheLoadOverBypass);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!(loadFlags & (nsIRequest::LOAD_BYPASS_CACHE |
|
||||
nsICachingChannel::LOAD_BYPASS_LOCAL_CACHE)) ||
|
||||
((loadFlags & nsIRequest::LOAD_FROM_CACHE) &&
|
||||
preferCacheLoadOverBypass)) {
|
||||
entry = sPreflightCache->GetEntry(uri, principal, withCredentials, false);
|
||||
}
|
||||
}
|
||||
nsPreflightCache::CacheEntry* entry =
|
||||
sPreflightCache
|
||||
? sPreflightCache->GetEntry(uri, principal, withCredentials, false)
|
||||
: nullptr;
|
||||
|
||||
if (entry && entry->CheckRequest(method, aUnsafeHeaders)) {
|
||||
aCallback->OnPreflightSucceeded();
|
||||
|
@ -1447,6 +1430,10 @@ nsresult nsCORSListenerProxy::StartCORSPreflight(
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(callbacks);
|
||||
|
||||
nsLoadFlags loadFlags;
|
||||
rv = aRequestChannel->GetLoadFlags(&loadFlags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Preflight requests should never be intercepted by service workers and
|
||||
// are always anonymous.
|
||||
// NOTE: We ignore CORS checks on synthesized responses (see the CORS
|
||||
|
|
Загрузка…
Ссылка в новой задаче