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

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 18:35:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 42d83d41cefe89e67d8b35a58cf71f1242179160
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 14 11:29:43 2010 +0000

    2010-12-14  Julien Chaffraix  <jchaffraix at codeaurora.org>
    
            Reviewed by Darin Adler.
    
            Test for: EventSource fails to connect if Content-Type header has a charset attribute
            https://bugs.webkit.org/show_bug.cgi?id=45372
    
            Test that a Content-Type of "text/event-stream; charset=UTF8" works correctly but
            "text/event-stream" does not work.
    
            * http/tests/eventsource/eventsource-content-type-charset-expected.txt: Added.
            * http/tests/eventsource/eventsource-content-type-charset.html: Added.
            * http/tests/eventsource/eventsource-content-type-text-event-stream-foobar-expected.txt: Added.
            * http/tests/eventsource/eventsource-content-type-text-event-stream-foobar.html: Added.
            * http/tests/eventsource/resources/response-content-type-charset.php: Added.
            * http/tests/eventsource/resources/response-content-type-event-stream-foobar.php: Added.
    2010-12-14  Julien Chaffraix  <jchaffraix at codeaurora.org>
    
            Reviewed by Darin Adler.
    
            Test for: EventSource fails to connect if Content-Type header has a charset attribute
            https://bugs.webkit.org/show_bug.cgi?id=45372
    
            Tests: http/tests/eventsource/eventsource-content-type-charset.html
                   http/tests/eventsource/eventsource-content-type-text-event-stream-foobar.html
    
            * page/EventSource.cpp:
            (WebCore::EventSource::didReceiveResponse): Use the mimeType instead of the Content-Type
            header directly. This makes the detection of the "text/stream" mimeType more accurate.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74011 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a8c920a..6980015 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-14  Julien Chaffraix  <jchaffraix at codeaurora.org>
+
+        Reviewed by Darin Adler.
+
+        Test for: EventSource fails to connect if Content-Type header has a charset attribute
+        https://bugs.webkit.org/show_bug.cgi?id=45372
+
+        Test that a Content-Type of "text/event-stream; charset=UTF8" works correctly but
+        "text/event-stream" does not work.
+
+        * http/tests/eventsource/eventsource-content-type-charset-expected.txt: Added.
+        * http/tests/eventsource/eventsource-content-type-charset.html: Added.
+        * http/tests/eventsource/eventsource-content-type-text-event-stream-foobar-expected.txt: Added.
+        * http/tests/eventsource/eventsource-content-type-text-event-stream-foobar.html: Added.
+        * http/tests/eventsource/resources/response-content-type-charset.php: Added.
+        * http/tests/eventsource/resources/response-content-type-event-stream-foobar.php: Added.
+
 2010-12-14  Pieter Senster  <psenster at google.com>
 
         Reviewed by Dirk Schulze.
diff --git a/LayoutTests/http/tests/eventsource/eventsource-content-type-charset-expected.txt b/LayoutTests/http/tests/eventsource/eventsource-content-type-charset-expected.txt
new file mode 100644
index 0000000..ef1f63b
--- /dev/null
+++ b/LayoutTests/http/tests/eventsource/eventsource-content-type-charset-expected.txt
@@ -0,0 +1,7 @@
+Test for bug 45372: https://bugs.webkit.org/show_bug.cgi?id=45372
+
+Test EventSource with an event-stream with a Content-Type with a charset is still recognized. You should see 2 PASSED below (one for open and one for message).
+
+PASSED: got open event
+PASSED: got message event
+
diff --git a/LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html b/LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html
new file mode 100644
index 0000000..4e07fa8
--- /dev/null
+++ b/LayoutTests/http/tests/eventsource/eventsource-content-type-charset.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=45372">45372</a>: https://bugs.webkit.org/show_bug.cgi?id=45372</p>
+<p>Test EventSource with an event-stream with a Content-Type with a charset is still recognized. You should see 2 PASSED below (one for open and one for message).</p>
+<div id="result"></div>
+<script>
+function log(msg) {
+    document.getElementById("result").innerHTML += msg + "<br>";
+}
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var es = new EventSource("resources/response-content-type-charset.php");
+
+es.onopen = function (evt) {
+    log("PASSED: got open event");
+};
+
+es.onmessage = function (evt) {
+    log("PASSED: got message event");
+    end();
+};
+
+es.onerror = function () {
+    log("FAILED: unexpected error event");
+    end();
+};
+
+function end() {
+    es.close();
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/eventsource/eventsource-content-type-text-event-stream-foobar-expected.txt b/LayoutTests/http/tests/eventsource/eventsource-content-type-text-event-stream-foobar-expected.txt
new file mode 100644
index 0000000..69d1460
--- /dev/null
+++ b/LayoutTests/http/tests/eventsource/eventsource-content-type-text-event-stream-foobar-expected.txt
@@ -0,0 +1,6 @@
+Test for bug 45372: https://bugs.webkit.org/show_bug.cgi?id=45372
+
+Test EventSource with an event-stream with a Content-Type of "text/event-stream-foobar" is not recognized as valid. You should see 1 PASSED below.
+
+PASSED
+
diff --git a/LayoutTests/http/tests/eventsource/eventsource-content-type-text-event-stream-foobar.html b/LayoutTests/http/tests/eventsource/eventsource-content-type-text-event-stream-foobar.html
new file mode 100644
index 0000000..6fcfe5c
--- /dev/null
+++ b/LayoutTests/http/tests/eventsource/eventsource-content-type-text-event-stream-foobar.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=45372">45372</a>: https://bugs.webkit.org/show_bug.cgi?id=45372</p>
+<p>Test EventSource with an event-stream with a Content-Type of "text/event-stream-foobar" is not recognized as valid. You should see 1 PASSED below.</p>
+<div id="result"></div>
+<script>
+function log(msg) {
+    document.getElementById("result").innerHTML += msg + "<br>";
+}
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var es = new EventSource("resources/response-content-type-text-stream-foobar.php");
+
+es.onopen = function (evt) {
+    log("FAILED: got unexpected open event");
+    end();
+};
+
+es.onmessage = function (evt) {
+    log("FAILED: got unexpected message event");
+    end();
+};
+
+es.onerror = function () {
+    if (es.readyState == es.CLOSED)
+        log("PASSED");
+    else
+        log("FAILED: invalid state");
+    end();
+};
+
+function end() {
+    es.close();
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/eventsource/resources/response-content-type-charset.php b/LayoutTests/http/tests/eventsource/resources/response-content-type-charset.php
new file mode 100644
index 0000000..a7cd42e
--- /dev/null
+++ b/LayoutTests/http/tests/eventsource/resources/response-content-type-charset.php
@@ -0,0 +1,8 @@
+<?php
+header("Content-Type: text/event-stream; charset=UTF8");
+?>
+
+id: 77
+retry: 300
+data: hello
+
diff --git a/LayoutTests/http/tests/eventsource/resources/response-content-type-event-stream-foobar.php b/LayoutTests/http/tests/eventsource/resources/response-content-type-event-stream-foobar.php
new file mode 100644
index 0000000..ef1e460
--- /dev/null
+++ b/LayoutTests/http/tests/eventsource/resources/response-content-type-event-stream-foobar.php
@@ -0,0 +1,8 @@
+<?php
+header("Content-Type: text/event-stream-foobar");
+?>
+
+id: 77
+retry: 300
+data: hello
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 609a9e4..9226806 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-14  Julien Chaffraix  <jchaffraix at codeaurora.org>
+
+        Reviewed by Darin Adler.
+
+        Test for: EventSource fails to connect if Content-Type header has a charset attribute
+        https://bugs.webkit.org/show_bug.cgi?id=45372
+
+        Tests: http/tests/eventsource/eventsource-content-type-charset.html
+               http/tests/eventsource/eventsource-content-type-text-event-stream-foobar.html
+
+        * page/EventSource.cpp:
+        (WebCore::EventSource::didReceiveResponse): Use the mimeType instead of the Content-Type
+        header directly. This makes the detection of the "text/stream" mimeType more accurate.
+
 2010-12-14  Pieter Senster  <psenster at google.com>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/page/EventSource.cpp b/WebCore/page/EventSource.cpp
index b0b07aa..39f15e9 100644
--- a/WebCore/page/EventSource.cpp
+++ b/WebCore/page/EventSource.cpp
@@ -180,7 +180,7 @@ ScriptExecutionContext* EventSource::scriptExecutionContext() const
 void EventSource::didReceiveResponse(const ResourceResponse& response)
 {
     int statusCode = response.httpStatusCode();
-    if (statusCode == 200 && response.httpHeaderField("Content-Type") == "text/event-stream") {
+    if (statusCode == 200 && response.mimeType() == "text/event-stream") {
         m_state = OPEN;
         dispatchEvent(Event::create(eventNames().openEvent, false, false));
     } else {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list