OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> | 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> |
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> | 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> |
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. |
6 * Copyright (C) 2012 Intel Corporation | 6 * Copyright (C) 2012 Intel Corporation |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 m_responseDocumentParser->setDecoder(createDecoder()); | 1537 m_responseDocumentParser->setDecoder(createDecoder()); |
1538 | 1538 |
1539 m_responseDocumentParser->appendBytes(data, len); | 1539 m_responseDocumentParser->appendBytes(data, len); |
1540 } | 1540 } |
1541 | 1541 |
1542 PassOwnPtr<TextResourceDecoder> XMLHttpRequest::createDecoder() const | 1542 PassOwnPtr<TextResourceDecoder> XMLHttpRequest::createDecoder() const |
1543 { | 1543 { |
1544 if (m_responseTypeCode == ResponseTypeJSON) | 1544 if (m_responseTypeCode == ResponseTypeJSON) |
1545 return TextResourceDecoder::create("application/json", "UTF-8"); | 1545 return TextResourceDecoder::create("application/json", "UTF-8"); |
1546 | 1546 |
1547 if (!m_finalResponseCharset.isEmpty()) { | 1547 if (!m_finalResponseCharset.isEmpty()) |
1548 OwnPtr<TextResourceDecoder> decoder(TextResourceDecoder::create("text/pl
ain")); | 1548 return TextResourceDecoder::create("text/plain", m_finalResponseCharset)
; |
1549 decoder->setEncoding(WTF::TextEncoding(m_finalResponseCharset), TextReso
urceDecoder::EncodingFromHTTPHeader); | |
1550 return decoder.release(); | |
1551 } | |
1552 | 1549 |
1553 // allow TextResourceDecoder to look inside the m_response if it's XML or HT
ML | 1550 // allow TextResourceDecoder to look inside the m_response if it's XML or HT
ML |
1554 if (responseIsXML()) { | 1551 if (responseIsXML()) { |
1555 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("appli
cation/xml"); | 1552 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("appli
cation/xml"); |
1556 // Don't stop on encoding errors, unlike it is done for other kinds | 1553 // Don't stop on encoding errors, unlike it is done for other kinds |
1557 // of XML resources. This matches the behavior of previous WebKit | 1554 // of XML resources. This matches the behavior of previous WebKit |
1558 // versions, Firefox and Opera. | 1555 // versions, Firefox and Opera. |
1559 decoder->useLenientXMLDecoding(); | 1556 decoder->useLenientXMLDecoding(); |
1560 | 1557 |
1561 return decoder.release(); | 1558 return decoder.release(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 visitor->trace(m_responseDocumentParser); | 1703 visitor->trace(m_responseDocumentParser); |
1707 visitor->trace(m_progressEventThrottle); | 1704 visitor->trace(m_progressEventThrottle); |
1708 visitor->trace(m_upload); | 1705 visitor->trace(m_upload); |
1709 visitor->trace(m_blobLoader); | 1706 visitor->trace(m_blobLoader); |
1710 XMLHttpRequestEventTarget::trace(visitor); | 1707 XMLHttpRequestEventTarget::trace(visitor); |
1711 DocumentParserClient::trace(visitor); | 1708 DocumentParserClient::trace(visitor); |
1712 ActiveDOMObject::trace(visitor); | 1709 ActiveDOMObject::trace(visitor); |
1713 } | 1710 } |
1714 | 1711 |
1715 } // namespace blink | 1712 } // namespace blink |
OLD | NEW |