mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
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:
parent
179a0134a9
commit
b5dcdc80bb
@ -1399,27 +1399,10 @@ nsresult nsCORSListenerProxy::StartCORSPreflight(
|
|||||||
bool withCredentials =
|
bool withCredentials =
|
||||||
originalLoadInfo->GetCookiePolicy() == nsILoadInfo::SEC_COOKIES_INCLUDE;
|
originalLoadInfo->GetCookiePolicy() == nsILoadInfo::SEC_COOKIES_INCLUDE;
|
||||||
|
|
||||||
nsPreflightCache::CacheEntry* entry = nullptr;
|
nsPreflightCache::CacheEntry* entry =
|
||||||
|
sPreflightCache
|
||||||
nsLoadFlags loadFlags;
|
? sPreflightCache->GetEntry(uri, principal, withCredentials, false)
|
||||||
rv = httpChannel->GetLoadFlags(&loadFlags);
|
: nullptr;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry && entry->CheckRequest(method, aUnsafeHeaders)) {
|
if (entry && entry->CheckRequest(method, aUnsafeHeaders)) {
|
||||||
aCallback->OnPreflightSucceeded();
|
aCallback->OnPreflightSucceeded();
|
||||||
@ -1447,6 +1430,10 @@ nsresult nsCORSListenerProxy::StartCORSPreflight(
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(callbacks);
|
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
|
// Preflight requests should never be intercepted by service workers and
|
||||||
// are always anonymous.
|
// are always anonymous.
|
||||||
// NOTE: We ignore CORS checks on synthesized responses (see the CORS
|
// NOTE: We ignore CORS checks on synthesized responses (see the CORS
|
||||||
|
Loading…
Reference in New Issue
Block a user