tor-browser

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

test_bug795275.xhtml (2520B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
      3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
      4 <!--
      5 https://bugzilla.mozilla.org/show_bug.cgi?id=795275
      6 -->
      7 <window title="Mozilla Bug 795275"
      8        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
     10 
     11  <!-- test results are displayed in the html:body -->
     12  <body xmlns="http://www.w3.org/1999/xhtml">
     13  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=795275"
     14     target="_blank">Mozilla Bug 795275</a>
     15  </body>
     16 
     17  <!-- test code goes here -->
     18  <script type="application/javascript">
     19  <![CDATA[
     20  /** Test for Warning in content scopes about Components. */
     21 
     22  SimpleTest.waitForExplicitFinish();
     23  SimpleTest.executeSoon(function() {
     24    SpecialPowers.pushPrefEnv({set: [["dom.use_components_shim", true]]},
     25                              startLoad)
     26  });
     27  function startLoad() {
     28    for (var i = 1; i <= document.getElementsByTagName('iframe').length; ++i) {
     29      var frame = document.getElementById('frame' + i);
     30      frame.contentWindow.location = 'http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_bug795275.html';
     31      frame.onload = frameLoaded;
     32    }
     33  }
     34 
     35  // Set up our console listener.
     36  var gWarnings = 0;
     37  function onWarning(consoleMessage) {
     38    if (/soon be removed/.test(consoleMessage.message))
     39      gWarnings++;
     40  }
     41  var gListener = {
     42    observe: onWarning,
     43    QueryInterface: ChromeUtils.generateQI(["nsIConsoleListener"])
     44  };
     45  Services.console.registerListener(gListener);
     46 
     47  // Wait for all four child frame to load.
     48  var gLoadCount = 0;
     49  function frameLoaded() {
     50    if (++gLoadCount == document.getElementsByTagName('iframe').length)
     51      go();
     52  }
     53 
     54  function getWin(id) { return document.getElementById(id).contentWindow.wrappedJSObject; }
     55  function go() {
     56    getWin('frame1').touchComponents();
     57    getWin('frame2').touchInterfaces();
     58    getWin('frame4').touchComponents();
     59    getWin('frame4').touchInterfaces();
     60 
     61    // Warnings are dispatched async, so stick ourselves at the end of the event
     62    // queue.
     63    setTimeout(done, 0);
     64  }
     65 
     66  function done() {
     67    Services.console.unregisterListener(gListener);
     68    is(gWarnings, 3, "Got the right number of warnings");
     69    SimpleTest.finish();
     70  }
     71 
     72  ]]>
     73 
     74  </script>
     75  <iframe id="frame1"/>
     76  <iframe id="frame2"/>
     77  <iframe id="frame3"/>
     78  <iframe id="frame4"/>
     79 
     80 </window>