Diff
Modified: branches/safari-537-branch/LayoutTests/ChangeLog (153618 => 153619)
--- branches/safari-537-branch/LayoutTests/ChangeLog 2013-08-01 22:36:07 UTC (rev 153618)
+++ branches/safari-537-branch/LayoutTests/ChangeLog 2013-08-01 22:40:31 UTC (rev 153619)
@@ -1,3 +1,19 @@
+2013-08-01 Lucas Forschler <[email protected]>
+
+ Merge r153553
+
+ 2013-07-31 Ryosuke Niwa <[email protected]>
+
+ Reuse of XMLHttpRequests causes character corruption in response text
+ https://bugs.webkit.org/show_bug.cgi?id=119358
+
+ Reviewed by Anders Carlsson.
+
+ * http/tests/xmlhttprequest/reopen-encoding-expected.txt: Added.
+ * http/tests/xmlhttprequest/reopen-encoding.html: Added.
+ * http/tests/xmlhttprequest/resources/get-utf-8.cgi: Added.
+ * http/tests/xmlhttprequest/resources/get-windows-1251.cgi: Added.
+
2013-08-01 Beth Dakin <[email protected]>
<rdar://problem/14616729> REGRESSION (r144350): Overflow bounding boxes are way
Copied: branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/reopen-encoding-expected.txt (from rev 153553, trunk/LayoutTests/http/tests/xmlhttprequest/reopen-encoding-expected.txt) (0 => 153619)
--- branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/reopen-encoding-expected.txt (rev 0)
+++ branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/reopen-encoding-expected.txt 2013-08-01 22:40:31 UTC (rev 153619)
@@ -0,0 +1,13 @@
+This test verifies that XMLHttpRequest properly handles Content-Type when it is reused.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS req.getResponseHeader('Content-Type') is "text/plain; charset=utf-8"
+PASS req.responseText is "Проверка"
+PASS req.getResponseHeader('Content-Type') is "text/plain; charset=windows-1251"
+PASS req.responseText is "Проверка"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/reopen-encoding.html (from rev 153553, trunk/LayoutTests/http/tests/xmlhttprequest/reopen-encoding.html) (0 => 153619)
--- branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/reopen-encoding.html (rev 0)
+++ branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/reopen-encoding.html 2013-08-01 22:40:31 UTC (rev 153619)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+</head>
+<body>
+<script src=""
+<script>
+ description('This test verifies that XMLHttpRequest properly handles Content-Type when it is reused.');
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var req = new XMLHttpRequest;
+ try {
+ req.open("GET", "resources/get-utf-8.cgi", false);
+ req.send();
+ shouldBeEqualToString("req.getResponseHeader('Content-Type')", "text/plain; charset=utf-8");
+ shouldBeEqualToString("req.responseText", "Проверка");
+ req.open("GET", "resources/get-windows-1251.cgi", false);
+ req.send();
+ shouldBeEqualToString("req.getResponseHeader('Content-Type')", "text/plain; charset=windows-1251");
+ shouldBeEqualToString("req.responseText", "Проверка");
+ finishJSTest();
+ } catch (ex) {
+ fail("an exception is thrown: " + ex);
+ }
+</script>
+<script src=""
+</body>
+</html>
Copied: branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/resources/get-utf-8.cgi (from rev 153553, trunk/LayoutTests/http/tests/xmlhttprequest/resources/get-utf-8.cgi) (0 => 153619)
--- branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/resources/get-utf-8.cgi (rev 0)
+++ branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/resources/get-utf-8.cgi 2013-08-01 22:40:31 UTC (rev 153619)
@@ -0,0 +1,6 @@
+#!/usr/bin/perl -w
+use utf8;
+use Encode 'encode';
+
+print "Content-type: text/plain; charset=utf-8\n\n";
+print encode("UTF-8", "Проверка");
Copied: branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/resources/get-windows-1251.cgi (from rev 153553, trunk/LayoutTests/http/tests/xmlhttprequest/resources/get-windows-1251.cgi) (0 => 153619)
--- branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/resources/get-windows-1251.cgi (rev 0)
+++ branches/safari-537-branch/LayoutTests/http/tests/xmlhttprequest/resources/get-windows-1251.cgi 2013-08-01 22:40:31 UTC (rev 153619)
@@ -0,0 +1,6 @@
+#!/usr/bin/perl -w
+use utf8;
+use Encode 'encode';
+
+print "Content-type: text/plain; charset=windows-1251\n\n";
+print encode("windows-1251", "Проверка");
Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (153618 => 153619)
--- branches/safari-537-branch/Source/WebCore/ChangeLog 2013-08-01 22:36:07 UTC (rev 153618)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog 2013-08-01 22:40:31 UTC (rev 153619)
@@ -1,5 +1,24 @@
2013-08-01 Lucas Forschler <[email protected]>
+ Merge r153553
+
+ 2013-07-31 Ryosuke Niwa <[email protected]>
+
+ Reuse of XMLHttpRequests causes character corruption in response text
+ https://bugs.webkit.org/show_bug.cgi?id=119358
+
+ Reviewed by Anders Carlsson.
+
+ Merge https://chromium.googlesource.com/chromium/blink/+/6496e7bb9a0b46bc79032b86d5993b25f127a4cb
+
+ Test: http/tests/xmlhttprequest/reopen-encoding.html
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::clearResponseBuffers):
+ (WebCore::XMLHttpRequest::didFinishLoading):
+
+2013-08-01 Lucas Forschler <[email protected]>
+
Merge r153494
2013-07-30 Andreas Kling <[email protected]>
Modified: branches/safari-537-branch/Source/WebCore/xml/XMLHttpRequest.cpp (153618 => 153619)
--- branches/safari-537-branch/Source/WebCore/xml/XMLHttpRequest.cpp 2013-08-01 22:36:07 UTC (rev 153618)
+++ branches/safari-537-branch/Source/WebCore/xml/XMLHttpRequest.cpp 2013-08-01 22:40:31 UTC (rev 153619)
@@ -885,6 +885,7 @@
void XMLHttpRequest::clearResponseBuffers()
{
m_responseBuilder.clear();
+ m_responseEncoding = String();
m_createdDocument = false;
m_responseDocument = 0;
m_responseBlob = 0;
@@ -1148,6 +1149,7 @@
m_loader = 0;
changeState(DONE);
+ m_responseEncoding = String();
m_decoder = 0;
if (hadLoader)