Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: http3 OR http2
- Manifest: dom/base/test/mochitest.toml
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="test_headers_append();">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
function test_headers_append()
{
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.setRequestHeader("X-appended-to-this", "True");
xhr.setRequestHeader("X-appended-to-this", "False");
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
is(xhr.getResponseHeader("X-appended-result"), "True, False", "Headers should have been appended.");
test_headers_clear();
}
}
xhr.send();
}
function test_headers_clear()
{
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.setRequestHeader("X-appended-to-this", "True");
xhr.setRequestHeader("Accept", "foo/bar");
xhr.open("GET", url);
xhr.setRequestHeader("X-appended-to-this", "True");
xhr.setRequestHeader("Accept", "bar/foo");
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
is(xhr.getResponseHeader("X-Accept-Result"), "bar/foo", "Set headers record should have been cleared by open.");
SimpleTest.finish();
}
}
xhr.send();
}
</script>
</pre>
</body>
</html>