Bug 10341 - SVGs fail to render intermittently (on reload)
Summary: SVGs fail to render intermittently (on reload)
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://www.w3.org/Graphics/SVG/Test/2...
Keywords: InRadar, NeedsReduction, SVGHitList
: 13188 (view as bug list)
Depends on:
Reported: 2006-08-10 19:17 PDT by Eric Seidel (no email)
Modified: 2011-05-18 10:20 PDT (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2006-08-10 19:17:40 PDT
REGRESSION: All embedded SVGs fail to render intermittently (on reload)They fail out due to a libxml error.  I've seen this error before, and I believe it happens when you call switchEncoding when you don't actuallly have any data to write.

error on line 1 at column 1: switching encoding : no input
Comment 1 Eric Seidel (no email) 2006-09-12 22:32:02 PDT
Wow, strange enough this is still an issue. :(  I'm testing with r16339.
Comment 2 Eric Seidel (no email) 2007-01-15 01:33:15 PST
This is still a (really bad!) problem on TOT.  Although since WebKit has never officially shipped SVG, I'm not sure this can be a P1 regression.
Comment 3 Stephanie Lewis 2007-01-27 19:53:38 PST
Radar <rdar://problem/4959694>
Comment 4 Maciej Stachowiak 2007-02-07 04:51:54 PST
Removing regression tag and downgrading to P2 per Eric's comments.
Comment 5 Eric Seidel (no email) 2007-06-12 11:49:15 PDT
*** Bug 13188 has been marked as a duplicate of this bug. ***
Comment 6 Eric Seidel (no email) 2008-11-21 14:33:40 PST
I'm seeing this on http://www.carto.net/papers/svg/samples/matrix.svg just now as well.
Comment 7 Eric Seidel (no email) 2008-11-21 14:35:25 PST
I suspect this is related to the encoding switching we do to work around another libxml bug:

void XMLTokenizer::doWrite(const String& parseString)
    if (!m_context)
    // libXML throws an error if you try to switch the encoding for an empty string.
    if (parseString.length()) {
        // Hack around libxml2's lack of encoding overide support by manually
        // resetting the encoding to UTF-16 before every chunk.  Otherwise libxml
        // will detect <?xml version="1.0" encoding="<encoding name>"?> blocks 
        // and switch encodings, causing the parse to fail.
        const UChar BOM = 0xFEFF;
        const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM);
        xmlSwitchEncoding(m_context, BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE);

        xmlParseChunk(m_context, reinterpret_cast<const char*>(parseString.characters()), sizeof(UChar) * parseString.length(), 0);
    if (m_doc->decoder() && m_doc->decoder()->sawError()) {
        // If the decoder saw an error, report it as fatal (stops parsing)
        handleError(fatal, "Encoding error", lineNumber(), columnNumber());

Comment 8 Eric Seidel (no email) 2008-11-21 14:36:39 PST
Today I'm using:
Version 4.0 (5528.1)
ProductName:	Mac OS X
ProductVersion:	10.5.5
BuildVersion:	9F33
Comment 9 Dirk Schulze 2011-05-18 10:20:04 PDT
I don't see problems on reload. But indeed it does not look correct. Like eric wrote, this is a bug with libxml and just occurs on MacOS right now. This should work, once Mac OS X has a newer version of libxml. I mark this as WONTFIX, since this is not a problem of WebKit. At least we don't want to add hacks as workaround for bugs in libxml.