| Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/header-value-update/normalize-unaffected.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/header-value-update/normalize-unaffected.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/header-value-update/normalize-unaffected.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..04dd6c0567a2883574aacfdf945c48ade12726f5
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/header-value-update/normalize-unaffected.html
|
| @@ -0,0 +1,42 @@
|
| +<!doctype html>
|
| +<script src="/js-test-resources/js-test.js"></script>
|
| +<script>
|
| +window.jsTestIsAsync = true;
|
| +description('A single call to XMLHttpRequest.setRequestHeader() with ' +
|
| + 'a header value with leading/trailing whitespaces ' +
|
| + 'should not show a deprecation message.');
|
| +
|
| +// According to the XHR spec [1], normalization (removing leading/trailing
|
| +// whitespaces) must be done on the value argument on setRequestHeader() call.
|
| +// Currently Blink's XHR implementation doesn't do the normalization, but other
|
| +// parts of Chromium do the normalization after setRequestHeader() and before
|
| +// headers are sent to network.
|
| +// A deprecation warning should be shown if the headers sent to the network is
|
| +// affected by introducing header value normalization in Blink's XHR.
|
| +// [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader
|
| +// https://crbug.com/455099
|
| +
|
| +var xhr = new XMLHttpRequest;
|
| +xhr.open("GET", "../resources/print-headers.cgi");
|
| +
|
| +// The leading/trailing whitespaces are removed by Chromium after
|
| +// setRequestHeader() if there aren't multiple setRequestHeader() calls with
|
| +// the same header name, so normalization in Blink's XHR wouldn't affect and
|
| +// no deprecation warnings should be shown.
|
| +xhr.setRequestHeader('test1', ' a ');
|
| +xhr.setRequestHeader('test2', '\ta\t');
|
| +
|
| +xhr.onload = function() {
|
| + // This expectation must be updated once we update header value checks.
|
| + shouldNotBe('xhr.responseText.match(/HTTP_TEST1: a\\r?\\n/)',
|
| + 'null');
|
| + shouldNotBe('xhr.responseText.match(/HTTP_TEST2: a\\r?\\n/)',
|
| + 'null');
|
| + finishJSTest();
|
| +};
|
| +xhr.onerror = function() {
|
| + testFailed();
|
| + finishJSTest();
|
| +};
|
| +xhr.send();
|
| +</script>
|
|
|