Changeset 142707 in webkit


Ignore:
Timestamp:
Feb 12, 2013 6:42:02 PM (11 years ago)
Author:
Nate Chapin
Message:

REGRESSION: Reloading a local file doesn't pick up changes
https://bugs.webkit.org/show_bug.cgi?id=109344

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Test: http/tests/cache/reload-main-resource.php

  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::load):

  • loader/cache/CachedResourceLoader.cpp:

(WebCore::CachedResourceLoader::determineRevalidationPolicy):
(WebCore::CachedResourceLoader::cachePolicy): Don't use subresourceCachePolicy()

for main resources.

  • loader/cache/CachedResourceLoader.h:

(CachedResourceLoader):

LayoutTests:

  • http/tests/cache/reload-main-resource-expected.txt: Added.
  • http/tests/cache/reload-main-resource.php: Added.
  • http/tests/cache/resources/reload-main-resource-iframe.php: Added.
  • http/tests/misc/favicon-loads-with-images-disabled-expected.txt: This test

was being loaded from memory cache in spite of being loaded via reload. We
shouldn't do that.

  • http/tests/misc/link-rel-icon-beforeload-expected.txt: This test

was being loaded from memory cache in spite of being loaded via reload. We
shouldn't do that.

Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142703 r142707  
     12013-02-12  Nate Chapin  <japhet@chromium.org>
     2
     3        REGRESSION: Reloading a local file doesn't pick up changes
     4        https://bugs.webkit.org/show_bug.cgi?id=109344
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * http/tests/cache/reload-main-resource-expected.txt: Added.
     9        * http/tests/cache/reload-main-resource.php: Added.
     10        * http/tests/cache/resources/reload-main-resource-iframe.php: Added.
     11        * http/tests/misc/favicon-loads-with-images-disabled-expected.txt: This test
     12            was being loaded from memory cache in spite of being loaded via reload. We
     13            shouldn't do that.
     14        * http/tests/misc/link-rel-icon-beforeload-expected.txt: This test
     15            was being loaded from memory cache in spite of being loaded via reload. We
     16            shouldn't do that.
     17
    1182013-02-12  Dima Gorbik  <dgorbik@apple.com>
    219
  • trunk/LayoutTests/http/tests/misc/favicon-loads-with-images-disabled-expected.txt

    r141136 r142707  
    22http://127.0.0.1:8000/misc/favicon-loads-with-images-disabled.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/misc/favicon-loads-with-images-disabled.html, main document URL http://127.0.0.1:8000/misc/favicon-loads-with-images-disabled.html, http method GET> redirectResponse (null)
    33http://127.0.0.1:8000/misc/favicon-loads-with-images-disabled.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/misc/favicon-loads-with-images-disabled.html, http status code 200>
    4 http://127.0.0.1:8000/misc/favicon-loads-with-images-disabled.html - didFinishLoading
    54Radar 6973106 and https://bugs.webkit.org/show_bug.cgi?id=27896 - Favicons still load when automatic image loading is disabled.
    65This test uses DRT's resource load delegate callback mode to see if the favicon is loaded even when image loading is off.
  • trunk/LayoutTests/http/tests/misc/link-rel-icon-beforeload-expected.txt

    r141136 r142707  
    22http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html, main document URL http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html, http method GET> redirectResponse (null)
    33http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html, http status code 200>
    4 http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html - didFinishLoading
    54http://127.0.0.1:8000/favicon.ico - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/favicon.ico, main document URL http://127.0.0.1:8000/misc/link-rel-icon-beforeload.html, http method GET> redirectResponse (null)
    65This test should not show a request for the favicon dont-load-this.ico, since the beforeload handler on the favicon link returns false. Therefore, if the resource request list below shows a request for dont-load-this.ico, then this test has failed.
  • trunk/Source/WebCore/ChangeLog

    r142705 r142707  
     12013-02-12  Nate Chapin  <japhet@chromium.org>
     2
     3        REGRESSION: Reloading a local file doesn't pick up changes
     4        https://bugs.webkit.org/show_bug.cgi?id=109344
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Test: http/tests/cache/reload-main-resource.php
     9
     10        * loader/cache/CachedResource.cpp:
     11        (WebCore::CachedResource::load):
     12        * loader/cache/CachedResourceLoader.cpp:
     13        (WebCore::CachedResourceLoader::determineRevalidationPolicy):
     14        (WebCore::CachedResourceLoader::cachePolicy): Don't use subresourceCachePolicy()
     15            for main resources.
     16        * loader/cache/CachedResourceLoader.h:
     17        (CachedResourceLoader):
     18
    1192013-02-12  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r142068 r142707  
    326326        const String& eTag = resourceToRevalidate->response().httpHeaderField("ETag");
    327327        if (!lastModified.isEmpty() || !eTag.isEmpty()) {
    328             ASSERT(cachedResourceLoader->cachePolicy() != CachePolicyReload);
    329             if (cachedResourceLoader->cachePolicy() == CachePolicyRevalidate)
     328            ASSERT(cachedResourceLoader->cachePolicy(type()) != CachePolicyReload);
     329            if (cachedResourceLoader->cachePolicy(type()) == CachePolicyRevalidate)
    330330                m_resourceRequest.setHTTPHeaderField("Cache-Control", "max-age=0");
    331331            if (!lastModified.isEmpty())
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r142024 r142707  
    585585   
    586586    // CachePolicyHistoryBuffer uses the cache no matter what.
    587     if (cachePolicy() == CachePolicyHistoryBuffer)
     587    if (cachePolicy(type) == CachePolicyHistoryBuffer)
    588588        return Use;
    589589
     
    610610
    611611    // CachePolicyReload always reloads
    612     if (cachePolicy() == CachePolicyReload) {
     612    if (cachePolicy(type) == CachePolicyReload) {
    613613        LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to CachePolicyReload.");
    614614        return Reload;
     
    626626
    627627    // Check if the cache headers requires us to revalidate (cache expiration for example).
    628     if (existingResource->mustRevalidateDueToCacheHeaders(cachePolicy())) {
     628    if (existingResource->mustRevalidateDueToCacheHeaders(cachePolicy(type))) {
    629629        // See if the resource has usable ETag or Last-modified headers.
    630630        if (existingResource->canUseCacheValidator())
     
    702702}
    703703
    704 CachePolicy CachedResourceLoader::cachePolicy() const
    705 {
    706     return frame() ? frame()->loader()->subresourceCachePolicy() : CachePolicyVerify;
     704CachePolicy CachedResourceLoader::cachePolicy(CachedResource::Type type) const
     705{
     706    if (!frame())
     707        return CachePolicyVerify;
     708
     709    if (type != CachedResource::MainResource)
     710        return frame()->loader()->subresourceCachePolicy();
     711   
     712    if (frame()->loader()->loadType() == FrameLoadTypeReloadFromOrigin || frame()->loader()->loadType() == FrameLoadTypeReload)
     713        return CachePolicyReload;
     714    return CachePolicyVerify;
    707715}
    708716
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.h

    r138658 r142707  
    113113    bool shouldDeferImageLoad(const KURL&) const;
    114114   
    115     CachePolicy cachePolicy() const;
     115    CachePolicy cachePolicy(CachedResource::Type) const;
    116116   
    117117    Frame* frame() const; // Can be null
Note: See TracChangeset for help on using the changeset viewer.