Index: Source/core/xml/XMLHttpRequest.cpp |
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp |
index 69986e041d2e82d180eab8f692b98c05f61ad237..dbfc7f853e3cbcfe29bf5ecbacc74b5e30494878 100644 |
--- a/Source/core/xml/XMLHttpRequest.cpp |
+++ b/Source/core/xml/XMLHttpRequest.cpp |
@@ -590,6 +590,13 @@ void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn |
exceptionState.throwDOMException(InvalidAccessError, "Synchronous requests must not set a timeout."); |
return; |
} |
+ |
+ // Here we just warn that firing sync XHR's may affect responsiveness. |
+ // Eventually sync xhr will be deprecated and an "InvalidAccessError" exception thrown. |
+ // Refer : https://xhr.spec.whatwg.org/#sync-warning |
+ // Use count for XHR synchronous requests on main thread only. |
+ if (!document()->processingBeforeUnload()) |
kouhei (in TOK)
2014/10/07 23:21:18
Ditto: !unloadStarted() ?
|
+ UseCounter::countDeprecation(executionContext(), UseCounter::XMLHttpRequestSynchronous); |
kouhei (in TOK)
2014/10/07 23:21:18
I don't think we should move callsite of existing
Mayur Kankanwadi
2014/10/08 10:14:25
If we use UseCounter::countDeprecation here, then
|
} |
m_method = uppercaseKnownHTTPMethod(method); |
@@ -879,11 +886,8 @@ void XMLHttpRequest::createRequest(PassRefPtr<FormData> httpBody, ExceptionState |
// FIXME: Maybe create() can return null for other reasons too? |
ASSERT(!m_loader); |
m_loader = ThreadableLoader::create(executionContext, this, request, options, resourceLoaderOptions); |
- } else { |
- // Use count for XHR synchronous requests. |
- UseCounter::count(&executionContext, UseCounter::XMLHttpRequestSynchronous); |
+ } else |
kouhei (in TOK)
2014/10/07 23:21:18
Ditto
|
ThreadableLoader::loadResourceSynchronously(executionContext, request, *this, options, resourceLoaderOptions); |
- } |
if (!m_exceptionCode && m_error) |
m_exceptionCode = NetworkError; |