Title: [138202] trunk/Source/WebCore
Revision
138202
Author
simon...@chromium.org
Date
2012-12-19 16:27:40 -0800 (Wed, 19 Dec 2012)

Log Message

Set the original resource's response even on a 304
https://bugs.webkit.org/show_bug.cgi?id=105373

Reviewed by Nate Chapin.

The existing setResponse was renamed to responseReceived to better reflect what it does. A new
setResponse was added that only sets the response. This is used in the 304 case.

No new tests. A new Resource Timing test will depend on this soon.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::responseReceived):
* loader/cache/CachedImage.h:
(CachedImage):
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::responseReceived):
* loader/cache/CachedRawResource.h:
(CachedRawResource):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::responseReceived):
* loader/cache/CachedResource.h:
(CachedResource):
(WebCore::CachedResource::setResponse):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138201 => 138202)


--- trunk/Source/WebCore/ChangeLog	2012-12-20 00:19:03 UTC (rev 138201)
+++ trunk/Source/WebCore/ChangeLog	2012-12-20 00:27:40 UTC (rev 138202)
@@ -1,3 +1,31 @@
+2012-12-18  James Simonsen  <simon...@chromium.org>
+
+        Set the original resource's response even on a 304
+        https://bugs.webkit.org/show_bug.cgi?id=105373
+
+        Reviewed by Nate Chapin.
+
+        The existing setResponse was renamed to responseReceived to better reflect what it does. A new
+        setResponse was added that only sets the response. This is used in the 304 case.
+
+        No new tests. A new Resource Timing test will depend on this soon.
+
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::didReceiveResponse):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::responseReceived):
+        * loader/cache/CachedImage.h:
+        (CachedImage):
+        * loader/cache/CachedRawResource.cpp:
+        (WebCore::CachedRawResource::responseReceived):
+        * loader/cache/CachedRawResource.h:
+        (CachedRawResource):
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::responseReceived):
+        * loader/cache/CachedResource.h:
+        (CachedResource):
+        (WebCore::CachedResource::setResponse):
+
 2012-12-19  Emil A Eklund  <e...@chromium.org>
 
         [Regression] text-overflow ellipsis clips content when zoomed

Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (138201 => 138202)


--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2012-12-20 00:19:03 UTC (rev 138201)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2012-12-20 00:27:40 UTC (rev 138202)
@@ -171,6 +171,7 @@
         if (response.httpStatusCode() == 304) {
             // 304 Not modified / Use local copy
             // Existing resource is ok, just use it updating the expiration time.
+            m_resource->setResponse(response);
             memoryCache()->revalidationSucceeded(m_resource, response);
             if (!reachedTerminalState())
                 ResourceLoader::didReceiveResponse(response);
@@ -180,7 +181,7 @@
         memoryCache()->revalidationFailed(m_resource);
     }
 
-    m_resource->setResponse(response);
+    m_resource->responseReceived(response);
     if (reachedTerminalState())
         return;
     ResourceLoader::didReceiveResponse(response);

Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (138201 => 138202)


--- trunk/Source/WebCore/loader/cache/CachedImage.cpp	2012-12-20 00:19:03 UTC (rev 138201)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp	2012-12-20 00:27:40 UTC (rev 138202)
@@ -404,11 +404,11 @@
     notifyObservers();
 }
 
-void CachedImage::setResponse(const ResourceResponse& response)
+void CachedImage::responseReceived(const ResourceResponse& response)
 {
     if (!m_response.isNull())
         clear();
-    CachedResource::setResponse(response);
+    CachedResource::responseReceived(response);
 }
 
 void CachedImage::destroyDecodedData()

Modified: trunk/Source/WebCore/loader/cache/CachedImage.h (138201 => 138202)


--- trunk/Source/WebCore/loader/cache/CachedImage.h	2012-12-20 00:19:03 UTC (rev 138201)
+++ trunk/Source/WebCore/loader/cache/CachedImage.h	2012-12-20 00:27:40 UTC (rev 138202)
@@ -78,7 +78,7 @@
 
     virtual void data(PassRefPtr<ResourceBuffer> data, bool allDataReceived);
     virtual void error(CachedResource::Status);
-    virtual void setResponse(const ResourceResponse&);
+    virtual void responseReceived(const ResourceResponse&);
     
     // For compatibility, images keep loading even if there are HTTP errors.
     virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return true; }

Modified: trunk/Source/WebCore/loader/cache/CachedRawResource.cpp (138201 => 138202)


--- trunk/Source/WebCore/loader/cache/CachedRawResource.cpp	2012-12-20 00:19:03 UTC (rev 138201)
+++ trunk/Source/WebCore/loader/cache/CachedRawResource.cpp	2012-12-20 00:27:40 UTC (rev 138202)
@@ -114,11 +114,11 @@
     CachedResource::willSendRequest(request, response);
 }
 
-void CachedRawResource::setResponse(const ResourceResponse& response)
+void CachedRawResource::responseReceived(const ResourceResponse& response)
 {
     if (!m_identifier)
         m_identifier = m_loader->identifier();
-    CachedResource::setResponse(response);
+    CachedResource::responseReceived(response);
     CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
     while (CachedRawResourceClient* c = w.next())
         c->responseReceived(this, m_response);

Modified: trunk/Source/WebCore/loader/cache/CachedRawResource.h (138201 => 138202)


--- trunk/Source/WebCore/loader/cache/CachedRawResource.h	2012-12-20 00:19:03 UTC (rev 138201)
+++ trunk/Source/WebCore/loader/cache/CachedRawResource.h	2012-12-20 00:27:40 UTC (rev 138202)
@@ -60,7 +60,7 @@
     virtual void allClientsRemoved();
 
     virtual void willSendRequest(ResourceRequest&, const ResourceResponse&);
-    virtual void setResponse(const ResourceResponse&);
+    virtual void responseReceived(const ResourceResponse&);
     virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
 #if PLATFORM(CHROMIUM)
     virtual void didDownloadData(int);

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (138201 => 138202)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2012-12-20 00:19:03 UTC (rev 138201)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2012-12-20 00:27:40 UTC (rev 138202)
@@ -409,9 +409,9 @@
     return 0;
 }
 
-void CachedResource::setResponse(const ResourceResponse& response)
+void CachedResource::responseReceived(const ResourceResponse& response)
 {
-    m_response = response;
+    setResponse(response);
     m_responseTimestamp = currentTime();
     String encoding = response.textEncodingName();
     if (!encoding.isNull())

Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (138201 => 138202)


--- trunk/Source/WebCore/loader/cache/CachedResource.h	2012-12-20 00:19:03 UTC (rev 138201)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h	2012-12-20 00:27:40 UTC (rev 138202)
@@ -185,7 +185,8 @@
     ResourceBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_data.get(); }
 
     virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_requestedFromNetworkingLayer = true; }
-    virtual void setResponse(const ResourceResponse&);
+    virtual void responseReceived(const ResourceResponse&);
+    void setResponse(const ResourceResponse& response) { m_response = response; }
     const ResourceResponse& response() const { return m_response; }
 
     // Sets the serialized metadata retrieved from the platform's cache.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to