Chromium Code Reviews| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 if (m_responseTypeCode != ResponseTypeDefault) { | 583 if (m_responseTypeCode != ResponseTypeDefault) { |
| 584 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests from a document must not set a response type."); | 584 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests from a document must not set a response type."); |
| 585 return; | 585 return; |
| 586 } | 586 } |
| 587 | 587 |
| 588 // Similarly, timeouts are disabled for synchronous requests as well. | 588 // Similarly, timeouts are disabled for synchronous requests as well. |
| 589 if (m_timeoutMilliseconds > 0) { | 589 if (m_timeoutMilliseconds > 0) { |
| 590 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests must not set a timeout."); | 590 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests must not set a timeout."); |
| 591 return; | 591 return; |
| 592 } | 592 } |
| 593 | |
| 594 // Here we just warn that firing sync XHR's may affect responsiveness. | |
| 595 // Eventually sync xhr will be deprecated and an "InvalidAccessError" ex ception thrown. | |
| 596 // Refer : https://xhr.spec.whatwg.org/#sync-warning | |
| 597 // Use count for XHR synchronous requests on main thread only. | |
| 598 if (!document()->processingBeforeUnload()) | |
| 599 UseCounter::countDeprecation(executionContext(), UseCounter::XMLHttp RequestSynchronous); | |
|
kouhei (in TOK)
2014/10/14 05:08:49
I'm still worried about this change. This will bre
| |
| 593 } | 600 } |
| 594 | 601 |
| 595 m_method = uppercaseKnownHTTPMethod(method); | 602 m_method = uppercaseKnownHTTPMethod(method); |
| 596 | 603 |
| 597 m_url = url; | 604 m_url = url; |
| 598 | 605 |
| 599 m_async = async; | 606 m_async = async; |
| 600 | 607 |
| 601 ASSERT(!m_loader); | 608 ASSERT(!m_loader); |
| 602 | 609 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 872 if (m_async) { | 879 if (m_async) { |
| 873 if (m_upload) | 880 if (m_upload) |
| 874 request.setReportUploadProgress(true); | 881 request.setReportUploadProgress(true); |
| 875 | 882 |
| 876 // ThreadableLoader::create can return null here, for example if we're n o longer attached to a page. | 883 // ThreadableLoader::create can return null here, for example if we're n o longer attached to a page. |
| 877 // This is true while running onunload handlers. | 884 // This is true while running onunload handlers. |
| 878 // FIXME: Maybe we need to be able to send XMLHttpRequests from onunload , <http://bugs.webkit.org/show_bug.cgi?id=10904>. | 885 // FIXME: Maybe we need to be able to send XMLHttpRequests from onunload , <http://bugs.webkit.org/show_bug.cgi?id=10904>. |
| 879 // FIXME: Maybe create() can return null for other reasons too? | 886 // FIXME: Maybe create() can return null for other reasons too? |
| 880 ASSERT(!m_loader); | 887 ASSERT(!m_loader); |
| 881 m_loader = ThreadableLoader::create(executionContext, this, request, opt ions, resourceLoaderOptions); | 888 m_loader = ThreadableLoader::create(executionContext, this, request, opt ions, resourceLoaderOptions); |
| 882 } else { | 889 } else |
| 883 // Use count for XHR synchronous requests. | |
| 884 UseCounter::count(&executionContext, UseCounter::XMLHttpRequestSynchrono us); | |
| 885 ThreadableLoader::loadResourceSynchronously(executionContext, request, * this, options, resourceLoaderOptions); | 890 ThreadableLoader::loadResourceSynchronously(executionContext, request, * this, options, resourceLoaderOptions); |
| 886 } | |
| 887 | 891 |
| 888 if (!m_exceptionCode && m_error) | 892 if (!m_exceptionCode && m_error) |
| 889 m_exceptionCode = NetworkError; | 893 m_exceptionCode = NetworkError; |
| 890 if (m_exceptionCode) | 894 if (m_exceptionCode) |
| 891 exceptionState.throwDOMException(m_exceptionCode, "Failed to load '" + m _url.elidedString() + "'."); | 895 exceptionState.throwDOMException(m_exceptionCode, "Failed to load '" + m _url.elidedString() + "'."); |
| 892 } | 896 } |
| 893 | 897 |
| 894 void XMLHttpRequest::abort() | 898 void XMLHttpRequest::abort() |
| 895 { | 899 { |
| 896 WTF_LOG(Network, "XMLHttpRequest %p abort()", this); | 900 WTF_LOG(Network, "XMLHttpRequest %p abort()", this); |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1570 visitor->trace(m_responseStream); | 1574 visitor->trace(m_responseStream); |
| 1571 visitor->trace(m_streamSource); | 1575 visitor->trace(m_streamSource); |
| 1572 visitor->trace(m_responseDocument); | 1576 visitor->trace(m_responseDocument); |
| 1573 visitor->trace(m_responseDocumentParser); | 1577 visitor->trace(m_responseDocumentParser); |
| 1574 visitor->trace(m_progressEventThrottle); | 1578 visitor->trace(m_progressEventThrottle); |
| 1575 visitor->trace(m_upload); | 1579 visitor->trace(m_upload); |
| 1576 XMLHttpRequestEventTarget::trace(visitor); | 1580 XMLHttpRequestEventTarget::trace(visitor); |
| 1577 } | 1581 } |
| 1578 | 1582 |
| 1579 } // namespace blink | 1583 } // namespace blink |
| OLD | NEW |