tor-browser

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

test_network_basics.html (995B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for Network API</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      7 </head>
      8 <body>
      9 <p id="display"></p>
     10 <div id="content" style="display: none">
     11 </div>
     12 <pre id="test">
     13 <script type="application/javascript">
     14 
     15 /** Test for Network Information API */
     16 function test() {
     17  ok('connection' in navigator, "navigator.connection should exist");
     18 
     19  ok(navigator.connection, "navigator.connection returns an object");
     20 
     21  ok(navigator.connection instanceof EventTarget,
     22     "navigator.connection is a EventTarget object");
     23 
     24  ok('type' in navigator.connection,
     25     "type should be a Connection attribute");
     26  is(navigator.connection.type, "none",
     27     "By default connection.type equals to none");
     28 
     29  SimpleTest.finish();
     30 }
     31 
     32 SimpleTest.waitForExplicitFinish();
     33 SpecialPowers.pushPrefEnv({'set': [["dom.netinfo.enabled", true]]}, test);
     34 
     35 </script>
     36 </pre>
     37 </body>
     38 </html>