Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1604)

Unified Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 585873002: Show a warning when using sync xhr. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated TestExpectations to rebaseline for tests failing on mac and win. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« LayoutTests/TestExpectations ('K') | « Source/core/frame/UseCounter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLHttpRequest.cpp
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 03f4ee76bc6974be96338ece9b63ee3e41f7708e..4a52251a42d1120c4cfe880449e788b54c3b44dc 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -605,6 +605,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())
+ UseCounter::countDeprecation(executionContext(), UseCounter::XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload);
}
m_method = FetchUtils::normalizeMethod(method);
« LayoutTests/TestExpectations ('K') | « Source/core/frame/UseCounter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698