aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/xmlhttprequest.rs6
-rw-r--r--tests/wpt/metadata/xhr/headers-normalize-response.htm.ini12
2 files changed, 4 insertions, 14 deletions
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 51a10298cda..1953aeddb60 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -783,8 +783,10 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
if !first {
vec.extend(", ".as_bytes());
}
- first = false;
- vec.extend(value.as_bytes());
+ if let Ok(v) = str::from_utf8(value.as_bytes()).map(|s| s.trim().as_bytes()) {
+ vec.extend(v);
+ first = false;
+ }
vec
});
diff --git a/tests/wpt/metadata/xhr/headers-normalize-response.htm.ini b/tests/wpt/metadata/xhr/headers-normalize-response.htm.ini
index 01ee7293a40..1cc5c779bc8 100644
--- a/tests/wpt/metadata/xhr/headers-normalize-response.htm.ini
+++ b/tests/wpt/metadata/xhr/headers-normalize-response.htm.ini
@@ -6,15 +6,3 @@
[Header value: \\0hello_world]
expected: FAIL
- [Header value: hello_world[tab\]]
- expected: FAIL
-
- [Header value: [tab\]hello_world[tab\]]
- expected: FAIL
-
- [Header value: hello_world__]
- expected: FAIL
-
- [Header value: __hello_world__]
- expected: FAIL
-