Commit 9459f56d authored by mahesh.kk@samsung.com's avatar mahesh.kk@samsung.com

Add UseCounter for synchronous XMLHttpRequests

This patch adds a UseCounter for only synchronous XMLHttpRequests.
This will count exactly once per per page using sync XHR requests.

Review URL: https://codereview.chromium.org/337283003

git-svn-id: svn://svn.chromium.org/blink/trunk@176351 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 859cec9d
...@@ -462,6 +462,7 @@ public: ...@@ -462,6 +462,7 @@ public:
EditingAppleTabSpanClass = 462, EditingAppleTabSpanClass = 462,
HTMLImportsAsyncAttribute = 463, HTMLImportsAsyncAttribute = 463,
FontFaceSetReady = 464, FontFaceSetReady = 464,
XMLHttpRequestSynchronous = 465,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
// Also, run update_use_counter_feature_enum.py in chromium/src/tools/metrics/histograms/ // Also, run update_use_counter_feature_enum.py in chromium/src/tools/metrics/histograms/
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include "core/fileapi/Blob.h" #include "core/fileapi/Blob.h"
#include "core/fileapi/File.h" #include "core/fileapi/File.h"
#include "core/fileapi/Stream.h" #include "core/fileapi/Stream.h"
#include "core/frame/Settings.h"
#include "core/frame/UseCounter.h"
#include "core/frame/csp/ContentSecurityPolicy.h" #include "core/frame/csp/ContentSecurityPolicy.h"
#include "core/html/DOMFormData.h" #include "core/html/DOMFormData.h"
#include "core/html/HTMLDocument.h" #include "core/html/HTMLDocument.h"
...@@ -42,7 +44,6 @@ ...@@ -42,7 +44,6 @@
#include "core/inspector/InspectorInstrumentation.h" #include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTraceEvents.h" #include "core/inspector/InspectorTraceEvents.h"
#include "core/loader/ThreadableLoader.h" #include "core/loader/ThreadableLoader.h"
#include "core/frame/Settings.h"
#include "core/xml/XMLHttpRequestProgressEvent.h" #include "core/xml/XMLHttpRequestProgressEvent.h"
#include "core/xml/XMLHttpRequestUpload.h" #include "core/xml/XMLHttpRequestUpload.h"
#include "platform/Logging.h" #include "platform/Logging.h"
...@@ -572,6 +573,9 @@ void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn ...@@ -572,6 +573,9 @@ void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn
} }
if (!async && executionContext()->isDocument()) { if (!async && executionContext()->isDocument()) {
// Use count for XHR synchronous requests.
UseCounter::count(document(), UseCounter::XMLHttpRequestSynchronous);
if (document()->settings() && !document()->settings()->syncXHRInDocumentsEnabled()) { if (document()->settings() && !document()->settings()->syncXHRInDocumentsEnabled()) {
exceptionState.throwDOMException(InvalidAccessError, "Synchronous requests are disabled for this page."); exceptionState.throwDOMException(InvalidAccessError, "Synchronous requests are disabled for this page.");
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment