A page containing multiparts with "multipart/x-mixed-replace" should not be cached.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 11:53:15 +0000 (11:53 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 11:53:15 +0000 (11:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82291

Patch by Chris Guan <chris.guan@torchmobile.com.cn> on 2012-03-27
Reviewed by Rob Buis.

If we have a multiPart reponse with multipart/x-mixed-replace,
the current page should not be cached. I use isMultipartPayload()
API which was supposed to be set in NetworkJob to decide to
cache page or not.

* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::canCachePage):

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

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

index 197fa2c..90738c4 100644 (file)
@@ -1,3 +1,18 @@
+2012-03-27  Chris Guan  <chris.guan@torchmobile.com.cn>
+
+        A page containing multiparts with "multipart/x-mixed-replace" should not be cached.
+        https://bugs.webkit.org/show_bug.cgi?id=82291
+
+        Reviewed by Rob Buis.
+
+        If we have a multiPart reponse with multipart/x-mixed-replace, 
+        the current page should not be cached. I use isMultipartPayload() 
+        API which was supposed to be set in NetworkJob to decide to 
+        cache page or not.
+
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::canCachePage):
+
 2012-03-25  Arvid Nilsson  <anilsson@rim.com>
 
         [BlackBerry] Accelerated compositing layers fail to render when using WebPageCompositor
index 10f8208..645f951 100644 (file)
@@ -1188,7 +1188,7 @@ void FrameLoaderClientBlackBerry::dispatchDidReceiveIcon()
 
 bool FrameLoaderClientBlackBerry::canCachePage() const
 {
-    // We won't cache pages containing video or audio.
+    // We won't cache pages containing video, audio or multipart with "multipart/x-mixed-replace".
     ASSERT(m_frame->document());
     RefPtr<NodeList> nodeList = m_frame->document()->getElementsByTagName(HTMLNames::videoTag.localName());
     if (nodeList.get()->length() > 0)
@@ -1197,6 +1197,13 @@ bool FrameLoaderClientBlackBerry::canCachePage() const
     if (nodeList.get()->length() > 0)
         return false;
 
+    ASSERT(m_frame->loader()->documentLoader());
+    const ResponseVector& responses = m_frame->loader()->documentLoader()->responses();
+    size_t count = responses.size();
+    for (size_t i = 0; i < count; i++) {
+        if (responses[i].isMultipartPayload())
+            return false;
+    }
     return true;
 }