[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:56:23 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 39adec9563040126af7f51544a2208ccc7e1b15f
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 7 02:20:02 2010 +0000

    2010-01-06  Adam Bergkvist  <adam.bergkvist at ericsson.com>
    
            Reviewed by Darin Adler.
    
            Modified EventSource event-stream parser to support a single CR as line ending.
            Updated test accordingly.
            https://bugs.webkit.org/show_bug.cgi?id=33207
    
            * http/tests/eventsource/eventsource-parse-event-stream-expected.txt:
            * http/tests/eventsource/eventsource-parse-event-stream.html:
            * http/tests/eventsource/resources/event-stream.php:
    2010-01-06  Adam Bergkvist  <adam.bergkvist at ericsson.com>
    
            Reviewed by Darin Adler.
    
            Modified EventSource event-stream parser to support a single CR as line ending.
            https://bugs.webkit.org/show_bug.cgi?id=33207
    
            * page/EventSource.cpp:
            (WebCore::EventSource::EventSource):
            (WebCore::EventSource::parseEventStream):
            * page/EventSource.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52891 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 70613b6..eb78230 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-06  Adam Bergkvist  <adam.bergkvist at ericsson.com>
+
+        Reviewed by Darin Adler.
+
+        Modified EventSource event-stream parser to support a single CR as line ending.
+        Updated test accordingly.
+        https://bugs.webkit.org/show_bug.cgi?id=33207
+
+        * http/tests/eventsource/eventsource-parse-event-stream-expected.txt:
+        * http/tests/eventsource/eventsource-parse-event-stream.html:
+        * http/tests/eventsource/resources/event-stream.php:
+
 2010-01-06  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream-expected.txt b/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream-expected.txt
index 7fc823d..f43ceaa 100644
--- a/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream-expected.txt
+++ b/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream-expected.txt
@@ -8,6 +8,6 @@ PASS: received event and lastEventId is still "1"
 PASS: received event and lastEventId has been cleared
 PASS: got open event from server
 PASS: received event and the event name has been reset
-PASS: received event with data that contains a colon and a carriage return
+PASS: received event with data that contains a colon
 DONE
 
diff --git a/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html b/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
index da71169..525c267 100644
--- a/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
+++ b/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
@@ -49,8 +49,8 @@ es.onmessage = function (evt) {
                 log("PASS: received event and the event name has been reset");
             break;
         case 6:
-            if (evt.data == "a line ending with crlf\na line with a : (colon)\na line with a \r (carriage return)")
-                log("PASS: received event with data that contains a colon and a carriage return");
+            if (evt.data == "a line ending with crlf\na line with a : (colon)\na line ending with cr");
+                log("PASS: received event with data that contains a colon");
             break;
         default:
             log("FAIL: got unexpected event");
diff --git a/LayoutTests/http/tests/eventsource/resources/event-stream.php b/LayoutTests/http/tests/eventsource/resources/event-stream.php
index c90396a..312b29f 100644
--- a/LayoutTests/http/tests/eventsource/resources/event-stream.php
+++ b/LayoutTests/http/tests/eventsource/resources/event-stream.php
@@ -38,7 +38,7 @@ ta: a message event with the name "message"
 
 <?php echo "data: a line ending with crlf\r\n"; ?>
 data: a line with a : (colon)
-<?php echo "data: a line with a \r (carriage return)\n"; ?>
+<?php echo "data: a line ending with cr\r"; ?>
 
 retry: 10000
 : reconnection time set to 10 seconds
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b2df360..68b3fdc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-06  Adam Bergkvist  <adam.bergkvist at ericsson.com>
+
+        Reviewed by Darin Adler.
+
+        Modified EventSource event-stream parser to support a single CR as line ending.
+        https://bugs.webkit.org/show_bug.cgi?id=33207
+
+        * page/EventSource.cpp:
+        (WebCore::EventSource::EventSource):
+        (WebCore::EventSource::parseEventStream):
+        * page/EventSource.h:
+
 2010-01-06  Joanmarie Diggs  <joanmarie.diggs at gmail.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/page/EventSource.cpp b/WebCore/page/EventSource.cpp
index 2c9a343..0c79998 100644
--- a/WebCore/page/EventSource.cpp
+++ b/WebCore/page/EventSource.cpp
@@ -57,6 +57,7 @@ EventSource::EventSource(const String& url, ScriptExecutionContext* context, Exc
     : ActiveDOMObject(context, this)
     , m_state(CONNECTING)
     , m_reconnectTimer(this, &EventSource::reconnectTimerFired)
+    , m_discardTrailingNewline(false)
     , m_failSilently(false)
     , m_requestInFlight(false)
     , m_reconnectDelay(defaultReconnectDelay)
@@ -210,21 +211,24 @@ void EventSource::parseEventStream()
 {
     unsigned int bufPos = 0;
     unsigned int bufSize = m_receiveBuf.size();
-    for (;;) {
+    while (bufPos < bufSize) {
+        if (m_discardTrailingNewline) {
+            if (m_receiveBuf[bufPos] == '\n')
+                bufPos++;
+            m_discardTrailingNewline = false;
+        }
+
         int lineLength = -1;
         int fieldLength = -1;
-        int carriageReturn = 0;
         for (unsigned int i = bufPos; lineLength < 0 && i < bufSize; i++) {
             switch (m_receiveBuf[i]) {
             case ':':
                 if (fieldLength < 0)
                     fieldLength = i - bufPos;
                 break;
+            case '\r':
+                m_discardTrailingNewline = true;
             case '\n':
-                if (i > bufPos && m_receiveBuf[i - 1] == '\r') {
-                    carriageReturn++;
-                    i--;
-                }
                 lineLength = i - bufPos;
                 break;
             }
@@ -234,7 +238,7 @@ void EventSource::parseEventStream()
             break;
 
         parseEventStreamLine(bufPos, fieldLength, lineLength);
-        bufPos += lineLength + carriageReturn + 1;
+        bufPos += lineLength + 1;
     }
 
     if (bufPos == bufSize)
diff --git a/WebCore/page/EventSource.h b/WebCore/page/EventSource.h
index c7ff2c9..d0d45cb 100644
--- a/WebCore/page/EventSource.h
+++ b/WebCore/page/EventSource.h
@@ -114,6 +114,7 @@ namespace WebCore {
         RefPtr<ThreadableLoader> m_loader;
         Timer<EventSource> m_reconnectTimer;
         Vector<UChar> m_receiveBuf;
+        bool m_discardTrailingNewline;
         bool m_failSilently;
         bool m_requestInFlight;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list