TestHarness: XMLHttpRequest: setRequestHeader() name argument checks

XMLHttpRequest: setRequestHeader() name argument checks

By
ashishc9211 1 Seen 500 times
Tags
testharness w3c xhr spec
Run this test now.

Results


Tested on
Chrome - 63 - Windows 10
ResultTest NameMessage
PASSXHR setRequestHeader name -
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t: t
PASSXHR setRequestHeader name - t:t
PASSXHR setRequestHeader name - t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - :tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - t"t
PASSXHR setRequestHeader name - t,t
PASSXHR setRequestHeader name - t;t
PASSXHR setRequestHeader name - ()[]{}
PASSXHR setRequestHeader name - a?B
PASSXHR setRequestHeader name - X-テスト
PASSXHR setRequestHeader name - a=B

Tested on
Chrome Mobile - 41 - Android
ResultTest NameMessage
PASSXHR setRequestHeader name -
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t: t
PASSXHR setRequestHeader name - t:t
PASSXHR setRequestHeader name - t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - :tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - t"t
PASSXHR setRequestHeader name - t,t
PASSXHR setRequestHeader name - t;t
PASSXHR setRequestHeader name - ()[]{}
PASSXHR setRequestHeader name - a?B
PASSXHR setRequestHeader name - X-テスト
PASSXHR setRequestHeader name - a=B

Tested on
Firefox - 39 - Windows 7
ResultTest NameMessage
PASSXHR setRequestHeader name -
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t: t
PASSXHR setRequestHeader name - t:t
PASSXHR setRequestHeader name - t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - :tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - t"t
PASSXHR setRequestHeader name - t,t
PASSXHR setRequestHeader name - t;t
PASSXHR setRequestHeader name - ()[]{}
PASSXHR setRequestHeader name - a?B
FAILXHR setRequestHeader name - X-テストassert_throws: function "function () { client.setRequestHeader(name, 'x-value') }" threw object "TypeError: Cannot convert string to ByteString because th..." that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
PASSXHR setRequestHeader name - a=B

Tested on
Googlebot - 2.1 - undefined
ResultTest NameMessage
PASSXHR setRequestHeader name -
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t: t
PASSXHR setRequestHeader name - t:t
PASSXHR setRequestHeader name - t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - :tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - t"t
PASSXHR setRequestHeader name - t,t
PASSXHR setRequestHeader name - t;t
PASSXHR setRequestHeader name - ()[]{}
PASSXHR setRequestHeader name - a?B
PASSXHR setRequestHeader name - X-テスト
PASSXHR setRequestHeader name - a=B

Tested on
Safari - 7 - Mac OS X
ResultTest NameMessage
PASSXHR setRequestHeader name -
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t: t
PASSXHR setRequestHeader name - t:t
PASSXHR setRequestHeader name - t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - :tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - t"t
PASSXHR setRequestHeader name - t,t
PASSXHR setRequestHeader name - t;t
PASSXHR setRequestHeader name - ()[]{}
PASSXHR setRequestHeader name - a?B
PASSXHR setRequestHeader name - X-テスト
PASSXHR setRequestHeader name - a=B

Tested on
Opera - 47 - Windows 10
ResultTest NameMessage
PASSXHR setRequestHeader name -
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - t: t
PASSXHR setRequestHeader name - t:t
PASSXHR setRequestHeader name - t
PASSXHR setRequestHeader name - t t
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - :tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - tt
PASSXHR setRequestHeader name - t"t
PASSXHR setRequestHeader name - t,t
PASSXHR setRequestHeader name - t;t
PASSXHR setRequestHeader name - ()[]{}
PASSXHR setRequestHeader name - a?B
PASSXHR setRequestHeader name - X-テスト
PASSXHR setRequestHeader name - a=B

User Script (TESTHARNESS)

					
<html>
<head>
<script src="/public/js/testharness-domstorm.js"></script>


<script>
// The userScript for the Module
// W3C Testharness.js
// Turotial: http://darobin.github.io/test-harness-tutorial/docs/using-testharness.html
// W3c Platform Tests: https://github.com/w3c/web-platform-tests

function try_name(name) {
        test(function() {
          var client = new XMLHttpRequest()
          client.open("GET", "...")
          assert_throws("SyntaxError", function() { client.setRequestHeader(name, 'x-value') })
        }, 'XHR setRequestHeader name - ' + name)
      }
      try_name("")
      try_name("t\rt")
      try_name("t\nt")
      try_name("t: t")
      try_name("t:t")
      try_name("t<t")
      try_name("t t")
      try_name(" tt")
      try_name(":tt")
      try_name("\ttt")
      try_name("\vtt")
      try_name("t\0t")
      try_name("t\"t")
      try_name("t,t")
      try_name("t;t")
      try_name("()[]{}")
      try_name("a?B")
      try_name("X-テスト")
      try_name("a=B")
</script>

</head>
<body>
Testing using W3C TestHarness.js for XHR MEthods
</body>
</html>