tor-browser

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

002.html (1057B)


      1 <!doctype html>
      2 <title>WebSockets: setting constants</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 <div id=log></div>
      9 <script>
     10 // this test is testing WebIDL stuff
     11 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/');
     12 var constants = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
     13 for (var i = 0; i < constants.length; ++i) {
     14  test(function() {
     15    WebSocket[constants[i]] = 5; // should be ignored, has { ReadOnly }
     16    WebSocket.prototype[constants[i]] = 5; // should be ignored, has { ReadOnly }
     17    ws[constants[i]] = 5; // should be ignored, { ReadOnly } is inherited from prototype
     18    assert_equals(WebSocket[constants[i]], i, 'WebSocket.'+constants[i]);
     19    assert_equals(WebSocket.prototype[constants[i]], i, 'WebSocket.prototype.'+constants[i]);
     20    assert_equals(ws[constants[i]], i, 'ws.'+constants[i]);
     21  }, "Readonly constants " + constants[i]);
     22 };
     23 </script>