| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 Stream* XMLHttpRequest::responseStream() | 329 Stream* XMLHttpRequest::responseStream() |
| 330 { | 330 { |
| 331 ASSERT(m_responseTypeCode == ResponseTypeStream); | 331 ASSERT(m_responseTypeCode == ResponseTypeStream); |
| 332 | 332 |
| 333 if (m_error || (m_state != LOADING && m_state != DONE)) | 333 if (m_error || (m_state != LOADING && m_state != DONE)) |
| 334 return 0; | 334 return 0; |
| 335 | 335 |
| 336 return m_responseStream.get(); | 336 return m_responseStream.get(); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exception
State) | 339 void XMLHttpRequest::setTimeout(unsigned long timeoutMilliseconds, ExceptionStat
e& exceptionState) |
| 340 { | 340 { |
| 341 // FIXME: Need to trigger or update the timeout Timer here, if needed. http:
//webkit.org/b/98156 | 341 // FIXME: Need to trigger or update the timeout Timer here, if needed. http:
//webkit.org/b/98156 |
| 342 // XHR2 spec, 4.7.3. "This implies that the timeout attribute can be set whi
le fetching is in progress. If that occurs it will still be measured relative to
the start of fetching." | 342 // XHR2 spec, 4.7.3. "This implies that the timeout attribute can be set whi
le fetching is in progress. If that occurs it will still be measured relative to
the start of fetching." |
| 343 if (executionContext()->isDocument() && !m_async) { | 343 if (executionContext()->isDocument() && !m_async) { |
| 344 exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be
set for synchronous requests made from a document."); | 344 exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be
set for synchronous requests made from a document."); |
| 345 return; | 345 return; |
| 346 } | 346 } |
| 347 m_timeoutMilliseconds = timeout; | 347 m_timeoutMilliseconds = timeoutMilliseconds; |
| 348 |
| 349 // From http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute: |
| 350 // Note: This implies that the timeout attribute can be set while fetching i
s in progress. If |
| 351 // that occurs it will still be measured relative to the start of fetching. |
| 352 // |
| 353 // The timeout may be overridden after send. |
| 354 if (m_loader) |
| 355 m_loader->overrideTimeout(timeoutMilliseconds); |
| 348 } | 356 } |
| 349 | 357 |
| 350 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState&
exceptionState) | 358 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState&
exceptionState) |
| 351 { | 359 { |
| 352 if (m_state >= LOADING) { | 360 if (m_state >= LOADING) { |
| 353 exceptionState.throwDOMException(InvalidStateError, "The response type c
annot be set if the object's state is LOADING or DONE."); | 361 exceptionState.throwDOMException(InvalidStateError, "The response type c
annot be set if the object's state is LOADING or DONE."); |
| 354 return; | 362 return; |
| 355 } | 363 } |
| 356 | 364 |
| 357 // Newer functionality is not available to synchronous requests in window co
ntexts, as a spec-mandated | 365 // Newer functionality is not available to synchronous requests in window co
ntexts, as a spec-mandated |
| (...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 } | 1426 } |
| 1419 | 1427 |
| 1420 void XMLHttpRequest::trace(Visitor* visitor) | 1428 void XMLHttpRequest::trace(Visitor* visitor) |
| 1421 { | 1429 { |
| 1422 visitor->trace(m_responseBlob); | 1430 visitor->trace(m_responseBlob); |
| 1423 visitor->trace(m_responseStream); | 1431 visitor->trace(m_responseStream); |
| 1424 visitor->trace(m_progressEventThrottle); | 1432 visitor->trace(m_progressEventThrottle); |
| 1425 } | 1433 } |
| 1426 | 1434 |
| 1427 } // namespace WebCore | 1435 } // namespace WebCore |
| OLD | NEW |