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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 { | 217 { |
218 if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != Respo
nseTypeText) { | 218 if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != Respo
nseTypeText) { |
219 es.throwDOMException(InvalidStateError, ExceptionMessages::failedToGet("
responseText", "XMLHttpRequest", "the value is only accessible if the object's '
responseType' is '' or 'text' (was '" + responseType() + "').")); | 219 es.throwDOMException(InvalidStateError, ExceptionMessages::failedToGet("
responseText", "XMLHttpRequest", "the value is only accessible if the object's '
responseType' is '' or 'text' (was '" + responseType() + "').")); |
220 return ScriptString(); | 220 return ScriptString(); |
221 } | 221 } |
222 if (m_error || (m_state != LOADING && m_state != DONE)) | 222 if (m_error || (m_state != LOADING && m_state != DONE)) |
223 return ScriptString(); | 223 return ScriptString(); |
224 return m_responseText; | 224 return m_responseText; |
225 } | 225 } |
226 | 226 |
227 ScriptString XMLHttpRequest::responseJSONSource(ExceptionState& es) | 227 ScriptString XMLHttpRequest::responseJSONSource() |
228 { | 228 { |
229 if (m_responseTypeCode != ResponseTypeJSON) { | 229 ASSERT(m_responseTypeCode == ResponseTypeJSON); |
230 es.throwDOMException(InvalidStateError); | 230 |
231 return ScriptString(); | |
232 } | |
233 if (m_error || m_state != DONE) | 231 if (m_error || m_state != DONE) |
234 return ScriptString(); | 232 return ScriptString(); |
235 return m_responseText; | 233 return m_responseText; |
236 } | 234 } |
237 | 235 |
238 Document* XMLHttpRequest::responseXML(ExceptionState& es) | 236 Document* XMLHttpRequest::responseXML(ExceptionState& es) |
239 { | 237 { |
240 if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != Respo
nseTypeDocument) { | 238 if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != Respo
nseTypeDocument) { |
241 es.throwDOMException(InvalidStateError, ExceptionMessages::failedToGet("
responseXML", "XMLHttpRequest", "the value is only accessible if the object's 'r
esponseType' is '' or 'document' (was '" + responseType() + "').")); | 239 es.throwDOMException(InvalidStateError, ExceptionMessages::failedToGet("
responseXML", "XMLHttpRequest", "the value is only accessible if the object's 'r
esponseType' is '' or 'document' (was '" + responseType() + "').")); |
242 return 0; | 240 return 0; |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 { | 1257 { |
1260 return eventNames().interfaceForXMLHttpRequest; | 1258 return eventNames().interfaceForXMLHttpRequest; |
1261 } | 1259 } |
1262 | 1260 |
1263 ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const | 1261 ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const |
1264 { | 1262 { |
1265 return ActiveDOMObject::scriptExecutionContext(); | 1263 return ActiveDOMObject::scriptExecutionContext(); |
1266 } | 1264 } |
1267 | 1265 |
1268 } // namespace WebCore | 1266 } // namespace WebCore |
OLD | NEW |