Changeset 228892 in webkit


Ignore:
Timestamp:
Feb 21, 2018 12:21:59 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Use ResourceLoader to load appcache manifest
https://bugs.webkit.org/show_bug.cgi?id=182861

Patch by Youenn Fablet <youenn@apple.com> on 2018-02-21
Reviewed by Alex Christensen.

Source/WebCore:

Covered by updated tests.

Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader.
Make use of it to load the app cache manifest.
Future work should load entries using the same loader.

Remove manifest handle.
Ensure that DocumentLoader does not register the manifest resource loader as its lifetime
is handled by its ApplicationCacheGroup.

Add a ResourceLoader option to bypass the application cache.
Use it for manifest loading.

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::addSubresourceLoader):

  • loader/ResourceLoaderOptions.h:
  • loader/appcache/ApplicationCacheGroup.cpp:

(WebCore::ApplicationCacheGroup::stopLoading):
(WebCore::ApplicationCacheGroup::update):
(WebCore::ApplicationCacheGroup::createRequest):
(WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
(WebCore::ApplicationCacheGroup::didReceiveData):
(WebCore::ApplicationCacheGroup::didFinishLoading):
(WebCore::ApplicationCacheGroup::didFail):
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
(WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):

  • loader/appcache/ApplicationCacheGroup.h:
  • loader/appcache/ApplicationCacheHost.cpp:

(WebCore::ApplicationCacheHost::maybeLoadResource):
(WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
(WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
(WebCore::ApplicationCacheHost::maybeLoadFallbackForError):

  • loader/appcache/ApplicationCacheResourceLoader.cpp: Added.
  • loader/appcache/ApplicationCacheResourceLoader.h: Added.

LayoutTests:

  • http/tests/appcache/fail-on-update-2-expected.txt:
  • http/tests/appcache/manifest-redirect-2-expected.txt:
  • http/tests/appcache/offline-access-expected.txt:
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r228886 r228892  
     12018-02-21  Youenn Fablet  <youenn@apple.com>
     2
     3        Use ResourceLoader to load appcache manifest
     4        https://bugs.webkit.org/show_bug.cgi?id=182861
     5
     6        Reviewed by Alex Christensen.
     7
     8        * http/tests/appcache/fail-on-update-2-expected.txt:
     9        * http/tests/appcache/manifest-redirect-2-expected.txt:
     10        * http/tests/appcache/offline-access-expected.txt:
     11
    1122018-02-21  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/http/tests/appcache/fail-on-update-2-expected.txt

    r228591 r228892  
     1CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
     2CONSOLE MESSAGE: Application Cache manifest could not be fetched, because the manifest had a 404 response.
    13CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
    24CONSOLE MESSAGE: Application Cache manifest could not be fetched, because the manifest had a 404 response.
    35CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
    46CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
    5 CONSOLE MESSAGE: Application Cache manifest could not be fetched, because the manifest had a 404 response.
    6 CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
    77SUCCESS: No crash.
  • trunk/LayoutTests/http/tests/appcache/manifest-redirect-2-expected.txt

    r228591 r228892  
    11CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
     2CONSOLE MESSAGE: Application Cache manifest could not be fetched, because a redirection was attempted.
    23Test that a redirect makes resource caching fail.
    34
  • trunk/LayoutTests/http/tests/appcache/offline-access-expected.txt

    r228591 r228892  
    11CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
    22CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
     3CONSOLE MESSAGE: Application Cache manifest could not be fetched, because a redirection was attempted.
    34CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead.
    45Test that offline applications work when there is no network access (simulated).
  • trunk/Source/WebCore/ChangeLog

    r228891 r228892  
     12018-02-21  Youenn Fablet  <youenn@apple.com>
     2
     3        Use ResourceLoader to load appcache manifest
     4        https://bugs.webkit.org/show_bug.cgi?id=182861
     5
     6        Reviewed by Alex Christensen.
     7
     8        Covered by updated tests.
     9
     10        Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader.
     11        Make use of it to load the app cache manifest.
     12        Future work should load entries using the same loader.
     13
     14        Remove manifest handle.
     15        Ensure that DocumentLoader does not register the manifest resource loader as its lifetime
     16        is handled by its ApplicationCacheGroup.
     17
     18        Add a ResourceLoader option to bypass the application cache.
     19        Use it for manifest loading.
     20
     21        * Sources.txt:
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * loader/DocumentLoader.cpp:
     24        (WebCore::DocumentLoader::addSubresourceLoader):
     25        * loader/ResourceLoaderOptions.h:
     26        * loader/appcache/ApplicationCacheGroup.cpp:
     27        (WebCore::ApplicationCacheGroup::stopLoading):
     28        (WebCore::ApplicationCacheGroup::update):
     29        (WebCore::ApplicationCacheGroup::createRequest):
     30        (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
     31        (WebCore::ApplicationCacheGroup::didReceiveData):
     32        (WebCore::ApplicationCacheGroup::didFinishLoading):
     33        (WebCore::ApplicationCacheGroup::didFail):
     34        (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
     35        (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
     36        * loader/appcache/ApplicationCacheGroup.h:
     37        * loader/appcache/ApplicationCacheHost.cpp:
     38        (WebCore::ApplicationCacheHost::maybeLoadResource):
     39        (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
     40        (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
     41        (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
     42        * loader/appcache/ApplicationCacheResourceLoader.cpp: Added.
     43        * loader/appcache/ApplicationCacheResourceLoader.h: Added.
     44
    1452018-02-21  Don Olmstead  <don.olmstead@sony.com>
    246
  • trunk/Source/WebCore/Sources.txt

    r228862 r228892  
    12531253loader/appcache/ApplicationCacheHost.cpp
    12541254loader/appcache/ApplicationCacheResource.cpp
     1255loader/appcache/ApplicationCacheResourceLoader.cpp
    12551256loader/appcache/ApplicationCacheStorage.cpp
    12561257loader/appcache/DOMApplicationCache.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r228862 r228892  
    71097109                418F88020FF957AE0080F045 /* JSAbstractWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAbstractWorker.cpp; sourceTree = "<group>"; };
    71107110                418F88030FF957AE0080F045 /* JSAbstractWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAbstractWorker.h; sourceTree = "<group>"; };
     7111                41945694203502A5004BA277 /* ApplicationCacheResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplicationCacheResourceLoader.cpp; sourceTree = "<group>"; };
     7112                41945696203502A6004BA277 /* ApplicationCacheResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationCacheResourceLoader.h; sourceTree = "<group>"; };
    71117113                419ACF8E1F97E7D5009F1A83 /* ServiceWorkerFetch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerFetch.h; sourceTree = "<group>"; };
    71127114                419ACF901F97E7D6009F1A83 /* ServiceWorkerFetch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerFetch.cpp; sourceTree = "<group>"; };
     
    1570315705                                1A8F6BB50DB55CDC001DB794 /* ApplicationCacheResource.cpp */,
    1570415706                                1A8F6BB60DB55CDC001DB794 /* ApplicationCacheResource.h */,
     15707                                41945694203502A5004BA277 /* ApplicationCacheResourceLoader.cpp */,
     15708                                41945696203502A6004BA277 /* ApplicationCacheResourceLoader.h */,
    1570515709                                1A2AAC560DC2A3B100A20D9A /* ApplicationCacheStorage.cpp */,
    1570615710                                1A2AAC570DC2A3B100A20D9A /* ApplicationCacheStorage.h */,
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r228852 r228892  
    15441544    ASSERT(!mainResourceLoader() || mainResourceLoader() != loader);
    15451545
     1546    // Application Cache loaders are handled by their ApplicationCacheGroup directly.
     1547    if (loader->options().applicationCacheMode == ApplicationCacheMode::Bypass)
     1548        return;
     1549
    15461550    // A page in the PageCache or about to enter PageCache should not be able to start loads.
    15471551    ASSERT_WITH_SECURITY_IMPLICATION(!document() || document()->pageCacheState() == Document::NotInPageCache);
  • trunk/Source/WebCore/loader/ResourceLoaderOptions.h

    r228591 r228892  
    102102};
    103103
     104enum class ApplicationCacheMode {
     105    Use,
     106    Bypass
     107};
     108
    104109enum class ContentEncodingSniffingPolicy {
    105110    Sniff,
     
    141146    InitiatorContext initiatorContext { InitiatorContext::Document };
    142147    ServiceWorkersMode serviceWorkersMode { ServiceWorkersMode::All };
     148    ApplicationCacheMode applicationCacheMode { ApplicationCacheMode::Use };
    143149#if ENABLE(SERVICE_WORKER)
    144150    std::optional<ServiceWorkerRegistrationIdentifier> serviceWorkerRegistrationIdentifier;
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp

    r228591 r228892  
    3030#include "ApplicationCacheHost.h"
    3131#include "ApplicationCacheResource.h"
     32#include "ApplicationCacheResourceLoader.h"
    3233#include "ApplicationCacheStorage.h"
    3334#include "Chrome.h"
     
    315316void ApplicationCacheGroup::stopLoading()
    316317{
    317     if (m_manifestHandle) {
    318         ASSERT(!m_currentHandle);
    319 
    320         ASSERT(m_manifestHandle->client() == this);
    321         m_manifestHandle->clearClient();
    322 
    323         m_manifestHandle->cancel();
    324         m_manifestHandle = nullptr;
    325     }
    326    
     318    if (m_loader) {
     319        m_loader->cancel();
     320        m_loader = nullptr;
     321    }
     322
    327323    if (m_currentHandle) {
    328         ASSERT(!m_manifestHandle);
     324        ASSERT(!m_loader);
    329325        ASSERT(m_cacheBeingUpdated);
    330326
     
    437433    }
    438434   
    439     ASSERT(!m_manifestHandle);
     435    ASSERT(!m_loader);
    440436    ASSERT(!m_manifestResource);
    441437    ASSERT(!m_currentHandle);
     
    444440
    445441    // FIXME: Handle defer loading
    446     m_manifestHandle = createResourceHandle(m_manifestURL, m_newestCache ? m_newestCache->manifestResource() : 0);
     442
     443    auto request = createRequest(URL { m_manifestURL }, m_newestCache ? m_newestCache->manifestResource() : nullptr);
     444
     445    m_currentResourceIdentifier = m_frame->page()->progress().createUniqueIdentifier();
     446    InspectorInstrumentation::willSendRequest(m_frame, m_currentResourceIdentifier, m_frame->loader().documentLoader(), request, ResourceResponse { });
     447
     448    m_loader = ApplicationCacheResourceLoader::create(documentLoader.cachedResourceLoader(), WTFMove(request), [this] (auto&& resourceOrError) {
     449        // 'this' is only valid if returned value is not Error::Abort.
     450        if (!resourceOrError.has_value()) {
     451            auto error = resourceOrError.error();
     452            if (error == ApplicationCacheResourceLoader::Error::Abort)
     453                return;
     454            if (error == ApplicationCacheResourceLoader::Error::CannotCreateResource) {
     455                // FIXME: We should get back the error from ApplicationCacheResourceLoader level.
     456                InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, ResourceError { ResourceError::Type::General });
     457                this->cacheUpdateFailed();
     458                return;
     459            }
     460            this->didFailLoadingManifest(error);
     461            return;
     462        }
     463
     464        m_manifestResource = WTFMove(resourceOrError.value());
     465        this->didFinishLoadingManifest();
     466    });
     467}
     468
     469ResourceRequest ApplicationCacheGroup::createRequest(URL&& url, ApplicationCacheResource* resource)
     470{
     471    ResourceRequest request { WTFMove(url) };
     472    m_frame->loader().applyUserAgentIfNeeded(request);
     473    request.setHTTPHeaderField(HTTPHeaderName::CacheControl, "max-age=0");
     474
     475    if (resource) {
     476        const String& lastModified = resource->response().httpHeaderField(HTTPHeaderName::LastModified);
     477        if (!lastModified.isEmpty())
     478            request.setHTTPHeaderField(HTTPHeaderName::IfModifiedSince, lastModified);
     479
     480        const String& eTag = resource->response().httpHeaderField(HTTPHeaderName::ETag);
     481        if (!eTag.isEmpty())
     482            request.setHTTPHeaderField(HTTPHeaderName::IfNoneMatch, eTag);
     483    }
     484    return request;
    447485}
    448486
     
    494532    ASSERT(m_frame);
    495533    InspectorInstrumentation::didReceiveResourceResponse(*m_frame, m_currentResourceIdentifier, m_frame->loader().documentLoader(), response, nullptr);
    496 
    497     if (handle == m_manifestHandle) {
    498         didReceiveManifestResponse(response);
    499         completionHandler();
    500         return;
    501     }
    502534
    503535    ASSERT(handle == m_currentHandle);
     
    579611{
    580612    UNUSED_PARAM(encodedDataLength);
     613    ASSERT_UNUSED(handle, handle == m_currentHandle);
    581614
    582615    InspectorInstrumentation::didReceiveData(m_frame, m_currentResourceIdentifier, 0, length, 0);
    583616
    584     if (handle == m_manifestHandle) {
    585         didReceiveManifestData(data, length);
    586         return;
    587     }
    588    
    589     ASSERT(handle == m_currentHandle);
    590    
    591617    ASSERT(m_currentResource);
    592618    m_currentResource->data().append(data, length);
     
    598624    NetworkLoadMetrics emptyMetrics;
    599625    InspectorInstrumentation::didFinishLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, emptyMetrics, nullptr);
    600 
    601     if (handle == m_manifestHandle) {
    602         didFinishLoadingManifest();
    603         return;
    604     }
    605626
    606627    ASSERT(m_currentHandle == handle);
     
    633654{
    634655    InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, error);
    635 
    636     if (handle == m_manifestHandle) {
    637         // A network error is logged elsewhere, no need to log again. Also, it's normal for manifest fetching to fail when working offline.
    638         cacheUpdateFailed();
    639         return;
    640     }
    641656
    642657    ASSERT(handle == m_currentHandle);
     
    666681}
    667682
    668 void ApplicationCacheGroup::didReceiveManifestResponse(const ResourceResponse& response)
    669 {
    670     ASSERT(!m_manifestResource);
    671     ASSERT(m_manifestHandle);
    672 
    673     if (response.httpStatusCode() == 404 || response.httpStatusCode() == 410) {
    674         InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, m_frame->loader().cancelledError(m_manifestHandle->firstRequest()));
    675         m_frame->document()->addConsoleMessage(MessageSource::AppCache, MessageLevel::Error, makeString("Application Cache manifest could not be fetched, because the manifest had a ", String::number(response.httpStatusCode()), " response."));
    676         manifestNotFound();
    677         return;
    678     }
    679 
    680     if (response.httpStatusCode() == 304)
    681         return;
    682 
    683     if (response.httpStatusCode() / 100 != 2) {
    684         InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, m_frame->loader().cancelledError(m_manifestHandle->firstRequest()));
    685         m_frame->document()->addConsoleMessage(MessageSource::AppCache, MessageLevel::Error, makeString("Application Cache manifest could not be fetched, because the manifest had a ", String::number(response.httpStatusCode()), " response."));
    686         cacheUpdateFailed();
    687         return;
    688     }
    689 
    690     if (response.url() != m_manifestHandle->firstRequest().url()) {
    691         InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, m_frame->loader().cancelledError(m_manifestHandle->firstRequest()));
    692         m_frame->document()->addConsoleMessage(MessageSource::AppCache, MessageLevel::Error, ASCIILiteral("Application Cache manifest could not be fetched, because a redirection was attempted."));
    693         cacheUpdateFailed();
    694         return;
    695     }
    696 
    697     m_manifestResource = ApplicationCacheResource::create(m_manifestHandle->firstRequest().url(), response, ApplicationCacheResource::Manifest);
    698 }
    699 
    700 void ApplicationCacheGroup::didReceiveManifestData(const char* data, int length)
    701 {
    702     if (m_manifestResource)
    703         m_manifestResource->data().append(data, length);
    704 }
    705 
    706683void ApplicationCacheGroup::didFinishLoadingManifest()
    707684{
     
    715692    }
    716693
    717     m_manifestHandle = nullptr;
     694    m_loader = nullptr;
    718695
    719696    // Check if the manifest was not modified.
     
    779756
    780757    startLoadingEntry();
     758}
     759
     760void ApplicationCacheGroup::didFailLoadingManifest(ApplicationCacheResourceLoader::Error error)
     761{
     762    ASSERT(error != ApplicationCacheResourceLoader::Error::Abort && error != ApplicationCacheResourceLoader::Error::CannotCreateResource);
     763
     764    InspectorInstrumentation::didReceiveResourceResponse(*m_frame, m_currentResourceIdentifier, m_frame->loader().documentLoader(), m_loader->resource()->response(), nullptr);
     765    switch (error) {
     766    case ApplicationCacheResourceLoader::Error::NetworkError:
     767        cacheUpdateFailed();
     768        break;
     769    case ApplicationCacheResourceLoader::Error::NotFound:
     770        InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, m_frame->loader().cancelledError(m_loader->resource()->resourceRequest()));
     771        m_frame->document()->addConsoleMessage(MessageSource::AppCache, MessageLevel::Error, makeString("Application Cache manifest could not be fetched, because the manifest had a ", String::number(m_loader->resource()->response().httpStatusCode()), " response."));
     772        manifestNotFound();
     773        break;
     774    case ApplicationCacheResourceLoader::Error::NotOK:
     775        InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, m_frame->loader().cancelledError(m_loader->resource()->resourceRequest()));
     776        m_frame->document()->addConsoleMessage(MessageSource::AppCache, MessageLevel::Error, makeString("Application Cache manifest could not be fetched, because the manifest had a ", String::number(m_loader->resource()->response().httpStatusCode()), " response."));
     777        cacheUpdateFailed();
     778        break;
     779    case ApplicationCacheResourceLoader::Error::RedirectForbidden:
     780        InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, m_frame->loader().cancelledError(m_loader->resource()->resourceRequest()));
     781        m_frame->document()->addConsoleMessage(MessageSource::AppCache, MessageLevel::Error, makeString("Application Cache manifest could not be fetched, because a redirection was attempted."));
     782        cacheUpdateFailed();
     783        break;
     784    case ApplicationCacheResourceLoader::Error::CannotCreateResource:
     785    case ApplicationCacheResourceLoader::Error::Abort:
     786        break;
     787    }
    781788}
    782789
     
    849856void ApplicationCacheGroup::checkIfLoadIsComplete()
    850857{
    851     if (m_manifestHandle || !m_pendingEntries.isEmpty() || m_downloadingPendingMasterResourceLoadersCount)
    852         return;
    853    
     858    if (m_loader || !m_pendingEntries.isEmpty() || m_downloadingPendingMasterResourceLoadersCount)
     859        return;
     860
    854861    // We're done, all resources have finished downloading (successfully or not).
    855862
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.h

    r228591 r228892  
    2626#pragma once
    2727
     28#include "ApplicationCacheResourceLoader.h"
    2829#include "DOMApplicationCache.h"
    2930#include "URL.h"
     
    119120    void didFail(ResourceHandle*, const ResourceError&) final;
    120121
    121     void didReceiveManifestResponse(const ResourceResponse&);
    122     void didReceiveManifestData(const char*, int);
    123122    void didFinishLoadingManifest();
     123    void didFailLoadingManifest(ApplicationCacheResourceLoader::Error);
     124
    124125    void didReachMaxAppCacheSize();
    125126    void didReachOriginQuota(int64_t totalSpaceNeeded);
     
    137138   
    138139    void stopLoading();
     140
     141    ResourceRequest createRequest(URL&&, ApplicationCacheResource*);
    139142
    140143    Ref<ApplicationCacheStorage> m_storage;
     
    196199
    197200    RefPtr<ApplicationCacheResource> m_manifestResource;
    198     RefPtr<ResourceHandle> m_manifestHandle;
     201
     202    RefPtr<ApplicationCacheResourceLoader> m_loader;
    199203
    200204    int64_t m_availableSpaceInQuota;
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp

    r228591 r228892  
    170170bool ApplicationCacheHost::maybeLoadResource(ResourceLoader& loader, const ResourceRequest& request, const URL& originalURL)
    171171{
     172    if (loader.options().applicationCacheMode != ApplicationCacheMode::Use)
     173        return false;
     174
    172175    if (!isApplicationCacheEnabled() && !isApplicationCacheBlockedForRequest(request))
    173176        return false;
     
    186189bool ApplicationCacheHost::maybeLoadFallbackForRedirect(ResourceLoader* resourceLoader, ResourceRequest& request, const ResourceResponse& redirectResponse)
    187190{
     191    if (resourceLoader && resourceLoader->options().applicationCacheMode != ApplicationCacheMode::Use)
     192        return false;
     193
    188194    if (!redirectResponse.isNull() && !protocolHostAndPortAreEqual(request.url(), redirectResponse.url())) {
    189195        if (scheduleLoadFallbackResourceFromApplicationCache(resourceLoader))
     
    195201bool ApplicationCacheHost::maybeLoadFallbackForResponse(ResourceLoader* resourceLoader, const ResourceResponse& response)
    196202{
     203    if (resourceLoader && resourceLoader->options().applicationCacheMode != ApplicationCacheMode::Use)
     204        return false;
     205
    197206    if (response.httpStatusCode() / 100 == 4 || response.httpStatusCode() / 100 == 5) {
    198207        if (scheduleLoadFallbackResourceFromApplicationCache(resourceLoader))
     
    204213bool ApplicationCacheHost::maybeLoadFallbackForError(ResourceLoader* resourceLoader, const ResourceError& error)
    205214{
     215    if (resourceLoader && resourceLoader->options().applicationCacheMode != ApplicationCacheMode::Use)
     216        return false;
     217
    206218    if (!error.isCancellation()) {
    207219        if (resourceLoader == m_documentLoader.mainResourceLoader())
Note: See TracChangeset for help on using the changeset viewer.