2009-11-25 Alexander Pavlov <apavlov@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Nov 2009 16:15:39 +0000 (16:15 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Nov 2009 16:15:39 +0000 (16:15 +0000)
        Reviewed by Pavel Feldman.

        Load InspectorResource mime type from CachedResource for 304 responses

        For network libraries that do not merge cache data into 304 ResourceResponses,
        the mime type for cached resources is unknown.
        https://bugs.webkit.org/show_bug.cgi?id=31868

        * inspector/InspectorResource.cpp:
        (WebCore::InspectorResource::updateResponse):
        (WebCore::InspectorResource::updateScriptObject):
        (WebCore::InspectorResource::type):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51385 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/inspector/InspectorResource.cpp

index d33ee7217edf3e505d87af55636791b845113f28..f0fae0513091b2e6bef1fff15b9c5b8ac8ffde4e 100644 (file)
@@ -1,3 +1,18 @@
+2009-11-25  Alexander Pavlov  <apavlov@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Load InspectorResource mime type from CachedResource for 304 responses
+
+        For network libraries that do not merge cache data into 304 ResourceResponses,
+        the mime type for cached resources is unknown.
+        https://bugs.webkit.org/show_bug.cgi?id=31868
+
+        * inspector/InspectorResource.cpp:
+        (WebCore::InspectorResource::updateResponse):
+        (WebCore::InspectorResource::updateScriptObject):
+        (WebCore::InspectorResource::type):
+
 2009-11-25  Andrei Popescu  <andreip@google.com>
 
         Reviewed by Eric Seidel.
index 0870240ca19ce9d6bd7318c1a7e11519d4d0b277..381dfd56d509f52e3b09ca6de63216517eb3ddf2 100644 (file)
@@ -105,6 +105,11 @@ void InspectorResource::updateResponse(const ResourceResponse& response)
 {
     m_expectedContentLength = response.expectedContentLength();
     m_mimeType = response.mimeType();
+    if (m_mimeType.isEmpty() && response.httpStatusCode() == 304) {
+        CachedResource* cachedResource = cache()->resourceForURL(response.url().string());
+        if (cachedResource)
+            m_mimeType = cachedResource->response().mimeType();
+    }
     m_responseHeaderFields = response.httpHeaderFields();
     m_responseStatusCode = response.httpStatusCode();
     m_suggestedFilename = response.suggestedFilename();
@@ -186,7 +191,7 @@ void InspectorResource::updateScriptObject(InspectorFrontend* frontend)
         jsonObject.set("type", static_cast<int>(type()));
         jsonObject.set("didTypeChange", true);
     }
-    
+
     if (m_changes.hasChange(LengthChange)) {
         jsonObject.set("contentLength", m_length);
         jsonObject.set("didLengthChange", true);
@@ -281,9 +286,9 @@ InspectorResource::Type InspectorResource::type() const
 
     if (m_loader->frameLoader() && m_requestURL == m_loader->frameLoader()->iconURL())
         return Image;
-    
+
     return cachedResourceType();
-    
+
 }
 
 void InspectorResource::setXMLHttpResponseText(const ScriptString& data)