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

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

Issue 585873002: Show a warning when using sync xhr. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added needsrebaseline for win_rel. Created 6 years, 1 month 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
« no previous file with comments | « 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/xmlhttprequest/XMLHttpRequest.cpp
diff --git a/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index b8063eb211674de9460382b8ec5aa006237c59f2..1a0f384f29ac10dc54ad90f00361530879f3297c 100644
--- a/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -607,6 +607,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);
« no previous file with comments | « Source/core/frame/UseCounter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698