+2006-09-07 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=10753
+ REGRESSION: The beginning of a CSS file is missing
+
+ * http/tests/incremental/slow-utf8-css-expected.checksum: Added.
+ * http/tests/incremental/slow-utf8-css-expected.png: Added.
+ * http/tests/incremental/slow-utf8-css-expected.txt: Added.
+ * http/tests/incremental/slow-utf8-css.pl: Added.
+
2006-09-07 Rob Buis <buis@kde.org>
Reviewed by Maciej.
--- /dev/null
+f539542b8e5ca8ed5877dc065488a7ba
\ 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 784x579
+ RenderBlock {PRE} at (0,0) size 784x45
+ RenderText {#text} at (0,0) size 472x30
+ text run at (0,0) width 472: "Test for bug 10753: The beginning of a CSS file is missing."
+ text run at (472,0) width 0: " "
+ text run at (0,15) width 0: " "
+ RenderText {#text} at (0,30) size 736x15
+ text run at (0,30) width 736: "You should see a bug description one line above (i.e., this line shouldn't be the only one)."
--- /dev/null
+#!/usr/bin/perl -w
+
+# flush the buffers after each print
+select (STDOUT);
+$| = 1;
+
+print "Content-Type: text/css; charset=utf-8\n";
+print "Expires: Thu, 01 Dec 2003 16:00:00 GMT\n";
+print "Cache-Control: no-store, no-cache, must-revalidate\n";
+print "Pragma: no-cache\n";
+print "\n";
+
+print "\xef\xbb\xbfTest for bug 10753: The beginning of a CSS file is missing.\n\n";
+for ($count=1; $count<4000; $count++) { # dump some BOMs to bypass CFNetwork buffering
+ print "\xef\xbb\xbf";
+}
+print "You should see a bug description one line above (i.e., this line shouldn't be the only one).";
+2006-09-07 Alexey Proskuryakov <ap@nypop.com>
+
+ Reviewed by Darin.
+
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=10753
+ REGRESSION: The beginning of a CSS file is missing
+
+ Test: http/tests/incremental/slow-utf8-css.pl
+
+ * loader/Decoder.cpp:
+ (WebCore::Decoder::checkForCSSCharset): Use the same buffering logic as used for HTML.
+ (WebCore::Decoder::decode):
+ * loader/Decoder.h: Added a return value and a movedDataToBuffer parameter to
+ checkForCSSCharset().
+
2006-09-07 Sam Weinig <sam.weinig@gmail.com>
Reviewed by Darin.
setEncoding(UTF8Encoding(), AutoDetectedEncoding);
}
-void Decoder::checkForCSSCharset(const char* data, size_t len)
+bool Decoder::checkForCSSCharset(const char* data, size_t len, bool& movedDataToBuffer)
{
if (m_source != DefaultEncoding) {
m_checkedForCSSCharset = true;
- return;
+ return true;
}
size_t oldSize = m_buffer.size();
m_buffer.resize(oldSize + len);
memcpy(m_buffer.data() + oldSize, data, len);
+ movedDataToBuffer = true;
+
if (m_buffer.size() > 8) { // strlen("@charset") == 8
const char* dataStart = m_buffer.data();
const char* dataEnd = dataStart + m_buffer.size();
dataStart += 8;
const char* pos = dataStart;
if (!skipWhitespace(pos, dataEnd))
- return;
+ return false;
if (*pos == '"' || *pos == '\'') {
char quotationMark = *pos;
while (pos < dataEnd && *pos != quotationMark)
++pos;
if (pos == dataEnd)
- return;
+ return false;
DeprecatedCString encodingName(dataStart, pos - dataStart + 1);
++pos;
if (!skipWhitespace(pos, dataEnd))
- return;
+ return false;
if (*pos == ';')
setEncoding(TextEncoding(encodingName), EncodingFromCSSCharset);
}
}
m_checkedForCSSCharset = true;
+ return true;
}
+ return false;
}
// Other browsers allow comments in the head section, so we need to also.
if (!m_checkedForBOM)
checkForBOM(data, len);
- if (m_contentType == CSS && !m_checkedForCSSCharset) {
- checkForCSSCharset(data, len);
- return "";
- }
-
bool movedDataToBuffer = false;
- if ((m_contentType == HTML || m_contentType == XML) && !m_checkedForHeadCharset) { // HTML and XML
+ if (m_contentType == CSS && !m_checkedForCSSCharset)
+ if (!checkForCSSCharset(data, len, movedDataToBuffer))
+ return "";
+
+ if ((m_contentType == HTML || m_contentType == XML) && !m_checkedForHeadCharset) // HTML and XML
if (!checkForHeadCharset(data, len, movedDataToBuffer))
return "";
- }
// Do the auto-detect if our default encoding is one of the Japanese ones.
// FIXME: It seems wrong to change our encoding downstream after we have already done some decoding.
static const TextEncoding& defaultEncoding(ContentType, const TextEncoding& defaultEncoding);
void checkForBOM(const char*, size_t);
- void checkForCSSCharset(const char*, size_t);
+ bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer);
bool checkForHeadCharset(const char*, size_t, bool& movedDataToBuffer);
void detectJapaneseEncoding(const char*, size_t);