Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1979103003: Revert "Reland "UTF-8 detector for pages missing encoding info"" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 m_responseDocumentParser->setDecoder(createDecoder()); 1544 m_responseDocumentParser->setDecoder(createDecoder());
1545 1545
1546 m_responseDocumentParser->appendBytes(data, len); 1546 m_responseDocumentParser->appendBytes(data, len);
1547 } 1547 }
1548 1548
1549 PassOwnPtr<TextResourceDecoder> XMLHttpRequest::createDecoder() const 1549 PassOwnPtr<TextResourceDecoder> XMLHttpRequest::createDecoder() const
1550 { 1550 {
1551 if (m_responseTypeCode == ResponseTypeJSON) 1551 if (m_responseTypeCode == ResponseTypeJSON)
1552 return TextResourceDecoder::create("application/json", "UTF-8"); 1552 return TextResourceDecoder::create("application/json", "UTF-8");
1553 1553
1554 if (!m_finalResponseCharset.isEmpty()) { 1554 if (!m_finalResponseCharset.isEmpty())
1555 OwnPtr<TextResourceDecoder> decoder(TextResourceDecoder::create("text/pl ain")); 1555 return TextResourceDecoder::create("text/plain", m_finalResponseCharset) ;
1556 decoder->setEncoding(WTF::TextEncoding(m_finalResponseCharset), TextReso urceDecoder::EncodingFromHTTPHeader);
1557 return decoder;
1558 }
1559 1556
1560 // allow TextResourceDecoder to look inside the m_response if it's XML or HT ML 1557 // allow TextResourceDecoder to look inside the m_response if it's XML or HT ML
1561 if (responseIsXML()) { 1558 if (responseIsXML()) {
1562 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("appli cation/xml"); 1559 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("appli cation/xml");
1563 // Don't stop on encoding errors, unlike it is done for other kinds 1560 // Don't stop on encoding errors, unlike it is done for other kinds
1564 // of XML resources. This matches the behavior of previous WebKit 1561 // of XML resources. This matches the behavior of previous WebKit
1565 // versions, Firefox and Opera. 1562 // versions, Firefox and Opera.
1566 decoder->useLenientXMLDecoding(); 1563 decoder->useLenientXMLDecoding();
1567 1564
1568 return decoder; 1565 return decoder;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 visitor->trace(m_responseArrayBuffer); 1711 visitor->trace(m_responseArrayBuffer);
1715 visitor->trace(m_progressEventThrottle); 1712 visitor->trace(m_progressEventThrottle);
1716 visitor->trace(m_upload); 1713 visitor->trace(m_upload);
1717 visitor->trace(m_blobLoader); 1714 visitor->trace(m_blobLoader);
1718 XMLHttpRequestEventTarget::trace(visitor); 1715 XMLHttpRequestEventTarget::trace(visitor);
1719 DocumentParserClient::trace(visitor); 1716 DocumentParserClient::trace(visitor);
1720 ActiveDOMObject::trace(visitor); 1717 ActiveDOMObject::trace(visitor);
1721 } 1718 }
1722 1719
1723 } // namespace blink 1720 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698