Changeset 183555 in webkit


Ignore:
Timestamp:
Apr 29, 2015 10:09:51 AM (9 years ago)
Author:
Antti Koivisto
Message:

Main resource loaded via 304 response becomes empty if reloaded by user
https://bugs.webkit.org/show_bug.cgi?id=144386

Reviewed by Darin Adler.

Source/WebCore:

Memory cache layer may make a main resource request conditional (add If-modified-since/If-none-match header).
DocumentLoader stores the final ResourceRequest associated with document. If user triggered reload for
conditionally loaded document DocumentLoader would include the same conditionals to the new request as well.
Since these were not added by the memory cache it would pass any 304 response back to the DocumentLoader.
However DocumentLoader has no code to handle 304 so we would end up with an empty document.

Test: http/tests/cache/main-resource-304-reload.html

  • loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::startLoadingMainResource):

Ensure DocumentLoader doesn't issue conditional requests.

LayoutTests:

  • http/tests/cache/main-resource-304-reload-expected.txt: Added.
  • http/tests/cache/main-resource-304-reload.html: Added.
  • http/tests/cache/resources/iframe304body.php: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r183552 r183555  
     12015-04-29  Antti Koivisto  <antti@apple.com>
     2
     3        Main resource loaded via 304 response becomes empty if reloaded by user
     4        https://bugs.webkit.org/show_bug.cgi?id=144386
     5
     6        Reviewed by Darin Adler.
     7
     8        * http/tests/cache/main-resource-304-reload-expected.txt: Added.
     9        * http/tests/cache/main-resource-304-reload.html: Added.
     10        * http/tests/cache/resources/iframe304body.php: Added.
     11
    1122015-04-29  Darin Adler  <darin@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r183554 r183555  
     12015-04-29  Antti Koivisto  <antti@apple.com>
     2
     3        Main resource loaded via 304 response becomes empty if reloaded by user
     4        https://bugs.webkit.org/show_bug.cgi?id=144386
     5
     6        Reviewed by Darin Adler.
     7
     8        Memory cache layer may make a main resource request conditional (add If-modified-since/If-none-match header).
     9        DocumentLoader stores the final ResourceRequest associated with document. If user triggered reload for
     10        conditionally loaded document DocumentLoader would include the same conditionals to the new request as well.
     11        Since these were not added by the memory cache it would pass any 304 response back to the DocumentLoader.
     12        However DocumentLoader has no code to handle 304 so we would end up with an empty document.
     13
     14        Test: http/tests/cache/main-resource-304-reload.html
     15
     16        * loader/DocumentLoader.cpp:
     17        (WebCore::DocumentLoader::startLoadingMainResource):
     18
     19            Ensure DocumentLoader doesn't issue conditional requests.
     20
    1212015-04-28  Jer Noble  <jer.noble@apple.com>
    222
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r183467 r183555  
    14011401    ResourceRequest request(m_request);
    14021402    request.setRequester(ResourceRequest::Requester::Main);
    1403    
     1403    // If this is a reload the cache layer might have made the previous request conditional. DocumentLoader can't handle 304 responses itself.
     1404    request.makeUnconditional();
     1405
    14041406    static NeverDestroyed<ResourceLoaderOptions> mainResourceLoadOptions(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, AskClientForAllCredentials, SkipSecurityCheck, UseDefaultOriginRestrictionsForType, IncludeCertificateInfo);
    14051407    CachedResourceRequest cachedResourceRequest(request, mainResourceLoadOptions);
Note: See TracChangeset for help on using the changeset viewer.