LayoutTests:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2006 02:39:22 +0000 (02:39 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2006 02:39:22 +0000 (02:39 +0000)
       - test for
        <rdar://problem/3727939> Safari strips \0 characters from HTML tags making them valid

        * fast/encoding/decoder-allow-null-chars.html
        * fast/encoding/decoder-allow-null-chars-expected.txt

WebCore:

        Reviewed by Maciej.

        - Fixed <rdar://problem/3727939> Safari strips \0 characters from HTML tags making them valid

        Test: fast/encoding/decoder-allow-null-chars.html

        * kwq/KWQTextCodec.cpp:
        (KWQTextDecoder::convertLatin1): Removed stripping of null characters
        (unwanted): ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12652 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/encoding/decoder-allow-null-chars-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/decoder-allow-null-chars.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/kwq/KWQTextCodec.cpp

index 64288925be8cf58829881a98f08b7ae304d3d88a..791d5ba322c4d930728ab141d4b1daef6d6862f6 100644 (file)
@@ -1,3 +1,11 @@
+2006-02-07  Adele Peterson  <adele@apple.com>
+
+       - test for 
+        <rdar://problem/3727939> Safari strips \0 characters from HTML tags making them valid
+
+        * fast/encoding/decoder-allow-null-chars.html
+        * fast/encoding/decoder-allow-null-chars-expected.txt
+
 2006-02-07  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Timothy.
diff --git a/LayoutTests/fast/encoding/decoder-allow-null-chars-expected.txt b/LayoutTests/fast/encoding/decoder-allow-null-chars-expected.txt
new file mode 100644 (file)
index 0000000..60ce3e0
--- /dev/null
@@ -0,0 +1,5 @@
+This tests that we no longer strip nulls from tags. This matches Firefox behavior.
+
+Test Passed
+
+result.innerHTML = message;
diff --git a/LayoutTests/fast/encoding/decoder-allow-null-chars.html b/LayoutTests/fast/encoding/decoder-allow-null-chars.html
new file mode 100644 (file)
index 0000000..e6ee249
Binary files /dev/null and b/LayoutTests/fast/encoding/decoder-allow-null-chars.html differ
index 55e50c93975a4ae8e3e38361f4781d0726f149f5..28fb1b2214637e4281228495a3cb9aaf10f55278 100644 (file)
@@ -1,3 +1,15 @@
+2006-02-07  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Maciej.
+
+        - Fixed <rdar://problem/3727939> Safari strips \0 characters from HTML tags making them valid 
+
+        Test: fast/encoding/decoder-allow-null-chars.html
+
+        * kwq/KWQTextCodec.cpp:
+        (KWQTextDecoder::convertLatin1): Removed stripping of null characters
+        (unwanted): ditto.
+
 2006-02-07  David Hyatt <hyatt@apple.com>
 
         Land the skeleton of a PNG decoder for Win32.
index 462bfbc604b95f4e8653a179a85dd00ca8cdbceb..2d0b67c51fac17791f94b360f91c395046078d43 100644 (file)
@@ -284,35 +284,7 @@ QString KWQTextDecoder::convertLatin1(const unsigned char *s, int length)
 {
     ASSERT(_numBufferedBytes == 0);
 
-    int i;
-    for (i = 0; i != length; ++i) {
-        if (s[i] == 0) {
-            break;
-        }
-    }
-    if (i == length) {
-        return QString(reinterpret_cast<const char *>(s), length);
-    }
-
-    QString result("");
-    
-    result.reserve(length);
-    
-    result.append(reinterpret_cast<const char *>(s), i);
-    int start = ++i;
-    for (; i != length; ++i) {
-        if (s[i] == 0) {
-            if (start != i) {
-                result.append(reinterpret_cast<const char *>(&s[start]), i - start);
-            }
-            start = i + 1;
-        }
-    }
-    if (start != length) {
-        result.append(reinterpret_cast<const char *>(&s[start]), length - start);
-    }
-
-    return result;
+    return QString(reinterpret_cast<const char *>(s), length);
 }
 
 QString KWQTextDecoder::convertUTF16(const unsigned char *s, int length)
@@ -405,7 +377,6 @@ UErrorCode KWQTextDecoder::createICUConverter()
     return U_ZERO_ERROR;
 }
 
-// We strip NUL characters because other browsers (at least WinIE) do.
 // We strip replacement characters because the ICU converter for UTF-8 converts
 // invalid sequences into replacement characters, but other browsers discard them.
 // We strip BOM characters because they can show up both at the start of content
@@ -413,7 +384,6 @@ UErrorCode KWQTextDecoder::createICUConverter()
 static inline bool unwanted(UniChar c)
 {
     switch (c) {
-        case 0:
         case replacementCharacter:
         case BOM:
             return true;