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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18988
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-01-19 Beth Dakin <bdakin@apple.com>
+
+ 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.
+
2007-01-19 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Eric.
--- /dev/null
+c932173cc509a9e9aefdf1294d1454a4
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 1072x585
+ RenderView at (0,0) size 800x585
+layer at (0,0) size 1072x585
+ RenderBlock {HTML} at (0,0) size 800x585
+ RenderBody {BODY} at (8,8) size 784x564
+ RenderBlock {DIV} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 31x18
+ text run at (0,0) width 31: "hello"
+ RenderBlock {PRE} at (0,31) size 784x15
+ RenderText {#text} at (0,0) size 1048x15
+ text run at (0,0) width 1048: "The null characters should be stripped out of the sting above and it should have a length of 5. And the DOM thinks the length is..."
+ RenderText {#text} at (1048,0) size 16x15
+ text run at (1048,0) width 16: "5!"
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS String("
+PASS String("").length is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+1e70565686519d04dd81426fe3ab3bc4
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x2 [border: (1px solid #FF0000)]
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderText {#text} at (0,0) size 665x18
- 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,"
+ 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,"
+++ /dev/null
-5f640b01fb244620bf1ae7cff7c407ed
\ No newline at end of file
+++ /dev/null
-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x584
- RenderText {#text} at (0,0) size 665x18
- 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,"
+2007-01-19 Beth Dakin <bdakin@apple.com>
+
+ 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:
+
2007-01-19 David Kilzer <ddkilzer@webkit.org>
Reviewed by NOBODY (no-svg build fix).
++src;
} else {
state.setDiscardLF(false);
- *dest++ = *src;
+ *dest++ = cc;
++src;
}
}
}
#endif
- currToken.text = new StringImpl( buffer, dest - buffer );
+ currToken.text = StringImpl::createStrippingNull(buffer, dest - buffer);
if (currToken.tagName != commentAtom)
currToken.tagName = textAtom;
} else if (currToken.tagName == nullAtom) {
init(reinterpret_cast<const UChar*>(str.data()), str.size());
}
+PassRefPtr<StringImpl> StringImpl::createStrippingNull(const UChar* str, unsigned len)
+{
+ StringImpl* result = new StringImpl;
+ if (!len || !str)
+ return result;
+
+ UChar* strippedCopy = newUCharVector(len);
+ int strippedLength = 0;
+ for (unsigned i = 0; i < len; i++)
+ if (UChar c = str[i])
+ strippedCopy[strippedLength++] = c;
+
+ result->m_data = strippedCopy;
+ result->m_length = strippedLength;
+ return result;
+}
+
StringImpl* StringImpl::newUninitialized(size_t length, UChar*& characterBuffer)
{
StringImpl* result = new StringImpl;
StringImpl(const KJS::UString&);
~StringImpl();
+ static PassRefPtr<StringImpl> createStrippingNull(const UChar*, unsigned len);
static StringImpl* newUninitialized(size_t length, UChar*& characterBuffer);
static StringImpl* adopt(Vector<UChar>&);
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
- compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
- shouldCheckCompatibility = 1;
targets = (
9398100A0824BF01008DF038 /* WebKit */,
);