tor-browser

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

test_bug336682_2.xhtml (1694B)


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