| 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 David Levin <levin@chromium.org> | 5 * Copyright (C) 2008 David Levin <levin@chromium.org> |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 if (m_inPreflight) | 1268 if (m_inPreflight) |
| 1269 return; | 1269 return; |
| 1270 | 1270 |
| 1271 if (m_state < HEADERS_RECEIVED) | 1271 if (m_state < HEADERS_RECEIVED) |
| 1272 changeState(HEADERS_RECEIVED); | 1272 changeState(HEADERS_RECEIVED); |
| 1273 | 1273 |
| 1274 if (!m_decoder) { | 1274 if (!m_decoder) { |
| 1275 if (!m_responseEncoding.isEmpty()) | 1275 if (!m_responseEncoding.isEmpty()) |
| 1276 m_decoder = TextResourceDecoder::create("text/plain", m_responseEnco
ding); | 1276 m_decoder = TextResourceDecoder::create("text/plain", m_responseEnco
ding); |
| 1277 // allow TextResourceDecoder to look inside the m_response if it's XML o
r HTML | 1277 // allow TextResourceDecoder to look inside the m_response if it's XML o
r HTML |
| 1278 else if (responseIsXML()) | 1278 else if (responseIsXML()) { |
| 1279 m_decoder = TextResourceDecoder::create("application/xml"); | 1279 m_decoder = TextResourceDecoder::create("application/xml"); |
| 1280 else if (responseMIMEType() == "text/html") | 1280 // Don't stop on encoding errors, unlike it is done for other kinds
of XML resources. This matches the behavior of previous WebKit versions, Firefox
and Opera. |
| 1281 m_decoder->useLenientXMLDecoding(); |
| 1282 } else if (responseMIMEType() == "text/html") |
| 1281 m_decoder = TextResourceDecoder::create("text/html", "UTF-8"); | 1283 m_decoder = TextResourceDecoder::create("text/html", "UTF-8"); |
| 1282 else | 1284 else |
| 1283 m_decoder = TextResourceDecoder::create("text/plain", "UTF-8"); | 1285 m_decoder = TextResourceDecoder::create("text/plain", "UTF-8"); |
| 1284 } | 1286 } |
| 1287 |
| 1285 if (!len) | 1288 if (!len) |
| 1286 return; | 1289 return; |
| 1287 | 1290 |
| 1288 if (len == -1) | 1291 if (len == -1) |
| 1289 len = strlen(data); | 1292 len = strlen(data); |
| 1290 | 1293 |
| 1291 m_responseText += m_decoder->decode(data, len); | 1294 m_responseText += m_decoder->decode(data, len); |
| 1292 | 1295 |
| 1293 if (!m_error) { | 1296 if (!m_error) { |
| 1294 updateAndDispatchOnProgress(len); | 1297 updateAndDispatchOnProgress(len); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 ASSERT(!m_loader); | 1383 ASSERT(!m_loader); |
| 1381 ActiveDOMObject::contextDestroyed(); | 1384 ActiveDOMObject::contextDestroyed(); |
| 1382 } | 1385 } |
| 1383 | 1386 |
| 1384 ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const | 1387 ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const |
| 1385 { | 1388 { |
| 1386 return ActiveDOMObject::scriptExecutionContext(); | 1389 return ActiveDOMObject::scriptExecutionContext(); |
| 1387 } | 1390 } |
| 1388 | 1391 |
| 1389 } // namespace WebCore | 1392 } // namespace WebCore |
| OLD | NEW |