Changeset 18988 in webkit


Ignore:
Timestamp:
Jan 19, 2007 1:57:23 PM (17 years ago)
Author:
bdakin
Message:

WebCore:

Reviewed by Maciej and Darin.

Fix for <rdar://problem/4702420> REGRESSION: Null characters need
to be stripped from text nodes (townhall.com)

This was a regression from the fix for <rdar://problem/3727939>
Safari strips \0 characters from HTML tags making them valid, which
was fixed with r12652. We still need to strip null characters in
text nodes.

  • html/HTMLTokenizer.cpp: (WebCore::HTMLTokenizer::write): No behavior change here, this is just to make Darin happy. (WebCore::HTMLTokenizer::processToken): Call into StringImpl's new createStrippingNull function instead of the normal StringImpl constructor.
  • platform/StringImpl.cpp: (WebCore::StringImpl::createStrippingNull): Strip null.
  • platform/StringImpl.h:

LayoutTests:

Reviewed by Maciej and Darin.

New layout tests and some updates results for the fix for <rdar://
problem/4702420> REGRESSION: Null characters need to be stripped
from text nodes (townhall.com)

  • fast/dom/stripNullFromTextNodes-expected.checksum: Added.
  • fast/dom/stripNullFromTextNodes-expected.png: Added.
  • fast/dom/stripNullFromTextNodes-expected.txt: Added.
  • fast/dom/stripNullFromTextNodes.html: Added.
  • fast/js/null-char-in-string-expected.txt: New results.
  • fast/text/stripNullFromText-expected.checksum: Added.
  • fast/text/stripNullFromText-expected.png: Added.
  • fast/text/stripNullFromText-expected.txt: Added.
  • fast/text/stripNullFromText.html: Added.
  • tables/mozilla/images/adforce_imgis_com-expected.txt: New results.
  • tables/mozilla_expected_failures/images/adforce_imgis_com- expected.checksum: Removed. This is the same test as the one above. The same test was in two places.
  • tables/mozilla_expected_failures/images/adforce_imgis_com- expected.png: Removed.
  • tables/mozilla_expected_failures/images/adforce_imgis_com- expected.txt: Removed.
  • tables/mozilla_expected_failures/images/adforce_imgis_com.html: Removed.
Location:
trunk
Files:
8 added
4 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r18979 r18988  
     12007-01-19  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Maciej and Darin.
     4
     5        New layout tests and some updates results for the fix for <rdar://
     6        problem/4702420> REGRESSION: Null characters need to be stripped
     7        from text nodes (townhall.com)
     8
     9        * fast/dom/stripNullFromTextNodes-expected.checksum: Added.
     10        * fast/dom/stripNullFromTextNodes-expected.png: Added.
     11        * fast/dom/stripNullFromTextNodes-expected.txt: Added.
     12        * fast/dom/stripNullFromTextNodes.html: Added.
     13        * fast/js/null-char-in-string-expected.txt: New results.
     14        * fast/text/stripNullFromText-expected.checksum: Added.
     15        * fast/text/stripNullFromText-expected.png: Added.
     16        * fast/text/stripNullFromText-expected.txt: Added.
     17        * fast/text/stripNullFromText.html: Added.
     18        * tables/mozilla/images/adforce_imgis_com-expected.txt: New
     19        results.
     20        * tables/mozilla_expected_failures/images/adforce_imgis_com-
     21        expected.checksum: Removed. This is the same test as the one above.
     22        The same test was in two places.
     23        * tables/mozilla_expected_failures/images/adforce_imgis_com-
     24        expected.png: Removed.
     25        * tables/mozilla_expected_failures/images/adforce_imgis_com-
     26        expected.txt: Removed.
     27        * tables/mozilla_expected_failures/images/adforce_imgis_com.html:
     28        Removed.
     29
    1302007-01-19  Nikolas Zimmermann  <zimmermann@kde.org>
    231
  • trunk/LayoutTests/fast/js/null-char-in-string-expected.txt

    r15522 r18988  
    44
    55
    6 PASS String("
     6PASS String("").length is 1
     7PASS successfullyParsed is true
     8
     9TEST COMPLETE
     10
  • trunk/LayoutTests/tables/mozilla/images/adforce_imgis_com-expected.txt

    r18844 r18988  
    55    RenderBody {BODY} at (8,8) size 784x584
    66      RenderText {#text} at (0,0) size 665x18
    7         text run at (0,0) width 665: "GIF89a\x{D4}\x{1}<\x{0}\x{20AC}\x{0}\x{0}\x{0}\x{0}\x{7F}\x{0}\x{0}\x{0}!\x{FF}\x{B}NETSCAPE2.0\x{3}\x{1}\x{0}\x{0}\x{0}!\x{F9}\x{4}\x{4}<\x{0}\x{0}\x{0},\x{0}\x{0}\x{0}\x{0}\x{D4}\x{1}<\x{0}\x{201A}\x{0}\x{0}\x{7F}\x{FF}\x{FF}\x{0}\x{FF}\x{FF}\x{FF}\x{DF}\x{DF}\x{DF}\x{BF}\x{BF}\x{BF}\x{7F}\x{7F}\x{7F}\x{0}\x{0}\x{0}\x{0}\x{0}\x{0}\x{3}\x{FF}8\x{BA}\x{DC}\x{FE}0\x{CA}I\x{AB}\x{BD}8\x{EB}\x{CD}\x{BB}\x{FF}`(\x{17D}di*\x{C6} \x{AC}l\x{EB}\x{BE}p,\x{CF}tm\x{DF}x\x{AE}\x{EF}|\x{EF}\x{FF}\x{C0} pH,"
     7        text run at (0,0) width 665: "GIF89a\x{D4}\x{1}<\x{20AC}\x{7F}!\x{FF}\x{B}NETSCAPE2.0\x{3}\x{1}!\x{F9}\x{4}\x{4}<,\x{D4}\x{1}<\x{201A}\x{7F}\x{FF}\x{FF}\x{FF}\x{FF}\x{FF}\x{DF}\x{DF}\x{DF}\x{BF}\x{BF}\x{BF}\x{7F}\x{7F}\x{7F}\x{3}\x{FF}8\x{BA}\x{DC}\x{FE}0\x{CA}I\x{AB}\x{BD}8\x{EB}\x{CD}\x{BB}\x{FF}`(\x{17D}di*\x{C6} \x{AC}l\x{EB}\x{BE}p,\x{CF}tm\x{DF}x\x{AE}\x{EF}|\x{EF}\x{FF}\x{C0} pH,"
  • trunk/WebCore/ChangeLog

    r18987 r18988  
     12007-01-19  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Maciej and Darin.
     4
     5        Fix for <rdar://problem/4702420> REGRESSION: Null characters need
     6        to be stripped from text nodes (townhall.com)
     7
     8        This was a regression from the fix for <rdar://problem/3727939>
     9        Safari strips \0 characters from HTML tags making them valid, which
     10        was fixed with r12652. We still need to strip null characters in
     11        text nodes.
     12
     13        * html/HTMLTokenizer.cpp:
     14        (WebCore::HTMLTokenizer::write): No behavior change here, this is
     15        just to make Darin happy.
     16        (WebCore::HTMLTokenizer::processToken): Call into StringImpl's new
     17        createStrippingNull function instead of the normal StringImpl
     18        constructor.
     19        * platform/StringImpl.cpp:
     20        (WebCore::StringImpl::createStrippingNull): Strip null.
     21        * platform/StringImpl.h:
     22
    1232007-01-19  David Kilzer  <ddkilzer@webkit.org>
    224
  • trunk/WebCore/html/HTMLTokenizer.cpp

    r18848 r18988  
    14091409        } else {
    14101410            state.setDiscardLF(false);
    1411             *dest++ = *src;
     1411            *dest++ = cc;
    14121412            ++src;
    14131413        }
     
    15451545
    15461546#endif
    1547         currToken.text = new StringImpl( buffer, dest - buffer );
     1547        currToken.text = StringImpl::createStrippingNull(buffer, dest - buffer);
    15481548        if (currToken.tagName != commentAtom)
    15491549            currToken.tagName = textAtom;
  • trunk/WebCore/platform/StringImpl.cpp

    r18764 r18988  
    11711171}
    11721172
     1173PassRefPtr<StringImpl> StringImpl::createStrippingNull(const UChar* str, unsigned len)
     1174{
     1175    StringImpl* result = new StringImpl;
     1176    if (!len || !str)
     1177        return result;
     1178   
     1179    UChar* strippedCopy = newUCharVector(len);
     1180    int strippedLength = 0;
     1181    for (unsigned i = 0; i < len; i++)
     1182        if (UChar c = str[i])
     1183            strippedCopy[strippedLength++] = c;
     1184
     1185    result->m_data = strippedCopy;
     1186    result->m_length = strippedLength;
     1187    return result;
     1188}
     1189
    11731190StringImpl* StringImpl::newUninitialized(size_t length, UChar*& characterBuffer)
    11741191{
  • trunk/WebCore/platform/StringImpl.h

    r18764 r18988  
    6565    ~StringImpl();
    6666
     67    static PassRefPtr<StringImpl> createStrippingNull(const UChar*, unsigned len);
    6768    static StringImpl* newUninitialized(size_t length, UChar*& characterBuffer);
    6869    static StringImpl* adopt(Vector<UChar>&);
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r18975 r18988  
    12671267                        isa = PBXProject;
    12681268                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
    1269                         compatibilityVersion = "Xcode 2.4";
    12701269                        hasScannedForEncodings = 1;
    12711270                        knownRegions = (
     
    12821281                        projectDirPath = "";
    12831282                        projectRoot = "";
    1284                         shouldCheckCompatibility = 1;
    12851283                        targets = (
    12861284                                9398100A0824BF01008DF038 /* WebKit */,
Note: See TracChangeset for help on using the changeset viewer.