Title: [149436] trunk
Revision
149436
Author
[email protected]
Date
2013-05-01 10:15:46 -0700 (Wed, 01 May 2013)

Log Message

EventSource: Loss of reconnect time precision due to integer division
https://bugs.webkit.org/show_bug.cgi?id=115358

Source/WebCore:

Make sure precision is not lost when converting the reconnect time from milliseconds to seconds.

Patch by Per-Erik Brodin <[email protected]> on 2013-05-01
Reviewed by Alexey Proskuryakov.

Test: http/tests/eventsource/eventsource-retry-precision.html

* page/EventSource.cpp:
(WebCore::EventSource::scheduleReconnect):

LayoutTests:

Patch by Per-Erik Brodin <[email protected]> on 2013-05-01
Reviewed by Alexey Proskuryakov.

* http/tests/eventsource/eventsource-retry-precision-expected.txt: Added.
* http/tests/eventsource/eventsource-retry-precision.html: Added.
* http/tests/eventsource/resources/precise-retry.asis: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149435 => 149436)


--- trunk/LayoutTests/ChangeLog	2013-05-01 16:55:59 UTC (rev 149435)
+++ trunk/LayoutTests/ChangeLog	2013-05-01 17:15:46 UTC (rev 149436)
@@ -1,3 +1,14 @@
+2013-05-01  Per-Erik Brodin  <[email protected]>
+
+        EventSource: Loss of reconnect time precision due to integer division
+        https://bugs.webkit.org/show_bug.cgi?id=115358
+
+        Reviewed by Alexey Proskuryakov.
+
+        * http/tests/eventsource/eventsource-retry-precision-expected.txt: Added.
+        * http/tests/eventsource/eventsource-retry-precision.html: Added.
+        * http/tests/eventsource/resources/precise-retry.asis: Added.
+
 2013-05-01  Sergio Villar Senin  <[email protected]>
 
         Show a block cursor in overtype mode

Added: trunk/LayoutTests/http/tests/eventsource/eventsource-retry-precision-expected.txt (0 => 149436)


--- trunk/LayoutTests/http/tests/eventsource/eventsource-retry-precision-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/eventsource/eventsource-retry-precision-expected.txt	2013-05-01 17:15:46 UTC (rev 149436)
@@ -0,0 +1,5 @@
+Test EventSource retry time precision. Should print PASS followed by DONE.
+
+PASS: did not immediately reconnect
+DONE
+

Added: trunk/LayoutTests/http/tests/eventsource/eventsource-retry-precision.html (0 => 149436)


--- trunk/LayoutTests/http/tests/eventsource/eventsource-retry-precision.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/eventsource/eventsource-retry-precision.html	2013-05-01 17:15:46 UTC (rev 149436)
@@ -0,0 +1,37 @@
+<html>
+<body>
+<p>Test EventSource retry time precision. Should print PASS followed by DONE.</p>
+<script>
+function log(msg) {
+    document.body.innerHTML += msg + "<br>";
+}
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+var timeoutId = setTimeout(function () {
+    log("PASS: did not immediately reconnect");
+    end();
+}, 500);
+
+var count = 0;
+var es = new EventSource("resources/precise-retry.asis");
+es._onopen_ = function () {
+    if (count++ != 2)
+        return;
+    clearTimeout(timeoutId);
+    log("FAIL: reconnected too soon");
+    end();
+};
+
+function end() {
+    es.close();
+    log("DONE");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/eventsource/resources/precise-retry.asis (0 => 149436)


--- trunk/LayoutTests/http/tests/eventsource/resources/precise-retry.asis	                        (rev 0)
+++ trunk/LayoutTests/http/tests/eventsource/resources/precise-retry.asis	2013-05-01 17:15:46 UTC (rev 149436)
@@ -0,0 +1,4 @@
+Content-Type: text/event-stream
+
+retry: 999
+

Modified: trunk/Source/WebCore/ChangeLog (149435 => 149436)


--- trunk/Source/WebCore/ChangeLog	2013-05-01 16:55:59 UTC (rev 149435)
+++ trunk/Source/WebCore/ChangeLog	2013-05-01 17:15:46 UTC (rev 149436)
@@ -1,3 +1,17 @@
+2013-05-01  Per-Erik Brodin  <[email protected]>
+
+        EventSource: Loss of reconnect time precision due to integer division
+        https://bugs.webkit.org/show_bug.cgi?id=115358
+
+        Make sure precision is not lost when converting the reconnect time from milliseconds to seconds.
+
+        Reviewed by Alexey Proskuryakov.
+
+        Test: http/tests/eventsource/eventsource-retry-precision.html
+
+        * page/EventSource.cpp:
+        (WebCore::EventSource::scheduleReconnect):
+
 2013-05-01  Andreas Kling  <[email protected]>
 
         REGRESSION(r149287): Assertion failure in fast/frames/flattening/iframe-flattening-crash.html

Modified: trunk/Source/WebCore/page/EventSource.cpp (149435 => 149436)


--- trunk/Source/WebCore/page/EventSource.cpp	2013-05-01 16:55:59 UTC (rev 149435)
+++ trunk/Source/WebCore/page/EventSource.cpp	2013-05-01 17:15:46 UTC (rev 149436)
@@ -166,7 +166,7 @@
 void EventSource::scheduleReconnect()
 {
     m_state = CONNECTING;
-    m_connectTimer.startOneShot(m_reconnectDelay / 1000);
+    m_connectTimer.startOneShot(m_reconnectDelay / 1000.0);
     dispatchEvent(Event::create(eventNames().errorEvent, false, false));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to