tor-browser

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

wpt-server-websocket.sub.html (2939B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <title>WPT Server checker</title>
      5    <meta charset="utf-8" />
      6    <script src="/resources/testharness.js"></script>
      7    <script src="/resources/testharnessreport.js"></script>
      8  </head>
      9 </body>
     10 <body>
     11 <script>
     12 function check(protocol, domain, port, done) {
     13  var url = protocol + '://' + domain + ':' + port + '/echo';
     14  var ws = new WebSocket(url);
     15 
     16  ws.addEventListener('error', function() {
     17    done(false);
     18  });
     19 
     20  ws.addEventListener('open', function() {
     21    done(true);
     22  });
     23 }
     24 
     25 async_test(function(t) {
     26  check('ws', '{{browser_host}}', {{ports[ws][0]}}, t.step_func(function(result) {
     27    assert_true(result);
     28 
     29    t.done();
     30  }));
     31 }, 'WS protocol, no subdomain');
     32 
     33 async_test(function(t) {
     34  check('ws', '{{domains[www1]}}', {{ports[ws][0]}}, t.step_func(function(result) {
     35    assert_true(result);
     36 
     37    t.done();
     38  }));
     39 }, 'WS protocol, www subdomain #1');
     40 
     41 async_test(function(t) {
     42  check('ws', '{{domains[www1]}}', {{ports[ws][0]}}, t.step_func(function(result) {
     43    assert_true(result);
     44 
     45    t.done();
     46  }));
     47 }, 'WS protocol, www subdomain #2');
     48 
     49 async_test(function(t) {
     50  check('ws', '{{domains[www2]}}', {{ports[ws][0]}}, t.step_func(function(result) {
     51    assert_true(result);
     52 
     53    t.done();
     54  }));
     55 }, 'WS protocol, www subdomain #3');
     56 
     57 async_test(function(t) {
     58  check('ws', '{{domains[élève]}}', {{ports[ws][0]}}, t.step_func(function(result) {
     59    assert_true(result);
     60 
     61    t.done();
     62  }));
     63 }, 'WS protocol, punycode subdomain #1');
     64 
     65 async_test(function(t) {
     66  check('ws', '{{domains[天気の良い日]}}', {{ports[ws][0]}}, t.step_func(function(result) {
     67    assert_true(result);
     68 
     69    t.done();
     70  }));
     71 }, 'WS protocol, punycode subdomain #2');
     72 
     73 async_test(function(t) {
     74  check('wss', '{{browser_host}}', {{ports[wss][0]}}, t.step_func(function(result) {
     75    assert_true(result);
     76 
     77    t.done();
     78  }));
     79 }, 'WSS protocol, no subdomain');
     80 
     81 async_test(function(t) {
     82  check('wss', '{{domains[www1]}}', {{ports[wss][0]}}, t.step_func(function(result) {
     83    assert_true(result);
     84 
     85    t.done();
     86  }));
     87 }, 'WSS protocol, www subdomain #1');
     88 
     89 async_test(function(t) {
     90  check('wss', '{{domains[www1]}}', {{ports[wss][0]}}, t.step_func(function(result) {
     91    assert_true(result);
     92 
     93    t.done();
     94  }));
     95 }, 'WSS protocol, www subdomain #2');
     96 
     97 async_test(function(t) {
     98  check('wss', '{{domains[www2]}}', {{ports[wss][0]}}, t.step_func(function(result) {
     99    assert_true(result);
    100 
    101    t.done();
    102  }));
    103 }, 'WSS protocol, www subdomain #3');
    104 
    105 async_test(function(t) {
    106  check('wss', '{{domains[élève]}}', {{ports[wss][0]}}, t.step_func(function(result) {
    107    assert_true(result);
    108 
    109    t.done();
    110  }));
    111 }, 'WSS protocol, punycode subdomain #1');
    112 
    113 async_test(function(t) {
    114  check('wss', '{{domains[天気の良い日]}}', {{ports[wss][0]}}, t.step_func(function(result) {
    115    assert_true(result);
    116 
    117    t.done();
    118  }));
    119 }, 'WSS protocol, punycode subdomain #2');
    120 </script>
    121 </body>
    122 </html>