Commit 183c1ccf authored by mahesh.kk@samsung.com's avatar mahesh.kk@samsung.com

Deprecate support for xhr.withCredentials for synchronous requests

As per XML Level2 spec, withCredentials flag cannot be set on sync request.
http://xhr.spec.whatwg.org/#the-withcredentials-attribute
However for time being add useCounter and throw console warning to web developers.

Intent to deprecate - https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/BOgLhbdljU4

BUG=383483

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176532 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent fe7c417a
CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s
CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s
CONSOLE MESSAGE: line 10: sending a %s request to %s CONSOLE MESSAGE: line 10: sending a %s request to %s
...@@ -11,6 +12,7 @@ CONSOLE ERROR: XMLHttpRequest cannot load http://localhost:8000/inspector/resour ...@@ -11,6 +12,7 @@ CONSOLE ERROR: XMLHttpRequest cannot load http://localhost:8000/inspector/resour
Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled. Tests that XMLHttpRequest Logging works when Enabled and doesn't show logs when Disabled.
sending a GET request to resources/xhr-exists.html console-xhr-logging.html:10 sending a GET request to resources/xhr-exists.html console-xhr-logging.html:10
Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated. network-test.js:94
XHR finished loading: GET "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". network-test.js:97 XHR finished loading: GET "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". network-test.js:97
sending a GET request to resources/xhr-does-not-exist.html console-xhr-logging.html:10 sending a GET request to resources/xhr-does-not-exist.html console-xhr-logging.html:10
GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) network-test.js:97 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) network-test.js:97
......
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 6: XHR loaded: 1 CONSOLE MESSAGE: line 6: XHR loaded: 1
Tests conversion of Inspector's resource representation into HAR format. Tests conversion of Inspector's resource representation into HAR format.
......
CONSOLE ERROR: Not allowed to load local resource: index.html CONSOLE ERROR: Not allowed to load local resource: index.html
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 6: XHR loaded: 1 CONSOLE MESSAGE: line 6: XHR loaded: 1
Running: testNetworkResourceNonCached Running: testNetworkResourceNonCached
......
CONSOLE MESSAGE: line 13: Done. CONSOLE MESSAGE: line 13: Done.
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 6: XHR loaded: 1 CONSOLE MESSAGE: line 6: XHR loaded: 1
CONSOLE MESSAGE: line 6: XHR loaded: 2 CONSOLE MESSAGE: line 6: XHR loaded: 2
CONSOLE MESSAGE: line 6: XHR loaded: 3 CONSOLE MESSAGE: line 6: XHR loaded: 3
......
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 6: XHR loaded: 1 CONSOLE MESSAGE: line 6: XHR loaded: 1
CONSOLE MESSAGE: line 6: XHR loaded: 2 CONSOLE MESSAGE: line 6: XHR loaded: 2
Tests cyrillic xhr content is correctly loaded in inspector. Tests cyrillic xhr content is correctly loaded in inspector.
......
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 6: XHR loaded: 1 CONSOLE MESSAGE: line 6: XHR loaded: 1
CONSOLE MESSAGE: line 6: XHR loaded: 2 CONSOLE MESSAGE: line 6: XHR loaded: 2
Tests empty xhr content is correctly loaded in inspector. Tests empty xhr content is correctly loaded in inspector.
......
CONSOLE MESSAGE: line 6: XHR loaded: 1 CONSOLE MESSAGE: line 6: XHR loaded: 1
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 6: XHR loaded: 2 CONSOLE MESSAGE: line 6: XHR loaded: 2
CONSOLE MESSAGE: line 6: XHR loaded: 3 CONSOLE MESSAGE: line 6: XHR loaded: 3
CONSOLE MESSAGE: line 6: XHR loaded: 4 CONSOLE MESSAGE: line 6: XHR loaded: 4
......
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 6: XHR loaded: 1 CONSOLE MESSAGE: line 6: XHR loaded: 1
Tests XHR network resource type and content for synchronous requests. Bug 61205 Tests XHR network resource type and content for synchronous requests. Bug 61205
......
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
CONSOLE MESSAGE: line 6: XHR loaded: 1 CONSOLE MESSAGE: line 6: XHR loaded: 1
Tests that XHRs are not added to resourceTreeModel. Tests that XHRs are not added to resourceTreeModel.
......
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
Test case for bug 37781: [XHR] Cross-Origin synchronous request with credential raises NETWORK_ERR Test case for bug 37781: [XHR] Cross-Origin synchronous request with credential raises NETWORK_ERR
PASSED PASSED
......
CONSOLE WARNING: Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.
Start Start
Cross-origin XMLHttpRequest (sync), testing that cookies are not set when not sending credentials. Cross-origin XMLHttpRequest (sync), testing that cookies are not set when not sending credentials.
PASS: Finished sync xhr. PASS: Finished sync xhr.
......
...@@ -745,6 +745,9 @@ String UseCounter::deprecationMessage(Feature feature) ...@@ -745,6 +745,9 @@ String UseCounter::deprecationMessage(Feature feature)
case ElementSetPrefix: case ElementSetPrefix:
return "Setting 'Element.prefix' is deprecated, as it is read-only per DOM (http://dom.spec.whatwg.org/#element)."; return "Setting 'Element.prefix' is deprecated, as it is read-only per DOM (http://dom.spec.whatwg.org/#element).";
case SyncXHRWithCredentials:
return "Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated.";
// Features that aren't deprecated don't have a deprecation message. // Features that aren't deprecated don't have a deprecation message.
default: default:
return String(); return String();
......
...@@ -469,6 +469,7 @@ public: ...@@ -469,6 +469,7 @@ public:
CSSSelectorPseudoHost = 469, CSSSelectorPseudoHost = 469,
CSSSelectorPseudoHostContext = 470, CSSSelectorPseudoHostContext = 470,
CSSDeepCombinator = 471, CSSDeepCombinator = 471,
SyncXHRWithCredentials = 472,
// 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/
......
...@@ -487,6 +487,11 @@ void XMLHttpRequest::setWithCredentials(bool value, ExceptionState& exceptionSta ...@@ -487,6 +487,11 @@ void XMLHttpRequest::setWithCredentials(bool value, ExceptionState& exceptionSta
return; return;
} }
// FIXME: According to XMLHttpRequest Level 2 we should throw InvalidAccessError exception here.
// However for time being only print warning message to warn web developers.
if (!m_async)
UseCounter::countDeprecation(executionContext(), UseCounter::SyncXHRWithCredentials);
m_includeCredentials = value; m_includeCredentials = value;
} }
......
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