tor-browser

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

test_bug336682_1.html (1460B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 Bug 336682: online/offline events tests.
      5 
      6 Any copyright is dedicated to the Public Domain.
      7 http://creativecommons.org/licenses/publicdomain/
      8 -->
      9 <head>
     10  <title>Test for Bug 336682 (online/offline events)</title>
     11  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     12  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     13 </head>
     14 <body ononline="trace('<body ononline=...>');
     15                bodyOnonline(this, event)"
     16      onoffline="trace('<body onoffline=...>'); bodyOnoffline(this, event)"
     17      >
     18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=336682">Mozilla Bug 336682</a>
     19 <p id="display"></p>
     20 <div id="content" style="display: none">
     21  
     22 </div>
     23 <pre id="test">
     24 </pre>
     25 <script type="text/javascript" src="test_bug336682.js"></script>
     26 
     27 <script class="testbody" type="text/javascript">
     28 
     29 function makeBodyHandler(eventName) {
     30  return function (aThis, aEvent) {
     31    var handler = makeHandler("<body on%1='...'>", eventName, [1]);
     32    handler(aEvent);
     33  }
     34 }
     35 addLoadEvent(function() {
     36  /** @see test_bug336682.js */
     37  MAX_STATE = 2;
     38 
     39  for (var event of ["online", "offline"]) {
     40    window["bodyOn" + event] = makeBodyHandler(event);
     41 
     42    window.addEventListener(
     43      event,
     44      makeHandler("window.addEventListener('%1', ..., false)",
     45                  event, [2]));
     46  }
     47 
     48  doTest();
     49  SimpleTest.finish();
     50 });
     51 
     52 SimpleTest.waitForExplicitFinish();
     53 </script>
     54 </body>
     55 </html>