[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 12:46:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ec6426180941c75b4f2c58376c9c1f70fcb37ed6
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Aug 29 20:46:08 2010 +0000

    2010-08-29  Pawel Hajdan  <phajdan.jr at chromium.org>
    
            Reviewed by Darin Adler.
    
            Fix libxml workarounds to work with recent versions of libxml.
            I was testing locally with libxml2-2.7.6.
            https://bugs.webkit.org/show_bug.cgi?id=30508
    
            Based on patch by Philippe Normand <pnormand at igalia.com>.
    
            This also fixes a Chromium bug:
            http://code.google.com/p/chromium/issues/detail?id=29333
    
            * dom/XMLDocumentParserLibxml2.cpp:
            (WebCore::switchToUTF16):
            (WebCore::XMLParserContext::createStringParser):
            (WebCore::XMLDocumentParser::doWrite):
            (WebCore::startDocumentHandler):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66336 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8cfbacc..be2c8bc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-29  Pawel Hajdan  <phajdan.jr at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Fix libxml workarounds to work with recent versions of libxml.
+        I was testing locally with libxml2-2.7.6.
+        https://bugs.webkit.org/show_bug.cgi?id=30508
+
+        Based on patch by Philippe Normand <pnormand at igalia.com>.
+
+        This also fixes a Chromium bug:
+        http://code.google.com/p/chromium/issues/detail?id=29333
+
+        * dom/XMLDocumentParserLibxml2.cpp:
+        (WebCore::switchToUTF16):
+        (WebCore::XMLParserContext::createStringParser):
+        (WebCore::XMLDocumentParser::doWrite):
+        (WebCore::startDocumentHandler):
+
 2010-08-29  Darin Adler  <darin at apple.com>
 
         Try to fix Windows build.
diff --git a/WebCore/dom/XMLDocumentParserLibxml2.cpp b/WebCore/dom/XMLDocumentParserLibxml2.cpp
index 320d37b..db94c50 100644
--- a/WebCore/dom/XMLDocumentParserLibxml2.cpp
+++ b/WebCore/dom/XMLDocumentParserLibxml2.cpp
@@ -361,6 +361,17 @@ private:
     unsigned m_currentOffset;
 };
 
+static void switchToUTF16(xmlParserCtxtPtr ctxt)
+{
+    // 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(ctxt, BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE);
+}
+
 static bool shouldAllowExternalLoad(const KURL& url)
 {
     String urlString = url.string();
@@ -476,9 +487,7 @@ PassRefPtr<XMLParserContext> XMLParserContext::createStringParser(xmlSAXHandlerP
     xmlParserCtxtPtr parser = xmlCreatePushParserCtxt(handlers, 0, 0, 0, 0);
     parser->_private = userData;
     parser->replaceEntities = true;
-    const UChar BOM = 0xFEFF;
-    const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM);
-    xmlSwitchEncoding(parser, BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE);
+    switchToUTF16(parser);
 
     return adoptRef(new XMLParserContext(parser));
 }
@@ -645,14 +654,7 @@ void XMLDocumentParser::doWrite(const String& parseString)
         // keep this alive until this function is done.
         RefPtr<XMLDocumentParser> protect(this);
 
-        // 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(context->context(), BOMHighByte == 0xFF ? XML_CHAR_ENCODING_UTF16LE : XML_CHAR_ENCODING_UTF16BE);
-
+        switchToUTF16(context->context());
         XMLDocumentParserScope scope(document()->docLoader());
         xmlParseChunk(context->context(), reinterpret_cast<const char*>(parseString.characters()), sizeof(UChar) * parseString.length(), 0);
 
@@ -1231,6 +1233,7 @@ static xmlEntityPtr getEntityHandler(void* closure, const xmlChar* name)
 static void startDocumentHandler(void* closure)
 {
     xmlParserCtxt* ctxt = static_cast<xmlParserCtxt*>(closure);
+    switchToUTF16(ctxt);
     getParser(closure)->startDocument(ctxt->version, ctxt->encoding, ctxt->standalone);
     xmlSAX2StartDocument(closure);
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list