tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

004.html (1133B)


      1 <!doctype html>
      2 <title>WebSockets: new WebSocket(url, invalid protocol)</title>
      3 <script src=/resources/testharness.js></script>
      4 <script src=/resources/testharnessreport.js></script>
      5 <script src=../constants.sub.js></script>
      6 <meta name="variant" content="?default">
      7 <meta name="variant" content="?wss">
      8 <meta name="variant" content="?wpt_flags=h2">
      9 <div id=log></div>
     10 <script>
     11 // empty string
     12 test(function() {
     13  assert_throws_dom("SyntaxError", function() {
     14    new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message', "")
     15  })
     16 });
     17 
     18 // chars below U+0020 except U+0000; U+0000 is tested in a separate test
     19 for (var i = 1; i < 0x20; ++i) {
     20  test(function() {
     21    assert_throws_dom("SyntaxError", function() {
     22      new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message',
     23                    "a"+String.fromCharCode(i)+"b")
     24    }, 'char code '+i);
     25  })
     26 }
     27 // some chars above U+007E
     28 for (var i = 0x7F; i < 0x100; ++i) {
     29  test(function() {
     30    assert_throws_dom("SyntaxError", function() {
     31      new WebSocket(SCHEME_DOMAIN_PORT + '/empty-message',
     32                    "a"+String.fromCharCode(i)+"b")
     33    }, 'char code '+i);
     34  })
     35 }
     36 </script>