Changeset 56035 in webkit
- Timestamp:
- Mar 15, 2010 9:58:55 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r56033 r56035 1 2010-03-15 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 Reviewed by Adam Barth. 4 5 According to the updated specification, a data field should always 6 result in a newline character being appended to the data buffer 7 regardless if the data buffer contains any data or not. However, upon 8 event dispatch, the last newline will be removed. This differs from an 9 older version of the specification where a newline character was 10 appended before the data value only if the buffer already contained 11 data. As a result, EventSource now supports receiving events with empty 12 data or newline characters only. Updated test accordingly. 13 https://bugs.webkit.org/show_bug.cgi?id=33210 14 15 * http/tests/eventsource/eventsource-parse-event-stream-expected.txt: 16 * http/tests/eventsource/eventsource-parse-event-stream.html: 17 * http/tests/eventsource/resources/event-stream.php: 18 1 19 2010-03-15 Valters Svabe <vsvabe@gmail.com> 2 20 -
trunk/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream-expected.txt
r52891 r56035 2 2 3 3 PASS: got open event 4 PASS: received event with two newlines 4 5 PASS: received event with data "simple" 5 6 PASS: received event with data spanning multiple lines -
trunk/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
r52891 r56035 13 13 } 14 14 15 var count = 0;15 var count = -1; 16 16 var es = new EventSource("resources/event-stream.php"); 17 17 … … 25 25 es.onmessage = function (evt) { 26 26 switch(count++) { 27 case -1: 28 if (evt.data == "\n\n") 29 log("PASS: received event with two newlines"); 30 break; 27 31 case 0: 28 32 if (evt.data == "simple") -
trunk/LayoutTests/http/tests/eventsource/resources/event-stream.php
r52891 r56035 13 13 data: 14 14 data 15 : no dispatch since data buffer is empty15 : dispatch event with two newlines 16 16 17 17 data: simple -
trunk/WebCore/ChangeLog
r56033 r56035 1 2010-03-15 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 Reviewed by Adam Barth. 4 5 According to the updated specification, a data field should always 6 result in a newline character being appended to the data buffer 7 regardless if the data buffer contains any data or not. However, upon 8 event dispatch, the last newline will be removed. This differs from an 9 older version of the specification where a newline character was 10 appended before the data value only if the buffer already contained 11 data. As a result, EventSource now supports receiving events with empty 12 data or newline characters only. 13 https://bugs.webkit.org/show_bug.cgi?id=33210 14 15 * page/EventSource.cpp: 16 (WebCore::EventSource::parseEventStreamLine): 17 1 18 2010-03-15 Valters Svabe <vsvabe@gmail.com> 2 19 -
trunk/WebCore/page/EventSource.cpp
r52891 r56035 251 251 { 252 252 if (!lineLength) { 253 if (!m_data.isEmpty()) 253 if (!m_data.isEmpty()) { 254 m_data.removeLast(); 254 255 dispatchEvent(createMessageEvent()); 256 } 255 257 if (!m_eventName.isEmpty()) 256 258 m_eventName = ""; … … 270 272 271 273 if (field == "data") { 272 if (m_data.size() > 0)273 m_data.append('\n');274 274 if (valueLength) 275 275 m_data.append(&m_receiveBuf[bufPos], valueLength); 276 m_data.append('\n'); 276 277 } else if (field == "event") 277 278 m_eventName = valueLength ? String(&m_receiveBuf[bufPos], valueLength) : "";
Note: See TracChangeset
for help on using the changeset viewer.