X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Source%2FWebCore%2Floader%2FDocumentLoader.cpp;h=a82c25bc018513f78555b8b29823822962799a5a;hp=298d6507cc15b7be36640dc8626125258aa93bf3;hb=4a94566e32caee1c21d7a770b6268d8a2017931b;hpb=82e083ca824e31f035ce4842daa70f5805166968;ds=inline diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp index 298d6507cc15..a82c25bc0185 100644 --- a/Source/WebCore/loader/DocumentLoader.cpp +++ b/Source/WebCore/loader/DocumentLoader.cpp @@ -1607,9 +1607,32 @@ void DocumentLoader::startLoadingMainResource() }); } +static inline FetchOptions::Cache toFetchOptionsCache(ResourceRequestCachePolicy policy) +{ + // We are setting FetchOptions::Cache values to keep current behavior consistency. + // FIXME: We should merge FetchOptions::Cache with ResourceRequestCachePolicy and merge related class members. + switch (policy) { + case UseProtocolCachePolicy: + return FetchOptions::Cache::Default; + case ReloadIgnoringCacheData: + return FetchOptions::Cache::Reload; + case ReturnCacheDataElseLoad: + return FetchOptions::Cache::Default; + case ReturnCacheDataDontLoad: + return FetchOptions::Cache::Default; + case DoNotUseAnyCache: + return FetchOptions::Cache::NoStore; + case RefreshAnyCacheData: + return FetchOptions::Cache::NoCache; + } + return FetchOptions::Cache::Default; +} + void DocumentLoader::loadMainResource(ResourceRequest&& request) { - static NeverDestroyed mainResourceLoadOptions(SendCallbacks, SniffContent, BufferData, StoredCredentialsPolicy::Use, ClientCredentialPolicy::MayAskClientForCredentials, FetchOptions::Credentials::Include, SkipSecurityCheck, FetchOptions::Mode::Navigate, IncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching); + ResourceLoaderOptions mainResourceLoadOptions { SendCallbacks, SniffContent, BufferData, StoredCredentialsPolicy::Use, ClientCredentialPolicy::MayAskClientForCredentials, FetchOptions::Credentials::Include, SkipSecurityCheck, FetchOptions::Mode::Navigate, IncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching }; + mainResourceLoadOptions.cache = toFetchOptionsCache(request.cachePolicy()); + CachedResourceRequest mainResourceRequest(ResourceRequest(request), mainResourceLoadOptions); if (!m_frame->isMainFrame() && m_frame->document()) { // If we are loading the main resource of a subframe, use the cache partition of the main document.