[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ukai at chromium.org ukai at chromium.org
Wed Dec 22 12:03:57 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a86c8ee08536d99895da0f7b070940c49be2ef04
Author: ukai at chromium.org <ukai at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 13 12:01:45 2010 +0000

    2010-08-13  Fumitoshi Ukai  <ukai at chromium.org>
    
            Reviewed by Alexey Proskuryakov.
    
            flaky websocket/tests/frame-length-overflow.html
            https://bugs.webkit.org/show_bug.cgi?id=43902
    
            Add m_shouldDiscardReceivedData flag to indicate it will no longer
            receive data from network.
    
            * websockets/WebSocketChannel.cpp:
            (WebCore::WebSocketChannel::WebSocketChannel):
            (WebCore::WebSocketChannel::didReceiveData):
            (WebCore::WebSocketChannel::didFail):
            (WebCore::WebSocketChannel::processBuffer):
            - when frame length overflows, we couldn't process data any more.
              clear buffer and mark m_shouldDiscardReceivedData true to make sure
              it doesn't process the same buffer again.
            * websockets/WebSocketChannel.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65313 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dd689ba..cec865d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-08-13  Fumitoshi Ukai  <ukai at chromium.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        flaky websocket/tests/frame-length-overflow.html
+        https://bugs.webkit.org/show_bug.cgi?id=43902
+
+        Add m_shouldDiscardReceivedData flag to indicate it will no longer
+        receive data from network.
+
+        * websockets/WebSocketChannel.cpp:
+        (WebCore::WebSocketChannel::WebSocketChannel):
+        (WebCore::WebSocketChannel::didReceiveData):
+        (WebCore::WebSocketChannel::didFail):
+        (WebCore::WebSocketChannel::processBuffer):
+        - when frame length overflows, we couldn't process data any more.
+          clear buffer and mark m_shouldDiscardReceivedData true to make sure
+          it doesn't process the same buffer again.
+        * websockets/WebSocketChannel.h:
+
 2010-08-13  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/websockets/WebSocketChannel.cpp b/WebCore/websockets/WebSocketChannel.cpp
index 47731cf..54be16a 100644
--- a/WebCore/websockets/WebSocketChannel.cpp
+++ b/WebCore/websockets/WebSocketChannel.cpp
@@ -61,6 +61,7 @@ WebSocketChannel::WebSocketChannel(ScriptExecutionContext* context, WebSocketCha
     , m_resumeTimer(this, &WebSocketChannel::resumeTimerFired)
     , m_suspended(false)
     , m_closed(false)
+    , m_shouldDiscardReceivedData(false)
     , m_unhandledBufferedAmount(0)
 {
 }
@@ -171,10 +172,14 @@ void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* da
         return;
     }
     if (!m_client) {
+        m_shouldDiscardReceivedData = true;
         handle->close();
         return;
     }
+    if (m_shouldDiscardReceivedData)
+        return;
     if (!appendToBuffer(data, len)) {
+        m_shouldDiscardReceivedData = true;
         handle->close();
         return;
     }
@@ -187,6 +192,7 @@ void WebSocketChannel::didFail(SocketStreamHandle* handle, const SocketStreamErr
 {
     LOG(Network, "WebSocketChannel %p didFail", this);
     ASSERT(handle == m_handle || !m_handle);
+    m_shouldDiscardReceivedData = true;
     handle->close();
 }
 
@@ -236,6 +242,8 @@ bool WebSocketChannel::processBuffer()
     ASSERT(!m_suspended);
     ASSERT(m_client);
     ASSERT(m_buffer);
+    if (m_shouldDiscardReceivedData)
+        return false;
 
     if (m_handshake.mode() == WebSocketHandshake::Incomplete) {
         int headerLength = m_handshake.readServerHandshake(m_buffer, m_bufferSize);
@@ -260,6 +268,7 @@ bool WebSocketChannel::processBuffer()
         }
         LOG(Network, "WebSocketChannel %p connection failed", this);
         skipBuffer(headerLength);
+        m_shouldDiscardReceivedData = true;
         if (!m_closed)
             m_handle->close();
         return false;
@@ -305,6 +314,8 @@ bool WebSocketChannel::processBuffer()
             errorFrame = true;
         }
         if (errorFrame) {
+            skipBuffer(m_bufferSize); // Save memory.
+            m_shouldDiscardReceivedData = true;
             m_client->didReceiveMessageError();
             if (!m_client)
                 return false;
diff --git a/WebCore/websockets/WebSocketChannel.h b/WebCore/websockets/WebSocketChannel.h
index 06be50e..43d431a 100644
--- a/WebCore/websockets/WebSocketChannel.h
+++ b/WebCore/websockets/WebSocketChannel.h
@@ -94,6 +94,7 @@ namespace WebCore {
         Timer<WebSocketChannel> m_resumeTimer;
         bool m_suspended;
         bool m_closed;
+        bool m_shouldDiscardReceivedData;
         unsigned long m_unhandledBufferedAmount;
     };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list