Index: LayoutTests/http/tests/xmlhttprequest/header-value-update/normalize-unaffected.html |
diff --git a/LayoutTests/http/tests/xmlhttprequest/header-value-update/normalize-unaffected.html b/LayoutTests/http/tests/xmlhttprequest/header-value-update/normalize-unaffected.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..04c4accc77927c6c6adabebf11b204020a8abb18 |
--- /dev/null |
+++ b/LayoutTests/http/tests/xmlhttprequest/header-value-update/normalize-unaffected.html |
@@ -0,0 +1,34 @@ |
+<!doctype html> |
+<head> |
+<script src = "../../resources/testharness.js"></script> |
+<script src = "../../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+<script> |
+// Normalization will remove leading/trailing whitespaces, but has no |
+// effect because the whitespaces are already stripped before the request |
+// is sent to the network. |
+// https://fetch.spec.whatwg.org/#concept-header-value-normalize |
+// https://crbug.com/455099 |
+async_test(function(t) { |
+ var xhr = new XMLHttpRequest; |
+ xhr.open("GET", "../resources/print-headers.cgi"); |
+ console.error('This error is added to avoid presubmit errors for -expected.txt with no CONSOLE WARNING. This is testing that no CONSOLE WARNING is shown for setRequestHeader().'); |
+ |
+ xhr.setRequestHeader('test1', ' a '); |
+ xhr.setRequestHeader('test2', '\ta\t'); |
+ |
+ xhr.onload = t.step_func(function() { |
+ assert_regexp_match(xhr.responseText, /HTTP_TEST1: a\r?\n/, |
+ 'Leading/trailing whitespaces (0x20) are already stripped.'); |
+ assert_regexp_match(xhr.responseText, /HTTP_TEST2: a\r?\n/, |
+ 'Leading/trailing whitespaces (0x09) are already stripped.'); |
+ t.done(); |
+ }); |
+ xhr.onerror = t.unreached_func('should not fail'); |
+ xhr.send(); |
+ }, 'single setRequestHeader() with leading/trailing whitespaces'); |
+ |
+done(); |
+</script> |
+</body> |